@arbidocs/blocks 0.4.168 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{ConnectedCallDock-ESH665DH.cjs → ConnectedCallDock-BNKBAKIT.cjs} +4 -3
  2. package/dist/{ConnectedCallDock-J5JU3KKO.js.map → ConnectedCallDock-BNKBAKIT.cjs.map} +1 -1
  3. package/dist/{ConnectedCallDock-J5JU3KKO.js → ConnectedCallDock-MBAAUETC.js} +4 -3
  4. package/dist/ConnectedCallDock-MBAAUETC.js.map +1 -0
  5. package/dist/{ConnectedCallRoom-AFMVICHG.cjs → ConnectedCallRoom-QRWD2SDG.cjs} +4 -3
  6. package/dist/{ConnectedCallRoom-AFMVICHG.cjs.map → ConnectedCallRoom-QRWD2SDG.cjs.map} +1 -1
  7. package/dist/{ConnectedCallRoom-XBEO7VXT.js → ConnectedCallRoom-XJUXVNMB.js} +4 -3
  8. package/dist/{ConnectedCallRoom-XBEO7VXT.js.map → ConnectedCallRoom-XJUXVNMB.js.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-TFAA5Z6J.cjs → ConnectedNativeDocxComparison-A7PMTYD7.cjs} +7 -7
  10. package/dist/{ConnectedNativeDocxComparison-TFAA5Z6J.cjs.map → ConnectedNativeDocxComparison-A7PMTYD7.cjs.map} +1 -1
  11. package/dist/{ConnectedNativeDocxComparison-DJBFRFCK.js → ConnectedNativeDocxComparison-CWEW7GV3.js} +6 -6
  12. package/dist/{ConnectedNativeDocxComparison-DJBFRFCK.js.map → ConnectedNativeDocxComparison-CWEW7GV3.js.map} +1 -1
  13. package/dist/{ConnectedNativeDocxEditor-2MSUQTE2.js → ConnectedNativeDocxEditor-6EBF7U4E.js} +5 -5
  14. package/dist/{ConnectedNativeDocxEditor-2MSUQTE2.js.map → ConnectedNativeDocxEditor-6EBF7U4E.js.map} +1 -1
  15. package/dist/{ConnectedNativeDocxEditor-AFECVTCH.cjs → ConnectedNativeDocxEditor-IWXEOAIF.cjs} +7 -7
  16. package/dist/{ConnectedNativeDocxEditor-AFECVTCH.cjs.map → ConnectedNativeDocxEditor-IWXEOAIF.cjs.map} +1 -1
  17. package/dist/{ConnectedStreamedWordArtifact-3OUYXRP2.js → ConnectedStreamedWordArtifact-27ISQYHI.js} +6 -6
  18. package/dist/ConnectedStreamedWordArtifact-27ISQYHI.js.map +1 -0
  19. package/dist/{ConnectedStreamedWordArtifact-IEGLOEEZ.cjs → ConnectedStreamedWordArtifact-WRGCCU5H.cjs} +7 -7
  20. package/dist/ConnectedStreamedWordArtifact-WRGCCU5H.cjs.map +1 -0
  21. package/dist/{WorkspaceTableView-GYIHAEIB.js → WorkspaceTableView-3TIMUU2J.js} +5 -5
  22. package/dist/{WorkspaceTableView-GYIHAEIB.js.map → WorkspaceTableView-3TIMUU2J.js.map} +1 -1
  23. package/dist/{WorkspaceTableView-733WL4DA.cjs → WorkspaceTableView-FROHEPCT.cjs} +7 -7
  24. package/dist/{WorkspaceTableView-733WL4DA.cjs.map → WorkspaceTableView-FROHEPCT.cjs.map} +1 -1
  25. package/dist/calls/index.cjs +35 -35
  26. package/dist/calls/index.js +6 -6
  27. package/dist/chat/index.cjs +76 -75
  28. package/dist/chat/index.js +2 -1
  29. package/dist/chat/thread-diagram.d.ts +3 -1
  30. package/dist/chunk-26EQQQBX.js +356 -0
  31. package/dist/chunk-26EQQQBX.js.map +1 -0
  32. package/dist/{chunk-CVJ2ZMA4.cjs → chunk-2BNWISLH.cjs} +4 -4
  33. package/dist/{chunk-CVJ2ZMA4.cjs.map → chunk-2BNWISLH.cjs.map} +1 -1
  34. package/dist/{chunk-U6B6LPIG.cjs → chunk-32W6STZ2.cjs} +5 -5
  35. package/dist/{chunk-U6B6LPIG.cjs.map → chunk-32W6STZ2.cjs.map} +1 -1
  36. package/dist/{chunk-SJVIBMVQ.js → chunk-34LBKTII.js} +4 -4
  37. package/dist/{chunk-SJVIBMVQ.js.map → chunk-34LBKTII.js.map} +1 -1
  38. package/dist/{chunk-E4AOCI46.cjs → chunk-3BJIS4GV.cjs} +7 -7
  39. package/dist/{chunk-E4AOCI46.cjs.map → chunk-3BJIS4GV.cjs.map} +1 -1
  40. package/dist/{chunk-ZWNUK3A2.cjs → chunk-3XA7EDPS.cjs} +7 -7
  41. package/dist/{chunk-ZWNUK3A2.cjs.map → chunk-3XA7EDPS.cjs.map} +1 -1
  42. package/dist/{chunk-O7FVBTBT.js → chunk-4MQKXHMC.js} +3 -3
  43. package/dist/{chunk-O7FVBTBT.js.map → chunk-4MQKXHMC.js.map} +1 -1
  44. package/dist/{chunk-HAYIPKKI.cjs → chunk-5DXTO7CE.cjs} +6 -6
  45. package/dist/{chunk-HAYIPKKI.cjs.map → chunk-5DXTO7CE.cjs.map} +1 -1
  46. package/dist/{chunk-7JIMJEB5.cjs → chunk-DAEDRTIN.cjs} +3 -3
  47. package/dist/{chunk-7JIMJEB5.cjs.map → chunk-DAEDRTIN.cjs.map} +1 -1
  48. package/dist/{chunk-FTLNYE2X.cjs → chunk-F66OH26L.cjs} +4 -96
  49. package/dist/chunk-F66OH26L.cjs.map +1 -0
  50. package/dist/chunk-KJXJRX33.js +94 -0
  51. package/dist/chunk-KJXJRX33.js.map +1 -0
  52. package/dist/chunk-LDRHUYRE.cjs +376 -0
  53. package/dist/chunk-LDRHUYRE.cjs.map +1 -0
  54. package/dist/{chunk-2TEST7FZ.cjs → chunk-LMXMUWPA.cjs} +8 -11
  55. package/dist/chunk-LMXMUWPA.cjs.map +1 -0
  56. package/dist/{chunk-DRIMPELS.cjs → chunk-MDFXGRLY.cjs} +15 -15
  57. package/dist/{chunk-DRIMPELS.cjs.map → chunk-MDFXGRLY.cjs.map} +1 -1
  58. package/dist/{chunk-UF2GRQQF.js → chunk-NHY4AKA4.js} +3 -3
  59. package/dist/{chunk-UF2GRQQF.js.map → chunk-NHY4AKA4.js.map} +1 -1
  60. package/dist/{chunk-U6QJB3G4.js → chunk-OD3UJ7XR.js} +3 -3
  61. package/dist/{chunk-U6QJB3G4.js.map → chunk-OD3UJ7XR.js.map} +1 -1
  62. package/dist/chunk-OK3UJMO4.cjs +98 -0
  63. package/dist/chunk-OK3UJMO4.cjs.map +1 -0
  64. package/dist/{chunk-ZBTJWS3M.cjs → chunk-RMLU363Q.cjs} +4 -4
  65. package/dist/{chunk-ZBTJWS3M.cjs.map → chunk-RMLU363Q.cjs.map} +1 -1
  66. package/dist/{chunk-GA77ONJJ.js → chunk-TXPOODAY.js} +8 -11
  67. package/dist/chunk-TXPOODAY.js.map +1 -0
  68. package/dist/{chunk-XUUKUIKH.js → chunk-ULQV2NJT.js} +5 -94
  69. package/dist/chunk-ULQV2NJT.js.map +1 -0
  70. package/dist/{chunk-ADL5A6FR.js → chunk-VMXLNBHF.js} +3 -3
  71. package/dist/{chunk-ADL5A6FR.js.map → chunk-VMXLNBHF.js.map} +1 -1
  72. package/dist/{chunk-D7MDBDN7.js → chunk-XKTYKZWV.js} +3 -3
  73. package/dist/{chunk-D7MDBDN7.js.map → chunk-XKTYKZWV.js.map} +1 -1
  74. package/dist/{chunk-ZHQBNOZQ.js → chunk-YSNQWUQQ.js} +4 -4
  75. package/dist/{chunk-ZHQBNOZQ.js.map → chunk-YSNQWUQQ.js.map} +1 -1
  76. package/dist/{chunk-CDP7S6RA.js → chunk-ZC5MJIRC.js} +3 -3
  77. package/dist/{chunk-CDP7S6RA.js.map → chunk-ZC5MJIRC.js.map} +1 -1
  78. package/dist/connect/docx.cjs +9 -9
  79. package/dist/connect/docx.js +5 -5
  80. package/dist/connect/index.cjs +1918 -2135
  81. package/dist/connect/index.cjs.map +1 -1
  82. package/dist/connect/index.js +46 -289
  83. package/dist/connect/index.js.map +1 -1
  84. package/dist/connect/viewer.cjs +30 -28
  85. package/dist/connect/viewer.cjs.map +1 -1
  86. package/dist/connect/viewer.js +14 -12
  87. package/dist/connect/viewer.js.map +1 -1
  88. package/dist/connection/ConnectionProvider.d.ts +4 -1
  89. package/dist/connection/viewer/parsed/ParsedPassage.d.ts +2 -1
  90. package/dist/index.cjs +219 -218
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.js +5 -4
  93. package/dist/index.js.map +1 -1
  94. package/dist/settings/index.cjs +155 -155
  95. package/dist/settings/index.js +2 -2
  96. package/dist/studio/index.cjs +4 -4
  97. package/dist/studio/index.js +2 -2
  98. package/dist/workflow-canvas/index.cjs +6 -6
  99. package/dist/workflow-canvas/index.js +2 -2
  100. package/node_modules/@arbidocs/coedit/package.json +1 -1
  101. package/package.json +5 -5
  102. package/dist/ConnectedCallDock-ESH665DH.cjs.map +0 -1
  103. package/dist/ConnectedStreamedWordArtifact-3OUYXRP2.js.map +0 -1
  104. package/dist/ConnectedStreamedWordArtifact-IEGLOEEZ.cjs.map +0 -1
  105. package/dist/chunk-2TEST7FZ.cjs.map +0 -1
  106. package/dist/chunk-3PEUP4CH.cjs +0 -109
  107. package/dist/chunk-3PEUP4CH.cjs.map +0 -1
  108. package/dist/chunk-FTLNYE2X.cjs.map +0 -1
  109. package/dist/chunk-GA77ONJJ.js.map +0 -1
  110. package/dist/chunk-LLEI5I5C.js +0 -102
  111. package/dist/chunk-LLEI5I5C.js.map +0 -1
  112. package/dist/chunk-XUUKUIKH.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/chat/participant-tints.ts","../src/chat/flashMessage.ts","../src/chat/DraftingDocChip.tsx","../src/chat/SlashMenu.tsx","../src/chat/ConversationLayout.tsx","../src/chat/BranchControls.tsx","../src/chat/ModelPicker.tsx","../src/chat/ConversationParts.tsx","../src/chat/ThreadMap.tsx","../src/chat/thread-diagram.ts","../src/chat/ThreadVisualizer.tsx","../src/lib/useLongPaste.ts","../src/chat/PendingAnswerBar.tsx","../src/chat/useRecipientDraft.ts","../src/chat/message-copy.ts","../src/chat/table-csv.ts","../src/chat/doc-links.ts","../src/chat/rehype-doc-entity-pills.ts","../src/chat/ContextUsageBar.tsx","../src/chat/slash-menu-helpers.ts","../src/chat/generatedDocuments.ts"],"names":["jsxs","cn","jsx","PenLine","BookOpen","SquareSlash","memo","SlashMenu","useId","useRef","useEffect","testIdOr","prefixedTestId","listOptionId","Globe","Tooltip","TooltipTrigger","Network","TooltipContent","ArrowLeft","ArrowRight","Zap","Glasses","Crown","Sparkles","forwardRef","ModelPickerTrigger","Button","ChevronsUpDown","BlocksTooltipProvider","Popover","PopoverTrigger","PopoverContent","Check","Settings","Plus","Bot","Download","DOMPurify","useMemo","useState","useCallback","MessageCircleQuestion","Clock","Play","Pause","hasMessageBody","buildDeepLinkUrl","markdownToPlainTextBlocks","plainText","downloadBlob","getContextUsedPercent","getContextRemainingPercent","filterSkills"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,IAAM,kBAAA,GAAqB;AAAA,EACzB,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA;AAEO,SAAS,oBAAoB,cAAA,EAAwD;AAC1F,EAAA,MAAM,KAAA,uBAAY,GAAA,EAAoB;AACtC,EAAA,KAAA,MAAW,MAAM,cAAA,EAAgB;AAC/B,IAAA,IAAI,CAAC,EAAA,IAAM,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA,EAAG;AAC1B,IAAA,MAAM,KAAA,GAAQ,kBAAA,CAAmB,KAAA,CAAM,IAAA,GAAO,mBAAmB,MAAM,CAAA;AACvE,IAAA,KAAA,CAAM,GAAA,CAAI,EAAA,EAAI,CAAA,YAAA,EAAe,KAAK,CAAA,KAAA,CAAO,CAAA;AAAA,EAC3C;AACA,EAAA,OAAO,KAAA;AACT;;;ACnBO,SAAS,aAAa,EAAA,EAAmB;AAC9C,EAAA,EAAA,CAAG,gBAAgB,uBAAuB,CAAA;AAE1C,EAAA,KAAM,EAAA,CAAmB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AAO,GAAG,CAAA,EAAG,IAAA,CAAK,KAAK,WAAW,CAAA;AAC5D,EAAA,OAAO,GAAA;AACT;AAOO,SAAS,mBAAA,CACd,MACA,YAAA,EACe;AACf,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,YAAA,EAAc,OAAO,MAAA;AACnC,EAAA,MAAM,OAAA,GAAU,KAAK,MAAA,CAAO,CAAC,MAAM,0BAAA,CAA2B,CAAC,MAAM,YAAY,CAAA;AACjF,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,WAAW,CAAA,CAAE,CAAC,CAAA;AACpC","file":"chunk-FTLNYE2X.cjs","sourcesContent":["/** Conversation-local colors: callers supply participants in first-post order. */\nconst PARTICIPANT_COLORS = [\n 'blue',\n 'amber',\n 'teal',\n 'violet',\n 'rose',\n 'lime',\n 'sky',\n 'orange',\n 'emerald',\n 'fuchsia',\n 'indigo',\n 'cyan',\n] as const\n\nexport function getParticipantTints(participantIds: readonly string[]): Map<string, string> {\n const tints = new Map<string, string>()\n for (const id of participantIds) {\n if (!id || tints.has(id)) continue\n const color = PARTICIPANT_COLORS[tints.size % PARTICIPANT_COLORS.length]\n tints.set(id, `var(--color-${color}-600)`)\n }\n return tints\n}\n","/**\n * Mark the message a link took the reader to: a brief, gentle highlight on the message itself (on\n * the theme's accent and ring, `[data-deep-link-target]` in `blocks.css`) that fades out and\n * removes itself, so nothing is left tinted afterwards.\n */\nexport function flashMessage(el: Element): void {\n el.removeAttribute('data-deep-link-target')\n // Restart the animation when the same message is flashed again.\n void (el as HTMLElement).offsetWidth\n el.setAttribute('data-deep-link-target', '')\n const clear = () => el.removeAttribute('data-deep-link-target')\n el.addEventListener('animationend', clear, { once: true })\n // Reduced motion runs no animation: clear it after the same time.\n setTimeout(clear, 2000)\n}\n","import { PenLine } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\n\n/** Every fixed string of the chip. Pass a partial `labels` to translate or reword. */\nexport interface DraftingDocChipLabels {\n /** `{title}` is the open document's name. */\n drafting: string\n /** What it means, on hover. */\n hint: string\n}\n\nexport const DEFAULT_DRAFTING_DOC_CHIP_LABELS: DraftingDocChipLabels = {\n drafting: 'Drafting in {title}',\n hint: 'ARBI sees the document open beside the chat: it reads what it needs and makes its edits as tracked changes you accept or reject.',\n}\n\nexport interface DraftingDocChipProps {\n /** The document open beside the chat (the one the assistant drafts in). */\n title: string\n className?: string\n labels?: Partial<DraftingDocChipLabels>\n testId?: string\n}\n\n/**\n * Drafting mode, said in the composer: the document open beside the chat is the one the assistant\n * works in — it reads it on demand and edits it granularly as tracked changes, never as a whole\n * document resent each turn (that is what a pin is for). Not removable: closing the document ends\n * it.\n */\nexport function DraftingDocChip({\n title,\n className,\n labels,\n testId = 'drafting-doc-chip',\n}: DraftingDocChipProps) {\n const l = { ...DEFAULT_DRAFTING_DOC_CHIP_LABELS, ...labels }\n const text = l.drafting.replace('{title}', title)\n return (\n <span\n className={cn(\n 'flex h-7 min-w-0 max-w-[16rem] items-center gap-1.5 rounded-md border border-border bg-card px-2 text-xs text-muted-foreground',\n className\n )}\n title={`${text}. ${l.hint}`}\n data-testid={testId}\n >\n <PenLine className=\"size-3.5 shrink-0 text-primary\" aria-hidden />\n <span className=\"truncate\">{text}</span>\n </span>\n )\n}\n","import { memo, useEffect, useId, useRef } from 'react'\nimport { BookOpen, Globe, SquareSlash } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { listOptionId } from '../lib/useListKeyNav'\nimport { prefixedTestId, testIdOr } from './test-id'\n\n/** Which list an entry came from: drives the menu's section grouping. */\nexport type SlashItemKind = 'command' | 'skill'\n\nexport interface SlashMenuItem {\n /** Slug used to invoke the entry (`/<slug>`). */\n name: string\n description?: string\n /** `command` = shipped built-in; `skill` = user-authored. */\n kind: SlashItemKind\n /** Args hint, e.g. `<prompt>`. */\n argHint?: string\n /** Marketplace visibility: drives the \"Global\" affordance. Skills only. */\n visibility?: 'mine' | 'global'\n}\n\n/** Every fixed string of the slash menu. Pass a partial `labels` to translate or reword. */\nexport interface SlashMenuLabels {\n hint: string\n commands: string\n skills: string\n global: string\n globalTitle: string\n /** Accessible name of the list. */\n list: string\n /** Polite count announced as the menu opens or the filter narrows it. */\n resultCount: (count: number) => string\n /** Footer action that opens the skills browser. */\n browse: string\n}\n\nexport const DEFAULT_SLASH_MENU_LABELS: SlashMenuLabels = {\n hint: 'Enter or Tab to insert, Esc to dismiss',\n commands: 'Commands',\n skills: 'Skills',\n global: 'Global',\n globalTitle: 'Shared skill from the marketplace',\n list: 'Commands and skills',\n resultCount: (count) => `${count} ${count === 1 ? 'command' : 'commands'} available`,\n browse: 'Browse skills',\n}\n\nexport interface SlashMenuProps {\n open: boolean\n /** The chat composer sits at the bottom (menu above); a top-of-page ask pill opens below. */\n placement?: 'above' | 'below'\n /** Highlighted row, 0-based over the flat list. */\n selectedIndex: number\n setSelectedIndex: (i: number) => void\n /**\n * Id of the listbox. Take it (and `comboboxProps`) from `useListKeyNav` so the text field's\n * `aria-controls` / `aria-activedescendant` point at this menu.\n */\n listboxId?: string\n /** Filtered list, already ordered commands-then-skills. */\n items: SlashMenuItem[]\n /** Adds a \"Browse skills\" footer that calls this (the host opens its skills browser). */\n onBrowse?: () => void\n onSelect: (item: SlashMenuItem) => void\n className?: string\n labels?: Partial<SlashMenuLabels>\n /** Test id of the menu (default `slash-menu`). */\n testId?: string\n /** Row prefixes (`<prefix>-<kind|name>`); defaults `slash-section` / `slash-item`. */\n testIds?: Partial<Record<'section' | 'item' | 'browse', string>>\n}\n\nfunction SectionIcon({ kind }: { kind: SlashItemKind }) {\n return kind === 'skill' ? (\n <BookOpen className=\"h-3 w-3\" aria-hidden=\"true\" />\n ) : (\n <SquareSlash className=\"h-3 w-3\" aria-hidden=\"true\" />\n )\n}\n\n/**\n * Slash-command autocomplete that floats over a text field. Presentational: the host owns the\n * filter, the highlighted index (see `useListKeyNav`) and what selecting an item does.\n */\nexport const SlashMenu = memo(function SlashMenu({\n open,\n placement = 'above',\n selectedIndex,\n setSelectedIndex,\n listboxId: listboxIdProp,\n items,\n onBrowse,\n onSelect,\n className,\n labels,\n testId,\n testIds,\n}: SlashMenuProps) {\n const l = { ...DEFAULT_SLASH_MENU_LABELS, ...labels }\n const ownId = useId()\n const listboxId = listboxIdProp ?? ownId\n // Keep the keyboard-highlighted row visible. Rows are split across per-section lists, so the\n // flat `data-slash-index` is the stable handle.\n const scrollRef = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (!open) return\n const el = scrollRef.current?.querySelector<HTMLElement>(\n `[data-slash-index=\"${selectedIndex}\"]`\n )\n // jsdom has no scrollIntoView.\n el?.scrollIntoView?.({ block: 'nearest' })\n }, [open, selectedIndex])\n\n if (!open || items.length === 0) return null\n\n let offset = 0\n const SECTIONS: ReadonlyArray<{ kind: SlashItemKind; label: string }> = [\n { kind: 'command', label: l.commands },\n { kind: 'skill', label: l.skills },\n ]\n const sections = SECTIONS.map(({ kind, label }) => {\n const rows = items.filter((i) => i.kind === kind)\n const section = { kind, label, rows, offset }\n offset += rows.length\n return section\n }).filter((s) => s.rows.length > 0)\n\n return (\n <div\n data-slot=\"slash-menu\"\n className={cn(\n 'absolute left-0 right-0 z-30 max-h-64 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg',\n placement === 'above' ? 'bottom-full mb-2' : 'top-full mt-2',\n className\n )}\n // mousedown would blur the textarea (closing the menu before the click lands).\n onMouseDown={(e) => e.preventDefault()}\n data-testid={testIdOr(testId, { testId: 'slash-menu' })}\n >\n <div className=\"border-b border-border/50 px-3 py-1.5 text-xs text-muted-foreground\">\n {l.hint}\n </div>\n <div className=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n {l.resultCount(items.length)}\n </div>\n <div\n ref={scrollRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={l.list}\n className=\"scrollbar-subtle max-h-56 overflow-y-auto py-1\"\n >\n {sections.map((section) => (\n <div\n key={section.kind}\n role=\"group\"\n aria-labelledby={`${listboxId}-section-${section.kind}`}\n >\n <div\n id={`${listboxId}-section-${section.kind}`}\n className=\"flex items-center gap-1.5 px-3 pb-1 pt-1.5 text-xs font-medium text-muted-foreground\"\n data-testid={prefixedTestId(testIds?.section, section.kind, {\n testId: `slash-section-${section.kind}`,\n })}\n >\n <SectionIcon kind={section.kind} />\n <span>{section.label}</span>\n </div>\n {section.rows.map((item, idx) => {\n const flatIndex = section.offset + idx\n const isActive = flatIndex === selectedIndex\n return (\n <div\n key={item.name}\n id={listOptionId(listboxId, flatIndex)}\n role=\"option\"\n aria-selected={isActive}\n data-slash-index={flatIndex}\n className={cn(\n 'flex cursor-pointer items-baseline gap-2 px-3 py-1.5 text-sm pointer-coarse:min-h-11 pointer-coarse:items-center',\n isActive ? 'bg-accent text-accent-foreground' : 'hover:bg-accent/50'\n )}\n onMouseEnter={() => setSelectedIndex(flatIndex)}\n onClick={() => onSelect(item)}\n data-testid={prefixedTestId(testIds?.item, item.name, {\n testId: `slash-item-${item.name}`,\n })}\n >\n <span className=\"shrink-0 font-mono text-foreground\">/{item.name}</span>\n {item.argHint && (\n <span className=\"shrink-0 font-mono text-xs text-muted-foreground\">\n {item.argHint}\n </span>\n )}\n {item.description && (\n <span className=\"truncate text-xs text-muted-foreground\">\n {item.description}\n </span>\n )}\n {item.visibility === 'global' && (\n <span\n className=\"ml-auto inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground\"\n title={l.globalTitle}\n >\n <Globe className=\"h-3 w-3\" />\n {l.global}\n </span>\n )}\n </div>\n )\n })}\n </div>\n ))}\n </div>\n {onBrowse && (\n <button\n type=\"button\"\n onClick={onBrowse}\n className=\"flex w-full items-center gap-1.5 border-t border-border/50 px-3 py-1.5 text-left text-xs text-muted-foreground hover:bg-accent/50 pointer-coarse:min-h-11\"\n data-testid={testIdOr(testIds?.browse, { testId: 'slash-browse-skills' })}\n >\n <BookOpen className=\"h-3 w-3\" aria-hidden=\"true\" />\n {l.browse}\n </button>\n )}\n </div>\n )\n})\n","import type { HTMLAttributes, ReactNode } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\n/** Every fixed string of the conversation layout. Pass a partial `labels` to reword. */\nexport interface ConversationLayoutLabels {\n loadingMessages: string\n}\n\nexport const DEFAULT_CONVERSATION_LAYOUT_LABELS: ConversationLayoutLabels = {\n loadingMessages: 'Loading messages...',\n}\n\n/**\n * Page frame of a conversation. The chat scroll surface belongs to the HOST (the outer\n * `[data-scroll-container]`), so this column must GROW with its content, not stay\n * viewport-capped: the sticky header and the sticky composer dock need a containing block that\n * spans the whole thread, otherwise `position: sticky` is clamped to one screen and both unpin.\n *\n * Do NOT put `overflow: clip/hidden`, `transform`, `filter`, `will-change` or `contain` on\n * {@link ConversationBody}: `overflow: clip` collapses the scrollHeight so the thread cannot\n * scroll, and a transform creates a containing block that breaks the dock's `bottom: 0`.\n */\nexport function ConversationRoot({\n className,\n children,\n testId = 'conversation',\n ...rest\n}: HTMLAttributes<HTMLDivElement> & { testId?: string }) {\n return (\n <div\n data-slot=\"conversation\"\n className={cn('flex min-h-full shrink-0 flex-col', className)}\n data-testid={testId}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\n/** Sticky strip at the top (tabs and their actions). */\nexport function ConversationHeader({\n className,\n children,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"conversation-header\"\n className={cn('sticky top-0 z-10 bg-background', className)}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\n/** Grows (never shrinks) to the thread's full height so the sticky dock spans the scroll range. */\nexport function ConversationBody({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"conversation-body\"\n className={cn('flex flex-[1_0_auto] flex-col', className)}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\n/** The thread (or its empty / loading state). `relative` so absolutely-filled states fit. */\nexport function ConversationMain({ className, children, ...rest }: HTMLAttributes<HTMLElement>) {\n return (\n <main\n data-slot=\"conversation-main\"\n className={cn('relative flex flex-[1_0_auto] flex-col', className)}\n {...rest}\n >\n {children}\n </main>\n )\n}\n\n/** Centered status while the thread loads. */\nexport function ConversationLoading({\n children,\n labels,\n className,\n testId = 'loading-messages',\n}: {\n /** Text; wins over `labels.loadingMessages`. */\n children?: ReactNode\n labels?: Partial<ConversationLayoutLabels>\n className?: string\n testId?: string\n}) {\n const l = { ...DEFAULT_CONVERSATION_LAYOUT_LABELS, ...labels }\n return (\n <div className={cn('flex h-64 items-center justify-center', className)} data-testid={testId}>\n <p className=\"text-muted-foreground\">{children ?? l.loadingMessages}</p>\n </div>\n )\n}\n\nexport const Conversation = {\n Root: ConversationRoot,\n Header: ConversationHeader,\n Body: ConversationBody,\n Main: ConversationMain,\n Loading: ConversationLoading,\n}\n","import { ArrowLeft, ArrowRight, Network } from 'lucide-react'\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { testIdOr } from './test-id'\n\n/** Every fixed string of the branch controls. Pass a partial `labels` to translate or reword. */\nexport interface BranchControlsLabels {\n /** \"Branch 2 of 3\" (1-based `current`). */\n branchOf: (current: number, total: number) => string\n previewHint: string\n previousBranch: string\n nextBranch: string\n}\n\nexport const DEFAULT_BRANCH_CONTROLS_LABELS: BranchControlsLabels = {\n branchOf: (current, total) => `Branch ${current} of ${total}`,\n previewHint: 'Click for side-by-side view',\n previousBranch: 'Previous branch',\n nextBranch: 'Next branch',\n}\n\nexport interface BranchControlsProps {\n /** 0-based index of the active branch. */\n index: number\n /** Number of branches at this fork; nothing renders when there is only one. */\n count: number\n onSwitch: (targetIndex: number) => void\n /** Makes the label a button that opens the side-by-side view. */\n onPreview?: () => void\n /** Tooltip of the preview button; wins over `labels.previewHint`. */\n previewHint?: string\n className?: string\n labels?: Partial<BranchControlsLabels>\n /** Per-part test ids; defaults are the current ids. */\n testIds?: Partial<{\n root: string\n preview: string\n icon: string\n indicator: string\n previous: string\n next: string\n }>\n}\n\nconst ARROW =\n 'rounded p-1 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:p-3'\n\n/** \"Branch 2 of 3\" with previous/next arrows at a fork in the conversation. */\nexport function BranchControls({\n index,\n count,\n onSwitch,\n onPreview,\n previewHint,\n className,\n labels,\n testIds,\n}: BranchControlsProps) {\n if (count <= 1) return null\n const l = { ...DEFAULT_BRANCH_CONTROLS_LABELS, ...labels }\n const label = l.branchOf(index + 1, count)\n const rootTestId = testIdOr(testIds?.root, { testId: 'branch-controls' })\n const previewTestId = testIdOr(testIds?.preview, { testId: 'threads-preview-button' })\n const iconTestId = testIdOr(testIds?.icon, { testId: 'branch-icon' })\n const indicatorTestId = testIdOr(testIds?.indicator, { testId: 'branch-indicator' })\n const previousTestId = testIdOr(testIds?.previous, { testId: 'previous-branch-button' })\n const nextTestId = testIdOr(testIds?.next, { testId: 'next-branch-button' })\n\n return (\n <div\n data-slot=\"branch-controls\"\n className={cn('branch-controls flex items-center gap-1', className)}\n data-testid={rootTestId}\n >\n {onPreview ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={onPreview}\n className=\"flex items-center gap-1 rounded-md bg-muted px-2 py-1 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11\"\n data-testid={previewTestId}\n >\n <Network size={12} className=\"text-primary\" data-testid={iconTestId} />\n <span\n className=\"text-sm font-medium text-muted-foreground\"\n data-testid={indicatorTestId}\n >\n {label}\n </span>\n </button>\n </TooltipTrigger>\n <TooltipContent>\n <p>{previewHint ?? l.previewHint}</p>\n </TooltipContent>\n </Tooltip>\n ) : (\n <span\n className=\"flex items-center gap-1 px-2 py-1 text-sm font-medium text-muted-foreground\"\n data-testid={indicatorTestId}\n >\n <Network size={12} className=\"text-primary\" data-testid={iconTestId} />\n {label}\n </span>\n )}\n\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={() => onSwitch(index - 1)}\n disabled={index <= 0}\n className={ARROW}\n title={l.previousBranch}\n aria-label={l.previousBranch}\n data-testid={previousTestId}\n >\n <ArrowLeft size={12} />\n </button>\n <button\n type=\"button\"\n onClick={() => onSwitch(index + 1)}\n disabled={index >= count - 1}\n className={ARROW}\n title={l.nextBranch}\n aria-label={l.nextBranch}\n data-testid={nextTestId}\n >\n <ArrowRight size={12} />\n </button>\n </div>\n </div>\n )\n}\n","import { forwardRef } from 'react'\nimport type { ComponentType, ReactNode } from 'react'\nimport { Check, ChevronsUpDown, Crown, Glasses, Settings, Sparkles, Zap } from 'lucide-react'\nimport {\n Button,\n Popover,\n PopoverContent,\n PopoverTrigger,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { BlocksTooltipProvider } from '../provider/TooltipScope'\n\n// ── Icons ───────────────────────────────────────────────────────────────────────────────────\n\nexport type ModelTierKind = 'standard' | 'wise' | 'premium'\n\nconst TIER_ICON: Record<ModelTierKind, ComponentType<{ className?: string }>> = {\n standard: Zap,\n wise: Glasses,\n premium: Crown,\n}\n\nconst TIER_TONE: Record<ModelTierKind, string> = {\n standard: 'text-secondary fill-secondary',\n wise: 'text-secondary fill-secondary',\n premium: 'text-yellow-text fill-yellow-text',\n}\n\nexport interface ModelTierIconProps {\n tier: ModelTierKind\n /** Agentic mode off: the tier glyph is greyed. */\n isGreyed?: boolean\n className?: string\n}\n\n/** The glyph of a model tier (Fast/Standard bolt, Wise glasses, Premium crown). */\nexport function ModelTierIcon({ tier, isGreyed, className }: ModelTierIconProps) {\n const Icon = TIER_ICON[tier]\n return (\n <Icon\n className={cn(\n 'size-3.5 shrink-0',\n isGreyed ? 'fill-muted-foreground text-muted-foreground' : TIER_TONE[tier],\n className\n )}\n />\n )\n}\n\n/** The Autoselect sparkle. */\nexport function ModelAutoIcon({ className }: { className?: string }) {\n return <Sparkles className={cn('size-3.5 shrink-0 fill-secondary text-secondary', className)} />\n}\n\n/** Neutral status dot for models with no tier glyph. */\nexport function ModelDot({ isGreyed }: { isGreyed?: boolean }) {\n return (\n <div\n className={cn(\n 'size-2 shrink-0 rounded-full',\n isGreyed ? 'bg-muted-foreground' : 'bg-primary'\n )}\n />\n )\n}\n\n/** Label + icon content shared by menu rows and select items. */\nexport function ModelOptionLabel({ icon, label }: { icon: ReactNode; label: ReactNode }) {\n return (\n <div className=\"flex w-full items-center gap-2\">\n {icon}\n <span className=\"min-w-0 flex-1 truncate\">{label}</span>\n </div>\n )\n}\n\n// ── Trigger ─────────────────────────────────────────────────────────────────────────────────\n\nexport interface ModelTriggerContentProps {\n icon?: ReactNode\n label: ReactNode\n}\n\n/** Icon + truncated label (used inside the compact trigger and the select trigger). */\nexport function ModelTriggerContent({ icon, label }: ModelTriggerContentProps) {\n return (\n <div className=\"flex min-w-0 items-center gap-1.5\">\n {icon}\n <span className=\"truncate\">{label}</span>\n </div>\n )\n}\n\nexport interface ModelPickerTriggerProps extends ModelTriggerContentProps {\n /** Spoken before the current model, so the button reads \"Model: Autoselect\". Default \"Model\". */\n nameLabel?: string\n className?: string\n testId?: string\n}\n\n/** The compact picker button (ghost, with a chevron). Forwards its ref for popover/tooltip triggers. */\nexport const ModelPickerTrigger = forwardRef<HTMLButtonElement, ModelPickerTriggerProps>(\n function ModelPickerTrigger(\n { icon, label, nameLabel = 'Model', className, testId = 'model-selector-compact', ...rest },\n ref\n ) {\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n 'h-8 min-w-0 shrink gap-1 px-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground pointer-coarse:h-11',\n className\n )}\n aria-label={typeof label === 'string' ? `${nameLabel}: ${label}` : undefined}\n data-slot=\"model-picker-trigger\"\n data-testid={testId}\n {...rest}\n >\n <ModelTriggerContent icon={icon} label={label} />\n <ChevronsUpDown className=\"size-3 shrink-0 text-muted-foreground\" />\n </Button>\n )\n }\n)\n\n// ── Popover + menu ──────────────────────────────────────────────────────────────────────────\n\nexport interface ModelPickerPopoverProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n /** The trigger (a ModelPickerTrigger). */\n trigger: ReactNode\n /** Hover tooltip on the trigger (hidden while open). */\n tooltip?: ReactNode\n title?: string\n /** The menu rows. */\n children: ReactNode\n}\n\n/** Popover shell: trigger + tooltip + titled, scrolling list. */\nexport function ModelPickerPopover({\n open,\n onOpenChange,\n trigger,\n tooltip,\n title = 'Select AI Model',\n children,\n}: ModelPickerPopoverProps) {\n return (\n <BlocksTooltipProvider>\n <Popover open={open} onOpenChange={onOpenChange}>\n <Tooltip>\n <TooltipTrigger asChild>\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\n </TooltipTrigger>\n {tooltip && !open && <TooltipContent side=\"top\">{tooltip}</TooltipContent>}\n </Tooltip>\n <PopoverContent side=\"top\" align=\"start\" className=\"w-[280px] p-1\" sideOffset={8}>\n <div className=\"px-2 py-1.5 text-sm font-medium text-muted-foreground\">{title}</div>\n <div className=\"flex max-h-[280px] flex-col gap-0.5 overflow-y-auto\">{children}</div>\n </PopoverContent>\n </Popover>\n </BlocksTooltipProvider>\n )\n}\n\nexport function ModelMenuDivider() {\n return <div className=\"my-0.5 border-t border-border\" role=\"separator\" />\n}\n\nexport function ModelMenuMessage({ children }: { children: ReactNode }) {\n return <div className=\"px-2 py-1.5 text-sm text-muted-foreground\">{children}</div>\n}\n\nexport interface ModelOptionProps {\n icon: ReactNode\n label: ReactNode\n isSelected: boolean\n onSelect: () => void\n testId: string\n /** Tier rows mark selection with a primary left edge and bold label. */\n emphasis?: 'plain' | 'tier'\n}\n\n/** One selectable model row. */\nexport function ModelOption({\n icon,\n label,\n isSelected,\n onSelect,\n testId,\n emphasis = 'plain',\n}: ModelOptionProps) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className={cn(\n 'flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent pointer-coarse:min-h-11',\n emphasis === 'tier' && 'border-l-4',\n emphasis === 'tier' && (isSelected ? 'border-l-primary' : 'border-l-transparent'),\n isSelected && 'bg-accent'\n )}\n aria-pressed={isSelected}\n data-slot=\"model-option\"\n data-testid={testId}\n >\n {icon}\n <span\n className={cn(\n 'min-w-0 flex-1 truncate',\n emphasis === 'tier' &&\n (isSelected ? 'font-semibold text-foreground' : 'font-medium text-muted-foreground')\n )}\n >\n {label}\n </span>\n {isSelected && <Check className=\"size-3 shrink-0 text-primary\" />}\n </button>\n )\n}\n\nexport interface ModelTierOptionProps {\n icon: ReactNode\n label: ReactNode\n isSelected: boolean\n /** The tier is switched off in settings: shown dimmed and not selectable. */\n isDisabled?: boolean\n onSelect: () => void\n /** Trailing control (the configure cog). */\n action?: ReactNode\n testId: string\n}\n\n/** A tier row with a trailing action (Premium + configure cog). */\nexport function ModelTierOption({\n icon,\n label,\n isSelected,\n isDisabled,\n onSelect,\n action,\n testId,\n}: ModelTierOptionProps) {\n return (\n <div\n className={cn(\n 'flex items-center gap-1 rounded-sm border-l-4 pr-1 transition-colors',\n isSelected ? 'border-l-primary bg-accent' : 'border-l-transparent'\n )}\n data-slot=\"model-tier-option\"\n >\n <button\n type=\"button\"\n onClick={() => {\n if (!isDisabled) onSelect()\n }}\n disabled={isDisabled}\n className={cn(\n 'flex min-w-0 flex-1 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm pointer-coarse:min-h-11',\n isDisabled ? 'cursor-not-allowed opacity-50' : 'hover:bg-accent'\n )}\n data-testid={testId}\n >\n {icon}\n <span\n className={cn(\n 'min-w-0 flex-1 truncate',\n isSelected ? 'font-semibold text-foreground' : 'font-medium text-muted-foreground'\n )}\n >\n {label}\n </span>\n </button>\n {action}\n </div>\n )\n}\n\nexport interface ModelConfigureButtonProps {\n onClick: () => void\n /** Accessible name. */\n label: string\n /** Tooltip text. */\n tooltip: string\n testId?: string\n}\n\n/** Small bordered cog beside a tier row. */\nexport function ModelConfigureButton({\n onClick,\n label,\n tooltip,\n testId,\n}: ModelConfigureButtonProps) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onClick()\n }}\n className=\"flex size-7 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground hover:bg-accent pointer-coarse:size-11\"\n data-testid={testId}\n aria-label={label}\n >\n <Settings className=\"size-4\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{tooltip}</TooltipContent>\n </Tooltip>\n )\n}\n\n/** Every fixed string of the pricing tip. Pass a partial `labels` to translate or reword. */\nexport interface ModelPricingTipLabels {\n input: (price: string) => string\n output: (price: string) => string\n}\n\nexport const DEFAULT_MODEL_PRICING_TIP_LABELS: ModelPricingTipLabels = {\n input: (price) => `Input: ${price} / M tokens`,\n output: (price) => `Output: ${price} / M tokens`,\n}\n\nexport interface ModelPricingTipProps {\n modelName: string\n /** £ per million tokens, formatted (\"£2.50\"). */\n inputPrice?: string | null\n outputPrice?: string | null\n labels?: Partial<ModelPricingTipLabels>\n}\n\n/** Tooltip body: model name and per-million-token £ prices. */\nexport function ModelPricingTip({\n modelName,\n inputPrice,\n outputPrice,\n labels,\n}: ModelPricingTipProps) {\n const l = { ...DEFAULT_MODEL_PRICING_TIP_LABELS, ...labels }\n return (\n <div className=\"space-y-1 text-sm\">\n <div className=\"font-medium\">{modelName}</div>\n {inputPrice && <div>{l.input(inputPrice)}</div>}\n {outputPrice && <div>{l.output(outputPrice)}</div>}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { Bot, Plus, Settings } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from './test-id'\n\n// ── Header actions ──────────────────────────────────────────────────────────────────────────\n\n/** Right side of the conversation tab strip. */\nexport function ConversationHeaderActions({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) {\n return (\n <div\n className={cn('flex items-center gap-2', className)}\n data-slot=\"conversation-header-actions\"\n >\n {children}\n </div>\n )\n}\n\n/** Every fixed string of the conversation parts. Pass a partial `labels` to a part to reword. */\nexport interface ConversationPartsLabels {\n /** \"New Chat\": `entityLabel` is the host's noun. */\n newEntity: (entityLabel: string) => string\n newPaChatTitle: string\n newPaChat: string\n paModeTitle: string\n pa: string\n}\n\nexport const DEFAULT_CONVERSATION_PARTS_LABELS: ConversationPartsLabels = {\n newEntity: (entityLabel) => `New ${entityLabel}`,\n newPaChatTitle: 'Start a new Personal Assistant chat',\n newPaChat: 'New PA Chat',\n paModeTitle: 'Personal Assistant mode',\n pa: 'PA',\n}\n\nexport interface NewChatButtonProps {\n /** Entity label, e.g. \"Chat\": names the button (\"New Chat\"). */\n entityLabel: string\n /** Narrow header: icon only. */\n isCompact: boolean\n onClick: () => void\n labels?: Partial<ConversationPartsLabels>\n testId?: string\n}\n\n/** \"+ New Chat\". */\nexport function NewChatButton({\n entityLabel,\n isCompact,\n onClick,\n labels,\n testId = 'new-conversation-button',\n}: NewChatButtonProps) {\n const text = { ...DEFAULT_CONVERSATION_PARTS_LABELS, ...labels }.newEntity(entityLabel)\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"flex h-8 items-center gap-1.5 rounded-md px-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10 pointer-coarse:h-11! pointer-coarse:min-w-11 pointer-coarse:justify-center\"\n data-testid={testId}\n aria-label={text}\n title={text}\n >\n <Plus className=\"size-4 shrink-0\" />\n {!isCompact && <span>{text}</span>}\n </button>\n )\n}\n\n/** Starts a Personal Assistant conversation (experimental). */\nexport function NewPaChatButton({\n isCompact,\n onClick,\n labels,\n testId = 'new-pa-conversation-button',\n}: {\n isCompact: boolean\n onClick: () => void\n labels?: Partial<ConversationPartsLabels>\n testId?: string\n}) {\n const l = { ...DEFAULT_CONVERSATION_PARTS_LABELS, ...labels }\n return (\n <Button\n variant=\"outline\"\n size=\"icon\"\n onClick={onClick}\n className={cn(\n 'pointer-coarse:min-h-11',\n isCompact ? 'flex items-center' : 'flex w-auto items-center gap-2 px-4'\n )}\n data-testid={testId}\n title={l.newPaChatTitle}\n >\n <Bot className=\"size-4\" />\n {!isCompact && <span>{l.newPaChat}</span>}\n </Button>\n )\n}\n\n// ── Composer slots ──────────────────────────────────────────────────────────────────────────\n\n/** Left of the composer toolbar: borderless, muted buttons (files, facts). */\nexport function ComposerAccessories({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) {\n return (\n <span\n className={cn(\n 'flex items-center gap-1 [&_button]:border-transparent [&_button]:bg-transparent [&_button]:text-muted-foreground pointer-coarse:[&_button]:h-11',\n className\n )}\n data-slot=\"composer-accessories\"\n >\n {children}\n </span>\n )\n}\n\n/** Right of the composer toolbar: tools (settings, mic) around the send button. */\nexport function ComposerTools({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) {\n return (\n <div\n className={cn(\n 'flex items-center gap-1 [&_button:not([data-testid=send-message-button]):not([data-testid=retry-button])]:border-transparent [&_button:not([data-testid=send-message-button]):not([data-testid=retry-button])]:bg-transparent',\n className\n )}\n data-slot=\"composer-tools\"\n >\n {children}\n </div>\n )\n}\n\n/** Personal Assistant mode marker in place of the accessories. */\nexport function PaModeBadge({\n icon,\n labels,\n testId = 'pa-mode-indicator',\n}: {\n icon: ReactNode\n labels?: Partial<ConversationPartsLabels>\n testId?: string\n}) {\n const l = { ...DEFAULT_CONVERSATION_PARTS_LABELS, ...labels }\n return (\n <div\n className=\"flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-yellow-text\"\n title={l.paModeTitle}\n data-testid={testId}\n >\n {icon}\n <span className=\"text-sm font-semibold\">{l.pa}</span>\n </div>\n )\n}\n\n/** Icon-only gear for the conversation's settings (developers). */\nexport function ConversationSettingsButton({\n label,\n onClick,\n testId = 'conversation-settings-button',\n}: {\n /** e.g. \"Chat Settings\". */\n label: string\n onClick: () => void\n testId?: string\n}) {\n return (\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-8 shrink-0 text-muted-foreground pointer-coarse:size-11\"\n onClick={onClick}\n title={label}\n aria-label={label}\n data-testid={testId}\n >\n <Settings className=\"size-4\" />\n </Button>\n )\n}\n\n/** The history (list) view area when no chat tab is active. */\nexport function ConversationHistoryPane({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) {\n return <div className={cn('min-h-0 flex-1 overflow-hidden', className)}>{children}</div>\n}\n","import { useMemo, type ReactNode, type Ref } from 'react'\nimport DOMPurify from 'dompurify'\nimport { Download } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\n\n/** Every fixed string of the thread map parts. Pass a partial `labels` to a part to reword. */\nexport interface ThreadMapLabels {\n saveSvgTitle: string\n saveSvg: string\n generating: string\n /** \"Error rendering diagram: <message>\". */\n renderError: (message: string) => string\n}\n\nexport const DEFAULT_THREAD_MAP_LABELS: ThreadMapLabels = {\n saveSvgTitle: 'Save SVG as file',\n saveSvg: 'Save SVG',\n generating: 'Generating visualization...',\n renderError: (message) => `Error rendering diagram: ${message}`,\n}\n\nexport interface ThreadMapProps {\n /** Hint line above the map; omit to hide the header. */\n hint?: string\n /** Offer \"Save SVG\" (only once there is a diagram). */\n onSave?: () => void\n /** The map body (ThreadMapLoading / ThreadMapError / ThreadMapDiagram). */\n children: ReactNode\n className?: string\n labels?: Partial<ThreadMapLabels>\n testId?: string\n}\n\n/** The conversation-thread map: hint + save header over a scrolling canvas. */\nexport function ThreadMap({\n hint,\n onSave,\n children,\n className,\n labels,\n testId = 'thread-visualizer',\n}: ThreadMapProps) {\n const l = { ...DEFAULT_THREAD_MAP_LABELS, ...labels }\n return (\n <div\n className={cn('thread-visualizer flex h-full w-full flex-col', className)}\n data-slot=\"thread-map\"\n data-testid={testId}\n >\n {hint !== undefined && (\n <div className=\"mb-2 flex items-center justify-between gap-2\">\n <div className=\"text-sm italic text-muted-foreground\">{hint}</div>\n {onSave && (\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={onSave}\n title={l.saveSvgTitle}\n className=\"shrink-0 pointer-coarse:min-h-11\"\n >\n <Download className=\"size-3\" />\n {l.saveSvg}\n </Button>\n )}\n </div>\n )}\n <div\n className=\"mermaid-container w-full flex-1 overflow-auto rounded-lg bg-muted\"\n style={{ scrollBehavior: 'auto', contain: 'layout style' }}\n onScroll={(e) => e.stopPropagation()}\n >\n {children}\n </div>\n </div>\n )\n}\n\nexport function ThreadMapLoading({\n label,\n labels,\n}: {\n /** Text; wins over `labels.generating`. */\n label?: string\n labels?: Partial<ThreadMapLabels>\n}) {\n const text = label ?? { ...DEFAULT_THREAD_MAP_LABELS, ...labels }.generating\n return (\n <div className=\"flex h-24 items-center justify-center text-muted-foreground\" role=\"status\">\n <div className=\"flex flex-col items-center\">\n <svg\n className=\"-ml-1 mr-3 size-5 animate-spin text-primary\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n <span>{text}</span>\n </div>\n </div>\n )\n}\n\nexport function ThreadMapError({\n message,\n labels,\n}: {\n message: string\n labels?: Partial<ThreadMapLabels>\n}) {\n const l = { ...DEFAULT_THREAD_MAP_LABELS, ...labels }\n return (\n <div className=\"p-4 text-red-text\" role=\"alert\">\n {l.renderError(message)}\n </div>\n )\n}\n\nexport interface ThreadMapDiagramProps {\n /**\n * Rendered SVG markup. Sanitised here (DOMPurify, SVG + HTML-label profile) before it is\n * injected: blocks cannot know whether the host's renderer ran in a strict security mode.\n */\n svg: string\n diagramRef?: Ref<HTMLDivElement>\n /** Accessible name of the diagram (default \"Conversation thread map\"). */\n label?: string\n}\n\n/** Strip scripts, event handlers and script URLs while keeping mermaid's `foreignObject` labels. */\nexport function sanitizeDiagramSvg(svg: string): string {\n // Without a DOM (SSR) DOMPurify cannot sanitise and would hand the input back: render nothing.\n if (!DOMPurify.isSupported) return ''\n return DOMPurify.sanitize(svg, {\n USE_PROFILES: { svg: true, svgFilters: true, html: true },\n ADD_TAGS: ['foreignobject'],\n HTML_INTEGRATION_POINTS: { foreignobject: true },\n ADD_ATTR: ['target'],\n })\n}\n\nexport function ThreadMapDiagram({\n svg,\n diagramRef,\n label = 'Conversation thread map',\n}: ThreadMapDiagramProps) {\n const safeSvg = useMemo(() => sanitizeDiagramSvg(svg), [svg])\n return (\n <div\n ref={diagramRef}\n className=\"p-4\"\n role=\"img\"\n aria-label={label}\n data-slot=\"thread-map-diagram\"\n dangerouslySetInnerHTML={{ __html: safeSvg }}\n />\n )\n}\n","/**\n * Pure helpers for the thread map: build the Mermaid flowchart of a conversation's threads, and\n * resolve which thread a clicked node should open.\n *\n * A Thread is `{ leaf_message_ext_id, history }`; threads may share history up to a branch point.\n */\n\n/** The message fields the map reads (an ARBI `MessageResponse` fits). */\nexport interface ThreadDiagramMessage {\n external_id?: string | null\n parent_message_ext_id?: string | null\n is_branch_point?: boolean | null\n role: string\n content?: string | null\n}\n\n/** One thread: the leaf message and the history leading to it (an ARBI `Thread` fits). */\nexport interface ThreadDiagramThread {\n leaf_message_ext_id: string\n history: ThreadDiagramMessage[]\n}\n\n/** Node colours, matching the message bubbles (Tailwind slate). */\nconst DIAGRAM_COLORS = {\n userBg: '#f1f5f9', // slate-100\n assistantBg: '#ffffff',\n stroke: '#cbd5e1', // slate-300\n strokeLight: '#e2e8f0', // slate-200\n text: '#334155', // slate-700\n}\n\n/** Escape the characters that break Mermaid label syntax. */\nfunction escapeLabel(text: string): string {\n return text\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&apos;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\[/g, '&#91;')\n .replace(/\\]/g, '&#93;')\n .replace(/\\(/g, '&#40;')\n .replace(/\\)/g, '&#41;')\n .replace(/\\{/g, '&#123;')\n .replace(/\\}/g, '&#125;')\n}\n\n/** Mermaid `graph TD` source for the threads, or null while there is nothing to draw. */\nexport function buildThreadDiagram(threads: ThreadDiagramThread[]): string | null {\n if (!threads || threads.length === 0) return null\n\n // Store all messages first so they are available for parent-child mapping.\n const allMessages = new Map<string, ThreadDiagramMessage>()\n threads.forEach((thread) => {\n thread.history.forEach((message) => {\n allMessages.set(message.external_id!, message)\n })\n })\n\n // Parent-child relationships, with fallbacks: every message but the first should have a parent.\n const parentToChildren = new Map<string | null, Set<string>>()\n threads.forEach((thread) => {\n thread.history.forEach((message, index) => {\n const messageId = message.external_id!\n let parentId = message.parent_message_ext_id\n\n if (!parentId && index > 0) {\n parentId = thread.history[index - 1].external_id!\n console.warn(\n `ThreadVisualizer: Message ${messageId} (${message.role}) missing parent_message_ext_id. Inferred parent: ${parentId}`\n )\n } else if (!parentId) {\n parentId = null\n }\n\n if (parentId && !allMessages.has(parentId)) {\n if (index > 0) {\n const fallbackParentId = thread.history[index - 1].external_id!\n console.warn(\n `ThreadVisualizer: Message ${messageId} has invalid parent ${parentId}. Using fallback: ${fallbackParentId}`\n )\n parentId = fallbackParentId\n } else {\n console.warn(\n `ThreadVisualizer: Message ${messageId} has invalid parent ${parentId} and no fallback. Using root.`\n )\n parentId = null\n }\n }\n\n if (!parentToChildren.has(parentId)) parentToChildren.set(parentId, new Set())\n parentToChildren.get(parentId)?.add(messageId)\n })\n })\n\n // Branch points: messages with several children, or explicitly marked.\n const branchPoints = new Set<string>()\n parentToChildren.forEach((children, parentId) => {\n if (children.size > 1 && parentId) branchPoints.add(parentId)\n })\n allMessages.forEach((message, id) => {\n if (message.is_branch_point) branchPoints.add(id)\n })\n\n const leafNodes = new Set(threads.map((thread) => thread.leaf_message_ext_id))\n\n let diagram = 'graph TD\\n'\n // Match the message bubble colours, with a consistent font size.\n diagram += ` classDef user fill:${DIAGRAM_COLORS.userBg},stroke:${DIAGRAM_COLORS.stroke},color:${DIAGRAM_COLORS.text},stroke-width:1px,font-size:12px\\n`\n diagram += ` classDef assistant fill:${DIAGRAM_COLORS.assistantBg},stroke:${DIAGRAM_COLORS.strokeLight},color:${DIAGRAM_COLORS.text},stroke-width:1px,font-size:12px\\n`\n diagram += ` linkStyle default stroke:${DIAGRAM_COLORS.stroke},stroke-width:1px\\n`\n\n allMessages.forEach((message, id) => {\n // Plain text for a cleaner node: strip markdown, flatten line breaks, cap at 180 chars.\n const plain = (message.content || '').replace(/[*_~`#]/g, '')\n const shortened = plain.substring(0, 180).replace(/\\n/g, ' ')\n const content = escapeLabel(shortened) + (shortened.length < plain.length ? '...' : '')\n\n let label = `${message.role === 'user' ? 'User' : 'Assistant'}: ${content}`\n if (branchPoints.has(id)) label = `${label} 🔀`\n if (leafNodes.has(id)) label = `${label} 🏁`\n\n diagram += ` ${id}[\"${label}\"]\\n`\n diagram += ` class ${id} ${message.role === 'user' ? 'user' : 'assistant'}\\n`\n })\n\n // Edges only between parent and child (no root/start node).\n parentToChildren.forEach((children, parentId) => {\n children.forEach((childId) => {\n if (parentId) diagram += ` ${parentId} --> ${childId}\\n`\n })\n })\n\n return diagram\n}\n\n/**\n * The thread to open for a clicked flowchart node: the thread ending at that message if there is\n * one, otherwise the first thread containing it. Node ids look like `flowchart-msg-{uuid}-{n}`.\n */\nexport function threadForNode(threads: ThreadDiagramThread[], nodeId: string): string | null {\n const messageId = nodeId.replace(/^flowchart-/, '').replace(/-\\d+$/, '')\n if (threads.some((thread) => thread.leaf_message_ext_id === messageId)) return messageId\n const containing = threads.find((thread) =>\n thread.history.some((msg) => msg.external_id === messageId)\n )\n return containing ? containing.leaf_message_ext_id : null\n}\n","/**\n * ThreadVisualizer: renders a conversation's threads as a Mermaid flowchart (message\n * relationships, branch points, thread paths) inside the ThreadMap parts. The diagram source is\n * built by `thread-diagram.ts`; node clicks open the thread through `switchToThread`.\n *\n * Mermaid is an optional peer, imported on first render, so it stays out of every bundle that\n * never shows the map.\n */\n\nimport { memo, useEffect, useMemo, useRef, useState, useCallback } from 'react'\nimport { ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading } from './ThreadMap'\nimport { buildThreadDiagram, threadForNode, type ThreadDiagramThread } from './thread-diagram'\n\n/** The hint above the map. */\nexport interface ThreadVisualizerLabels {\n hint: string\n /** Shown instead of `hint` when there are more than five threads. */\n hintMany: string\n}\n\nexport const DEFAULT_THREAD_VISUALIZER_LABELS: ThreadVisualizerLabels = {\n hint: 'Click on a message to resume conversation thread.',\n hintMany: 'This conversation has many threads. Click on a message to resume conversation thread.',\n}\n\nexport interface ThreadVisualizerProps {\n threads: ThreadDiagramThread[]\n /** Open a thread, by its leaf message id. */\n switchToThread: (threadId: string) => void\n showHeader?: boolean\n showDownloadButton?: boolean\n className?: string\n labels?: Partial<ThreadVisualizerLabels>\n}\n\n// Lazily loaded mermaid instance, initialized once on first use.\nlet mermaidInitialized = false\nlet mermaidModule: typeof import('mermaid').default | null = null\n\nasync function getMermaid(): Promise<typeof import('mermaid').default> {\n if (!mermaidModule) {\n mermaidModule = (await import('mermaid')).default\n }\n if (!mermaidInitialized) {\n try {\n mermaidModule.initialize({\n startOnLoad: false,\n flowchart: { useMaxWidth: true, curve: 'basis' },\n securityLevel: 'loose', // Required for click interactivity\n })\n mermaidInitialized = true\n } catch (error) {\n console.error('Error initializing Mermaid:', error)\n }\n }\n return mermaidModule\n}\n\nfunction ThreadVisualizerView({\n threads,\n switchToThread,\n showHeader = true,\n showDownloadButton = true,\n className,\n labels,\n}: ThreadVisualizerProps) {\n const svgContainerRef = useRef<HTMLDivElement>(null)\n const [isRendering, setIsRendering] = useState(true)\n const [renderError, setRenderError] = useState<string | null>(null)\n const [svgContent, setSvgContent] = useState<string>('')\n const renderingRef = useRef(false)\n\n const mermaidDiagram = useMemo(() => buildThreadDiagram(threads), [threads])\n\n const handleNodeClick = useCallback(\n (nodeId: string) => {\n try {\n const threadId = threadForNode(threads, nodeId)\n if (threadId) switchToThread(threadId)\n } catch (error) {\n console.error('Error in thread navigation callback:', error)\n }\n },\n [threads, switchToThread]\n )\n\n const saveSvgAsFile = useCallback(() => {\n if (!svgContent) return\n try {\n const blob = new Blob([svgContent], { type: 'image/svg+xml' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = `thread-visualizer-${new Date().toISOString().split('T')[0]}.svg`\n document.body.appendChild(link)\n link.click()\n document.body.removeChild(link)\n URL.revokeObjectURL(url)\n } catch (error) {\n console.error('Failed to save SVG:', error)\n }\n }, [svgContent])\n\n // Render the diagram once per change of threads (never concurrently).\n useEffect(() => {\n if (renderingRef.current || !mermaidDiagram) return\n\n const renderDiagram = async () => {\n renderingRef.current = true\n setIsRendering(true)\n setRenderError(null)\n setSvgContent('')\n try {\n const renderDiagramId = `mermaid-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n const mermaid = await getMermaid()\n const { svg } = await mermaid.render(renderDiagramId, mermaidDiagram)\n setSvgContent(svg)\n setIsRendering(false)\n } catch (error) {\n console.error('Error rendering mermaid diagram:', error)\n setRenderError(error instanceof Error ? error.message : String(error))\n setIsRendering(false)\n setSvgContent('')\n } finally {\n renderingRef.current = false\n }\n }\n\n renderDiagram()\n }, [mermaidDiagram])\n\n // Style the SVG and make its nodes clickable once rendered.\n useEffect(() => {\n if (!svgContent || !svgContainerRef.current) return\n const svgElement = svgContainerRef.current.querySelector('svg')\n if (!svgElement) return\n svgElement.style.maxWidth = '100%'\n svgElement.style.height = 'auto'\n svgElement.style.minHeight = '400px'\n\n // Force consistent font styling.\n const textElements = svgElement.getElementsByTagName('text')\n for (let i = 0; i < textElements.length; i++) {\n textElements[i].setAttribute('font-family', 'system-ui, sans-serif')\n textElements[i].setAttribute('font-size', '12px')\n textElements[i].style.fontSize = '12px !important'\n }\n\n svgElement.querySelectorAll('g.node').forEach((element) => {\n const nodeId = element.getAttribute('id')\n if (!nodeId) return\n ;(element as SVGElement).style.cursor = 'pointer'\n element.addEventListener('click', () => handleNodeClick(nodeId))\n })\n }, [svgContent, handleNodeClick])\n\n const l = { ...DEFAULT_THREAD_VISUALIZER_LABELS, ...labels }\n const hint = showHeader ? (threads.length > 5 ? l.hintMany : l.hint) : undefined\n\n return (\n <ThreadMap\n hint={hint}\n onSave={showDownloadButton && svgContent ? saveSvgAsFile : undefined}\n className={className}\n >\n {/* Loading while rendering, with no content yet, or with no threads data. */}\n {(isRendering || !svgContent || !mermaidDiagram) && !renderError && <ThreadMapLoading />}\n {renderError && <ThreadMapError message={renderError} />}\n {svgContent && !renderError && (\n <ThreadMapDiagram svg={svgContent} diagramRef={svgContainerRef} />\n )}\n </ThreadMap>\n )\n}\n\nexport const ThreadVisualizer = memo(ThreadVisualizerView)\n","import { useCallback, useState, type ClipboardEvent } from 'react'\n\nconst LONG_PASTE_CHARACTER_LIMIT = 1_000\nconst LONG_PASTE_LINE_LIMIT = 12\n\n/** True when the text is big enough that a composer should fold it behind a \"Pasted text\" chip. */\nexport function isLongPastedText(value: string): boolean {\n return (\n value.length >= LONG_PASTE_CHARACTER_LIMIT || value.split('\\n').length >= LONG_PASTE_LINE_LIMIT\n )\n}\n\nexport interface UseLongPaste {\n /** The draft is long AND the user pasted it (typing a long text never folds it). */\n isCollapsed: boolean\n /** Wire to the textarea `onPaste`. Folds when the post-paste draft is long. */\n onPaste: (event: ClipboardEvent<HTMLTextAreaElement>, currentValue: string) => void\n /** Wire to the textarea `onChange`: unfolds once the draft is short again. */\n onValueChange: (nextValue: string) => void\n /** Unfold (the \"Expand\" chip). */\n expand: () => void\n}\n\n/** Headless long-paste folding for a composer draft. */\nexport function useLongPaste(value: string): UseLongPaste {\n const [collapsed, setCollapsed] = useState(false)\n\n const onPaste = useCallback(\n (event: ClipboardEvent<HTMLTextAreaElement>, currentValue: string) => {\n const pasted = event.clipboardData.getData('text')\n const el = event.currentTarget\n const next =\n currentValue.slice(0, el.selectionStart) + pasted + currentValue.slice(el.selectionEnd)\n if (isLongPastedText(next)) setCollapsed(true)\n },\n []\n )\n\n const onValueChange = useCallback((nextValue: string) => {\n if (!isLongPastedText(nextValue)) setCollapsed(false)\n }, [])\n\n const expand = useCallback(() => setCollapsed(false), [])\n\n return { isCollapsed: collapsed && isLongPastedText(value), onPaste, onValueChange, expand }\n}\n","/**\n * PendingAnswerBar\n *\n * When the agent pauses to ask the user a question (ask_user / Human-in-the-loop),\n * this card docks directly above the message composer. It shows the FULL question\n * and lays the answer options out vertically — one full-width row each — so every\n * label is readable in full, however long. A countdown sits in the header.\n *\n * There is intentionally NO text input here: a free-text answer is typed in the\n * real composer below, which interjects the answer while a question is\n * pending. One input, where the user's cursor already is.\n */\n\nimport { useEffect, useRef, useState } from 'react'\nimport { MessageCircleQuestion, Clock, Pause, Play } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\n\n/** Every fixed string of the pending-answer bar. */\nexport interface PendingAnswerBarLabels {\n heading: string\n optionsLabel: string\n hint: string\n /** Pause button while the countdown runs. */\n pauseTimer: string\n /** Pause button while it is paused. */\n resumeTimer: string\n /** Name of the countdown, spoken with its value. */\n timeLeft: string\n /** Announced at 30 and 10 seconds left. */\n secondsWarning: (seconds: number) => string\n}\n\nexport const DEFAULT_PENDING_ANSWER_BAR_LABELS: PendingAnswerBarLabels = {\n heading: 'ARBI is asking',\n optionsLabel: 'Answer options',\n hint: 'Pick an option, or type your own answer below.',\n pauseTimer: 'Pause the countdown',\n resumeTimer: 'Resume the countdown',\n timeLeft: 'Time left to answer',\n secondsWarning: (seconds) => `${seconds} seconds left to answer`,\n}\n\nexport interface PendingAnswerBarProps {\n question: string\n options: string[]\n timeoutSeconds: number\n /** Called with the chosen option, the typed answer, or 'timeout' when it expires. */\n onPick: (answer: string) => void\n labels?: Partial<PendingAnswerBarLabels>\n}\n\nexport function PendingAnswerBar({\n question,\n options,\n timeoutSeconds,\n onPick,\n labels,\n}: PendingAnswerBarProps) {\n const l = { ...DEFAULT_PENDING_ANSWER_BAR_LABELS, ...labels }\n const [secondsLeft, setSecondsLeft] = useState(timeoutSeconds)\n // Once we've answered (or timed out) don't fire again as the bar unmounts.\n const firedRef = useRef(false)\n // WCAG 2.2.1: the countdown is pausable, and holds still while focus is inside the bar so a\n // keyboard or screen-reader user reading the options is never timed out under their hands.\n const [isPausedByUser, setIsPausedByUser] = useState(false)\n const [hasFocusWithin, setHasFocusWithin] = useState(false)\n const isPaused = isPausedByUser || hasFocusWithin\n // Spoken once the bar is mounted (a live region only announces changes made after it exists).\n const [announcement, setAnnouncement] = useState('')\n\n // A bare \"Other\" option is redundant — the composer is the free-text path.\n const choices = options.filter((o) => o.trim().toLowerCase() !== 'other')\n\n useEffect(() => {\n setAnnouncement(`${l.heading}: ${question}`)\n // Once per question: the bar is keyed by it in the host.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n useEffect(() => {\n if (secondsLeft <= 0 || isPaused) return\n const t = setInterval(() => setSecondsLeft((s) => (s <= 1 ? 0 : s - 1)), 1000)\n return () => clearInterval(t)\n }, [secondsLeft, isPaused])\n\n useEffect(() => {\n if (secondsLeft === 30 || secondsLeft === 10) setAnnouncement(l.secondsWarning(secondsLeft))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [secondsLeft])\n\n useEffect(() => {\n if (secondsLeft === 0 && !firedRef.current) {\n firedRef.current = true\n onPick('timeout')\n }\n }, [secondsLeft, onPick])\n\n const pick = (answer: string) => {\n if (firedRef.current) return\n firedRef.current = true\n onPick(answer)\n }\n\n const fmt = (s: number): string => {\n const m = Math.floor(s / 60)\n const r = s % 60\n return m > 0 ? `${m}:${r.toString().padStart(2, '0')}` : `${r}s`\n }\n const low = secondsLeft <= 30\n\n return (\n <div\n role=\"group\"\n aria-label={l.heading}\n className=\"mb-2 rounded-lg border border-theme-cyan/30 bg-theme-cyan/[0.05] px-3 py-2.5\"\n data-slot=\"pending-answer-bar\"\n data-testid=\"pending-answer-bar\"\n onFocus={() => setHasFocusWithin(true)}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n setHasFocusWithin(false)\n }\n }}\n >\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"sr-only\"\n data-testid=\"pending-answer-status\"\n >\n {announcement}\n </div>\n {/* Header: label + countdown */}\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <MessageCircleQuestion aria-hidden=\"true\" className=\"h-4 w-4 shrink-0 text-theme-cyan\" />\n <span className=\"text-xs font-medium uppercase tracking-wide text-theme-cyan\">\n {l.heading}\n </span>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <span\n role=\"timer\"\n aria-label={l.timeLeft}\n className={cn(\n 'flex items-center gap-1 text-xs tabular-nums',\n low ? 'text-red-text' : 'text-muted-foreground'\n )}\n data-testid=\"pending-answer-timer\"\n >\n <Clock aria-hidden=\"true\" className=\"h-3 w-3\" />\n {fmt(secondsLeft)}\n </span>\n <button\n type=\"button\"\n onClick={() => setIsPausedByUser((p) => !p)}\n aria-pressed={isPausedByUser}\n aria-label={l.pauseTimer}\n title={isPausedByUser ? l.resumeTimer : l.pauseTimer}\n className=\"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-11\"\n data-testid=\"pending-answer-pause\"\n >\n {isPausedByUser ? (\n <Play aria-hidden=\"true\" className=\"h-3 w-3\" />\n ) : (\n <Pause aria-hidden=\"true\" className=\"h-3 w-3\" />\n )}\n </button>\n </div>\n </div>\n\n {/* The full question — wraps freely, never truncated */}\n <p className=\"mt-1.5 whitespace-pre-line text-sm text-foreground\">{question}</p>\n\n {/* Options, stacked vertically — each row reveals its full label */}\n {choices.length > 0 && (\n <div className=\"mt-2.5 flex flex-col gap-1.5\" role=\"group\" aria-label={l.optionsLabel}>\n {choices.map((option, i) => (\n <button\n key={`${i}-${option}`}\n type=\"button\"\n onClick={() => pick(option)}\n className={cn(\n 'flex w-full items-center gap-2 rounded-md border border-border bg-background',\n 'px-3 py-2 text-left text-sm text-foreground transition-colors',\n 'hover:border-theme-cyan/50 hover:bg-theme-cyan/10',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11'\n )}\n data-testid={`pending-answer-option-${option}`}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-theme-cyan/40 text-xs font-medium text-theme-cyan\"\n >\n {i + 1}\n </span>\n <span className=\"min-w-0 flex-1\">{option}</span>\n </button>\n ))}\n </div>\n )}\n\n {/* Free-text affordance — points at the composer below */}\n <p className=\"mt-2 text-xs text-muted-foreground\">{l.hint}</p>\n </div>\n )\n}\n","import { useEffect, useRef, type KeyboardEvent } from 'react'\nimport { hasMessageBody } from '@arbidocs/react/shell'\n\n/** Seed a shared draft once, preserve edits, and restore the default after a send. */\nexport function useRecipientDraft({\n value,\n onValueChange,\n contextKey,\n defaultLabel,\n}: {\n value: string\n onValueChange: (value: string) => void\n contextKey: string | null | undefined\n defaultLabel: string | null\n}) {\n const prefix = defaultLabel ? `@${defaultLabel} ` : ''\n const context = `${contextKey ?? ''}:${defaultLabel ?? ''}`\n const previousContext = useRef<string | null>(null)\n const resetAfterSend = useRef(false)\n useEffect(() => {\n const changed = previousContext.current !== context\n const previousLabel = previousContext.current?.split(':').pop()\n previousContext.current = context\n if (changed || (resetAfterSend.current && !value)) {\n resetAfterSend.current = false\n if (!value && prefix) onValueChange(prefix)\n // A visibility change removes only the untouched default, never someone's text.\n else if (changed && !prefix && previousLabel && value.trim() === `@${previousLabel}`)\n onValueChange('')\n }\n }, [context, prefix, value, onValueChange])\n\n return {\n hasBody: hasMessageBody(value, defaultLabel ?? 'ARBI'),\n onSend: () => {\n resetAfterSend.current = true\n },\n handleKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => {\n const textarea = event.currentTarget\n if (\n prefix &&\n value.startsWith(prefix) &&\n event.key === 'Backspace' &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n textarea.selectionStart === textarea.selectionEnd &&\n textarea.selectionStart === prefix.length\n ) {\n event.preventDefault()\n onValueChange(value.slice(prefix.length))\n requestAnimationFrame(() => textarea.setSelectionRange(0, 0))\n return true\n }\n return false\n },\n }\n}\n","/**\n * Message Copy Utilities\n *\n * Handles copying message content with formatting, including:\n * - Citation deep links in HTML with proper footnotes\n * - Message link at top\n * - Plain text with URL on first line\n */\n\nimport type { Chunk, ToolResponses } from '@arbidocs/react'\nimport { buildDeepLinkUrl } from '../lib/deep-link'\nimport { markdownToPlainTextBlocks } from '@arbidocs/react/ui'\n\ninterface CopyMessageOptions {\n messageRef: React.RefObject<HTMLDivElement | null>\n responseContent: string\n messageContent: string\n isUser: boolean\n selectedWorkspaceId: string | null\n /** The deployment the links point at (the environment's `runtimeConfig.deploymentDomain`). */\n deploymentDomain?: string | null\n conversationExtId: string | undefined\n messageExtId: string | undefined\n activeCitations: Record<string, string[]> | null\n citationData: ToolResponses\n /** The preceding user message content (for assistant messages) */\n precedingUserMessage?: string\n}\n\ninterface PassageInfo {\n deepLink: string\n docTitle: string\n pageNumber?: number\n passageText?: string\n}\n\ninterface FootnoteData {\n citationNum: string\n passages: PassageInfo[]\n}\n\n/**\n * Build a lookup map from chunk_ext_id to chunk metadata\n */\nfunction buildChunkLookup(citationData: ToolResponses): Map<string, Chunk> {\n const lookup = new Map<string, Chunk>()\n Object.values(citationData).forEach((chunks) => {\n if (Array.isArray(chunks)) {\n ;(chunks as Chunk[]).forEach((chunk) => {\n if (chunk.metadata?.chunk_ext_id) {\n lookup.set(chunk.metadata.chunk_ext_id, chunk)\n }\n })\n }\n })\n return lookup\n}\n\n/**\n * Get all passage info for a citation number\n */\nfunction getPassagesForCitation(\n citationNum: string,\n selectedWorkspaceId: string,\n activeCitations: Record<string, string[]>,\n chunkLookup: Map<string, Chunk>,\n deploymentDomain: string | null | undefined\n): PassageInfo[] {\n const chunkIds = activeCitations[citationNum]\n if (!chunkIds?.length) return []\n\n const passages: PassageInfo[] = []\n\n for (const chunkId of chunkIds) {\n const chunk = chunkLookup.get(chunkId)\n if (!chunk?.metadata?.doc_ext_id || !chunk?.metadata?.chunk_ext_id) continue\n\n passages.push({\n deepLink: buildDeepLinkUrl(\n {\n workspaceId: selectedWorkspaceId,\n documentId: chunk.metadata.doc_ext_id,\n chunkId: chunk.metadata.chunk_ext_id,\n },\n deploymentDomain\n ),\n docTitle: chunk.metadata.doc_title || 'Document',\n pageNumber: chunk.metadata.page_number,\n passageText: chunk.content ? truncateText(chunk.content, 150) : undefined,\n })\n }\n\n return passages\n}\n\n/**\n * Truncate text to a maximum length with ellipsis\n */\nfunction truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text\n return text.slice(0, maxLength).trim() + '...'\n}\n\n/**\n * Generate HTML for a single footnote entry\n */\nfunction generateFootnoteHtml(footnote: FootnoteData): string {\n const { citationNum, passages } = footnote\n\n if (passages.length === 0) {\n return `<p id=\"fn-${citationNum}\" style=\"margin: 4px 0; font-size: 12px;\"><sup>${citationNum}</sup> [No source available]</p>`\n }\n\n let html = `<p id=\"fn-${citationNum}\" style=\"margin: 8px 0; font-size: 13px;\"><sup style=\"font-weight: bold;\">${citationNum}</sup> `\n\n // Each passage gets its own entry with doc title, page, and link following\n const passageEntries = passages.map((p) => {\n const pageStr = p.pageNumber ? `, p.${p.pageNumber}` : ''\n return `${p.docTitle}${pageStr} <a href=\"${p.deepLink}\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: #2563eb; text-decoration: underline;\">[view]</a>`\n })\n\n html += passageEntries.join('; ')\n html += '</p>'\n\n return html\n}\n\n/**\n * Generate the complete footnotes section HTML\n */\nfunction generateFootnotesSection(footnotes: FootnoteData[]): string {\n if (footnotes.length === 0) return ''\n\n let html = '<hr style=\"margin: 16px 0; border: none; border-top: 1px solid #e5e7eb;\">'\n html += '<div style=\"font-size: 12px; color: #6b7280;\">'\n html += '<p style=\"margin-bottom: 8px; font-weight: 600;\">References:</p>'\n\n for (const footnote of footnotes) {\n html += generateFootnoteHtml(footnote)\n }\n\n html += '</div>'\n return html\n}\n\n/**\n * Generate plain text footnotes section\n */\nfunction generateFootnotesSectionPlainText(footnotes: FootnoteData[]): string {\n if (footnotes.length === 0) return ''\n\n let text = '\\nReferences:\\n'\n\n for (const footnote of footnotes) {\n const { citationNum, passages } = footnote\n if (passages.length === 0) {\n text += `[${citationNum}] [No source available]\\n`\n continue\n }\n\n const passageEntries = passages.map((p) => {\n const pageStr = p.pageNumber ? `, p.${p.pageNumber}` : ''\n return `${p.docTitle}${pageStr} - ${p.deepLink}`\n })\n\n text += `[${citationNum}] ${passageEntries.join('; ')}\\n`\n }\n\n return text\n}\n\n/**\n * Replace markdown citation links with bracketed references\n * Converts [text](#cite-N) to text[N]\n *\n * The link text may itself contain one level of brackets (e.g. \"co-arbitrator [9] under…\"),\n * which CommonMark allows; a plain [^\\]] match would stop at the inner ] and leak the link.\n */\nfunction replaceCitationLinksInMarkdown(text: string): string {\n return text.replace(/\\[((?:[^[\\]]|\\[[^[\\]]*\\])+)\\]\\(#cite-(\\d+)\\)/g, '$1[$2]')\n}\n\n/**\n * Process HTML to add citation links and collect footnote data\n */\nfunction processCitationsInHtml(\n html: string,\n selectedWorkspaceId: string,\n activeCitations: Record<string, string[]>,\n citationData: ToolResponses,\n deploymentDomain: string | null | undefined\n): { html: string; footnotes: FootnoteData[] } {\n const chunkLookup = buildChunkLookup(citationData)\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = html\n\n const footnotes: FootnoteData[] = []\n const processedCitations = new Set<string>()\n\n // Find all citation spans and process them\n tempDiv.querySelectorAll('[data-testid^=\"citation-link-\"]').forEach((span) => {\n const citationNum = span.getAttribute('data-testid')?.replace('citation-link-', '')\n if (!citationNum) return\n\n // Get all passages for this citation\n const passages = getPassagesForCitation(\n citationNum,\n selectedWorkspaceId,\n activeCitations,\n chunkLookup,\n deploymentDomain\n )\n\n // Collect footnote data (only once per citation number)\n if (!processedCitations.has(citationNum)) {\n processedCitations.add(citationNum)\n footnotes.push({ citationNum, passages })\n }\n\n // Style the superscript with brackets (footnotes section has the actual links)\n const supElement = span.querySelector('sup')\n if (supElement) {\n supElement.textContent = `[${citationNum}]`\n supElement.style.cssText = 'color: #2563eb;'\n }\n })\n\n // Sort footnotes by citation number\n footnotes.sort((a, b) => parseInt(a.citationNum) - parseInt(b.citationNum))\n\n return { html: tempDiv.innerHTML, footnotes }\n}\n\n/**\n * Build message link URL and HTML\n */\nexport function buildMessageLink(\n selectedWorkspaceId: string | null,\n conversationExtId: string | undefined,\n messageExtId: string | undefined,\n deploymentDomain?: string | null\n): { url: string; html: string } | null {\n if (!selectedWorkspaceId || !conversationExtId || !messageExtId) return null\n\n const fullUrl = buildDeepLinkUrl(\n {\n workspaceId: selectedWorkspaceId,\n conversationId: conversationExtId,\n messageId: messageExtId,\n },\n deploymentDomain\n )\n return {\n url: fullUrl,\n html: `<p style=\"margin-bottom: 12px;\"><a href=\"${fullUrl}\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: #2563eb; text-decoration: underline;\">ARBI Docs message link</a></p>`,\n }\n}\n\nconst NO_ANSWER_TEXT = '(No answer text was written.)'\n\n/**\n * Build clipboard content (both HTML and plain text)\n */\nfunction buildClipboardContent(\n htmlContent: string,\n plainTextContent: string,\n messageLinkUrl: string,\n messageLinkHtml: string,\n footnotesHtml: string,\n footnotes: FootnoteData[],\n precedingUserMessage?: string,\n isUser?: boolean\n): { html: string; plainText: string } {\n // An answer stopped before it wrote any text has an empty body. Say so, rather than\n // leave a bare \"Assistant:\" heading that looks like the copy lost the answer.\n const isEmptyAnswer = !isUser && !plainTextContent.trim()\n const bodyHtml = isEmptyAnswer ? `<p><em>${NO_ANSWER_TEXT}</em></p>` : htmlContent\n // Assistant answers are markdown: strip the markup so the pasted text has no stray ** or #\n const body = replaceCitationLinksInMarkdown(plainTextContent)\n const bodyText = isEmptyAnswer ? NO_ANSWER_TEXT : isUser ? body : markdownToPlainTextBlocks(body)\n\n // HTML: message link at top, content, then footnotes at bottom\n let html = ''\n if (messageLinkHtml) html += messageLinkHtml\n\n // For assistant messages with a preceding user message, format as User:/Assistant: sections\n if (!isUser && precedingUserMessage) {\n html += `<p><strong>User:</strong></p>${escapeHtml(precedingUserMessage)}<br><br>`\n html += `<p><strong>Assistant:</strong></p>${bodyHtml}`\n } else {\n html += bodyHtml\n }\n\n if (footnotesHtml) html += footnotesHtml\n\n // Plain text: URL on first line, content with [N] refs, then footnotes\n let plainText = messageLinkUrl ? `${messageLinkUrl}\\n\\n` : ''\n\n // For assistant messages with a preceding user message, format as User:/Assistant: sections\n if (!isUser && precedingUserMessage) {\n plainText += `User:\\n${precedingUserMessage}\\n\\nAssistant:\\n`\n }\n\n plainText += bodyText\n plainText += generateFootnotesSectionPlainText(footnotes)\n\n return { html, plainText }\n}\n\n/**\n * Escape HTML special characters\n */\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#039;')\n .replace(/\\n/g, '<br>')\n}\n\n/**\n * Find the message content div — the rendered answer.\n *\n * It used to have to step over a `thinking-section` panel that could precede it\n * in the card. That panel is gone, so the lookup is just the first\n * `.markdown-content` — exactly the branch this already took for every message\n * that had no reasoning, which was almost all of them.\n */\nfunction findMessageContentDiv(messageRef: HTMLDivElement): Element | null {\n return messageRef.querySelector('.markdown-content')\n}\n\n/**\n * Copy message content to clipboard with formatting\n */\nexport async function copyMessageToClipboard(options: CopyMessageOptions): Promise<boolean> {\n const {\n messageRef,\n responseContent,\n messageContent,\n isUser,\n selectedWorkspaceId,\n conversationExtId,\n messageExtId,\n activeCitations,\n citationData,\n deploymentDomain,\n } = options\n\n if (!messageRef.current) return false\n\n const plainTextContent = isUser ? messageContent : responseContent\n const messageLink = buildMessageLink(\n selectedWorkspaceId,\n conversationExtId,\n messageExtId,\n deploymentDomain\n )\n const messageLinkUrl = messageLink?.url || ''\n const messageLinkHtml = messageLink?.html || ''\n\n const targetContentDiv = findMessageContentDiv(messageRef.current)\n\n if (!targetContentDiv) {\n const { plainText } = buildClipboardContent(\n '',\n plainTextContent,\n messageLinkUrl,\n '',\n '',\n [],\n undefined,\n isUser\n )\n await navigator.clipboard.writeText(plainText)\n return true\n }\n\n // Process citations and generate footnotes\n let htmlContent = targetContentDiv.innerHTML\n let footnotesHtml = ''\n let footnotes: FootnoteData[] = []\n\n if (selectedWorkspaceId && activeCitations) {\n const result = processCitationsInHtml(\n htmlContent,\n selectedWorkspaceId,\n activeCitations,\n citationData,\n deploymentDomain\n )\n htmlContent = result.html\n footnotes = result.footnotes\n footnotesHtml = generateFootnotesSection(footnotes)\n }\n\n const { html, plainText } = buildClipboardContent(\n htmlContent,\n plainTextContent,\n messageLinkUrl,\n messageLinkHtml,\n footnotesHtml,\n footnotes,\n options.precedingUserMessage,\n isUser\n )\n\n const clipboardItem = new ClipboardItem({\n 'text/html': new Blob([html], { type: 'text/html' }),\n 'text/plain': new Blob([plainText], { type: 'text/plain' }),\n })\n\n await navigator.clipboard.write([clipboardItem])\n return true\n}\n","/**\n * Turn a rendered answer table (an HTML <table>) into a CSV download.\n *\n * Works from the DOM rather than the markdown source so the CSV holds exactly\n * what the reader sees: cited text stays, the citation's superscript number\n * does not.\n */\nimport { downloadBlob } from '@arbidocs/react/document-tools'\n\n/** The superscript number a citation renders after its cited words. */\nconst CITATION_MARKER_SELECTOR = '[data-mark-kind=\"citation\"] > sup, .cited-text > sup'\nconst HEADING_SELECTOR = 'h1, h2, h3, h4, h5, h6'\nconst PARAGRAPH_SELECTOR = 'p'\nconst MAX_SLUG_LENGTH = 80\n/** Where the block search stops: the answer's own markdown root. */\nconst ANSWER_ROOT_SELECTOR = '.markdown-content, [data-testid=\"citation-renderer\"]'\n\nconst LINE_BREAK = '\\u0000'\n\nfunction cellText(cell: Element): string {\n const clone = cell.cloneNode(true) as Element\n clone.querySelectorAll(CITATION_MARKER_SELECTOR).forEach((marker) => marker.remove())\n // A sentinel, not '\\n', so source newlines (plain whitespace) still collapse.\n clone.querySelectorAll('br').forEach((br) => br.replaceWith(LINE_BREAK))\n return (clone.textContent ?? '')\n .split(LINE_BREAK)\n .map((line) => line.replace(/\\s+/g, ' ').trim())\n .join('\\n')\n .trim()\n}\n\n/** Visible cell text of every row (header included), citation markers removed. */\nexport function extractTableRows(table: HTMLTableElement): string[][] {\n return Array.from(table.rows).map((row) => Array.from(row.cells).map(cellText))\n}\n\n/**\n * RFC 4180 CSV (CRLF rows; fields with commas, quotes or line breaks are quoted\n * and inner quotes doubled). Prefixed with a UTF-8 BOM so Excel reads accents\n * and currency symbols correctly.\n */\nexport async function rowsToCsv(rows: string[][]): Promise<string> {\n const Papa = (await import('papaparse')).default\n return '\\ufeff' + Papa.unparse(rows, { newline: '\\r\\n' })\n}\n\n/** The closest element matching `selector` above `el` inside the answer, or null. */\nfunction findPrecedingBlock(el: Element, selector: string): Element | null {\n let node: Element | null = el\n while (node && !node.matches(ANSWER_ROOT_SELECTOR)) {\n let sibling = node.previousElementSibling\n while (sibling) {\n if (sibling.matches(selector)) return sibling\n const nested = sibling.querySelectorAll(selector)\n if (nested.length > 0) return nested[nested.length - 1]\n sibling = sibling.previousElementSibling\n }\n node = node.parentElement\n }\n return null\n}\n\n/**\n * `<nearest-heading>.csv`, else `<introducing-sentence>.csv` (the paragraph just\n * above the table), slugified. `table.csv` when neither exists.\n */\nexport function csvFilenameForTable(el: Element): string {\n const source =\n findPrecedingBlock(el, HEADING_SELECTOR) ?? findPrecedingBlock(el, PARAGRAPH_SELECTOR)\n const slug = (source ? cellText(source) : '')\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[̀-ͯ]/g, '')\n .replace(/['’]/g, '')\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n // Cap the length at a word boundary, so a long sentence never ends mid-word.\n const capped =\n slug.length > MAX_SLUG_LENGTH ? slug.slice(0, MAX_SLUG_LENGTH).replace(/-[^-]*$/, '') : slug\n return `${capped || 'table'}.csv`\n}\n\n/**\n * Download `table` as CSV, named after the content above `anchor` (see `csvFilenameForTable`).\n * Resolves to the file name that was downloaded.\n */\nexport async function downloadTableAsCsv(\n table: HTMLTableElement,\n anchor: Element = table\n): Promise<string> {\n const csv = await rowsToCsv(extractTableRows(table))\n const filename = csvFilenameForTable(anchor)\n downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8' }), filename)\n return filename\n}\n","/**\n * Recognising workspace-document links inside rendered markdown hrefs.\n */\n\n/**\n * A workspace document id in an href — `doc-` plus EXACTLY eight alphanumerics,\n * the format every model in the backend pins (`^doc-[a-zA-Z0-9]{8}$`).\n *\n * `{8,}` would swallow an unrelated external URL that merely contains a `doc-…`\n * segment (`https://example.com/doc-download1234`) and route it to a viewer that\n * has nothing to show.\n */\nexport const DOC_ID_IN_HREF = /\\b(doc-[a-zA-Z0-9]{8})\\b/\n\n/**\n * The document id an href points at, or null if it does not address one of OURS.\n *\n * Absolute URLs qualify only for this origin or the deployment (`deploymentDomain`, the blocks\n * environment's `runtimeConfig.deploymentDomain`).\n * Development UI and API hosts can differ. Unrelated origins remain external. The\n * observed shape is the bare id (`[title](doc-35ce54e8)`), which is relative.\n */\nexport function workspaceDocIdFromHref(\n href: string | undefined,\n deploymentDomain?: string | null\n): string | null {\n if (!href) return null\n const match = DOC_ID_IN_HREF.exec(href)\n if (!match) return null\n if (/^[a-z][a-z0-9+.-]*:/i.test(href)) {\n try {\n const target = new URL(href)\n const isDeployment =\n !!deploymentDomain && target.protocol === 'https:' && target.hostname === deploymentDomain\n if (target.origin !== window.location.origin && !isDeployment) return null\n } catch {\n return null\n }\n }\n return match[1]\n}\n","// A document (doc-…) or an email of the person's own mailbox (eml-…): both render as entity pills.\nconst DOC_ID_PATTERN = /\\b((?:doc|eml)-[a-zA-Z0-9]+)\\b/\n\n/**\n * Per-text-node transform cache.\n *\n * Keyed by the raw text-node value. For the vast majority of text nodes — those\n * without any `doc-…` substring — we memoize the \"no match\" decision so a repeat\n * render of an unchanged message skips the regex entirely. When a node does\n * contain doc IDs we also cache the pre-built replacement children, so repeated\n * renders of a finished message don't re-scan or re-allocate.\n *\n * Uses a bounded LRU-ish Map — oldest entries are evicted when we exceed the\n * cap. This is a module singleton; across the app the hottest entries (tool\n * responses, common answer fragments) end up cached permanently for the session.\n */\nconst MAX_CACHE_ENTRIES = 512\nconst textCache = new Map<string, ReadonlyArray<unknown> | null>()\n\nfunction cacheGet(key: string): ReadonlyArray<unknown> | null | undefined {\n if (!textCache.has(key)) return undefined\n const value = textCache.get(key)\n // Touch to move it to the end of the insertion order (LRU).\n textCache.delete(key)\n textCache.set(key, value as ReadonlyArray<unknown> | null)\n return value\n}\n\nfunction cacheSet(key: string, value: ReadonlyArray<unknown> | null): void {\n if (textCache.size >= MAX_CACHE_ENTRIES) {\n const oldest = textCache.keys().next().value\n if (oldest !== undefined) textCache.delete(oldest)\n }\n textCache.set(key, value)\n}\n\n/**\n * Test-only helper to reset the memoization cache.\n * @internal\n */\nexport function __resetDocEntityPillCache(): void {\n textCache.clear()\n}\n\nfunction buildReplacementNodes(text: string): ReadonlyArray<unknown> | null {\n if (!DOC_ID_PATTERN.test(text)) return null\n\n const globalPattern = /\\b((?:doc|eml)-[a-zA-Z0-9]+)\\b/g\n const newNodes: unknown[] = []\n let lastIndex = 0\n let m: RegExpExecArray | null\n\n while ((m = globalPattern.exec(text)) !== null) {\n if (m.index > lastIndex) {\n newNodes.push({ type: 'text', value: text.slice(lastIndex, m.index) })\n }\n newNodes.push({\n type: 'element',\n tagName: 'span',\n properties: m[1].startsWith('eml-') ? { dataMailId: m[1] } : { dataDocId: m[1] },\n children: [],\n })\n lastIndex = m.index + m[0].length\n }\n\n if (lastIndex < text.length) {\n newNodes.push({ type: 'text', value: text.slice(lastIndex) })\n }\n\n return newNodes\n}\n\n/**\n * Rehype plugin that detects doc external IDs in text nodes and converts them to\n * <span data-doc-id=\"...\"> elements for rendering as entity pills in MarkdownRenderer.\n *\n * Skips text inside code/pre elements so IDs in code blocks are left as plain text.\n *\n * Results are memoized per text-node value — stable messages re-use the cached\n * decision instead of re-running the regex on every render.\n */\n/** A node of the HTML tree (hast), as far as the transform reads it. */\ninterface TreeNode {\n type: string\n tagName?: string\n value?: string\n children?: unknown[]\n}\n\n/** Replace the doc/mail ids in the text nodes under `parent` (code and pre are left alone). */\nfunction transformChildren(parent: TreeNode): void {\n const children = parent.children\n if (!children) return\n const inCode = parent.tagName === 'code' || parent.tagName === 'pre'\n for (let index = 0; index < children.length; index++) {\n const node = children[index] as TreeNode\n if (node.type !== 'text') {\n transformChildren(node)\n continue\n }\n if (inCode) continue\n const text = node.value ?? ''\n let replacement = cacheGet(text)\n if (replacement === undefined) {\n replacement = buildReplacementNodes(text)\n cacheSet(text, replacement)\n }\n if (replacement === null) continue\n // Clone cached nodes so each tree gets its own object identity. AST transforms by other\n // plugins may otherwise mutate shared references.\n const cloned = replacement.map((n) =>\n typeof n === 'object' && n !== null ? { ...(n as object) } : n\n )\n children.splice(index, 1, ...cloned)\n index += cloned.length - 1\n }\n}\n\nexport function rehypeDocEntityPills() {\n return (tree: TreeNode) => {\n transformChildren(tree)\n }\n}\n","/**\n * Thin strip pinned to the bottom inner edge of the composer box that shows\n * how full the context window is. Fills left-to-right like a percent-full\n * meter (colored = used, white space = headroom left); the tooltip frames\n * it to the user as a plain countdown percentage, not raw token counts.\n * Must be rendered inside a `relative` ancestor sized to the composer box —\n * it positions itself relative to that box, not the page.\n */\n\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport {\n type ContextUsage,\n getContextRemainingPercent,\n getContextUsedPercent,\n} from '@arbidocs/sdk/browser'\n\nconst WARM_REMAINING_THRESHOLD_PERCENT = 50\n\nexport function ContextUsageBar({\n contextUsage,\n draftLength = 0,\n}: {\n contextUsage?: ContextUsage | null\n /** Length of the not-yet-sent draft text, so the bar reacts while typing. */\n draftLength?: number\n}) {\n if (!contextUsage || contextUsage.context_window <= 0) return null\n\n const usedPercent = getContextUsedPercent(contextUsage, draftLength)\n const remainingPercent = getContextRemainingPercent(contextUsage, draftLength)\n // £ spent is a past-turn cost, not future context headroom — that lives in\n // the assistant message's own steps expander instead (see AgentSteps).\n const isWarm = remainingPercent < WARM_REMAINING_THRESHOLD_PERCENT || contextUsage.truncated\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <div\n className=\"pointer-events-auto absolute inset-x-0 bottom-0 z-10 h-[2px] cursor-default overflow-hidden rounded-b-md bg-muted-foreground/20\"\n data-testid=\"context-usage-bar\"\n >\n <div\n className={cn(\n 'h-full transition-all duration-500 ease-out',\n isWarm ? 'bg-yellow-text' : 'bg-muted-foreground'\n )}\n style={{ width: `${usedPercent}%` }}\n data-testid=\"context-usage-bar-fill\"\n />\n </div>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-[240px] space-y-1 text-sm\">\n <div className=\"font-medium\">\n {Math.round(remainingPercent)}% remaining before auto-compaction\n </div>\n {isWarm && (\n <div className=\"text-yellow-text\">\n This conversation is getting long and will be autocompacted when this reaches 0%. Run\n /compact any time to reduce context length.\n </div>\n )}\n {contextUsage.truncated && (\n <div className=\"font-medium text-yellow-text\">Context was truncated</div>\n )}\n </TooltipContent>\n </Tooltip>\n )\n}\n","/**\n * Slash-menu data logic (build + filter the item list) for the `SlashMenu`.\n *\n * The SDK owns the slug grammar and filter ranking; this file is the\n * single React-side import site for slash-command primitives so\n * upstream changes propagate without touching the component.\n */\n\nimport { filterSkills } from '@arbidocs/sdk/browser'\nimport type { SlashItemKind, SlashMenuItem } from './SlashMenu'\n\nexport { parseSlashTokenInProgress as parseSlashToken } from '@arbidocs/sdk/browser'\n\n/**\n * Build the single menu list from the two sources that feed it: the\n * backend's built-in commands (``GET /v1/assistant/commands``) and the\n * user's skills (``GET /v1/assistant/skills``).\n *\n * Built-ins come first — they're shipped vocabulary the backend always\n * handles — and a built-in wins a name collision, because a skill named\n * ``compact`` could never actually be invoked: the dispatcher checks its\n * built-in branches before it ever reaches the skill loader, so listing the\n * shadowed skill would promise something the backend won't do. Same rule the\n * TUI applies in ``toSlashCommandsWithSkills``.\n */\nexport function buildSlashItems(\n commands: ReadonlyArray<SlashMenuItem>,\n skills: ReadonlyArray<SlashMenuItem>\n): SlashMenuItem[] {\n const taken = new Set(commands.map((c) => c.name))\n return [...commands, ...skills.filter((s) => !taken.has(s.name))]\n}\n\n/**\n * Filter+sort wrapper around the SDK's ``filterSkills`` that returns\n * exactly the shape the menu renders. Kept as a thin adapter so future\n * refactors (e.g. switching to a fuzzy matcher) can move upstream into\n * the SDK without touching the component.\n *\n * Each kind is ranked independently and the groups are re-concatenated in\n * commands-then-skills order, so the flat array the menu indexes into is\n * *already* grouped. The component slices it into sections without a second\n * sort, and keyboard navigation stays a plain index over one array.\n */\nexport function filterSlashItems(\n items: ReadonlyArray<SlashMenuItem>,\n query: string,\n pinned: ReadonlyArray<string> = []\n): SlashMenuItem[] {\n const ofKind = (kind: SlashItemKind) =>\n filterSkills(\n items.filter((i) => i.kind === kind),\n query,\n pinned\n )\n return [...ofKind('command'), ...ofKind('skill')]\n}\n","/**\n * Generated-document helpers. A generated document names the assistant message that made it\n * (`source_message_ext_id`) and that message's conversation (`conversation_ext_id`, null for\n * uploads). Every edit is a new version of the same document, and each version names the message\n * whose turn made it (and its conversation): none for a person's upload or save.\n */\n\nimport type { components } from '@arbidocs/client'\n\ntype Doc = components['schemas']['DocResponse']\n\ntype LinkedDoc = Pick<\n Doc,\n 'external_id' | 'source_message_ext_id' | 'conversation_ext_id' | 'created_at' | 'updated_at'\n> & {\n versions?: ReadonlyArray<\n Pick<Doc['versions'][number], 'source_message_ext_id' | 'conversation_ext_id'>\n >\n}\n\nconst newestFirst = (a: LinkedDoc, b: LinkedDoc): number =>\n (b.created_at ?? '').localeCompare(a.created_at ?? '')\n\n/**\n * The message that made a document's latest version a thread made (a person's later save does not\n * move it): the newest version naming a message, else the generating message.\n */\nexport function latestThreadVersionMessage(d: LinkedDoc): string | null {\n const named = (d.versions ?? []).filter((v) => v.source_message_ext_id)\n return named.at(-1)?.source_message_ext_id ?? d.source_message_ext_id ?? null\n}\n\n/** The threads a document was made or edited in. */\nfunction threadsOf(d: LinkedDoc): string[] {\n const ids = [d.conversation_ext_id, ...(d.versions ?? []).map((v) => v.conversation_ext_id)]\n return [...new Set(ids.filter((id): id is string => !!id))]\n}\n\n/**\n * Generated documents grouped by the conversations they were made or edited in, newest first.\n * Uploads nobody's thread touched are excluded.\n */\nexport function groupOutputsByConversation<T extends LinkedDoc>(\n docs: readonly T[]\n): Record<string, T[]> {\n const out: Record<string, T[]> = {}\n for (const d of docs) for (const id of threadsOf(d)) (out[id] ??= []).push(d)\n for (const list of Object.values(out)) list.sort(newestFirst)\n return out\n}\n\n/**\n * The document to show under an assistant message: the newest document whose latest thread-made\n * version this message made. A document edited by a later message shows under that later\n * message, so the earlier message no longer matches; a person's own save changes nothing.\n */\nexport function findMessageDocument<T extends LinkedDoc>(\n docs: readonly T[] | undefined,\n messageExtId: string | undefined\n): T | undefined {\n if (!docs || !messageExtId) return undefined\n const matches = docs.filter((d) => latestThreadVersionMessage(d) === messageExtId)\n return matches.sort(newestFirst)[0]\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/connection/ConnectionProvider.tsx"],"names":["login"],"mappings":";;;;;;AAwEA,IAAM,iBAAA,GAAoB,cAAsC,IAAI,CAAA;AAQpE,IAAM,wBAAA,GAA2B,wBAAA;AACjC,IAAM,mBAAmB,CAAC,KAAA,KAAkB,KAAA,CAAM,IAAA,GAAO,WAAA,EAAY;AAG9D,IAAM,mBAAA,GAAsB,CAAC,MAAA,EAAgB,OAAA,KAClD,CAAA,EAAG,wBAAwB,CAAA,CAAA,EAAI,MAAA,IAAU,MAAM,CAAA,CAAA,EAAI,gBAAA,CAAiB,OAAO,CAAC,CAAA,CAAA;AAG9E,IAAM,4BAA4B,C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S,aAAa;AAAA,GAC/D;AACF","file":"chunk-GA77ONJJ.js","sourcesContent":["/**\n * The demo/live connection layer for a host app. Holds auth + workspace\n * selection state and exposes it via {@link useConnection}, so every surface\n * works identically whether it's talking to a live ARBI backend or the seeded\n * demo workspace. Host-specific values (backend URL, demo identity, default\n * workspace/assistant ids) arrive once through {@link ArbiConnectionConfig}.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport {\n arbiAccountClient,\n clearSealedDrafts,\n toProfileView,\n useArbi,\n useArbiSessionState,\n useArbiSessionStore,\n useSwitchWorkspace,\n type AccountClient,\n type LoginProfile,\n type ProfileView,\n} from '@arbidocs/react'\nimport type { ArbiMode, ArbiUser, ConnectionStatus, ArbiConnectionConfig } from './types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ArbiHost } from '../provider/host'\n\ninterface ConnectionValue {\n mode: ArbiMode\n status: ConnectionStatus\n user: ArbiUser | null\n /** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */\n workspaceId: string | null\n apiConfigured: boolean\n apiUrl: string\n /**\n * The deployment domain the user's keys are derived for (`arbi.getDeploymentDomain()`), for the\n * document tools' e-signing. `undefined` in demo mode.\n */\n deploymentDomain: string | undefined\n error: string | null\n /** Default assistant config ext_id (for the AI hooks). */\n assistantConfig?: string\n /** Fallback workspace ext_id when none is actively selected. */\n fallbackWorkspaceId?: string\n /** Authenticate. Live login when a backend is configured, otherwise the demo workspace. */\n login: (email: string, password: string) => Promise<void>\n /** One-click demo entry (no backend required). */\n enterDemo: () => void\n logout: () => void\n /**\n * Affirmatively select a workspace: opens it on the server (via the SDK),\n * updates the app-wide state, and persists the choice so it survives future\n * logins. This is the single entry point for \"the user is now in workspace X\".\n */\n setWorkspace: (id: string) => Promise<void>\n /**\n * Re-assert the selected workspace on the server session (idempotent `/open`).\n * Call before a workspace-scoped write when the session may have lost its open\n * workspace (token re-login, backend restart, session expiry) — the server\n * resolves the workspace from the session, so a dropped `/open` yields\n * \"No active workspace\" until it's re-opened.\n */\n ensureWorkspaceOpen: () => Promise<void>\n}\n\nconst ConnectionContext = createContext<ConnectionValue | null>(null)\n\n/**\n * Persist the affirmatively-selected workspace per backend AND per signed-in user, so a returning\n * user lands back in the workspace they last chose, while the next person on a shared browser\n * never starts from someone else's workspace id. Namespaced by apiUrl so distinct deployments\n * (and the demo workspace) don't clobber each other. Cleared on logout.\n */\nconst WORKSPACE_STORAGE_PREFIX = 'arbi:selectedWorkspace'\nconst normalizeUserKey = (email: string) => email.trim().toLowerCase()\n\n/** Exported for tests. */\nexport const workspaceStorageKey = (apiUrl: string, userKey: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}:${normalizeUserKey(userKey)}`\n\n/** The pre-isolation key (apiUrl only). Never read: removed so it cannot leak across users. */\nconst legacyWorkspaceStorageKey = (apiUrl: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}`\n\nfunction readPersistedWorkspace(apiUrl: string, userKey: string | null): string | null {\n if (!userKey) return null\n try {\n return window.localStorage.getItem(workspaceStorageKey(apiUrl, userKey))\n } catch {\n return null\n }\n}\n\nfunction persistWorkspace(apiUrl: string, userKey: string | null, id: string | null): void {\n if (!userKey) return\n try {\n if (id) window.localStorage.setItem(workspaceStorageKey(apiUrl, userKey), id)\n else window.localStorage.removeItem(workspaceStorageKey(apiUrl, userKey))\n window.localStorage.removeItem(legacyWorkspaceStorageKey(apiUrl))\n } catch {\n // Storage unavailable (private mode, SSR) — selection stays in-memory only.\n }\n}\n\n/** Shown on the sign-in screen after the session could not be recovered. */\nexport const SESSION_EXPIRED_MESSAGE = 'Your session expired. Sign in again.'\n\n/** The connection user for a profile: its full name, falling back to the email local part. */\nfunction userFromProfile(profile: LoginProfile, externalId?: string): ArbiUser {\n const fullName = [profile.givenName, profile.familyName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ')\n return {\n name: fullName || profile.email.split('@')[0],\n email: profile.email,\n externalId,\n picture: profile.picture,\n }\n}\n\n/**\n * The sign-in layer of a blocks-only site, mounted by its host (`defaultHost`): login, demo mode\n * and the selected workspace, over the host's session state (the selected workspace lives there,\n * so every block reads one value). Its account client is the host's `account` below it.\n */\nexport function ConnectionProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const arbi = useArbi()\n const session = useArbiSessionStore()\n const { switchWorkspace, openSelectedWorkspace } = useSwitchWorkspace()\n const isLiveConfigured = config.apiUrl.length > 0\n const demoWorkspaceId = config.demoWorkspaceId ?? 'demo-workspace'\n\n const [status, setStatus] = useState<ConnectionStatus>(\n isLiveConfigured ? 'connecting' : 'disconnected'\n )\n const [user, setUser] = useState<ArbiUser | null>(null)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const selectWorkspaceId = session.setWorkspaceId\n const [mode, setMode] = useState<ArbiMode>('demo')\n const [error, setError] = useState<string | null>(null)\n // Who the persisted workspace belongs to; set at sign-in, cleared at logout.\n const storageUserRef = useRef<string | null>(null)\n\n // The SDK could not recover the session (token refused, workspace not re-openable): drop to\n // 'disconnected' with a plain message, so the host's gate sends the user to sign in instead of\n // every call failing with a raw backend error. The remembered workspace is kept for next login.\n useEffect(\n () =>\n arbi.onSessionExpired?.(() => {\n storageUserRef.current = null\n setUser(null)\n selectWorkspaceId(null)\n setStatus('disconnected')\n setError(SESSION_EXPIRED_MESSAGE)\n }),\n [arbi, selectWorkspaceId]\n )\n\n // A saved name, picture or email reaches every surface reading `useConnection().user`.\n useEffect(\n () =>\n arbi.user.onProfileChange?.((profile) =>\n setUser((current) => (current ? userFromProfile(profile, current.externalId) : current))\n ),\n [arbi]\n )\n\n const enterDemo = useCallback(() => {\n setMode('demo')\n setStatus('demo')\n setError(null)\n setUser({ name: config.demoUser.name, email: config.demoUser.email })\n selectWorkspaceId(demoWorkspaceId)\n }, [config.demoUser.name, config.demoUser.email, demoWorkspaceId, selectWorkspaceId])\n\n /**\n * The session signed in, by whatever path (`login` below, a sign-in page on the host's `Arbi`,\n * a restored session): open the user's workspace and resolve who they are.\n */\n const completeSignIn = useCallback(\n async (email: string) => {\n setMode('live')\n setStatus('connecting')\n setError(null)\n try {\n storageUserRef.current = normalizeUserKey(email)\n const workspaces = await arbi.workspaces.list()\n if (workspaces?.length) {\n // Prefer the workspace the user last affirmatively selected (persisted),\n // then the configured workspace (there may be several — e.g. a\n // marketing/KM workspace), then whichever happens to be first. Ternary\n // (not `&&`) so an empty value can't leak `\"\"` into `target`.\n const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current)\n const preferred = persisted ?? config.workspaceId\n const target =\n (preferred ? workspaces.find((w) => w.external_id === preferred) : undefined) ??\n workspaces[0]\n selectWorkspaceId(target.external_id)\n if (!(await openSelectedWorkspace()))\n throw new Error('Could not open your workspace. Try signing in again.')\n persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id)\n }\n // The profile (name + avatar) comes with the login response. A session restored without\n // a login has none, so fall back to finding ourselves in the workspace roster; the email\n // local part is only the last resort, never the answer when a profile name exists.\n let resolved: ArbiUser = { name: email.split('@')[0], email }\n const me = arbi.user.identity()\n const profile = arbi.user.profile?.()\n if (profile) {\n resolved = userFromProfile(profile, me?.externalId)\n } else {\n try {\n const members = await arbi.workspaces.listUsers()\n const self = members.find((m) => m.user.external_id === me?.externalId)?.user\n if (self) {\n const fullName = [self.given_name, self.family_name].filter(Boolean).join(' ').trim()\n resolved = {\n name: fullName || email.split('@')[0],\n email: self.email || email,\n externalId: self.external_id,\n picture: self.picture ?? null,\n }\n } else if (me?.externalId) {\n resolved.externalId = me.externalId\n }\n } catch {\n // Roster not available (e.g. no workspace) — keep the fallback identity.\n }\n }\n setUser(resolved)\n setStatus('authenticated')\n } catch (e) {\n // Surface the real error — no silent fallback to a fake session.\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, config.workspaceId, config.apiUrl, selectWorkspaceId, openSelectedWorkspace]\n )\n\n // Every sign-in on the host's `Arbi` lands here, whichever page or kit made it.\n const signingIn = useRef<Promise<void>>(Promise.resolve())\n useEffect(\n () =>\n arbi.onSignedIn?.((login) => {\n signingIn.current = completeSignIn(\n login.profile?.email ??\n arbi.session?.getState().userEmail ??\n arbi.user.identity()?.email ??\n ''\n )\n }),\n [arbi, completeSignIn]\n )\n\n /** Authenticate: a live login when a backend is configured, otherwise the demo workspace. */\n const login = useCallback(\n async (email: string, password: string) => {\n setError(null)\n if (!isLiveConfigured) {\n enterDemo()\n return\n }\n setStatus('connecting')\n setMode('live')\n try {\n // Signed in: `completeSignIn` follows (onSignedIn); done once it is.\n await arbi.login(email, password)\n await signingIn.current\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, enterDemo, isLiveConfigured]\n )\n\n // The session kept on this device signs in again (no password; the key stays encrypted on the\n // device). Run once even under StrictMode.\n const restoreStarted = useRef(false)\n useEffect(() => {\n if (restoreStarted.current || !isLiveConfigured) return\n restoreStarted.current = true\n arbi\n .restore()\n .catch(() => false)\n .then(async (restored) => {\n if (restored) await signingIn.current\n else setStatus('disconnected')\n })\n }, [arbi, isLiveConfigured])\n\n const logout = useCallback(() => {\n if (mode === 'live') {\n void arbi.logout?.()\n }\n // What was typed never outlives the session (it is sealed, but kept for no one now).\n clearSealedDrafts()\n setUser(null)\n selectWorkspaceId(null)\n persistWorkspace(config.apiUrl, storageUserRef.current, null)\n storageUserRef.current = null\n setStatus('disconnected')\n setError(null)\n }, [arbi, mode, config.apiUrl, selectWorkspaceId])\n\n // Affirmative selection: the shared workspace switch (live), then remember it so the next\n // login lands there too. This provider IS the host's navigation, so it alone (with sign-in and\n // ensureWorkspaceOpen, which re-open the host's own selection) changes the workspace; kits reach\n // another workspace with `arbi.workspaces.open`.\n const setWorkspace = useCallback(\n async (id: string) => {\n if (mode === 'live' && arbi.isLoggedIn) {\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n } else {\n selectWorkspaceId(id)\n }\n persistWorkspace(config.apiUrl, storageUserRef.current, id)\n },\n [arbi, mode, config.apiUrl, selectWorkspaceId, switchWorkspace]\n )\n\n // Re-open the selected workspace on the session if the server may have dropped it. Idempotent.\n // The selection as of now, not as of the last render: a flow that switches workspace and then\n // re-opens it in the same async chain must not re-open the one it just left.\n const ensureWorkspaceOpen = useCallback(async () => {\n if (mode !== 'live' || !arbi.isLoggedIn) return\n if (session.getState().workspaceId) {\n await openSelectedWorkspace()\n return\n }\n const fallback =\n readPersistedWorkspace(config.apiUrl, storageUserRef.current) ?? config.workspaceId\n if (fallback) await arbi.selectWorkspace(fallback)\n }, [arbi, session, mode, config.apiUrl, config.workspaceId, openSelectedWorkspace])\n\n const value = useMemo<ConnectionValue>(\n () => ({\n mode,\n status,\n user,\n workspaceId,\n apiConfigured: isLiveConfigured,\n apiUrl: config.apiUrl,\n deploymentDomain: isLiveConfigured ? arbi.getDeploymentDomain() : undefined,\n error,\n assistantConfig: config.assistantConfig,\n fallbackWorkspaceId: config.workspaceId,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n }),\n [\n mode,\n status,\n user,\n workspaceId,\n isLiveConfigured,\n config.apiUrl,\n arbi,\n config.assistantConfig,\n config.workspaceId,\n error,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n ]\n )\n\n const account = useConnectionAccount(arbi, user, logout)\n const authenticated = status === 'authenticated'\n const host = useMemo(\n () => ({ account: { client: account, useEnabled: () => authenticated } }),\n [account, authenticated]\n )\n\n return (\n <ConnectionContext.Provider value={value}>\n <ArbiHost config={host}>{children}</ArbiHost>\n </ConnectionContext.Provider>\n )\n}\n\n/**\n * The account client of the settings blocks below: the SDK's, with sign-out going through this\n * connection (so its state is cleared too) and, for a session restored without a login (no SDK\n * profile), the connection user as the profile.\n */\nfunction useConnectionAccount(\n arbi: ReturnType<typeof useArbi>,\n user: ArbiUser | null,\n logout: () => void\n): AccountClient {\n const userRef = useRef(user)\n const logoutRef = useRef(logout)\n logoutRef.current = logout\n const listeners = useRef(new Set<() => void>())\n useEffect(() => {\n userRef.current = user\n listeners.current.forEach((listener) => listener())\n }, [user])\n return useMemo(() => {\n const base = arbiAccountClient(arbi)\n return {\n ...base,\n profile: (): ProfileView | null => {\n const own = base.profile()\n const fallback = userRef.current\n if (own || !fallback) return own\n return {\n ...toProfileView({\n givenName: '',\n familyName: null,\n picture: fallback.picture ?? null,\n email: fallback.email,\n isSso: false,\n }),\n fullName: fallback.name,\n }\n },\n onProfileChange: (listener) => {\n listeners.current.add(listener)\n const off = base.onProfileChange(listener)\n return () => {\n listeners.current.delete(listener)\n off()\n }\n },\n signOut: async ({ everywhere } = {}) => {\n try {\n if (everywhere) await arbi.sessions.logoutAll()\n } finally {\n logoutRef.current()\n }\n },\n }\n }, [arbi])\n}\n\nexport function useConnection(): ConnectionValue {\n const ctx = useContext(ConnectionContext)\n if (!ctx) throw new Error('useConnection needs the sign-in layer of `defaultHost` above it')\n return ctx\n}\n\nexport const isAuthenticated = (s: ConnectionStatus) => s === 'demo' || s === 'authenticated'\n\n/** The open workspace as the connected kits see it, whoever hosts them. */\nexport interface ConnectedWorkspace {\n /** The selected workspace (the session state's; with a connection, else its fallback). */\n workspaceId: string | null\n /** Signed in to a live backend: workspace-scoped queries may run. */\n live: boolean\n /** The signed-in user (their name and email, e.g. to sign a document). */\n user: ArbiUser | null\n /** The signed-in user's external id. */\n userId: string | undefined\n /** Re-assert the workspace on the server session before a workspace-scoped write. */\n ensureWorkspaceOpen: () => Promise<void>\n /**\n * Go into a workspace: select it (with a connection) and show it (`BlocksEnvironment.\n * openWorkspace`, where a host without a connection also switches its session).\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => Promise<void>\n}\n\nconst keptOpenByHost = async () => {}\n\n/** The signed-in user of a host's own session, from its login profile. */\nfunction sessionUser(arbi: ReturnType<typeof useArbi>): ArbiUser | null {\n if (!arbi.isLoggedIn) return null\n const me = arbi.user.identity()\n const profile = arbi.user.profile()\n if (!me) return null\n return profile\n ? userFromProfile(profile, me.externalId)\n : { name: (me.email ?? '').split('@')[0], email: me.email ?? '', externalId: me.externalId }\n}\n\n/**\n * The workspace for a connected kit: the sign-in layer's (`defaultHost`) when there is one, else the\n * host's own session (an app whose host config has its `arbi` and `session` and keeps its\n * workspace open itself). So a kit runs the same in Clarum and in the ARBI app.\n */\nexport function useConnectedWorkspace(): ConnectedWorkspace {\n const connection = useContext(ConnectionContext)\n const arbi = useArbi()\n const sessionWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const live = connection ? connection.status === 'authenticated' : arbi.isLoggedIn\n const user = connection ? connection.user : live ? sessionUser(arbi) : null\n const userKey = `${user?.externalId ?? ''}|${user?.name ?? ''}|${user?.email ?? ''}`\n const { openWorkspace: showWorkspace } = useBlocksEnvironment()\n return useMemo(\n () => ({\n workspaceId: connection\n ? (connection.workspaceId ?? connection.fallbackWorkspaceId ?? null)\n : sessionWorkspaceId,\n live,\n user,\n userId: user?.externalId,\n ensureWorkspaceOpen: connection?.ensureWorkspaceOpen ?? keptOpenByHost,\n openWorkspace: async (workspaceId: string, options?: { name?: string }) => {\n if (connection) await connection.setWorkspace(workspaceId)\n showWorkspace(workspaceId, options)\n },\n }),\n // `user` is rebuilt each render without a connection: its key says when it changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [connection, sessionWorkspaceId, live, userKey, showWorkspace]\n )\n}\n"]}
@@ -1,102 +0,0 @@
1
- "use client";
2
- import { useConnectedWorkspace } from './chunk-GA77ONJJ.js';
3
- import { useHost } from './chunk-T4P237N6.js';
4
- import { useBlocksEnvironment } from './chunk-GKM4EOH7.js';
5
- import { useMemo, useCallback } from 'react';
6
- import { useQueryClient } from '@tanstack/react-query';
7
- import { useArbi, refreshDocuments, arbiQueryKeys } from '@arbidocs/react';
8
- import { useOptionalDocumentTools, documentBytesKey, clientUpload, DocumentToolsProvider } from '@arbidocs/react/document-tools';
9
- import { jsx, Fragment } from 'react/jsx-runtime';
10
-
11
- var NO_EMAIL = () => void 0;
12
- function ConnectedDocumentToolsProvider({ children }) {
13
- const enclosing = useOptionalDocumentTools();
14
- return enclosing ? /* @__PURE__ */ jsx(Fragment, { children }) : /* @__PURE__ */ jsx(OwnDocumentTools, { children });
15
- }
16
- function OwnDocumentTools({ children }) {
17
- const arbi = useArbi();
18
- const queryClient = useQueryClient();
19
- const host = useHost().documentTools;
20
- const { user, ensureWorkspaceOpen } = useConnectedWorkspace();
21
- const { notify: environmentNotify, openDocument: openInHost } = useBlocksEnvironment();
22
- const useEmailDocument = host?.useEmailDocument ?? NO_EMAIL;
23
- const emailDocument = useEmailDocument();
24
- const client = host?.client ?? (arbi.isLoggedIn ? arbi.getClient().fetch : null);
25
- const signer = useMemo(
26
- () => user ? { name: user.name, email: user.email, externalId: user.externalId } : null,
27
- [user]
28
- );
29
- const notify = useCallback(
30
- (message, kind, options) => environmentNotify(message, kind, {
31
- description: options?.description,
32
- action: options?.action
33
- }),
34
- [environmentNotify]
35
- );
36
- const ownDocumentsChanged = useCallback(
37
- async (ids, change) => {
38
- const refresh = [refreshDocuments(queryClient, arbi, ids)];
39
- if (change === "signed" || change === "version")
40
- for (const id of ids)
41
- refresh.push(
42
- queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documentVersions(id) }),
43
- queryClient.invalidateQueries({ queryKey: documentBytesKey(id) })
44
- );
45
- await Promise.all(refresh);
46
- },
47
- [queryClient, arbi]
48
- );
49
- const ownUpload = useCallback(
50
- async (request) => {
51
- if (!client) throw new Error("Sign in to save a copy.");
52
- await ensureWorkspaceOpen();
53
- return clientUpload(client)(request);
54
- },
55
- [client, ensureWorkspaceOpen]
56
- );
57
- const ownOpenDocument = useCallback((ref) => openInHost(ref), [openInHost]);
58
- if (!client) return /* @__PURE__ */ jsx(Fragment, { children });
59
- return /* @__PURE__ */ jsx(
60
- DocumentToolsProvider,
61
- {
62
- client,
63
- deploymentDomain: host?.deploymentDomain,
64
- user: signer,
65
- notify,
66
- openDocument: host?.openDocument ?? ownOpenDocument,
67
- onDocumentsChanged: host?.onDocumentsChanged ?? ownDocumentsChanged,
68
- uploadDocument: host?.uploadDocument ?? ownUpload,
69
- emailDocument,
70
- certificateUrl: host?.certificateUrl,
71
- children
72
- }
73
- );
74
- }
75
-
76
- // src/connection/viewer/support.ts
77
- var NO_SUPPORT = {};
78
- function useDocumentViewerSupport() {
79
- return useHost().viewer ?? NO_SUPPORT;
80
- }
81
- var NONE = () => void 0;
82
- var ATTACHED = () => false;
83
- function useViewerStreamingDocument(documentId) {
84
- const useStreaming = useDocumentViewerSupport().useStreamingDocument ?? NONE;
85
- return useStreaming(documentId);
86
- }
87
- function useViewerDraftDocument(draftId) {
88
- const useDraft = useDocumentViewerSupport().useDraftDocument ?? NONE;
89
- return useDraft(draftId);
90
- }
91
- function useViewerPassageCitation() {
92
- const useCitation = useDocumentViewerSupport().usePassageCitation ?? NONE;
93
- return useCitation();
94
- }
95
- function useViewerIsDetached() {
96
- const useDetached = useDocumentViewerSupport().useIsDetached ?? ATTACHED;
97
- return useDetached();
98
- }
99
-
100
- export { ConnectedDocumentToolsProvider, useDocumentViewerSupport, useViewerDraftDocument, useViewerIsDetached, useViewerPassageCitation, useViewerStreamingDocument };
101
- //# sourceMappingURL=chunk-LLEI5I5C.js.map
102
- //# sourceMappingURL=chunk-LLEI5I5C.js.map