@ai-matrx/records-ui 0.116.46 → 0.116.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/{SaveToTable-SWB2ZN5X.js → SaveToTable-HG3HQMAQ.js} +5 -5
  3. package/dist/{chunk-KQR2RA4V.js → chunk-ABIUJCNS.js} +3 -3
  4. package/dist/chunk-ABIUJCNS.js.map +1 -0
  5. package/dist/{chunk-Y5QOV3XA.js → chunk-K3B5IRXY.js} +3 -3
  6. package/dist/{chunk-OV6QBL5R.js → chunk-LBZZDHV6.js} +8 -8
  7. package/dist/chunk-LBZZDHV6.js.map +1 -0
  8. package/dist/{chunk-ZUQUZOL5.js → chunk-MDXDJVDB.js} +3 -3
  9. package/dist/chunk-MDXDJVDB.js.map +1 -0
  10. package/dist/{chunk-UTMV5ES2.js → chunk-VJDJQDDI.js} +7 -7
  11. package/dist/{chunk-UTMV5ES2.js.map → chunk-VJDJQDDI.js.map} +1 -1
  12. package/dist/helpers.cjs +9 -9
  13. package/dist/helpers.cjs.map +1 -1
  14. package/dist/helpers.js +9 -9
  15. package/dist/helpers.js.map +1 -1
  16. package/dist/index.cjs +30 -30
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +22 -22
  21. package/dist/index.js.map +1 -1
  22. package/dist/object-actions.cjs +8 -8
  23. package/dist/object-actions.cjs.map +1 -1
  24. package/dist/object-actions.d.cts +1 -1
  25. package/dist/object-actions.d.ts +1 -1
  26. package/dist/object-actions.js +2 -2
  27. package/dist/{objectActions-Be9sBGvW.d.cts → objectActions-DK-qa5zC.d.cts} +1 -1
  28. package/dist/{objectActions-Be9sBGvW.d.ts → objectActions-DK-qa5zC.d.ts} +1 -1
  29. package/dist/pickers.cjs +8 -8
  30. package/dist/pickers.cjs.map +1 -1
  31. package/dist/pickers.js +3 -3
  32. package/package.json +2 -2
  33. package/dist/chunk-KQR2RA4V.js.map +0 -1
  34. package/dist/chunk-OV6QBL5R.js.map +0 -1
  35. package/dist/chunk-ZUQUZOL5.js.map +0 -1
  36. /package/dist/{SaveToTable-SWB2ZN5X.js.map → SaveToTable-HG3HQMAQ.js.map} +0 -0
  37. /package/dist/{chunk-Y5QOV3XA.js.map → chunk-K3B5IRXY.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -29,11 +29,25 @@
29
29
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
30
30
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
31
31
 
32
- ## 0.116.46
32
+ ## 0.116.47
33
33
 
34
34
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
35
35
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
36
36
 
37
+ ## 0.116.46
38
+
39
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
40
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
41
+ Diff: `git diff 6903c71965 be963e798f -- apps/shared/records-ui/src`
42
+
43
+ Changed shipped source files (6):
44
+ - `apps/shared/records-ui/src/Grid.tsx`
45
+ - `apps/shared/records-ui/src/TablePage.tsx`
46
+ - `apps/shared/records-ui/src/formattedValue.tsx`
47
+ - `apps/shared/records-ui/src/gridBulk.tsx`
48
+ - `apps/shared/records-ui/src/gridMenus.ts`
49
+ - `apps/shared/records-ui/src/plainWords.ts`
50
+
37
51
  ## 0.116.45
38
52
 
39
53
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
@@ -4,11 +4,11 @@ import {
4
4
  SAVE_TO_TABLE_TYPES,
5
5
  SaveToTable,
6
6
  shapesOfSource
7
- } from "./chunk-UTMV5ES2.js";
8
- import "./chunk-KQR2RA4V.js";
9
- import "./chunk-ZUQUZOL5.js";
7
+ } from "./chunk-VJDJQDDI.js";
8
+ import "./chunk-ABIUJCNS.js";
9
+ import "./chunk-MDXDJVDB.js";
10
10
  import "./chunk-6Z537SLG.js";
11
- import "./chunk-OV6QBL5R.js";
11
+ import "./chunk-LBZZDHV6.js";
12
12
  import "./chunk-4ZS4WEEE.js";
13
13
  import "./chunk-WCQSJPLS.js";
14
14
  import "./chunk-HKYEHBQT.js";
@@ -17,4 +17,4 @@ export {
17
17
  SaveToTable,
18
18
  shapesOfSource
19
19
  };
20
- //# sourceMappingURL=SaveToTable-SWB2ZN5X.js.map
20
+ //# sourceMappingURL=SaveToTable-HG3HQMAQ.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  LEVEL_WORD,
4
4
  levelNeededFor
5
- } from "./chunk-OV6QBL5R.js";
5
+ } from "./chunk-LBZZDHV6.js";
6
6
  import {
7
7
  ADD_FIELD_OPEN_LABEL
8
8
  } from "./chunk-WCQSJPLS.js";
@@ -49,7 +49,7 @@ function rightsReason(rights, what, table) {
49
49
  if (what === "structure" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
50
50
  if (rights[what]) return null;
51
51
  if (rights.level === null) return ACTION_NO_ACCESS_REASON;
52
- return `Needs ${LEVEL_WORD[levelNeededFor(what)]} access`;
52
+ return `Needs ${LEVEL_WORD[levelNeededFor(what)]}`;
53
53
  }
54
54
  var BUILT_ON = [
55
55
  { destination: "forms", label: "Forms", icon: "file-text", rank: 2 },
@@ -245,4 +245,4 @@ export {
245
245
  STRIP_FEATURE_ROWS,
246
246
  toStripAndRows
247
247
  };
248
- //# sourceMappingURL=chunk-KQR2RA4V.js.map
248
+ //# sourceMappingURL=chunk-ABIUJCNS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/objectActions.ts"],"sourcesContent":["// src/objectActions.ts — @ai-matrx/records-ui\n//\n// THE ONE ACTION LIST FOR A RECORD-STORE TABLE (lane TABLE-ACTIONS, v6 lane 1).\n//\n// Every menu a person meets on a table — the header ⋯, a row ⋯ on the Data\n// home, right-click, a card, the phone sheet, later ⌘K — is drawn from the\n// array `tableActions()` returns. Before this there were three hand-made lists\n// (`TABLE_MENU` in TablePage, `dataHomeRowActions` in matrx-frontend, the\n// Sheet's own v3 sections) and they drifted: no Archive, no Copy link, no\n// Duplicate, Rename and Share only as hand JSX beside the list.\n//\n// THE SHAPE IS COPIED, NOT INVENTED. It is the in-house registry pattern of\n// `features/agents/browse/agentActionRegistry.tsx` and `conversationActionRegistry.tsx`\n// in matrx-frontend: a context of HOST HANDLERS in, one ordered list out, every\n// renderer reading the same list. The one difference is deliberate: those two\n// build matrx-frontend's `ItemMenuConfig` directly, which this package cannot\n// import, so the list here is renderer-neutral (`ObjectAction[]`) and each\n// renderer has a pure adapter (`toDropdownEntries` / `toStripAndRows` here;\n// `toItemMenuConfig` and `toExtraSections` in matrx-frontend\n// `features/unified-data/actions/`).\n//\n// TWO INVARIANTS, each with a guard (`one-table-action-list-*.test.tsx`,\n// `rights-never-change-the-table-menus-shape.test.tsx`):\n// G1 — every renderer draws the same ids — none hidden, none added, disabled ones\n// drawn disabled with their reason — for every seat and with handlers missing.\n// G2 — rights change only `disabledReason`, never which ids appear, their order,\n// their verb or their rank (Airtable hides items from members; we beat it).\n// A missing host handler is the same: the action stays, disabled, with its reason.\n//\n// THE ORDER (handoff §4, the same everywhere):\n// Open · Open in new tab · Copy link | Rename · Duplicate · Move to… · Favorite |\n// Share… · Export… · Import… | Add column · Settings · History · Make … the default |\n// Built on it ▸ (Forms, Bookings, Checklists, Notifications, Portals, Inbox,\n// Dashboards, Archived records) | Archive table (last, destructive).\n// \"Add column\" and \"Make … the default\" are the header ⋯'s own entries before the\n// registry (TABLE_MENU and the designate item); they sit with Settings.\n//\n// VERB AND RANK — for the icon-strip menu. An action with a `verb` is one of the\n// platform's standard verbs (a strip icon); every other action has a `rank`, its\n// place among the feature rows. Neither changes the list's order: `toStripAndRows`\n// is a renderer that splits the same list, and G1 holds it to the same ids.\n//\n// No JSX here: this file is the `./object-actions` subpath, light enough for a\n// list row's menu to import without pulling every screen of the package.\n\nimport type { Table } from \"@ai-matrx/records\";\nimport { formatTapShortcut } from \"@ai-matrx/design-system/tap-target\";\nimport { ADD_FIELD_OPEN_LABEL } from \"./fieldTypes\";\nimport { LEVEL_WORD, levelNeededFor, type Capability, type WhatYouMayDo } from \"./rights\";\n\n/**\n * A Lucide icon NAME, kebab-case — the same currency `Table.icon` already uses.\n * Closed on purpose: each renderer maps every member to its own glyph, and a\n * new member fails that renderer's typecheck until it is mapped.\n */\nexport type ObjectActionIcon =\n | \"folder-open\"\n | \"external-link\"\n | \"link\"\n | \"pencil\"\n | \"copy\"\n | \"folder-input\"\n | \"star\"\n | \"star-off\"\n | \"share-2\"\n | \"download\"\n | \"upload\"\n | \"columns-3\"\n | \"settings\"\n | \"history\"\n | \"blocks\"\n | \"file-text\"\n | \"calendar-clock\"\n | \"list-checks\"\n | \"bell\"\n | \"door-open\"\n | \"inbox\"\n | \"layout-dashboard\"\n | \"archive-restore\"\n | \"archive\"\n | \"link-2\"\n | \"layout-grid\"\n | \"git-merge\"\n | \"split\"\n | \"arrow-up-from-line\"\n | \"lock\"\n | \"lock-open\"\n | \"eraser\"\n | \"printer\";\n\n/** The groups, in their one order. Separators fall out of group boundaries. */\nexport type ObjectActionGroup = \"open\" | \"organize\" | \"share\" | \"manage\" | \"built-on\" | \"danger\";\n\n/**\n * THE STANDARD VERBS every object's menu shares — what the icon strip draws. One\n * per meaning; an object maps its action onto the verb, never a second \"share\".\n */\nexport type StandardVerbId =\n | \"open\"\n | \"open-new-tab\"\n | \"copy-link\"\n | \"rename\"\n | \"duplicate\"\n | \"move\"\n | \"favorite\"\n | \"share\"\n | \"export\"\n | \"import\"\n | \"settings\"\n | \"history\"\n | \"archive\";\n\nexport const STANDARD_VERBS: readonly StandardVerbId[] = [\n \"open\",\n \"open-new-tab\",\n \"copy-link\",\n \"rename\",\n \"duplicate\",\n \"move\",\n \"favorite\",\n \"share\",\n \"export\",\n \"import\",\n \"settings\",\n \"history\",\n \"archive\",\n];\n\nexport interface ObjectActionGroupDef {\n id: ObjectActionGroup;\n /** Present only on a group that renders as a submenu. */\n label?: string;\n icon?: ObjectActionIcon;\n /** Rendered as ONE submenu entry holding the group's actions. */\n submenu: boolean;\n}\n\nexport const OBJECT_ACTION_GROUPS: readonly ObjectActionGroupDef[] = [\n { id: \"open\", submenu: false },\n { id: \"organize\", submenu: false },\n { id: \"share\", submenu: false },\n { id: \"manage\", submenu: false },\n { id: \"built-on\", label: \"Built on it\", icon: \"blocks\", submenu: true },\n { id: \"danger\", submenu: false },\n];\n\nconst GROUP_IDS = new Set<string>(OBJECT_ACTION_GROUPS.map((g) => g.id));\n\n/** One thing a person can do to an object, for any renderer. */\nexport interface ObjectAction {\n /** Stable within the object's list. React key, test handle, future ⌘K id. */\n id: string;\n label: string;\n icon: ObjectActionIcon;\n group: ObjectActionGroup;\n /** The standard verb this action IS (a strip icon). Absent = a feature row. */\n verb?: StandardVerbId;\n /** A feature row's place among the rows, 1 first. Ignored when `verb` is set. */\n rank?: number;\n /** Display-only hint (\"⌘D\"). */\n shortcut?: string;\n destructive?: boolean;\n /** Present = shown disabled with this line (≤ 60 chars). Absent = enabled. */\n disabledReason?: string;\n /** Called only when enabled. The host owns the side effect and its feedback. */\n run: () => void | Promise<void>;\n}\n\n/** What the list needs to know about the table. A full `Table` satisfies it. */\nexport type TableActionSubject = Pick<Table, \"id\" | \"name\"> & Partial<Pick<Table, \"is_kernel\">>;\n\n/** The places built on a table, in their one order. */\nexport type BuiltOnDestination =\n | \"forms\"\n | \"bookings\"\n | \"checklists\"\n | \"notifications\"\n | \"portals\"\n | \"inbox\"\n | \"dashboards\"\n | \"archived\";\n\ntype Handler = (table: TableActionSubject) => void | Promise<void>;\n\n/**\n * THE SIDE EFFECTS THIS PACKAGE CANNOT OWN. Every handler is optional: one the\n * host leaves out keeps its action in the list, disabled, saying so.\n */\nexport interface TableActionHost {\n /** Origin for Copy link and Open in new tab. Default `https://www.aimatrx.com`. */\n origin?: string;\n open?: Handler;\n /** Receives the table's link (`<origin>/data/<id>`). */\n openInNewTab?: (url: string, table: TableActionSubject) => void;\n /** Receives the table's link. Runs inside the click (clipboard needs the gesture). */\n copyText?: (text: string, table: TableActionSubject) => void | Promise<void>;\n rename?: Handler;\n duplicate?: Handler;\n move?: Handler;\n /** Current favorite state; flips the Favorite label. Unknown = \"Add to favorites\". */\n isFavorite?: boolean;\n toggleFavorite?: Handler;\n share?: Handler;\n export?: Handler;\n import?: Handler;\n addColumn?: Handler;\n settings?: Handler;\n history?: Handler;\n /** Make the layout on screen the table's default. Leave out when it already is. */\n makeDefault?: Handler;\n /** The layout on screen, for \"Make Kanban the default\". */\n layoutLabel?: string;\n /** The \"Built on it\" destinations, one handler for all eight. */\n openBuiltOn?: (destination: BuiltOnDestination, table: TableActionSubject) => void;\n archive?: Handler;\n /**\n * Why an action whose handler is left out is unavailable here, by action id\n * (≤ 60 chars) — e.g. `make-default: \"Already the default\"`. Unnamed ids say\n * \"Not available here\". Never used when rights already refuse.\n */\n unavailableReasons?: Readonly<Record<string, string>>;\n /**\n * ANOTHER LANE'S ENTRIES (\"Link a record…\", a hub tile's verbs, a feature's own\n * row such as \"When a row changes, run an agent…\"). Return the same ids whatever\n * `rights` say — express rights as `disabledReason`. Each entry lands at the END\n * of its named group, in the order returned. Refused, loudly: the `danger` group\n * (Archive is always last), a group that does not exist, and an id already in\n * the list.\n */\n extend?: (table: TableActionSubject, rights: WhatYouMayDo) => readonly ObjectAction[];\n}\n\nexport interface TableActionsInput {\n table: TableActionSubject;\n rights: WhatYouMayDo;\n host: TableActionHost;\n}\n\nexport const DEFAULT_ACTION_ORIGIN = \"https://www.aimatrx.com\";\n\n/** The one link to a table: `<origin>/data/<tableId>`. */\nexport function tableLink(tableId: string, origin: string = DEFAULT_ACTION_ORIGIN): string {\n return `${origin.replace(/\\/+$/, \"\")}/data/${encodeURIComponent(tableId)}`;\n}\n\n/** The designate entry's words, matching `makeDefaultLabel` in views.ts. */\nfunction makeDefaultWords(layoutLabel: string | undefined): string {\n return layoutLabel ? `Make ${layoutLabel} the default` : \"Make this the default\";\n}\n\n// Reasons — one line, ≤ 60 characters, said on the action itself.\nexport const ACTION_NOT_HERE_REASON = \"Not available here\";\nexport const ACTION_CHECKING_ACCESS_REASON = \"Checking your access…\";\nexport const ACTION_NO_ACCESS_REASON = \"You don't have access\";\nexport const ACTION_PLATFORM_TABLE_REASON = \"Platform tables can't be changed here\";\n\n/** Why `rights` refuse `what`, in one short line — or null when they allow it. */\nexport function rightsReason(\n rights: WhatYouMayDo,\n what: Capability,\n table?: TableActionSubject,\n): string | null {\n if (!rights.known) return ACTION_CHECKING_ACCESS_REASON;\n if (what === \"structure\" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;\n if (rights[what]) return null;\n if (rights.level === null) return ACTION_NO_ACCESS_REASON;\n return `Needs ${LEVEL_WORD[levelNeededFor(what)]}`;\n}\n\n// Feature rows' ranks: what the strip menu shows as its first rows. Lower is first.\nconst BUILT_ON: ReadonlyArray<{ destination: BuiltOnDestination; label: string; icon: ObjectActionIcon; rank: number }> = [\n { destination: \"forms\", label: \"Forms\", icon: \"file-text\", rank: 2 },\n { destination: \"bookings\", label: \"Bookings\", icon: \"calendar-clock\", rank: 6 },\n { destination: \"checklists\", label: \"Checklists\", icon: \"list-checks\", rank: 7 },\n { destination: \"notifications\", label: \"Notifications\", icon: \"bell\", rank: 8 },\n { destination: \"portals\", label: \"Portals\", icon: \"door-open\", rank: 9 },\n { destination: \"inbox\", label: \"Inbox\", icon: \"inbox\", rank: 10 },\n { destination: \"dashboards\", label: \"Dashboards\", icon: \"layout-dashboard\", rank: 3 },\n { destination: \"archived\", label: \"Archived records\", icon: \"archive-restore\", rank: 5 },\n];\n\nconst NOOP = () => {};\n\n/**\n * THE TABLE'S KEYBOARD CHORDS (lane TABLE-ACTIONS wave 4, item 17): ⌥⇧ + one key, the same on\n * every surface that runs the list. Chosen because nothing else owns them: ⌘D is the browser's\n * bookmark, ⌘S save, ⌘P print, ⌘K the command bar, ⌘⇧K the menu's palette, ⌘Z undo — and the\n * app binds no ⌥⇧ chord. A chord is never taken while the person types in a field\n * (`objectActionForKey`). `code` is the KeyboardEvent.code, so ⌥ on a Mac (which changes\n * `key` to a symbol) still matches.\n */\nexport const TABLE_ACTION_CHORDS: Readonly<Record<string, { code: string; chord: string }>> = {\n \"copy-link\": { code: \"KeyL\", chord: \"alt+shift+l\" },\n rename: { code: \"KeyR\", chord: \"alt+shift+r\" },\n duplicate: { code: \"KeyD\", chord: \"alt+shift+d\" },\n move: { code: \"KeyM\", chord: \"alt+shift+m\" },\n favorite: { code: \"KeyF\", chord: \"alt+shift+f\" },\n share: { code: \"KeyS\", chord: \"alt+shift+s\" },\n export: { code: \"KeyE\", chord: \"alt+shift+e\" },\n import: { code: \"KeyI\", chord: \"alt+shift+i\" },\n settings: { code: \"Comma\", chord: \"alt+shift+,\" },\n history: { code: \"KeyH\", chord: \"alt+shift+h\" },\n archive: { code: \"Backspace\", chord: \"alt+shift+backspace\" },\n};\n\n/**\n * The chords with their LABEL in this platform's words — \"⌥⇧S\" on a Mac, \"Alt+Shift+S\" on Windows\n * and Linux — through the design system's one shortcut formatter (`formatTapShortcut`, the tap\n * button's tooltip), so a menu entry and the ⌘K bar read alike everywhere.\n */\nexport const TABLE_ACTION_KEYS: Readonly<Record<string, { code: string; label: string }>> = Object.fromEntries(\n Object.entries(TABLE_ACTION_CHORDS).map(([id, { code, chord }]) => [id, { code, label: formatTapShortcut(chord) }]),\n);\n\n/** The fields of a keyboard event a chord reads (a DOM KeyboardEvent satisfies it). */\nexport interface ChordEvent {\n code: string;\n altKey: boolean;\n shiftKey: boolean;\n metaKey: boolean;\n ctrlKey: boolean;\n target?: EventTarget | null;\n}\n\nfunction typingIn(target: EventTarget | null | undefined): boolean {\n const el = target as { tagName?: string; isContentEditable?: boolean } | null | undefined;\n if (!el || typeof el.tagName !== \"string\") return false;\n return el.isContentEditable === true || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\n/**\n * The action a key press asks for, or null: ⌥⇧ + its key, no ⌘/Ctrl, never inside a field. A\n * disabled action is still RETURNED (the caller says its reason instead of doing nothing).\n */\nexport function objectActionForKey(actions: readonly ObjectAction[], event: ChordEvent): ObjectAction | null {\n if (!event.altKey || !event.shiftKey || event.metaKey || event.ctrlKey) return null;\n if (typingIn(event.target)) return null;\n const id = Object.keys(TABLE_ACTION_KEYS).find((k) => TABLE_ACTION_KEYS[k]!.code === event.code);\n return id ? (actions.find((a) => a.id === id) ?? null) : null;\n}\n\n/**\n * One action, from its needs: the capability it asks for and the host handler\n * that performs it. Rights speak first; a missing handler second.\n */\nfunction action(\n base: Omit<ObjectAction, \"run\" | \"disabledReason\">,\n needs: Capability,\n input: TableActionsInput,\n perform: (() => void | Promise<void>) | undefined,\n): ObjectAction {\n const chord = TABLE_ACTION_KEYS[base.id];\n if (chord && base.shortcut === undefined) base = { ...base, shortcut: chord.label };\n const refused = rightsReason(input.rights, needs, input.table);\n if (refused !== null) return { ...base, disabledReason: refused, run: NOOP };\n if (perform === undefined) {\n return { ...base, disabledReason: input.host.unavailableReasons?.[base.id] ?? ACTION_NOT_HERE_REASON, run: NOOP };\n }\n return { ...base, run: perform };\n}\n\nfunction bind(handler: Handler | undefined, table: TableActionSubject): (() => void | Promise<void>) | undefined {\n return handler ? () => handler(table) : undefined;\n}\n\n/**\n * THE TABLE'S ACTIONS, in the one order. Same ids, same order, same verbs and\n * ranks, for every seat and every host — only `disabledReason` varies.\n */\nexport function tableActions(input: TableActionsInput): ObjectAction[] {\n const { table, host } = input;\n const url = tableLink(table.id, host.origin);\n const favorite = host.isFavorite === true;\n const openInNewTab = host.openInNewTab;\n const copyText = host.copyText;\n const openBuiltOn = host.openBuiltOn;\n\n const built: ObjectAction[] = [\n action({ id: \"open\", label: \"Open\", icon: \"folder-open\", group: \"open\", verb: \"open\" }, \"read\", input, bind(host.open, table)),\n action(\n { id: \"open-new-tab\", label: \"Open in new tab\", icon: \"external-link\", group: \"open\", verb: \"open-new-tab\" },\n \"read\",\n input,\n openInNewTab ? () => openInNewTab(url, table) : undefined,\n ),\n action(\n { id: \"copy-link\", label: \"Copy link\", icon: \"link\", group: \"open\", verb: \"copy-link\" },\n \"read\",\n input,\n copyText ? () => copyText(url, table) : undefined,\n ),\n action({ id: \"rename\", label: \"Rename…\", icon: \"pencil\", group: \"organize\", verb: \"rename\" }, \"structure\", input, bind(host.rename, table)),\n action({ id: \"duplicate\", label: \"Duplicate\", icon: \"copy\", group: \"organize\", verb: \"duplicate\" }, \"read\", input, bind(host.duplicate, table)),\n action({ id: \"move\", label: \"Move to…\", icon: \"folder-input\", group: \"organize\", verb: \"move\" }, \"structure\", input, bind(host.move, table)),\n action(\n {\n id: \"favorite\",\n label: favorite ? \"Remove from favorites\" : \"Add to favorites\",\n icon: favorite ? \"star-off\" : \"star\",\n group: \"organize\",\n verb: \"favorite\",\n },\n \"read\",\n input,\n bind(host.toggleFavorite, table),\n ),\n action({ id: \"share\", label: \"Share…\", icon: \"share-2\", group: \"share\", verb: \"share\" }, \"share\", input, bind(host.share, table)),\n action({ id: \"export\", label: \"Export…\", icon: \"download\", group: \"share\", verb: \"export\" }, \"read\", input, bind(host.export, table)),\n action({ id: \"import\", label: \"Import…\", icon: \"upload\", group: \"share\", verb: \"import\" }, \"structure\", input, bind(host.import, table)),\n action({ id: \"add-column\", label: ADD_FIELD_OPEN_LABEL, icon: \"columns-3\", group: \"manage\", rank: 1 }, \"structure\", input, bind(host.addColumn, table)),\n action({ id: \"settings\", label: \"Settings\", icon: \"settings\", group: \"manage\", verb: \"settings\" }, \"structure\", input, bind(host.settings, table)),\n action({ id: \"history\", label: \"History\", icon: \"history\", group: \"manage\", verb: \"history\" }, \"read\", input, bind(host.history, table)),\n // custom.view_designate asks editor on the table — `canDesignate` in TablePage.\n action(\n { id: \"make-default\", label: makeDefaultWords(host.layoutLabel), icon: \"layout-grid\", group: \"manage\", rank: 4 },\n \"organise\",\n input,\n bind(host.makeDefault, table),\n ),\n ...BUILT_ON.map(({ destination, label, icon, rank }) =>\n action(\n { id: `built-on.${destination}`, label, icon, group: \"built-on\", rank },\n \"read\",\n input,\n openBuiltOn ? () => openBuiltOn(destination, table) : undefined,\n ),\n ),\n action(\n { id: \"archive\", label: \"Archive table\", icon: \"archive\", group: \"danger\", destructive: true, verb: \"archive\" },\n \"structure\",\n input,\n bind(host.archive, table),\n ),\n ];\n\n return withExtensions(built, host.extend ? host.extend(table, input.rights) : []);\n}\n\n/**\n * Another lane's entries, placed deterministically: each at the end of its\n * group, in the order given. Loud on every mistake that would break the\n * invariants — a `danger` entry (Archive must stay last), a group that does not\n * exist (it would be dropped by every renderer) and a duplicate id.\n */\nexport function withExtensions(base: readonly ObjectAction[], extra: readonly ObjectAction[]): ObjectAction[] {\n if (extra.length === 0) return [...base];\n const seen = new Set(base.map((a) => a.id));\n for (const entry of extra) {\n if (entry.group === \"danger\") {\n throw new Error(`Object action \"${entry.id}\": the danger group is closed to extensions.`);\n }\n if (!GROUP_IDS.has(entry.group)) {\n throw new Error(`Object action \"${entry.id}\": \"${String(entry.group)}\" is not a group.`);\n }\n if (seen.has(entry.id)) {\n throw new Error(`Object action \"${entry.id}\" is already in the list.`);\n }\n seen.add(entry.id);\n }\n const out: ObjectAction[] = [];\n for (const group of OBJECT_ACTION_GROUPS) {\n out.push(...base.filter((a) => a.group === group.id), ...extra.filter((a) => a.group === group.id));\n }\n return out;\n}\n\n/** A run of actions that renders together: a plain section, or one submenu. */\nexport interface ObjectActionSection {\n group: ObjectActionGroupDef;\n actions: ObjectAction[];\n}\n\n/**\n * THE ONE GROUPING every adapter uses: the list cut at group boundaries, in\n * group order, empty groups dropped, the order inside a group kept.\n */\nexport function groupObjectActions(actions: readonly ObjectAction[]): ObjectActionSection[] {\n const sections: ObjectActionSection[] = [];\n for (const group of OBJECT_ACTION_GROUPS) {\n const inGroup = actions.filter((a) => a.group === group.id);\n if (inGroup.length > 0) sections.push({ group, actions: inGroup });\n }\n return sections;\n}\n\n/** The header ⋯ dropdown's entries — records-ui's own renderer reads these. */\nexport type ObjectActionDropdownEntry =\n | { kind: \"separator\"; id: string }\n | { kind: \"item\"; action: ObjectAction }\n | { kind: \"submenu\"; id: string; label: string; icon: ObjectActionIcon | undefined; actions: ObjectAction[] };\n\nexport function toDropdownEntries(actions: readonly ObjectAction[]): ObjectActionDropdownEntry[] {\n const entries: ObjectActionDropdownEntry[] = [];\n groupObjectActions(actions).forEach(({ group, actions: inGroup }, index) => {\n if (index > 0) entries.push({ kind: \"separator\", id: `separator:${group.id}` });\n if (group.submenu) {\n entries.push({ kind: \"submenu\", id: group.id, label: group.label ?? group.id, icon: group.icon, actions: inGroup });\n } else {\n for (const a of inGroup) entries.push({ kind: \"item\", action: a });\n }\n });\n return entries;\n}\n\n/** The actions a dropdown draws, in order — what G1 compares. */\nexport function dropdownActions(entries: readonly ObjectActionDropdownEntry[]): ObjectAction[] {\n return entries.flatMap((e) => (e.kind === \"item\" ? [e.action] : e.kind === \"submenu\" ? e.actions : []));\n}\n\n/** The action ids a dropdown draws, in order. */\nexport function dropdownActionIds(entries: readonly ObjectActionDropdownEntry[]): string[] {\n return dropdownActions(entries).map((a) => a.id);\n}\n\n/** The icon-strip menu: standard verbs as icons, then the first feature rows, then the rest. */\nexport interface StripAndRows {\n /** Every action with a `verb`, in the list's order. */\n strip: ObjectAction[];\n /** The first `rowCount` feature actions by rank (ties keep list order). */\n rows: ObjectAction[];\n /** The remaining feature actions, behind \"More … options\", same ordering. */\n more: ObjectAction[];\n}\n\nexport const STRIP_FEATURE_ROWS = 4;\n\n/**\n * THE STRIP RENDERER'S SPLIT of the same list. Nothing is added or dropped: every\n * id lands in exactly one of strip / rows / more (G1). Unranked feature actions\n * (an extension that gave none) follow every ranked one.\n */\nexport function toStripAndRows(actions: readonly ObjectAction[], rowCount: number = STRIP_FEATURE_ROWS): StripAndRows {\n const strip = actions.filter((a) => a.verb !== undefined);\n const features = actions\n .map((a, index) => ({ a, index }))\n .filter(({ a }) => a.verb === undefined)\n .sort((x, y) => (x.a.rank ?? Infinity) - (y.a.rank ?? Infinity) || x.index - y.index)\n .map(({ a }) => a);\n return { strip, rows: features.slice(0, rowCount), more: features.slice(rowCount) };\n}\n"],"mappings":";;;;;;;;;;AA8CA,SAAS,yBAAyB;AAkE3B,IAAM,iBAA4C;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWO,IAAM,uBAAwD;AAAA,EACnE,EAAE,IAAI,QAAQ,SAAS,MAAM;AAAA,EAC7B,EAAE,IAAI,YAAY,SAAS,MAAM;AAAA,EACjC,EAAE,IAAI,SAAS,SAAS,MAAM;AAAA,EAC9B,EAAE,IAAI,UAAU,SAAS,MAAM;AAAA,EAC/B,EAAE,IAAI,YAAY,OAAO,eAAe,MAAM,UAAU,SAAS,KAAK;AAAA,EACtE,EAAE,IAAI,UAAU,SAAS,MAAM;AACjC;AAEA,IAAM,YAAY,IAAI,IAAY,qBAAqB,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AA4FhE,IAAM,wBAAwB;AAG9B,SAAS,UAAU,SAAiB,SAAiB,uBAA+B;AACzF,SAAO,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,SAAS,mBAAmB,OAAO,CAAC;AAC1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U,CAAC,CAAE;AACxG;AAGO,SAAS,kBAAkB,SAAyD;AACzF,SAAO,gBAAgB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE;AACjD;AAYO,IAAM,qBAAqB;AAO3B,SAAS,eAAe,SAAkC,WAAmB,oBAAkC;AACpH,QAAM,QAAQ,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,MAAS;AACxD,QAAM,WAAW,QACd,IAAI,CAAC,GAAG,WAAW,EAAE,GAAG,MAAM,EAAE,EAChC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,MAAS,EACtC,KAAK,CAAC,GAAG,OAAO,EAAE,EAAE,QAAQ,aAAa,EAAE,EAAE,QAAQ,aAAa,EAAE,QAAQ,EAAE,KAAK,EACnF,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC;AACnB,SAAO,EAAE,OAAO,MAAM,SAAS,MAAM,GAAG,QAAQ,GAAG,MAAM,SAAS,MAAM,QAAQ,EAAE;AACpF;","names":[]}
@@ -54,7 +54,7 @@ import {
54
54
  useRecordsUi,
55
55
  useTableRights,
56
56
  withoutInternalCodes
57
- } from "./chunk-ZUQUZOL5.js";
57
+ } from "./chunk-MDXDJVDB.js";
58
58
  import {
59
59
  kindItemWords,
60
60
  kindLabel,
@@ -4786,7 +4786,7 @@ import { AlchemyMenu } from "@ai-matrx/alchemy/react";
4786
4786
  import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4787
4787
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4788
4788
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
4789
- var SaveToTable = lazy(() => import("./SaveToTable-SWB2ZN5X.js").then((m) => ({ default: m.SaveToTable })));
4789
+ var SaveToTable = lazy(() => import("./SaveToTable-HG3HQMAQ.js").then((m) => ({ default: m.SaveToTable })));
4790
4790
  var LONGEST_READ = 5e5;
4791
4791
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4792
4792
  function isPlainObject(v) {
@@ -12328,4 +12328,4 @@ export {
12328
12328
  RecordNameText,
12329
12329
  HeldChangeDecision
12330
12330
  };
12331
- //# sourceMappingURL=chunk-Y5QOV3XA.js.map
12331
+ //# sourceMappingURL=chunk-K3B5IRXY.js.map
@@ -3,11 +3,11 @@
3
3
  // src/rights.ts
4
4
  import { atLeast } from "@ai-matrx/records/field-kinds";
5
5
  var LEVEL_WORD = {
6
- viewer: "Viewer",
7
- commenter: "Commenter",
8
- edit_content: "Content editor",
9
- editor: "Editor",
10
- admin: "Admin"
6
+ viewer: "View access",
7
+ commenter: "Comment access",
8
+ edit_content: "Edit access",
9
+ editor: "Edit access",
10
+ admin: "Full access"
11
11
  };
12
12
  var NEEDS = {
13
13
  read: "viewer",
@@ -32,7 +32,7 @@ function levelNeededFor(what) {
32
32
  return NEEDS[what];
33
33
  }
34
34
  var NOT_YET = "Checking what you may do here. Nothing is offered until then.";
35
- var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
35
+ var NOTHING_AT_ALL = "You have not been given this. Ask somebody with Full access on it to share it with you.";
36
36
  function sentenceFor(what, level) {
37
37
  if (level === null) return NOTHING_AT_ALL;
38
38
  const need = LEVEL_WORD[NEEDS[what]];
@@ -46,7 +46,7 @@ function sentenceFor(what, level) {
46
46
  share: "pass this on to somebody else",
47
47
  structure: "change the columns of this table"
48
48
  };
49
- return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
49
+ return `You have ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody with Full access on it to move you up.`;
50
50
  }
51
51
  function whatYouMayDo(level, known = true) {
52
52
  const may = (what) => known && atLeast(level, NEEDS[what]);
@@ -92,4 +92,4 @@ export {
92
92
  tableIsLocked,
93
93
  DATABASE_LOCKED_REASON
94
94
  };
95
- //# sourceMappingURL=chunk-OV6QBL5R.js.map
95
+ //# sourceMappingURL=chunk-LBZZDHV6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rights.ts"],"sourcesContent":["// src/rights.ts — @ai-matrx/records-ui\n//\n// THE ONE PLACE A LEVEL BECOMES A SCREEN.\n//\n// WHAT A PERSON HIT (independent verdict, sixth pass, 19-20 September). A\n// colleague who had been shared a table at viewer opened it, double-clicked a\n// cell, got a live editor, typed a value and pressed Enter — and only THEN was\n// told she may not write. \"The permission is right; the screen told her she\n// could.\" Measured against Airtable, Notion and Linear the verdict called it\n// out by name: \"None of these three products lets you start an action it\n// already knows it will reject.\"\n//\n// WHY THE SCREEN COULD NOT KNOW. The rights question was a PORT with two honest\n// answers and no third: `NO_RIGHTS` (every administering control absent, which\n// is useless for a host whose authority IS the store's) and\n// `storeDecidesRights` — `{admin: true, comment: true, write: true}` for every\n// non-kernel table, for everybody. That second one is the defect, written down:\n// it is the screen ASSUMING the answer and letting the door say no afterwards.\n//\n// WHAT REPLACES IT. The store already answers this, and the client now carries\n// it: `custom.read_records` returns the reader's level on the TABLE on every\n// row (so `Table.your_level` costs nothing), and `custom.my_levels` — the door\n// this lane added — answers the caller's level on any subject they name, one\n// call for a whole page. This file is the only place in the package that turns\n// one of those four words into what a screen may DRAW.\n//\n// THE LADDER IS THE STORE'S, NOT OURS: viewer < commenter < editor < admin, and\n// which rung each door requires is read from the doors themselves —\n// `custom.record_update` asserts `editor` on the record, `custom.field_declare`\n// asserts `admin` on the TABLE (\"the SHAPE of this table, which is an admin's\n// right and not an editor's\"), `custom.io_comment_write` admits a commenter.\n// Nothing here invents a rule; it mirrors the four assertions those doors make\n// and is wrong the moment they change, which is what the suite is for.\n//\n// ABSENT OR HONEST, NEVER DEAD. Every `false` here carries the sentence that\n// says why and what to do about it, so a control can be left out AND explained.\n// A screen that hid a control with nothing to say is the silent half of the\n// same defect.\n\nimport { atLeast, type PermissionLevel } from \"@ai-matrx/records/field-kinds\";\nimport type { Table } from \"@ai-matrx/records\";\n\n/** The six things a person does to a record or a table, as the screens offer them. */\nexport type Capability = \"read\" | \"comment\" | \"write\" | \"organise\" | \"remove\" | \"share\" | \"structure\";\n\nexport interface WhatYouMayDo {\n /** The word the store answered, or null when it answered nothing. */\n level: PermissionLevel | null;\n /**\n * Whether the store has ANSWERED yet. `false` is a third state and not a\n * refusal: a screen that drew \"you may not\" while the answer was in flight\n * would blink every control off on every reload, which is its own lie.\n */\n known: boolean;\n read: boolean;\n comment: boolean;\n write: boolean;\n /** Duplicate, merge, restore, make a layout the default: the doors that ask `editor`, above content. */\n organise: boolean;\n remove: boolean;\n share: boolean;\n structure: boolean;\n /** Why this person may not do that, in one sentence naming the way in. */\n why: (what: Capability) => string;\n}\n\n/** What each rung of the ladder is called where a person reads it. */\nexport const LEVEL_WORD: Record<PermissionLevel, string> = {\n viewer: \"View access\",\n commenter: \"Comment access\",\n edit_content: \"Edit access\",\n editor: \"Edit access\",\n admin: \"Full access\",\n};\n\n/**\n * WHICH RUNG EACH DOOR ASKS FOR. Read off the doors themselves, in one place,\n * so a screen never re-decides it and the suite has one thing to check.\n */\nconst NEEDS: Record<Capability, PermissionLevel> = {\n read: \"viewer\",\n // custom.io_comment_write\n comment: \"commenter\",\n // custom.record_update / custom.record_write — `edit_content` changes rows and page content;\n // columns, views and settings (structure) stay with admin below, and sharing with admin.\n write: \"edit_content\",\n // custom.view_designate / view_declare / migrate_merge / record_restore — all ask `editor`: more than\n // changing content (`edit_content`), less than changing columns (`admin`).\n organise: \"editor\",\n // custom.record_delete\n remove: \"editor\",\n // custom.share_grant — ONE-LADDER (2026-10-10): Edit may pass View / Comment / Edit on inside the\n // organization (iam.may_grant_as, knobs access.sharing/*). Which levels, and to whom, is the share\n // dialog's own question (iam.my_grantable_levels); the Share button only has to open for Edit.\n share: \"editor\",\n // custom.field_declare / field_update / field_retire / table settings\n structure: \"admin\",\n};\n\n/** The rung a capability asks for — so a short \"Needs Full access\" never re-decides the ladder. */\nexport function levelNeededFor(what: Capability): PermissionLevel {\n return NEEDS[what];\n}\n\nconst NOT_YET =\n \"Checking what you may do here. Nothing is offered until then.\";\n\nconst NOTHING_AT_ALL =\n \"You have not been given this. Ask somebody with Full access on it to share it with you.\";\n\n/** The sentence for one refusal: what the level is, what it would have to be. */\nfunction sentenceFor(what: Capability, level: PermissionLevel | null): string {\n if (level === null) return NOTHING_AT_ALL;\n const need = LEVEL_WORD[NEEDS[what]];\n const have = LEVEL_WORD[level];\n const doing: Record<Capability, string> = {\n read: \"open this\",\n comment: \"leave a comment\",\n write: \"change anything here\",\n organise: \"organize this\",\n remove: \"delete this\",\n share: \"pass this on to somebody else\",\n structure: \"change the columns of this table\",\n };\n return `You have ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody with Full access on it to move you up.`;\n}\n\n/**\n * WHAT ONE LEVEL LETS A PERSON DO. `level` null and `known` true means the\n * store said \"nothing\" — a real answer. `known` false means it has not said.\n */\nexport function whatYouMayDo(level: PermissionLevel | null, known = true): WhatYouMayDo {\n const may = (what: Capability) => known && atLeast(level, NEEDS[what]);\n return {\n level: known ? level : null,\n known,\n read: may(\"read\"),\n comment: may(\"comment\"),\n write: may(\"write\"),\n organise: may(\"organise\"),\n remove: may(\"remove\"),\n share: may(\"share\"),\n structure: may(\"structure\"),\n why: (what) => (known ? sentenceFor(what, level) : NOT_YET),\n };\n}\n\n/** Nothing offered, because nothing is known yet. */\nexport const NOT_ANSWERED_YET: WhatYouMayDo = whatYouMayDo(null, false);\n\n/**\n * REC-27. The nine Tables the platform ships are not administered from a\n * person's screen whatever level they hold on them — so the structure controls\n * are absent for a kernel Table and say why, and everything else follows the\n * level as usual.\n */\nexport const KERNEL_REASON =\n \"This is one of the tables the platform ships, so its columns are not changed from a screen. \" +\n \"Make your own table to change columns.\";\n\nexport function whatYouMayDoWithTable(\n table: Table | null | undefined,\n level: PermissionLevel | null,\n known: boolean,\n): WhatYouMayDo {\n const base = whatYouMayDo(level, known);\n // A LOCKED DATABASE (lane NOTION-SMALL-2): the columns and the table's settings stay as they are until\n // somebody unlocks it. An editing convenience, never a permission — the lock changes what is OFFERED, the\n // store's ladder is untouched and anyone who may edit the table may unlock it.\n if (!table?.is_kernel) return table && tableIsLocked(table) ? lockedStructure(base) : base;\n return {\n ...base,\n structure: false,\n why: (what) => (what === \"structure\" ? KERNEL_REASON : base.why(what)),\n };\n}\n\n/** Is this table locked against column and settings changes? Kept on the table's own metadata. */\nexport function tableIsLocked(table: Pick<Table, \"metadata\"> | null | undefined): boolean {\n return table?.metadata?.[\"locked\"] === true;\n}\n\nexport const DATABASE_LOCKED_REASON = \"This database is locked, so its columns and settings are read-only. Unlock it to change them.\";\n\nfunction lockedStructure(base: WhatYouMayDo): WhatYouMayDo {\n return { ...base, structure: false, why: (what) => (what === \"structure\" ? DATABASE_LOCKED_REASON : base.why(what)) };\n}\n"],"mappings":";;;AAuCA,SAAS,eAAqC;AA4BvC,IAAM,aAA8C;AAAA,EACzD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,OAAO;AACT;AAMA,IAAM,QAA6C;AAAA,EACjD,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA;AAAA,EAGT,OAAO;AAAA;AAAA;AAAA,EAGP,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIR,OAAO;AAAA;AAAA,EAEP,WAAW;AACb;AAGO,SAAS,eAAe,MAAmC;AAChE,SAAO,MAAM,IAAI;AACnB;AAEA,IAAM,UACJ;AAEF,IAAM,iBACJ;AAGF,SAAS,YAAY,MAAkB,OAAuC;AAC5E,MAAI,UAAU,KAAM,QAAO;AAC3B,QAAM,OAAO,WAAW,MAAM,IAAI,CAAC;AACnC,QAAM,OAAO,WAAW,KAAK;AAC7B,QAAM,QAAoC;AAAA,IACxC,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AACA,SAAO,YAAY,IAAI,uBAAuB,I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
  } from "./chunk-HKYEHBQT.js";
@@ -328,7 +328,7 @@ function exampleOf(error) {
328
328
  const example = detail.example;
329
329
  return typeof example === "string" && example.trim() !== "" ? example.trim() : null;
330
330
  }
331
- var TIMED_OUT_SAID = "This took too long. Please try again.";
331
+ var TIMED_OUT_SAID = "That took too long. Nothing was lost; try again.";
332
332
  function refusalForAPerson(error) {
333
333
  const code = error.code ?? "internal";
334
334
  const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
@@ -1432,4 +1432,4 @@ export {
1432
1432
  choiceNudgeOf,
1433
1433
  useChoiceNudge
1434
1434
  };
1435
- //# sourceMappingURL=chunk-ZUQUZOL5.js.map
1435
+ //# sourceMappingURL=chunk-MDXDJVDB.js.map