@arbidocs/blocks 0.5.126 → 0.5.128

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 (102) hide show
  1. package/README.md +19 -0
  2. package/dist/{ConnectedCallDock-733O5M36.cjs → ConnectedCallDock-XJOYVVAH.cjs} +5 -5
  3. package/dist/{ConnectedCallDock-733O5M36.cjs.map → ConnectedCallDock-XJOYVVAH.cjs.map} +1 -1
  4. package/dist/{ConnectedCallRoom-TAUGSRGV.cjs → ConnectedCallRoom-CUDYAPQK.cjs} +5 -5
  5. package/dist/{ConnectedCallRoom-TAUGSRGV.cjs.map → ConnectedCallRoom-CUDYAPQK.cjs.map} +1 -1
  6. package/dist/{ConnectedNativeDocxComparison-HDE522YC.cjs → ConnectedNativeDocxComparison-JUF2TI2P.cjs} +9 -9
  7. package/dist/{ConnectedNativeDocxComparison-HDE522YC.cjs.map → ConnectedNativeDocxComparison-JUF2TI2P.cjs.map} +1 -1
  8. package/dist/ConnectedPresentation-SI3L77J4.cjs +1 -1
  9. package/dist/{ConnectedSlidesTab-JSPU6EY5.cjs → ConnectedSlidesTab-E76OVY34.cjs} +3 -3
  10. package/dist/{ConnectedSlidesTab-JSPU6EY5.cjs.map → ConnectedSlidesTab-E76OVY34.cjs.map} +1 -1
  11. package/dist/{ConnectedStreamedWordArtifact-4FHPOAFZ.cjs → ConnectedStreamedWordArtifact-Q64DRRQD.cjs} +9 -9
  12. package/dist/{ConnectedStreamedWordArtifact-4FHPOAFZ.cjs.map → ConnectedStreamedWordArtifact-Q64DRRQD.cjs.map} +1 -1
  13. package/dist/{DocumentReviewCard-BDNXP3D4.cjs → DocumentReviewCard-M53XFLI2.cjs} +4 -4
  14. package/dist/{DocumentReviewCard-BDNXP3D4.cjs.map → DocumentReviewCard-M53XFLI2.cjs.map} +1 -1
  15. package/dist/{FilesViewerDialog-WQRNSKWM.cjs → FilesViewerDialog-C7XHGK36.cjs} +9 -9
  16. package/dist/{FilesViewerDialog-WQRNSKWM.cjs.map → FilesViewerDialog-C7XHGK36.cjs.map} +1 -1
  17. package/dist/{NativeDocxEditor-SUDULUN3.cjs → NativeDocxEditor-2PTEK6ND.cjs} +6 -6
  18. package/dist/{NativeDocxEditor-SUDULUN3.cjs.map → NativeDocxEditor-2PTEK6ND.cjs.map} +1 -1
  19. package/dist/WorkspaceTableView-3XYAV4BV.cjs +1 -1
  20. package/dist/agents/index.cjs +1 -1
  21. package/dist/ai-IEIR7SC2.cjs +1 -1
  22. package/dist/calls/index.cjs +2 -2
  23. package/dist/{chunk-Q6N5D3R5.cjs → chunk-23I5EUZA.cjs} +45 -15
  24. package/dist/chunk-23I5EUZA.cjs.map +1 -0
  25. package/dist/{chunk-KXIRVKCJ.cjs → chunk-ERRXU2HL.cjs} +38 -6
  26. package/dist/chunk-ERRXU2HL.cjs.map +1 -0
  27. package/dist/{chunk-6B4CCDDB.cjs → chunk-ESVRVZ53.cjs} +5 -5
  28. package/dist/{chunk-6B4CCDDB.cjs.map → chunk-ESVRVZ53.cjs.map} +1 -1
  29. package/dist/{chunk-KA3F6TIH.cjs → chunk-IWHP7FAB.cjs} +12 -5
  30. package/dist/chunk-IWHP7FAB.cjs.map +1 -0
  31. package/dist/{chunk-OHHKBURG.cjs → chunk-IWMHQTVL.cjs} +401 -18
  32. package/dist/chunk-IWMHQTVL.cjs.map +1 -0
  33. package/dist/{chunk-FGOJBOZX.cjs → chunk-IZJ5L246.cjs} +4 -4
  34. package/dist/{chunk-FGOJBOZX.cjs.map → chunk-IZJ5L246.cjs.map} +1 -1
  35. package/dist/{chunk-I4X72WUT.cjs → chunk-MMSHIIKG.cjs} +6 -6
  36. package/dist/{chunk-I4X72WUT.cjs.map → chunk-MMSHIIKG.cjs.map} +1 -1
  37. package/dist/{chunk-LXM5QXII.cjs → chunk-MXBXZXXQ.cjs} +3 -3
  38. package/dist/{chunk-LXM5QXII.cjs.map → chunk-MXBXZXXQ.cjs.map} +1 -1
  39. package/dist/{chunk-463QM764.cjs → chunk-NG2EE7HR.cjs} +3 -3
  40. package/dist/{chunk-463QM764.cjs.map → chunk-NG2EE7HR.cjs.map} +1 -1
  41. package/dist/chunk-NTDQQLDD.cjs +18 -0
  42. package/dist/{chunk-OALQGO5C.cjs.map → chunk-NTDQQLDD.cjs.map} +1 -1
  43. package/dist/{chunk-XNB27POJ.cjs → chunk-Q6IKXWPG.cjs} +4 -4
  44. package/dist/{chunk-XNB27POJ.cjs.map → chunk-Q6IKXWPG.cjs.map} +1 -1
  45. package/dist/{chunk-LOB2ATS5.cjs → chunk-VLQCLQAS.cjs} +5 -5
  46. package/dist/{chunk-LOB2ATS5.cjs.map → chunk-VLQCLQAS.cjs.map} +1 -1
  47. package/dist/{chunk-4KEQ62SL.cjs → chunk-YP5EBGLU.cjs} +6 -6
  48. package/dist/{chunk-4KEQ62SL.cjs.map → chunk-YP5EBGLU.cjs.map} +1 -1
  49. package/dist/{chunk-FB3JXSQT.cjs → chunk-ZQNTYINE.cjs} +10 -10
  50. package/dist/{chunk-FB3JXSQT.cjs.map → chunk-ZQNTYINE.cjs.map} +1 -1
  51. package/dist/{chunk-CMPHJRVV.cjs → chunk-ZYGAXD3N.cjs} +3 -3
  52. package/dist/{chunk-CMPHJRVV.cjs.map → chunk-ZYGAXD3N.cjs.map} +1 -1
  53. package/dist/connect/docx.cjs +13 -13
  54. package/dist/connect/index.cjs +245 -299
  55. package/dist/connect/index.cjs.map +1 -1
  56. package/dist/connect/viewer.cjs +7 -7
  57. package/dist/connection/conversation/MermaidDiagram.js +11 -2
  58. package/dist/connection/conversation/MermaidDiagram.js.map +2 -2
  59. package/dist/connection/conversation/download-mermaid.d.ts +2 -0
  60. package/dist/connection/conversation/download-mermaid.js +29 -0
  61. package/dist/connection/conversation/download-mermaid.js.map +7 -0
  62. package/dist/connection/remote-control/ConnectedRemoteControlConsent.js +6 -3
  63. package/dist/connection/remote-control/ConnectedRemoteControlConsent.js.map +2 -2
  64. package/dist/connection/remote-control/ConnectedRemoteControlIndicator.js +12 -2
  65. package/dist/connection/remote-control/ConnectedRemoteControlIndicator.js.map +2 -2
  66. package/dist/connection/remote-control/ConnectedRemoteControlSwitch.js +1 -1
  67. package/dist/connection/remote-control/ConnectedRemoteControlSwitch.js.map +1 -1
  68. package/dist/connection/remote-control/browser-diagnostics.d.ts +7 -0
  69. package/dist/connection/remote-control/browser-diagnostics.js +109 -0
  70. package/dist/connection/remote-control/browser-diagnostics.js.map +7 -0
  71. package/dist/connection/remote-control/remoteControl.d.ts +9 -1
  72. package/dist/connection/remote-control/remoteControl.js +146 -10
  73. package/dist/connection/remote-control/remoteControl.js.map +2 -2
  74. package/dist/connection/remote-control/screen-sharing.d.ts +11 -0
  75. package/dist/connection/remote-control/screen-sharing.js +78 -0
  76. package/dist/connection/remote-control/screen-sharing.js.map +7 -0
  77. package/dist/connection/report-problem/screen-capture.d.ts +1 -0
  78. package/dist/connection/report-problem/screen-capture.js +2 -1
  79. package/dist/connection/report-problem/screen-capture.js.map +2 -2
  80. package/dist/docx/NativeDocxEditor.js +14 -12
  81. package/dist/docx/NativeDocxEditor.js.map +2 -2
  82. package/dist/docx/index.cjs +38 -38
  83. package/dist/docx/useVersionAutosave.d.ts +10 -0
  84. package/dist/docx/useVersionAutosave.js +36 -0
  85. package/dist/docx/useVersionAutosave.js.map +7 -0
  86. package/dist/embed/index.cjs +10 -10
  87. package/dist/facts/index.cjs +43 -43
  88. package/dist/index.cjs +94 -94
  89. package/dist/settings/index.cjs +1 -1
  90. package/dist/shell/RemoteControlPill.d.ts +2 -1
  91. package/dist/shell/RemoteControlPill.js +10 -3
  92. package/dist/shell/RemoteControlPill.js.map +2 -2
  93. package/dist/shell/index.cjs +21 -21
  94. package/dist/studio/index.cjs +1 -1
  95. package/dist/workflow-canvas/index.cjs +12 -12
  96. package/node_modules/@arbidocs/coedit/package.json +1 -1
  97. package/package.json +5 -5
  98. package/dist/chunk-KA3F6TIH.cjs.map +0 -1
  99. package/dist/chunk-KXIRVKCJ.cjs.map +0 -1
  100. package/dist/chunk-OALQGO5C.cjs +0 -18
  101. package/dist/chunk-OHHKBURG.cjs.map +0 -1
  102. package/dist/chunk-Q6N5D3R5.cjs.map +0 -1
@@ -7,11 +7,11 @@ var chunkMCXS6X37_cjs = require('./chunk-MCXS6X37.cjs');
7
7
  var chunk75BNMCUX_cjs = require('./chunk-75BNMCUX.cjs');
8
8
  var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
9
9
  var React = require('react');
10
+ var lucideReact = require('lucide-react');
11
+ var ui = require('@arbidocs/react/ui');
10
12
  var jsxRuntime = require('react/jsx-runtime');
11
13
  var react = require('@arbidocs/react');
12
14
  var shell = require('@arbidocs/react/shell');
13
- var ui = require('@arbidocs/react/ui');
14
- var lucideReact = require('lucide-react');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
17
 
@@ -31,6 +31,32 @@ function normalizeMermaidGraph(source) {
31
31
  return `${header}
32
32
  ${body.trimStart()}`;
33
33
  }
34
+
35
+ // src/connection/conversation/download-mermaid.ts
36
+ function downloadMermaidSvg(rendered) {
37
+ const doc = new DOMParser().parseFromString(rendered, "image/svg+xml");
38
+ const svg = doc.documentElement;
39
+ if (svg.localName !== "svg" || doc.querySelector("parsererror"))
40
+ throw new Error("The diagram did not produce a valid SVG image");
41
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
42
+ const box = svg.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number);
43
+ if (box?.length === 4 && box.every(Number.isFinite) && box[2] > 0 && box[3] > 0) {
44
+ svg.setAttribute("width", String(Math.ceil(box[2])));
45
+ svg.setAttribute("height", String(Math.ceil(box[3])));
46
+ }
47
+ const blob = new Blob([new XMLSerializer().serializeToString(svg)], { type: "image/svg+xml" });
48
+ const url = URL.createObjectURL(blob);
49
+ const link = document.createElement("a");
50
+ link.href = url;
51
+ link.download = "diagram.svg";
52
+ document.body.append(link);
53
+ try {
54
+ link.click();
55
+ } finally {
56
+ link.remove();
57
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
58
+ }
59
+ }
34
60
  var mermaidInstance = null;
35
61
  var mermaidLoadPromise = null;
36
62
  async function getMermaid() {
@@ -118,12 +144,18 @@ function MermaidDiagram({ chart }) {
118
144
  }
119
145
  );
120
146
  }
121
- return /* @__PURE__ */ jsxRuntime.jsx(
147
+ return /* @__PURE__ */ jsxRuntime.jsxs(
122
148
  "div",
123
149
  {
124
150
  className: "mermaid-diagram my-4 overflow-x-auto rounded-md border border-border bg-background p-4",
125
151
  "data-testid": "mermaid-diagram",
126
- dangerouslySetInnerHTML: { __html: svg }
152
+ children: [
153
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "ghost", size: "sm", onClick: () => downloadMermaidSvg(svg), children: [
154
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "mr-2 size-4", "aria-hidden": "true" }),
155
+ "Download SVG"
156
+ ] }) }),
157
+ /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: svg } })
158
+ ]
127
159
  }
128
160
  );
129
161
  }
@@ -284,5 +316,5 @@ exports.InternalDocLink = InternalDocLink;
284
316
  exports.MermaidDiagram = MermaidDiagram;
285
317
  exports.WorkspaceDocumentReference = WorkspaceDocumentReference;
286
318
  exports.useDocumentWorkspace = useDocumentWorkspace;
287
- //# sourceMappingURL=chunk-KXIRVKCJ.cjs.map
288
- //# sourceMappingURL=chunk-KXIRVKCJ.cjs.map
319
+ //# sourceMappingURL=chunk-ERRXU2HL.cjs.map
320
+ //# sourceMappingURL=chunk-ERRXU2HL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chat/mermaid-normalize.ts","../src/connection/conversation/download-mermaid.ts","../src/connection/conversation/MermaidDiagram.tsx","../src/connection/conversation/DocumentWorkspaceContext.tsx","../src/connection/conversation/ConnectedMarkdown.tsx"],"names":["useState","useId","useEffect","jsxs","jsx","Button","Download","createContext","useContext","useBlocksEnvironment","React","useArbiSession","MentionChip","QuietLink","useArbiHost","Fragment","useCompactChat","useDocument","EntityPill","FileText","DocumentEntity","Mail","mentionFromHref","MarkdownLink","workspaceDocIdFromHref","MarkdownStreamingContext","MarkdownCode","rehypeDocEntityPills","useMemo","KitMarkdownRenderer"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,SAAS,sBAAsB,MAAA,EAAwB;AAE5D,EAAA,IAAI,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA,EAAG,OAAO,MAAA;AAE9B,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,gCAAgC,CAAA;AACjE,EAAA,IAAI,CAAC,aAAa,OAAO,MAAA;AAEzB,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,CAAC,CAAA,CAAE,OAAA,EAAQ;AACtC,EAAA,IAAI,OAAO,MAAA,CAAO,KAAA,CAAM,WAAA,CAAY,CAAC,EAAE,MAAM,CAAA;AAG7C,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,uDAAA,EAAyD,OAAO,CAAA;AAIpF,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,cAAA,EAAgB,SAAS,CAAA;AAI7C,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,wCAAA,EAA0C,KAAK,CAAA;AAGnE,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,SAAA,EAAW,IAAI,CAAA;AAEnC,EAAA,OAAO,GAAG,MAAM;AAAA,EAAK,IAAA,CAAK,WAAW,CAAA,CAAA;AACvC;;;AC9CO,SAAS,mBAAmB,QAAA,EAAwB;AACzD,EAAA,MAAM,MAAM,IAAI,SAAA,EAAU,CAAE,eAAA,CAAgB,UAAU,eAAe,CAAA;AACrE,EAAA,MAAM,MAAM,GAAA,CAAI,eAAA;AAChB,EAAA,IAAI,GAAA,CAAI,SAAA,KA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I,MAAA,EAAQ,uBAAOA,cAAAA,CAAC,YAAS,MAAA,EAAgB,CAAA;AAC7C,IAAA,uBACEA,cAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAuB,GAAG,OAC7B,QAAA,EACH,CAAA;AAAA,EAEJ;AACF,CAAA;AAGA,IAAM,yBAAA,GAA4B,CAACuB,sCAAoB,CAAA;AAWvD,SAAS,0BAAA,CAA2B,EAAE,UAAA,EAAY,GAAG,OAAM,EAA2B;AACpF,EAAA,MAAM,MAAA,GAASC,aAAA;AAAA,IACb,MACE,UAAA,GACI,EAAE,GAAG,8BAAA,EAAgC,GAAG,YAAW,GACnD,8BAAA;AAAA,IACN,CAAC,UAAU;AAAA,GACb;AACA,EAAA,uBACExB,eAACyB,mBAAA,EAAA,EAAqB,GAAG,OAAO,UAAA,EAAY,MAAA,EAAQ,eAAe,yBAAA,EAA2B,CAAA;AAElG;AAEO,IAAM,iBAAA,GAAoBnB,sBAAA,CAAM,IAAA,CAAK,0BAA0B","file":"chunk-ERRXU2HL.cjs","sourcesContent":["/**\n * Defensive normalizer for single-line `graph` / `flowchart` Mermaid source.\n *\n * Some LLMs emit the entire diagram on one line. Mermaid's parser splits\n * statements on newlines, so a single-line graph fails outright. This helper\n * inserts newlines on safe statement boundaries so the diagram has a chance\n * of parsing. Only attempts normalization when:\n * 1. The source has no embedded newlines (i.e. is genuinely single-line), and\n * 2. The first directive is `graph` or `flowchart`.\n *\n * Other diagram types (sequenceDiagram, classDiagram, gantt, …) have very\n * different syntaxes — applying these heuristics to them would corrupt valid\n * input, so they're left untouched.\n *\n * Boundaries we split on:\n * - After the diagram-type header (`graph TD`, `flowchart LR`, …).\n * - Before each `style` / `classDef` / `class` / `linkStyle` / `click`\n * / `subgraph` keyword.\n * - Before/after `end` (closes a subgraph block).\n * - After a `]` (label close) that's followed by another node identifier\n * starting a new edge or node declaration.\n */\nexport function normalizeMermaidGraph(source: string): string {\n // Already multi-line — assume it's well-formed; don't touch it.\n if (/\\n/.test(source)) return source\n\n const headerMatch = source.match(/^\\s*(graph|flowchart)\\s+\\w+\\s+/)\n if (!headerMatch) return source\n\n const header = headerMatch[0].trimEnd()\n let body = source.slice(headerMatch[0].length)\n\n // Insert newline before keywords that always start a new statement.\n body = body.replace(/\\s+(style|classDef|class|linkStyle|click|subgraph)\\s/g, '\\n$1 ')\n\n // `end` closes a subgraph: put it on its own line, with a break after it\n // too so any trailing statements don't stay attached.\n body = body.replace(/\\s+end\\b\\s*/g, '\\nend\\n')\n\n // After a label close (`]`), if the next token looks like a Mermaid node id\n // followed by another `[` or `-->`, that's a new statement starting.\n body = body.replace(/\\]\\s+(?=[A-Za-z_][\\w-]*\\s*(?:\\[|-->))/g, ']\\n')\n\n // Collapse any accidental runs of blank lines we may have produced.\n body = body.replace(/\\n{2,}/g, '\\n')\n\n return `${header}\\n${body.trimStart()}`\n}\n","/** Save the rendered graphic, including Mermaid's styles, as a standalone image. */\nexport function downloadMermaidSvg(rendered: string): void {\n const doc = new DOMParser().parseFromString(rendered, 'image/svg+xml')\n const svg = doc.documentElement\n if (svg.localName !== 'svg' || doc.querySelector('parsererror'))\n throw new Error('The diagram did not produce a valid SVG image')\n svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n const box = svg\n .getAttribute('viewBox')\n ?.trim()\n .split(/[\\s,]+/)\n .map(Number)\n if (box?.length === 4 && box.every(Number.isFinite) && box[2] > 0 && box[3] > 0) {\n svg.setAttribute('width', String(Math.ceil(box[2])))\n svg.setAttribute('height', String(Math.ceil(box[3])))\n }\n const blob = new Blob([new XMLSerializer().serializeToString(svg)], { type: 'image/svg+xml' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = 'diagram.svg'\n document.body.append(link)\n try {\n link.click()\n } finally {\n link.remove()\n // Let the browser consume the download before releasing the image URL.\n setTimeout(() => URL.revokeObjectURL(url), 1000)\n }\n}\n","/**\n * MermaidDiagram Component\n *\n * Renders a Mermaid diagram from source code.\n * Used inside MarkdownRenderer to handle ```mermaid code blocks.\n * Lazy-loads the mermaid library to avoid bloating the initial bundle.\n */\n\nimport { useState, useEffect, useId } from 'react'\nimport { Download } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { normalizeMermaidGraph } from '../../chat/mermaid-normalize'\nimport { downloadMermaidSvg } from './download-mermaid'\n\ninterface MermaidDiagramProps {\n /** Mermaid diagram source code */\n chart: string\n}\n\n// Lazy-load and initialize mermaid once\nlet mermaidInstance: typeof import('mermaid').default | null = null\nlet mermaidLoadPromise: Promise<typeof import('mermaid').default> | null = null\n\nasync function getMermaid() {\n if (mermaidInstance) return mermaidInstance\n if (!mermaidLoadPromise) {\n mermaidLoadPromise = import('mermaid').then((mod) => {\n const m = mod.default\n m.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'strict',\n flowchart: { useMaxWidth: true, curve: 'basis' },\n })\n mermaidInstance = m\n return m\n })\n }\n return mermaidLoadPromise\n}\n\nexport function MermaidDiagram({ chart }: MermaidDiagramProps) {\n const [svg, setSvg] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const uniqueId = useId().replace(/:/g, '-')\n\n useEffect(() => {\n let cancelled = false\n\n async function render() {\n const mermaid = await getMermaid()\n const diagramId = `mermaid${uniqueId}`\n\n // Validate with parse() before render(). In Mermaid v11 a render() with\n // bad source can return a \"Syntax error in text\" bomb SVG instead of\n // throwing — and it appends DOM side-effects of its own — so a try/catch\n // around render() doesn't reliably catch failures and the bomb leaks\n // into the page (especially under React StrictMode where effects run\n // twice). parse() throws cleanly with no DOM side-effects.\n //\n // Defensive rescue: some LLMs emit single-line `graph`/`flowchart`\n // source. If the original parse fails, try a normalized variant. The\n // normalizer is a no-op on already-multi-line source and on non-graph\n // diagram types, so this only helps the bad-source case and never\n // corrupts valid input.\n let validSource: string | null = null\n let firstErr: unknown\n try {\n await mermaid.parse(chart)\n validSource = chart\n } catch (err) {\n firstErr = err\n const normalized = normalizeMermaidGraph(chart)\n if (normalized !== chart) {\n try {\n await mermaid.parse(normalized)\n validSource = normalized\n } catch (retryErr) {\n console.warn('Mermaid normalized parse also failed', retryErr)\n }\n }\n }\n\n if (cancelled) return\n\n if (!validSource) {\n console.warn('Mermaid parse failed, showing source', firstErr)\n setError('Failed to render diagram')\n setSvg(null)\n return\n }\n\n try {\n const { svg: renderedSvg } = await mermaid.render(diagramId, validSource)\n if (!cancelled) {\n setSvg(renderedSvg)\n setError(null)\n }\n } catch (renderErr) {\n if (!cancelled) {\n console.warn('Mermaid render failed despite parse success', renderErr)\n setError('Failed to render diagram')\n setSvg(null)\n }\n }\n }\n\n render()\n return () => {\n cancelled = true\n }\n }, [chart, uniqueId])\n\n if (error) {\n // Fall back to showing the raw source in a code block\n return (\n <div className=\"code-block\" data-testid=\"mermaid-error\">\n <div className=\"text-sm text-muted-foreground mb-1\">{error}</div>\n <code className=\"language-mermaid\">{chart}</code>\n </div>\n )\n }\n\n if (!svg) {\n return (\n <div\n className=\"flex items-center justify-center py-8 text-muted-foreground text-sm\"\n data-testid=\"mermaid-loading\"\n >\n Rendering diagram...\n </div>\n )\n }\n\n return (\n <div\n className=\"mermaid-diagram my-4 overflow-x-auto rounded-md border border-border bg-background p-4\"\n data-testid=\"mermaid-diagram\"\n >\n <div className=\"mb-2 flex justify-end\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => downloadMermaidSvg(svg)}>\n <Download className=\"mr-2 size-4\" aria-hidden=\"true\" />\n Download SVG\n </Button>\n </div>\n <div dangerouslySetInnerHTML={{ __html: svg }} />\n </div>\n )\n}\n","/**\n * The workspace a conversation's document references belong to, when it is not the open one: an\n * agent's direct-message thread runs in the agent's workspace, so the documents it names are there.\n * A reference then opens that workspace first (`openDocument(id, { workspaceId })`).\n */\n\nimport { createContext, useContext, type ReactNode } from 'react'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\n/** The workspace of the documents referenced inside it (null: the open workspace). */\nexport const DocumentWorkspaceContext = createContext<string | null>(null)\nexport const useDocumentWorkspace = () => useContext(DocumentWorkspaceContext)\n\n/** A reference to a document of another workspace: opening it opens that workspace first. */\nexport function WorkspaceDocumentReference({\n workspaceId,\n docId,\n children,\n className = 'inline-flex rounded-full border px-2 py-0.5 text-xs hover:bg-muted',\n}: {\n workspaceId: string\n docId: string\n children?: ReactNode\n className?: string\n}) {\n const { openDocument } = useBlocksEnvironment()\n return (\n <button\n type=\"button\"\n className={className}\n onClick={() => openDocument(docId, { workspaceId })}\n >\n {children ?? docId}\n </button>\n )\n}\n","/**\n * The conversation's markdown: the kit's `MarkdownRenderer` (`@arbidocs/react`: sanitised HTML,\n * slugs, lazy KaTeX, streaming blocks, tables, code) with what a conversation adds: @mention chips,\n * workspace documents opening in the viewer, quiet external links, document and email pills (the\n * host's chips, `ArbiChatHost.renderDocumentChip` / `renderMailChip`) and Mermaid diagrams.\n */\nimport { useArbiHost, useArbiSession, useDocument } from '@arbidocs/react'\nimport { mentionFromHref, type MentionKind } from '@arbidocs/react/shell'\nimport {\n EntityPill,\n getDocumentTitle,\n MarkdownCode,\n MarkdownLink,\n MarkdownRenderer as KitMarkdownRenderer,\n MarkdownStreamingContext,\n type MarkdownRendererProps as KitMarkdownRendererProps,\n DocumentEntity,\n} from '@arbidocs/react/ui'\nimport React, { useContext, useMemo } from 'react'\nimport { FileText, Mail } from 'lucide-react'\n\n/** The markdown element overrides, as the kit's renderer takes them. */\ntype Components = NonNullable<KitMarkdownRendererProps['components']>\nimport { useCompactChat } from '../../chat/CompactChatContext'\nimport { MentionChip } from '../../chat/MentionMenu'\nimport { QuietLink } from '../../citations/QuietMarks'\nimport { rehypeDocEntityPills } from '../../chat/rehype-doc-entity-pills'\nimport { workspaceDocIdFromHref } from '../../chat/doc-links'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { MermaidDiagram } from './MermaidDiagram'\nimport { useDocumentWorkspace, WorkspaceDocumentReference } from './DocumentWorkspaceContext'\n\n/** Plain text of a link's children (the `@Label` of a mention link). */\nfunction childrenText(children: React.ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (typeof child === 'string' || typeof child === 'number' ? String(child) : ''))\n .join('')\n}\n\n/** A mention chip; a mention of the reader stands out. */\nfunction MentionLink({ kind, id, text }: { kind: MentionKind; id: string; text: string }) {\n const currentUserId = useArbiSession().user?.external_id\n return (\n <MentionChip\n kind={kind}\n id={id}\n label={text.replace(/^@/, '')}\n isSelf={kind === 'user' && id === currentUserId}\n />\n )\n}\n\n/**\n * A link to elsewhere, as quiet text. Its menu (Open link / Copy link) is the deliberate step\n * the old confirmation dialog used to be; nothing opens until the menu's primary row is chosen.\n */\nexport function ExternalLink({ href, children }: React.ComponentPropsWithoutRef<'a'>) {\n return (\n <QuietLink href={href} kind=\"external\">\n {children}\n </QuietLink>\n )\n}\n\n/**\n * A workspace document referenced by a link's href rather than by its text.\n *\n * `rehypeDocEntityPills` turns a bare `doc-…` id into a pill, but it only walks\n * TEXT nodes — so `[NVDA DCF Valuation Report](…doc-abc12345…)`, which is how an\n * answer links an artifact it just saved, keeps the id in the href where the\n * plugin never looks. The link then fell through to `ExternalLink`, and opening\n * your own workspace document asked you to confirm an \"external link\" and\n * launched a new tab. It opens in the document viewer, like the pill and the\n * artifact card already do.\n */\nexport function InternalDocLink({\n docId,\n href,\n children,\n}: React.ComponentPropsWithoutRef<'a'> & { docId: string }) {\n const { openDocument } = useBlocksEnvironment()\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) {\n return (\n <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId}>\n {children}\n </WorkspaceDocumentReference>\n )\n }\n\n return (\n <QuietLink href={href} kind=\"document\" onOpen={() => openDocument(docId)}>\n {children}\n </QuietLink>\n )\n}\n\n/** A document of the workspace, as a pill: the host's chip, else the document entity. */\nexport function DocumentChip({ docId }: { docId: string }) {\n const render = useArbiHost().chat?.renderDocumentChip\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) return <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId} />\n return render ? <>{render(docId)}</> : <DefaultDocumentChip docId={docId} />\n}\n\nfunction DefaultDocumentChip({ docId }: { docId: string }) {\n const compact = useCompactChat()\n const { data: doc } = useDocument(docId)\n const { openDocument } = useBlocksEnvironment()\n if (compact && doc)\n return (\n <button\n type=\"button\"\n className=\"inline text-left text-primary underline decoration-primary/30 underline-offset-2 hover:decoration-primary\"\n onClick={() => openDocument(docId)}\n >\n {getDocumentTitle(doc)}\n </button>\n )\n if (!doc)\n return (\n <EntityPill\n icon={<FileText className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label={docId}\n size=\"sm\"\n onClick={() => openDocument(docId)}\n data-testid=\"doc-entity-pill\"\n />\n )\n return (\n <DocumentEntity doc={doc} onClick={() => openDocument(docId)} data-testid=\"doc-entity-pill\" />\n )\n}\n\n/** An email of the person's mailbox, as a pill: the host's chip, else a plain \"Email\". */\nfunction MailChip({ mailId }: { mailId: string }) {\n const render = useArbiHost().chat?.renderMailChip\n if (render) return <>{render(mailId)}</>\n return (\n <EntityPill\n icon={<Mail className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label=\"Email\"\n size=\"sm\"\n data-testid=\"mail-entity-pill\"\n />\n )\n}\n\n/**\n * The conversation's overrides, layered on the kit's defaults. Module scope, so the reference is stable\n * and memoised markdown blocks do not re-parse.\n */\nconst conversationMarkdownComponents: Partial<Components> = {\n a: function ConversationMarkdownLink({\n href,\n children,\n ...props\n }: React.ComponentPropsWithoutRef<'a'>) {\n const deploymentDomain = useBlocksEnvironment().runtimeConfig.deploymentDomain\n // @mentions: `linkMentions` turned them into `#mention-<id>` links; draw them as chips.\n const mention = mentionFromHref(href)\n if (mention) {\n return <MentionLink kind={mention.kind} id={mention.id} text={childrenText(children)} />\n }\n // Bookmarks: in-page anchors are near-invisible text; the menu jumps or copies the place.\n if (href?.startsWith('#') && !href.startsWith('#cite-')) {\n return (\n <QuietLink href={href} kind=\"anchor\">\n {children}\n </QuietLink>\n )\n }\n // Citations, `cite:` references and bare links: the kit's link.\n if (!href || href.startsWith('#') || href.startsWith('cite:')) {\n return (\n <MarkdownLink href={href} {...props}>\n {children}\n </MarkdownLink>\n )\n }\n // A workspace document is not an external link, wherever it is hosted: it opens in the viewer.\n const docId = workspaceDocIdFromHref(href, deploymentDomain)\n if (docId) {\n return (\n <InternalDocLink docId={docId} href={href} {...props}>\n {children}\n </InternalDocLink>\n )\n }\n return (\n <ExternalLink href={href} {...props}>\n {children}\n </ExternalLink>\n )\n },\n code: function ConversationMarkdownCode(\n props: React.ComponentPropsWithoutRef<'code'> & { inline?: boolean }\n ) {\n const isStreaming = useContext(MarkdownStreamingContext)\n const { className, children } = props\n const language = /language-(\\w+)/.exec(className || '')?.[1]\n if (!language) {\n // Answers often backtick a bare doc id (`doc-f7b3eeb5`). The text-node pass skips code, so\n // the id would stay monospace text; show it as the document pill. Only a whole id (eight\n // alphanumerics): while streaming, a partial one (\"doc-e\") would be looked up and 404.\n const codeText = typeof children === 'string' ? children.trim() : ''\n if (/^doc-[a-zA-Z0-9]{8}$/.test(codeText)) return <DocumentChip docId={codeText} />\n if (/^eml-[a-zA-Z0-9]{8}$/.test(codeText)) return <MailChip mailId={codeText} />\n }\n // Mermaid lazy-loads its own bundle and re-renders SVG on every change. While streaming the\n // fence is almost always partial, so it stays a code block until generation completes.\n if (language === 'mermaid' && !isStreaming) {\n return <MermaidDiagram chart={String(children).replace(/\\n$/, '')} />\n }\n return <MarkdownCode {...props} />\n },\n span: ({ children, className, ...props }: React.ComponentPropsWithoutRef<'span'>) => {\n const docId = (props as Record<string, unknown>)['data-doc-id'] as string | undefined\n if (docId) return <DocumentChip docId={docId} />\n const mailId = (props as Record<string, unknown>)['data-mail-id'] as string | undefined\n if (mailId) return <MailChip mailId={mailId} />\n return (\n <span className={className} {...props}>\n {children}\n </span>\n )\n },\n}\n\n/** Bare `doc-…` / `eml-…` ids in text become `<span data-doc-id>` / `<span data-mail-id>` pills. */\nconst conversationRehypePlugins = [rehypeDocEntityPills]\n\nexport type ConnectedMarkdownProps = Omit<\n KitMarkdownRendererProps,\n 'rehypePlugins' | 'allowHtml' | 'renderCitation'\n>\n\n/**\n * The kit's renderer with the conversation's overrides; a caller's `components` (e.g. the citation\n * core's) still win over both.\n */\nfunction ConnectedMarkdownComponent({ components, ...props }: ConnectedMarkdownProps) {\n const merged = useMemo(\n () =>\n components\n ? { ...conversationMarkdownComponents, ...components }\n : conversationMarkdownComponents,\n [components]\n )\n return (\n <KitMarkdownRenderer {...props} components={merged} rehypePlugins={conversationRehypePlugins} />\n )\n}\n\nexport const ConnectedMarkdown = React.memo(ConnectedMarkdownComponent)\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkQ6N5D3R5_cjs = require('./chunk-Q6N5D3R5.cjs');
4
+ var chunk23I5EUZA_cjs = require('./chunk-23I5EUZA.cjs');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
7
  function StreamedWordArtifact({
@@ -15,7 +15,7 @@ function StreamedWordArtifact({
15
15
  }) {
16
16
  if (!busy && documentId) {
17
17
  return /* @__PURE__ */ jsxRuntime.jsx(
18
- chunkQ6N5D3R5_cjs.NativeDocxEditor,
18
+ chunk23I5EUZA_cjs.NativeDocxEditor,
19
19
  {
20
20
  adapter,
21
21
  documentId,
@@ -26,7 +26,7 @@ function StreamedWordArtifact({
26
26
  );
27
27
  }
28
28
  return /* @__PURE__ */ jsxRuntime.jsx(
29
- chunkQ6N5D3R5_cjs.NativeDocxEditor,
29
+ chunk23I5EUZA_cjs.NativeDocxEditor,
30
30
  {
31
31
  adapter,
32
32
  documentId: "stream-preview",
@@ -39,5 +39,5 @@ function StreamedWordArtifact({
39
39
  }
40
40
 
41
41
  exports.StreamedWordArtifact = StreamedWordArtifact;
42
- //# sourceMappingURL=chunk-6B4CCDDB.cjs.map
43
- //# sourceMappingURL=chunk-6B4CCDDB.cjs.map
42
+ //# sourceMappingURL=chunk-ESVRVZ53.cjs.map
43
+ //# sourceMappingURL=chunk-ESVRVZ53.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":["jsx","NativeDocxEditor"],"mappings":";;;;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACEA,cAAA;AAAA,MAACC,kCAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACED,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-6B4CCDDB.cjs","sourcesContent":["import { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface StreamedWordArtifactProps {\n adapter: NativeDocxAdapter\n /** Streamed Markdown, shown as a read-only preview while the draft is generated. */\n content: string\n title: string\n busy: boolean\n error?: string | null\n /** The DOCX draft the server stored for this generation (`doc-…`), once known. */\n documentId?: string\n onSaved?: (documentId: string) => void\n}\n\n/**\n * One drafting surface for an AI document draft. The server stores every draft as DOCX, so\n * this component never creates a document: it previews the streamed Markdown until generation\n * ends and the stored DOCX is known, then opens that DOCX in the live collaborative editor.\n */\nexport function StreamedWordArtifact({\n adapter,\n content,\n title,\n busy,\n error,\n documentId,\n onSaved,\n}: StreamedWordArtifactProps) {\n if (!busy && documentId) {\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={title}\n onSaved={onSaved}\n />\n )\n }\n return (\n <NativeDocxEditor\n key=\"stream-preview\"\n adapter={adapter}\n documentId=\"stream-preview\"\n title={title}\n draftContent=\"\"\n stream={{ content, busy, error }}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":["jsx","NativeDocxEditor"],"mappings":";;;;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACEA,cAAA;AAAA,MAACC,kCAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACED,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-ESVRVZ53.cjs","sourcesContent":["import { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface StreamedWordArtifactProps {\n adapter: NativeDocxAdapter\n /** Streamed Markdown, shown as a read-only preview while the draft is generated. */\n content: string\n title: string\n busy: boolean\n error?: string | null\n /** The DOCX draft the server stored for this generation (`doc-…`), once known. */\n documentId?: string\n onSaved?: (documentId: string) => void\n}\n\n/**\n * One drafting surface for an AI document draft. The server stores every draft as DOCX, so\n * this component never creates a document: it previews the streamed Markdown until generation\n * ends and the stored DOCX is known, then opens that DOCX in the live collaborative editor.\n */\nexport function StreamedWordArtifact({\n adapter,\n content,\n title,\n busy,\n error,\n documentId,\n onSaved,\n}: StreamedWordArtifactProps) {\n if (!busy && documentId) {\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={title}\n onSaved={onSaved}\n />\n )\n }\n return (\n <NativeDocxEditor\n key=\"stream-preview\"\n adapter={adapter}\n documentId=\"stream-preview\"\n title={title}\n draftContent=\"\"\n stream={{ content, busy, error }}\n />\n )\n}\n"]}
@@ -585,6 +585,7 @@ function RemoteControlPill({
585
585
  label,
586
586
  onDisable,
587
587
  disableLabel: disableLabelProp,
588
+ showDisableLabel = false,
588
589
  labels,
589
590
  "data-testid": testId,
590
591
  disableTestId
@@ -603,7 +604,7 @@ function RemoteControlPill({
603
604
  children: [
604
605
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MousePointerClick, { className: ui.cn("size-3.5 shrink-0", isActive && "animate-pulse") }),
605
606
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 max-w-[16rem] truncate", children: label }),
606
- /* @__PURE__ */ jsxRuntime.jsx(
607
+ /* @__PURE__ */ jsxRuntime.jsxs(
607
608
  "button",
608
609
  {
609
610
  type: "button",
@@ -611,8 +612,14 @@ function RemoteControlPill({
611
612
  title: disableLabel,
612
613
  "aria-label": disableLabel,
613
614
  "data-testid": chunkPLIF5CUV_cjs.testIdOr(disableTestId, { testId: "remote-control-indicator-disable" }),
614
- className: "flex size-5 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-foreground/10 hover:text-foreground pointer-coarse:size-8",
615
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5" })
615
+ className: ui.cn(
616
+ "flex shrink-0 items-center justify-center rounded-full transition-colors hover:bg-foreground/10 hover:text-foreground",
617
+ showDisableLabel ? "gap-1 px-2 py-1" : "size-5 pointer-coarse:size-8"
618
+ ),
619
+ children: [
620
+ showDisableLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: disableLabel }),
621
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5" })
622
+ ]
616
623
  }
617
624
  )
618
625
  ]
@@ -895,5 +902,5 @@ exports.resolveSidebarLayout = resolveSidebarLayout;
895
902
  exports.useCloseOnEscape = useCloseOnEscape;
896
903
  exports.useSidebarController = useSidebarController;
897
904
  exports.useSidebarSettle = useSidebarSettle;
898
- //# sourceMappingURL=chunk-KA3F6TIH.cjs.map
899
- //# sourceMappingURL=chunk-KA3F6TIH.cjs.map
905
+ //# sourceMappingURL=chunk-IWHP7FAB.cjs.map
906
+ //# sourceMappingURL=chunk-IWHP7FAB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shell/ShellSidebar.tsx","../src/lib/use-close-on-escape.ts","../src/lib/sidebar-mode.ts","../src/shell/use-sidebar-controller.ts","../src/shell/SidebarRowAction.tsx","../src/shell/AskField.tsx","../src/shell/ActionCluster.tsx","../src/shell/StatusRow.tsx","../src/shell/OfflinePill.tsx","../src/shell/RemoteControlPill.tsx","../src/shell/TipCard.tsx","../src/shell/DockZone.tsx"],"names":["jsxs","Sidebar","jsx","useRef","useEffect","useState","useControllableState","useIsPhone","useIsNarrow","useIsTouchScreen","useCallback","useContext","SidebarRowHoverContext","cn","BlocksTooltipProvider","Tooltip","TooltipTrigger","TooltipContent","testIdOr","Sparkles","Button","Search","ArrowUp","X","useId","STATUS_ROW_TONES","STATUS_ROW_BASE_CLASS","WifiOff","TriangleAlert","RefreshCw","MousePointerClick","Lightbulb","Pencil","ChevronLeft","ChevronRight","containerWidth"],"mappings":";;;;;;;;;;;;;AAyCO,SAAS,YAAA,CAAa;AAAA,EAC3B,UAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,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Ac;AAAA;AACrC;AAAA,KACF;AAAA,IAEC,UAAA,IAAc,YAAA,KAAiB,IAAA,oBAC9BX,cAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,mEAAA;AAAA,QACV,KAAA,EAAO,EAAE,IAAA,EAAM,YAAA;AAAa;AAAA,KAC9B;AAAA,IAED,UAAA,oBAAcA,cAAAA,CAAC,KAAA,EAAA,EAAI,WAAU,yCAAA,EAA0C;AAAA,GAAA,EAC1E,CAAA;AAEJ","file":"chunk-IWHP7FAB.cjs","sourcesContent":["import type { ReactNode } from 'react'\nimport { Sidebar, type SidebarRootProps } from './Sidebar'\nimport type { SidebarController } from './use-sidebar-controller'\nimport type { NavItem, NavSection } from './types'\n\nexport interface ShellSidebarProps extends Pick<\n SidebarRootProps,\n 'className' | 'aria-label' | 'labels' | 'backdropTestId'\n> {\n /** From `useSidebarController`: layout, hover/pin/drawer behaviour. */\n controller: SidebarController\n /** Brand mark of the phone drawer's header (logo + close). Omit for no drawer header. */\n drawerLogo?: ReactNode\n /** `data-testid` of the drawer's close button. */\n drawerCloseTestId?: string\n /** Top block (workspace switcher, ask field, pin toggle). Read `controller.expanded` for the rail. */\n header?: ReactNode\n /** Rows as data. */\n items?: NavItem[]\n /** Labelled groups of rows as data, after `items`. */\n sections?: NavSection[]\n navClassName?: string\n /**\n * Width-bound cards at the top of the footer (smart tips, notices): shown only once the panel\n * has settled open, and gone the instant it starts to close.\n */\n tips?: ReactNode\n /** The rest of the footer (status rows, account rows). */\n footer?: ReactNode\n /** Root `data-testid` (default `sidebar`). */\n 'data-testid'?: string\n}\n\n/**\n * The whole sidebar from a controller and data: `Sidebar.Root` in the resolved mode, the phone\n * drawer header, the header slot, the nav rows/groups and the footer. Renders nothing while the\n * layout is hidden (a phone with the drawer closed), so no clipped rows carry duplicate test ids.\n *\n * const sidebar = useSidebarController({ isPinned, onPinnedChange: setPinned })\n * <ShellSidebar controller={sidebar} header={…} items={nav} footer={…} />\n */\nexport function ShellSidebar({\n controller,\n drawerLogo,\n drawerCloseTestId,\n header,\n items,\n sections,\n navClassName,\n tips,\n footer,\n ...rootProps\n}: ShellSidebarProps) {\n if (controller.layout.hidden) return null\n return (\n <Sidebar.Root {...controller.rootProps} {...rootProps}>\n {controller.isDrawer && drawerLogo && (\n <Sidebar.DrawerHeader\n logo={drawerLogo}\n onClose={controller.closeDrawer}\n data-testid={drawerCloseTestId}\n />\n )}\n {header && <Sidebar.Header>{header}</Sidebar.Header>}\n <Sidebar.Nav items={items} sections={sections} className={navClassName} />\n {(tips || footer) && (\n <Sidebar.Footer>\n {controller.tipsVisible && tips}\n {footer}\n </Sidebar.Footer>\n )}\n </Sidebar.Root>\n )\n}\n","import { useEffect, useRef } from 'react'\n\n/**\n * While `isActive`, Escape calls `onClose`. For surfaces that float over the page without being a\n * modal (no backdrop, no focus trap), so nothing else closes them from the keyboard. An Escape a\n * dialog already handled (`defaultPrevented`) is left alone so one press closes one layer.\n */\nexport function useCloseOnEscape(isActive: boolean, onClose: () => void): void {\n const onCloseRef = useRef(onClose)\n useEffect(() => {\n onCloseRef.current = onClose\n })\n\n useEffect(() => {\n if (!isActive) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onCloseRef.current()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isActive])\n}\n","import { useEffect, useRef, useState } from 'react'\n\n/**\n * Headless sidebar behaviour (no DOM, no store): how the sidebar lays out for a given set of\n * inputs, and the settle timing that keeps labels/tips from squeezing during the width transition.\n *\n * - `drawer` small-screen off-canvas panel (opened by the app bar's menu button)\n * - `collapsed` hidden (width 0): a phone with the drawer closed, or `isCollapsed`\n * - `pinned` full width, inline, pushes the content\n * - `rail` icon strip that floats open to full width while hovered\n */\nexport type SidebarMode = 'drawer' | 'collapsed' | 'pinned' | 'rail'\n\nexport interface SidebarModeInput {\n isSmallScreen: boolean\n /** The phone drawer was requested open. */\n isDrawerRequested: boolean\n isCollapsed: boolean\n isPinned: boolean\n isHovering: boolean\n /**\n * Tablet-width viewport (above the phone drawer breakpoint but too narrow to give the content a\n * usable column next to a 255px panel): pinning is ignored and the sidebar stays an icon rail.\n */\n isNarrow?: boolean\n}\n\nexport interface SidebarLayout {\n mode: SidebarMode\n /** Labels should be shown (the panel is, or is becoming, full width). */\n expanded: boolean\n /** Phones: nothing is rendered until the drawer opens. */\n hidden: boolean\n /** Hover state that actually applies (never on touch-sized screens). */\n hovering: boolean\n}\n\nexport function resolveSidebarLayout(input: SidebarModeInput): SidebarLayout {\n const { isSmallScreen, isDrawerRequested, isCollapsed, isPinned, isHovering } = input\n const canPin = isPinned && !isSmallScreen && !input.isNarrow\n const drawerOpen = isSmallScreen && isDrawerRequested\n // Small screens are drawer-only: when it is closed the panel is fully off-canvas\n // regardless of pinning (pinning is a desktop concept), and hover never expands.\n const effectiveCollapsed = isCollapsed || (isSmallScreen && !drawerOpen)\n const hovering = isHovering && !isSmallScreen\n\n let mode: SidebarMode\n if (drawerOpen) mode = 'drawer'\n else if (effectiveCollapsed) mode = 'collapsed'\n else if (canPin) mode = 'pinned'\n else mode = 'rail'\n\n // `hovering`, not `isHovering`: a stale hover flag must not report a hidden phone sidebar as expanded.\n const expanded = drawerOpen || (!effectiveCollapsed && (canPin || hovering))\n\n return { mode, expanded, hidden: isSmallScreen && !drawerOpen, hovering }\n}\n\n/**\n * Settle timing around the width transition (default 300ms):\n * - `labelsExpanded` switches on immediately but off only after the transition, so labels do not\n * snap to icon-only while the panel is still wide;\n * - `tipsVisible` is the opposite: width-bound content (a tip card) appears only once the panel\n * has fully opened and disappears the instant collapse starts.\n */\nexport function useSidebarSettle(expanded: boolean, settleMs = 300) {\n const [labelsExpanded, setLabelsExpanded] = useState(expanded)\n const [tipsVisible, setTipsVisible] = useState(expanded)\n const labelsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const tipsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useEffect(() => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n if (expanded) setLabelsExpanded(true)\n else labelsTimer.current = setTimeout(() => setLabelsExpanded(false), settleMs)\n return () => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n }\n }, [expanded, settleMs])\n\n useEffect(() => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n if (expanded) tipsTimer.current = setTimeout(() => setTipsVisible(true), settleMs)\n else setTipsVisible(false)\n return () => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n }\n }, [expanded, settleMs])\n\n return { labelsExpanded, tipsVisible }\n}\n","import { useCallback, useEffect, useRef, type PointerEvent } from 'react'\nimport { useControllableState } from '../lib/useControllableState'\nimport { useCloseOnEscape } from '../lib/use-close-on-escape'\nimport { useIsNarrow, useIsPhone, useIsTouchScreen } from '../lib/use-media-query'\nimport { resolveSidebarLayout, useSidebarSettle, type SidebarLayout } from '../lib/sidebar-mode'\nimport type { SidebarRootProps } from './Sidebar'\n\nexport interface UseSidebarControllerOptions {\n /** Pinned open (desktop). Controlled when set; otherwise kept here, seeded by `defaultPinned`. */\n isPinned?: boolean\n /** Default `true`. */\n defaultPinned?: boolean\n onPinnedChange?: (isPinned: boolean) => void\n /** The rail is floated open (hover, or its toggle at a narrow width). Controlled when set. */\n isHovering?: boolean\n onHoveringChange?: (isHovering: boolean) => void\n /** The phone drawer is open. Controlled when set (the app bar's menu button opens it). */\n isDrawerOpen?: boolean\n onDrawerOpenChange?: (isDrawerOpen: boolean) => void\n /**\n * Keep the sidebar a rail even when pinned, on top of the tablet width (for example while a\n * docked panel squeezes the content). The stored pin is left untouched.\n */\n forceRail?: boolean\n /**\n * Which rails expand on pointer enter. The default ignores narrow and emulated touch hover;\n * `all` retains hover expansion for a host whose narrow rail has no separate expand button.\n */\n hoverExpansion?: 'desktop-pointer' | 'all'\n}\n\n/** The `Sidebar.Root` props the controller resolves. */\nexport type SidebarControllerRootProps = Pick<\n SidebarRootProps,\n | 'mode'\n | 'expanded'\n | 'isHovering'\n | 'onBackdropClick'\n | 'hasRailBackdrop'\n | 'onPointerEnter'\n | 'onPointerLeave'\n>\n\nexport interface SidebarController {\n layout: SidebarLayout\n /** Labels shown (settled: they stay on until the closing transition ends). */\n expanded: boolean\n /** Width-bound content (tips, notices) may show: on once fully open, off as closing starts. */\n tipsVisible: boolean\n /** The phone drawer is showing. */\n isDrawer: boolean\n isSmallScreen: boolean\n /** Tablet width (or `forceRail`): pinning is ignored and the sidebar stays a rail. */\n isNarrow: boolean\n /** The pin as it applies (always off while narrow). */\n isPinned: boolean\n /** Spread onto `Sidebar.Root` (or pass the controller to `ShellSidebar`). */\n rootProps: SidebarControllerRootProps\n openDrawer: () => void\n closeDrawer: () => void\n /** The pin toggle: pins/unpins, or floats the rail open/closed while narrow. */\n togglePin: () => void\n /** Open from the rail (its ask button): pins, or floats the rail open while narrow. */\n expand: () => void\n /** After a nav row is chosen: closes the drawer, and a floated rail the pointer has left. */\n afterNavigate: () => void\n}\n\n// A menu opened from the rail (the account menu) is positioned against the sidebar's current\n// layout. Hovering that menu from the content would expand the rail, re-anchor the menu under\n// the pointer and move the item being clicked, so hover does not expand the rail while one is open.\nconst isMenuOpen = () =>\n typeof document !== 'undefined' &&\n document.querySelector('[role=\"menu\"][data-state=\"open\"]') !== null\n\n/**\n * Sidebar behaviour as one hook, shared by every shell: resolves the layout (drawer / pinned /\n * rail) for the viewport, settles labels and tips around the width transition, and owns the hover,\n * pin and drawer rules:\n * - touch: the rail opens only through its toggle, never by the pointer enter of a tap;\n * - narrow: a pointer drifting over the rail does not float the labels over the content;\n * - Escape closes a floated rail; the drawer closes itself when the viewport grows past a phone;\n * - choosing a row closes the drawer, and a floated rail unless the pointer is still over it.\n *\n * State is controlled per field (`isPinned`, `isHovering`, `isDrawerOpen`) so an app can keep it\n * in its own store, or uncontrolled for a shell that does not care.\n */\nexport function useSidebarController(options: UseSidebarControllerOptions = {}): SidebarController {\n const [storedPinned, setPinned] = useControllableState(\n options.isPinned,\n options.defaultPinned ?? true,\n options.onPinnedChange\n )\n const [isHovering, setHovering] = useControllableState(\n options.isHovering,\n false,\n options.onHoveringChange\n )\n const [isDrawerOpen, setDrawerOpen] = useControllableState(\n options.isDrawerOpen,\n false,\n options.onDrawerOpenChange\n )\n\n const isSmallScreen = useIsPhone()\n const isNarrow = useIsNarrow() || !!options.forceRail\n const isTouch = useIsTouchScreen()\n\n const layout = resolveSidebarLayout({\n isSmallScreen,\n isDrawerRequested: isDrawerOpen,\n isCollapsed: false,\n isPinned: storedPinned,\n isHovering,\n isNarrow,\n })\n const isDrawer = layout.mode === 'drawer'\n const { labelsExpanded, tipsVisible } = useSidebarSettle(layout.expanded)\n\n // Whether the pointer is physically over the sidebar (decides if navigating closes the rail).\n const isPointerOver = useRef(false)\n\n const closeDrawer = useCallback(() => setDrawerOpen(false), [setDrawerOpen])\n const openDrawer = useCallback(() => setDrawerOpen(true), [setDrawerOpen])\n\n // The floated rail has no modal behaviour (the drawer gets Escape from `Sidebar.Root`).\n useCloseOnEscape(layout.mode === 'rail' && layout.hovering, () => setHovering(false))\n\n // A drawer left open when the viewport grows past a phone (rotate/resize) would be a stuck overlay.\n useEffect(() => {\n if (isDrawerOpen && !isSmallScreen) setDrawerOpen(false)\n }, [isDrawerOpen, isSmallScreen, setDrawerOpen])\n\n const onPointerEnter = (event: PointerEvent<HTMLElement>) => {\n // Primary-input media queries can report touch even while a mouse is in use.\n if (event.pointerType !== 'mouse' && options.hoverExpansion !== 'all') return\n isPointerOver.current = true\n if (\n !isSmallScreen &&\n (!isNarrow || options.hoverExpansion === 'all') &&\n (!isMenuOpen() || options.hoverExpansion === 'all')\n )\n setHovering(true)\n }\n const onPointerLeave = (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== 'mouse' && options.hoverExpansion !== 'all') return\n isPointerOver.current = false\n if (!isSmallScreen) setHovering(false)\n }\n\n return {\n layout,\n expanded: labelsExpanded,\n tipsVisible,\n isDrawer,\n isSmallScreen,\n isNarrow,\n isPinned: storedPinned && !isNarrow,\n rootProps: {\n mode: layout.mode,\n expanded: labelsExpanded,\n isHovering: layout.hovering,\n onBackdropClick: isDrawer ? closeDrawer : () => setHovering(false),\n hasRailBackdrop: isTouch,\n onPointerEnter,\n onPointerLeave,\n },\n openDrawer,\n closeDrawer,\n togglePin: () => (isNarrow ? setHovering(!isHovering) : setPinned(!storedPinned)),\n expand: () => (isNarrow ? setHovering(true) : setPinned(true)),\n afterNavigate: () => {\n if (!isPointerOver.current && !storedPinned) setHovering(false)\n if (isDrawer) closeDrawer()\n },\n }\n}\n","import { useContext, type ReactNode } from 'react'\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { BlocksTooltipProvider } from '../provider/TooltipScope'\nimport { SidebarRowHoverContext } from './Sidebar'\n\nexport type SidebarRowActionPulse = 'active' | 'success' | 'error'\n\nexport interface SidebarRowActionProps {\n /** The row this control sits on is selected: the glyph takes the selection ink. */\n active?: boolean\n onClick?: () => void\n /** Tooltip text and accessible label. */\n label: string\n /**\n * Demand attention while the row is idle: `active` pulses primary (work in progress),\n * `success` pulses green (just finished), `error` is a steady red alert. A selected row wins.\n */\n pulse?: SidebarRowActionPulse | null\n 'data-testid'?: string\n children: ReactNode\n}\n\nconst PULSE_STYLES: Record<SidebarRowActionPulse, string> = {\n active: 'animate-pulse-attention text-primary',\n success: 'animate-pulse-attention text-green-text',\n // Steady (not animated) so a failure stays put and reads as a standing alert.\n error: 'text-red-text opacity-100',\n}\n\n/**\n * The secondary control at the right edge of a sidebar row: a small muted glyph. Always visible\n * (touch has no hover); hovering or focusing the row only brightens it a tone, through\n * SidebarRowHoverContext. Stops propagation so it never triggers the row's own click.\n */\nexport function SidebarRowAction({\n active = false,\n onClick,\n label,\n pulse = null,\n 'data-testid': testId,\n children,\n}: SidebarRowActionProps) {\n const rowHovered = useContext(SidebarRowHoverContext)\n\n const tone = active\n ? 'text-accent-foreground hover:bg-background/60'\n : pulse\n ? `${PULSE_STYLES[pulse]} hover:bg-muted`\n : cn(\n 'text-muted-foreground hover:bg-muted hover:text-foreground',\n rowHovered ? 'opacity-100' : 'opacity-70'\n )\n\n return (\n <BlocksTooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild onFocusCapture={(e) => e.stopPropagation()}>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onClick?.()\n }}\n aria-label={label}\n data-slot=\"sidebar-row-action\"\n data-testid={testId}\n className={cn('rounded-md p-1 transition-colors pointer-coarse:p-2.5', tone)}\n >\n {children}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\">{label}</TooltipContent>\n </Tooltip>\n </BlocksTooltipProvider>\n )\n}\n","import type { InputHTMLAttributes, KeyboardEvent, ReactNode, Ref } from 'react'\nimport { ArrowUp, Search, Sparkles, X } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the ask field, its trigger and the expanded row. */\nexport interface AskFieldLabels {\n /** Input placeholder (the `placeholder` prop wins). */\n placeholder: string\n /** The input's accessible name. */\n inputLabel: string\n search: string\n askAi: string\n /** The icon-only trigger. */\n askOrSearch: string\n closeSearch: string\n}\n\nexport const DEFAULT_ASK_FIELD_LABELS: AskFieldLabels = {\n placeholder: 'Ask or search…',\n inputLabel: 'Ask AI or search your documents',\n search: 'Search',\n askAi: 'Ask AI',\n askOrSearch: 'Ask AI or search',\n closeSearch: 'Close search',\n}\n\nexport interface AskFieldProps {\n value: string\n onValueChange: (value: string) => void\n /** Enter / the arrow button: ask AI. */\n onAsk: (text: string) => void\n /** The magnifier button: semantic search. */\n onSearch: (text: string) => void\n /** Intercept keys first (e.g. a slash menu); call `preventDefault` to stop the default Enter-asks. */\n onInputKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void\n /** Rendered just under the field at its width (a slash/autocomplete menu). */\n menu?: ReactNode\n inputRef?: Ref<HTMLInputElement>\n /** Extra attributes for the input, e.g. the combobox props of `useListKeyNav` for a slash menu. */\n inputProps?: InputHTMLAttributes<HTMLInputElement>\n placeholder?: string\n labels?: Partial<AskFieldLabels>\n autoFocus?: boolean\n className?: string\n /** Root id (default `workspace-ask-bar`); the input/search/submit ids are `<root>-input|search|submit`. */\n 'data-testid'?: string\n}\n\n/**\n * The compact one-line ask/search field: sparkle, input, then two icon doors (Search, Ask AI).\n * Text and the menu are controlled by the host, so the same field serves the sidebar, the phone\n * app bar and any custom shell.\n */\nexport function AskField({\n value,\n onValueChange,\n onAsk,\n onSearch,\n onInputKeyDown,\n menu,\n inputRef,\n inputProps,\n placeholder,\n labels,\n autoFocus = false,\n className,\n 'data-testid': testIdProp,\n}: AskFieldProps) {\n const testId = testIdOr(testIdProp, { testId: 'workspace-ask-bar' })\n const l = { ...DEFAULT_ASK_FIELD_LABELS, ...labels }\n const isEmpty = !value.trim()\n const submit = (handler: (text: string) => void) => {\n const text = value.trim()\n if (text) handler(text)\n }\n\n return (\n <div className={cn('relative', className)} data-slot=\"ask-field\" data-testid={testId}>\n {menu && <div className=\"absolute inset-x-0 top-9 z-30\">{menu}</div>}\n <div\n role=\"search\"\n className=\"flex h-9 items-center gap-0.5 rounded-md border border-border bg-background pl-2.5 pr-0.5 transition-colors focus-within:border-primary focus-within:ring-3 focus-within:ring-primary pointer-coarse:h-11\"\n >\n <Sparkles aria-hidden=\"true\" className=\"size-4 shrink-0 text-ai-ink\" />\n <input\n {...inputProps}\n ref={inputRef}\n type=\"text\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n onKeyDown={(e) => {\n onInputKeyDown?.(e)\n // Enter asks (not mid-IME-composition). A plain div, not a <form>.\n if (e.defaultPrevented) return\n if (e.key === 'Enter' && !e.nativeEvent.isComposing) {\n e.preventDefault()\n submit(onAsk)\n }\n }}\n placeholder={placeholder ?? l.placeholder}\n aria-label={l.inputLabel}\n autoFocus={autoFocus}\n className=\"ml-1.5 h-8 min-w-0 flex-1 bg-transparent pointer-coarse:h-11 text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n data-testid={`${testId}-input`}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={isEmpty}\n onClick={() => submit(onSearch)}\n title={l.search}\n aria-label={l.search}\n className=\"size-7 shrink-0 text-muted-foreground hover:text-foreground pointer-coarse:size-10\"\n data-testid={`${testId}-search`}\n >\n <Search className=\"size-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={isEmpty}\n onClick={() => submit(onAsk)}\n title={l.askAi}\n aria-label={l.askAi}\n className=\"!inline-flex size-7 shrink-0 text-ai-ink hover:bg-ai-soft hover:text-ai-ink pointer-coarse:size-10\"\n data-testid={`${testId}-submit`}\n >\n <ArrowUp className=\"size-4\" />\n </Button>\n </div>\n </div>\n )\n}\n\nexport interface AskTriggerProps {\n /** Opens the ask field (or the palette): one action that asks AI and searches. */\n onClick: () => void\n /** `rail`: the icon-only sidebar's bordered tile; `appbar`: the phone app bar's bare icon. */\n variant?: 'rail' | 'appbar'\n labels?: Partial<Pick<AskFieldLabels, 'askOrSearch'>>\n 'data-testid'?: string\n}\n\n/** The icon that stands in for the field where there is no room for it. */\nexport function AskTrigger({\n onClick,\n variant = 'rail',\n labels,\n 'data-testid': testId,\n}: AskTriggerProps) {\n const text = labels?.askOrSearch ?? DEFAULT_ASK_FIELD_LABELS.askOrSearch\n return (\n <button\n type=\"button\"\n onClick={onClick}\n title={text}\n aria-label={text}\n data-slot=\"ask-trigger\"\n data-testid={testId}\n className={cn(\n 'flex items-center justify-center rounded-md text-ai-ink transition-colors hover:bg-ai-soft',\n variant === 'rail'\n ? 'h-9 w-12 border border-border bg-background pointer-coarse:h-11'\n : 'size-11'\n )}\n >\n <Sparkles className={variant === 'rail' ? 'size-4' : 'size-5'} />\n </button>\n )\n}\n\nexport interface AskRowProps {\n /** The field (an AskField). */\n children: ReactNode\n onClose: () => void\n labels?: Partial<Pick<AskFieldLabels, 'closeSearch'>>\n /** Row id (default `workspace-ask-bar-expanded`). */\n 'data-testid'?: string\n /** Collapse button id (default `workspace-ask-bar-collapse`). */\n collapseTestId?: string\n}\n\n/** The phone's expanded ask row: takes over the app bar so there is room to type; Escape closes. */\nexport function AskRow({\n children,\n onClose,\n labels,\n 'data-testid': testId,\n collapseTestId,\n}: AskRowProps) {\n return (\n <div\n className=\"flex h-14 flex-shrink-0 items-center gap-1 bg-background px-3 pt-safe\"\n data-slot=\"ask-row\"\n data-testid={testIdOr(testId, { testId: 'workspace-ask-bar-expanded' })}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onClose()\n }}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={labels?.closeSearch ?? DEFAULT_ASK_FIELD_LABELS.closeSearch}\n data-testid={testIdOr(collapseTestId, { testId: 'workspace-ask-bar-collapse' })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n >\n <X className=\"size-5\" />\n </button>\n </div>\n )\n}\n","import { useId, type MouseEvent, type ReactNode } from 'react'\nimport type { ShellActionLayout } from './types'\n\nexport interface ActionClusterProps {\n /**\n * `bar`: one row for a page header or phone app bar (status, bell, contacts, account).\n * `sidebar`: the bottom of the expanded sidebar: the bell and contacts rows stacked above the\n * account row.\n * `rail`: the same stack on the icon-only rail (same order, icon-only rows).\n * `drawer`: the phone drawer's rows (bell and contacts only; the app bar carries the account).\n */\n layout?: ShellActionLayout\n /** Status pill (remote control); `bar` only. Other layouts show status in their own rows. */\n status?: ReactNode\n /** Report a problem (bug icon), first in the cluster. */\n report?: ReactNode\n /** Notification bell (the kit's NotificationBell, or a `Sidebar.BadgeRow`). */\n mail?: ReactNode\n /** Calendar entry (a `Sidebar.BadgeRow`), right after mail. */\n calendar?: ReactNode\n /** Databases entry (a `Sidebar.BadgeRow`), right after calendar. */\n databases?: ReactNode\n bell?: ReactNode\n /** Contacts / messages entry with its own badge (a `Sidebar.BadgeRow`). */\n contacts?: ReactNode\n /** Account menu (the kit's UserMenu). */\n account?: ReactNode\n /**\n * Names the cluster: the group's accessible name in every layout, and a visible heading above\n * the rows in the `drawer` layout (where phones otherwise get unlabelled rows).\n */\n label?: string\n 'data-testid'?: string\n}\n\n/**\n * The account area: notifications, contacts and the account menu, in one of four placements. In\n * the sidebar and on the rail the two badge rows are stacked above the account row in the same\n * order, so nothing moves when the rail expands; the account menu holds everything else (help,\n * settings, tips, processing).\n */\nexport function ActionCluster({\n layout = 'bar',\n status,\n report,\n mail,\n calendar,\n databases,\n bell,\n contacts,\n account,\n label,\n 'data-testid': testId = 'sidebar-actions',\n}: ActionClusterProps) {\n const labelId = useId()\n // Dashboard's content area resets focus on click, and Radix PORTALS bubble through the React\n // tree: stop clicks here or a dropdown item (e.g. \"View all\") would un-focus the panel it opened.\n const stop = (e: MouseEvent) => e.stopPropagation()\n\n if (layout === 'sidebar' || layout === 'rail' || layout === 'drawer') {\n const rail = layout === 'rail'\n return (\n <div\n className={rail ? 'flex flex-col items-center gap-0.5' : 'flex flex-col gap-0.5'}\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-labelledby={label && layout === 'drawer' ? labelId : undefined}\n aria-label={label && layout !== 'drawer' ? label : undefined}\n data-slot=\"action-cluster\"\n data-layout={layout}\n data-testid={testId}\n >\n {label && layout === 'drawer' && (\n <p\n id={labelId}\n className=\"px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground\"\n data-slot=\"action-cluster-label\"\n >\n {label}\n </p>\n )}\n {bell}\n {mail}\n {calendar}\n {databases}\n {contacts}\n {report}\n {account && layout !== 'drawer' && (\n <div className={rail ? 'mt-1' : 'mt-1 min-w-0'}>{account}</div>\n )}\n </div>\n )\n }\n\n return (\n <div\n className=\"flex items-center gap-1\"\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-label={label}\n data-slot=\"action-cluster\"\n >\n {status}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account}\n </div>\n )\n}\n","import { X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { STATUS_ROW_BASE_CLASS, STATUS_ROW_TONES } from './status-row-styles'\n\nexport type StatusRowTone = 'progress' | 'success' | 'error'\n\nexport interface StatusRowProps {\n tone: StatusRowTone\n /** e.g. \"Processing 3 files…\". Always the accessible name; hidden visually when `compact`. */\n label: string\n /** Opens the thing the status is about (the processing panel). */\n onClick: () => void\n /** Icon-only (the collapsed rail). */\n compact?: boolean\n 'data-testid'?: string\n}\n\n/**\n * A live status line for the sidebar footer: a spinner and a short sentence that opens the\n * thing it reports on. The host renders it ONLY while the state is relevant (work running,\n * something failed), so a quiet app shows nothing. Announced politely to screen readers.\n */\nexport function StatusRow({\n tone,\n label,\n onClick,\n compact = false,\n 'data-testid': testId,\n}: StatusRowProps) {\n const { className, Icon, spin } = STATUS_ROW_TONES[tone]\n return (\n <div role=\"status\" data-slot=\"status-row\" className={cn(compact && 'flex justify-center')}>\n <button\n type=\"button\"\n onClick={onClick}\n aria-label={label}\n title={label}\n data-testid={testId}\n data-tone={tone}\n className={cn(\n STATUS_ROW_BASE_CLASS,\n compact ? 'size-9 justify-center pointer-coarse:size-11' : 'w-full px-2.5 py-1.5',\n className\n )}\n >\n <Icon\n className={cn('size-4 shrink-0', spin && 'animate-spin motion-reduce:animate-none')}\n />\n {!compact && <span className=\"min-w-0 flex-1 truncate text-left\">{label}</span>}\n </button>\n </div>\n )\n}\n\n/** Short live state at a navigation row's right edge, replacing inventory counts. */\nexport function StatusBadge({\n tone,\n label,\n onClick,\n onDismiss,\n 'data-testid': testId,\n}: {\n tone: StatusRowTone\n label: string\n onClick?: () => void\n onDismiss?: () => void\n 'data-testid'?: string\n}) {\n const className = cn(\n 'rounded-md px-1.5 py-0.5 text-xs font-medium whitespace-nowrap',\n STATUS_ROW_TONES[tone].className\n )\n return (\n <span\n role=\"status\"\n className={cn(\n 'ml-auto inline-flex items-center rounded-md',\n STATUS_ROW_TONES[tone].className\n )}\n data-testid={testId}\n data-tone={tone}\n >\n {onClick ? (\n <button\n type=\"button\"\n title={label}\n className={className}\n onClick={(event) => {\n event.stopPropagation()\n onClick()\n }}\n onKeyDown={(event) => event.stopPropagation()}\n >\n {label}\n </button>\n ) : (\n <span className={className}>{label}</span>\n )}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={`Dismiss ${label}`}\n title=\"Dismiss\"\n className=\"mr-1 rounded-sm p-0.5 opacity-60 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n event.stopPropagation()\n onDismiss()\n }}\n onKeyDown={(event) => event.stopPropagation()}\n >\n <X className=\"size-3\" />\n </button>\n )}\n </span>\n )\n}\n","import { RefreshCw, TriangleAlert, WifiOff } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { SidebarRowHoverContext } from './Sidebar'\nimport { SidebarRowAction } from './SidebarRowAction'\n\nexport type OfflinePillTone = 'offline' | 'failed' | 'syncing'\n\n/** Fixed strings of the offline pill. */\nexport interface OfflinePillLabels {\n reconnect: string\n}\n\nexport const DEFAULT_OFFLINE_PILL_LABELS: OfflinePillLabels = {\n reconnect: 'Reconnect',\n}\n\nexport interface OfflinePillProps {\n tone: OfflinePillTone\n /** e.g. \"Offline · 3 pending\", \"2 failed to sync\", \"Syncing 4…\". */\n label: string\n /** Icon-only (the collapsed rail / app bar). */\n compact?: boolean\n /** Opens the pending-changes list. */\n onOpen: () => void\n /** Offered beside the pill (only when not compact); pass it only while it can do something. */\n onReconnect?: () => void\n labels?: Partial<OfflinePillLabels>\n /** Pill button id (default `offline-sync-status`). */\n 'data-testid'?: string\n /** Reconnect button id (default `offline-reconnect-button`). */\n reconnectTestId?: string\n}\n\nconst TONES: Record<OfflinePillTone, { className: string; Icon: typeof WifiOff }> = {\n offline: { className: 'bg-yellow-bg text-yellow-text', Icon: WifiOff },\n failed: { className: 'bg-red-bg text-red-text', Icon: TriangleAlert },\n syncing: { className: 'bg-blue-bg text-blue-text', Icon: RefreshCw },\n}\n\n/**\n * Connection + sync indicator: a status pill that opens the pending-changes list, plus an\n * optional Reconnect button beside it. The app renders it only when there is something to say\n * (offline, or changes waiting/failing), so online-and-synced stays clean.\n */\nexport function OfflinePill({\n tone,\n label,\n compact = false,\n onOpen,\n onReconnect,\n labels,\n 'data-testid': testId,\n reconnectTestId,\n}: OfflinePillProps) {\n const { className, Icon } = TONES[tone]\n return (\n <div\n className={cn('flex items-center gap-1', compact && 'justify-center')}\n data-slot=\"offline-pill\"\n >\n <button\n type=\"button\"\n data-testid={testIdOr(testId, { testId: 'offline-sync-status' })}\n aria-label={label}\n title={label}\n onClick={onOpen}\n className={cn(\n 'flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors hover:brightness-95 pointer-coarse:min-h-11',\n compact && 'flex-none justify-center',\n className\n )}\n >\n <Icon className={cn('size-4 shrink-0', tone === 'syncing' && 'animate-spin')} />\n {!compact && <span className=\"truncate\">{label}</span>}\n </button>\n {!compact && onReconnect && (\n // Forced visible (context true): there is no row to hover.\n <SidebarRowHoverContext.Provider value={true}>\n <SidebarRowAction\n label={labels?.reconnect ?? DEFAULT_OFFLINE_PILL_LABELS.reconnect}\n onClick={onReconnect}\n data-testid={testIdOr(reconnectTestId, { testId: 'offline-reconnect-button' })}\n >\n <RefreshCw className=\"size-5\" />\n </SidebarRowAction>\n </SidebarRowHoverContext.Provider>\n )}\n </div>\n )\n}\n","import { MousePointerClick, X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the remote-control pill. */\nexport interface RemoteControlPillLabels {\n /** The disable button (the `disableLabel` prop wins). */\n turnOffRemoteControl: string\n}\n\nexport const DEFAULT_REMOTE_CONTROL_PILL_LABELS: RemoteControlPillLabels = {\n turnOffRemoteControl: 'Turn off remote control',\n}\n\nexport interface RemoteControlPillProps {\n /** A run is actively driving the screen (tinted + pulsing). */\n isActive: boolean\n label: string\n onDisable: () => void\n disableLabel?: string\n showDisableLabel?: boolean\n labels?: Partial<RemoteControlPillLabels>\n /** Root id (default `remote-control-indicator`). */\n 'data-testid'?: string\n /** Disable button id (default `remote-control-indicator-disable`). */\n disableTestId?: string\n}\n\n/**\n * Persistent, unobtrusive status pill shown while remote control is on or a run is executing,\n * with a one-click disable. The app decides when to mount it.\n */\nexport function RemoteControlPill({\n isActive,\n label,\n onDisable,\n disableLabel: disableLabelProp,\n showDisableLabel = false,\n labels,\n 'data-testid': testId,\n disableTestId,\n}: RemoteControlPillProps) {\n const disableLabel =\n disableLabelProp ??\n labels?.turnOffRemoteControl ??\n DEFAULT_REMOTE_CONTROL_PILL_LABELS.turnOffRemoteControl\n return (\n <div\n data-slot=\"remote-control-pill\"\n // Remote control's own control: a remote run never acts inside it.\n data-remote-control-surface=\"\"\n data-testid={testIdOr(testId, { testId: 'remote-control-indicator' })}\n className={cn(\n 'flex min-w-0 max-w-full items-center gap-1.5 rounded-full py-1 pl-2.5 pr-1 text-xs font-medium',\n isActive ? 'bg-accent text-accent-foreground' : 'bg-muted text-muted-foreground'\n )}\n >\n <MousePointerClick className={cn('size-3.5 shrink-0', isActive && 'animate-pulse')} />\n <span className=\"min-w-0 max-w-[16rem] truncate\">{label}</span>\n <button\n type=\"button\"\n onClick={onDisable}\n title={disableLabel}\n aria-label={disableLabel}\n data-testid={testIdOr(disableTestId, { testId: 'remote-control-indicator-disable' })}\n className={cn(\n 'flex shrink-0 items-center justify-center rounded-full transition-colors hover:bg-foreground/10 hover:text-foreground',\n showDisableLabel ? 'gap-1 px-2 py-1' : 'size-5 pointer-coarse:size-8'\n )}\n >\n {showDisableLabel && <span>{disableLabel}</span>}\n <X className=\"size-3.5\" />\n </button>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { ChevronLeft, ChevronRight, Lightbulb, Pencil, X } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the tip card. */\nexport interface TipCardLabels {\n /** Default CTA text (the `ctaLabel` prop wins). */\n showMe: string\n previousTip: string\n nextTip: string\n editTip: string\n /** The card's heading and accessible name. */\n tip: string\n /** The dismiss button: it turns tips off (they come back from the account menu). */\n hideTips: string\n /** \"1 of 3\". */\n position: (index: number, count: number) => string\n}\n\nexport const DEFAULT_TIP_CARD_LABELS: TipCardLabels = {\n showMe: 'Show me',\n previousTip: 'Previous tip',\n nextTip: 'Next tip',\n editTip: 'Edit tip',\n tip: 'Tip',\n hideTips: 'Hide tips',\n position: (index, count) => `${index} of ${count}`,\n}\n\nexport interface TipCardProps {\n /** The tip text: one sentence. */\n message: ReactNode\n /** Which tip is showing (0-based) out of `count`; the pager appears when `count` > 1. */\n index?: number\n count?: number\n onPrev?: () => void\n onNext?: () => void\n /** The single primary action; omit when the tip has none. */\n ctaLabel?: string\n onCta?: () => void\n /** Turns tips off. The card is dismissible so it never becomes permanent furniture. */\n onDismiss?: () => void\n /** Dev-only edit affordance: the host passes it only in development builds. */\n onEdit?: () => void\n /** Hover pauses the host's tip rotation (desktop enhancement). */\n onHoverChange?: (hovered: boolean) => void\n labels?: Partial<TipCardLabels>\n className?: string\n /** Card id (default `tip-row`). */\n testId?: string\n /** Control ids; defaults are the current ids. */\n testIds?: Partial<Record<'prev' | 'next' | 'cta' | 'edit' | 'dismiss', string>>\n}\n\nconst ICON_BUTTON =\n 'flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-11'\n\n/**\n * The Smart Tips card: a compact muted tile. Header (bulb, \"Tip\", dismiss), one sentence, then\n * ONE primary action with a quiet \"n of m\" pager. It is shown only while tips are on and a tip\n * applies; the host owns which tip is current, rotation and the on/off preference.\n */\nexport function TipCard({\n message,\n index = 0,\n count = 1,\n onPrev,\n onNext,\n ctaLabel,\n onCta,\n onDismiss,\n onEdit,\n onHoverChange,\n labels,\n className,\n testId,\n testIds,\n}: TipCardProps) {\n const l = { ...DEFAULT_TIP_CARD_LABELS, ...labels }\n const hasMany = count > 1\n\n return (\n <section\n data-slot=\"tip-card\"\n aria-label={l.tip}\n className={cn('min-w-0 rounded-lg bg-muted p-3 text-sm', className)}\n onMouseEnter={() => onHoverChange?.(true)}\n onMouseLeave={() => onHoverChange?.(false)}\n data-testid={testIdOr(testId, { testId: 'tip-row' })}\n >\n <div className=\"-my-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground\">\n <Lightbulb className=\"size-4 shrink-0 text-primary\" aria-hidden />\n <span>{l.tip}</span>\n <span className=\"-mr-1.5 ml-auto flex items-center\">\n {onEdit && (\n <button\n type=\"button\"\n onClick={onEdit}\n aria-label={l.editTip}\n title={l.editTip}\n className={cn(ICON_BUTTON, 'text-red-text hover:bg-red-bg hover:text-red-text')}\n data-testid={testIdOr(testIds?.edit, { testId: 'tip-edit' })}\n >\n <Pencil className=\"size-3.5\" />\n </button>\n )}\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label={l.hideTips}\n title={l.hideTips}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.dismiss, { testId: 'tip-dismiss' })}\n >\n <X className=\"size-4\" />\n </button>\n )}\n </span>\n </div>\n <p className=\"mt-2 text-foreground\">{message}</p>\n {(onCta || hasMany) && (\n <div className=\"mt-3 flex items-center justify-between gap-2\">\n {onCta ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onCta}\n className=\"font-medium text-primary\"\n data-testid={testIdOr(testIds?.cta, { testId: 'page-header-info-cta' })}\n >\n {ctaLabel ?? l.showMe}\n </Button>\n ) : (\n <span />\n )}\n {hasMany && (\n <span className=\"-mr-1.5 flex items-center text-xs text-muted-foreground\">\n <button\n type=\"button\"\n onClick={onPrev}\n aria-label={l.previousTip}\n title={l.previousTip}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.prev, { testId: 'tip-prev' })}\n >\n <ChevronLeft className=\"size-4\" />\n </button>\n <span className=\"min-w-10 text-center tabular-nums\" aria-live=\"polite\">\n {l.position(index + 1, count)}\n </span>\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={l.nextTip}\n title={l.nextTip}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.next, { testId: 'tip-next' })}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </span>\n )}\n </div>\n )}\n </section>\n )\n}\n","/**\n * DockZone Component\n *\n * Layout wrapper that provides a resizable right-hand panel area (#dock-zone)\n * where panels in 'docked' mode render via PanelPortal.\n *\n * Uses MutationObserver on the #dock-zone element to detect when content is\n * portaled in/out, so the split layout appears only when a panel is actually\n * mounted — not just when the store says a panel prefers 'docked' mode.\n *\n * The dock zone reads its initial width from the child's data-dock-width\n * attribute (pixels). If absent, defaults to 50% of the container.\n *\n * Below MOBILE_BREAKPOINT_PX, MIN_MAIN_PX + MIN_DOCK_PX (500px combined)\n * can't both fit — the clamp math still ran unconditionally and squeezed the\n * dock pane down to whatever sliver was left (as little as ~90px on a 390px\n * phone), rendering both panes as unusable slivers instead of showing either\n * one properly. Below that width this becomes a single full-width view that\n * swaps between main and docked content instead of splitting — same\n * principle as the Document Viewer's own view-swap (Edit ⇄ Track Changes).\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nconst MIN_DOCK_PX = 200\nconst MIN_MAIN_PX = 300\n// Standard right-panel width — matches the overlay sheet (sm:w-[34rem]) so a\n// panel is the same size whether it's pinned or floating. Pinned stays\n// draggable from here; floating is fixed.\nconst DEFAULT_DOCK_PX = 544\nconst MOBILE_BREAKPOINT_PX = 640\n\ninterface DockZoneProps {\n children: React.ReactNode\n 'data-testid'?: string\n}\n\nexport function DockZone({ children, ...props }: DockZoneProps) {\n const [hasDockedContent, setHasDockedContent] = useState(false)\n const [dockWidth, setDockWidth] = useState<number | null>(null)\n const [isResizing, setIsResizing] = useState(false)\n const [dragPosition, setDragPosition] = useState<number | null>(null)\n const [containerWidth, setContainerWidth] = useState(0)\n const containerRef = useRef<HTMLDivElement>(null)\n const dockZoneRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const el = containerRef.current\n if (!el) return\n const observer = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width\n if (width !== undefined) setContainerWidth(width)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n const isMobile = containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT_PX\n\n // Observe dock-zone children to know when content is actually portaled in\n // Also read initial width from the child's data-dock-width attribute\n useEffect(() => {\n const el = dockZoneRef.current\n if (!el) return\n\n const update = () => {\n const hasChildren = el.children.length > 0\n setHasDockedContent(hasChildren)\n if (hasChildren) {\n const requestedWidth = el.firstElementChild?.getAttribute('data-dock-width')\n if (requestedWidth) {\n setDockWidth(parseInt(requestedWidth, 10))\n }\n }\n }\n\n const observer = new MutationObserver(update)\n update()\n observer.observe(el, { childList: true })\n return () => observer.disconnect()\n }, [])\n\n const handleMouseDown = useCallback(() => {\n setIsResizing(true)\n setDragPosition(null)\n }, [])\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || !containerRef.current) return\n const rect = containerRef.current.getBoundingClientRect()\n const x = e.clientX - rect.left\n // Clamp so neither pane gets too small\n const clamped = Math.min(Math.max(x, MIN_MAIN_PX), rect.width - MIN_DOCK_PX)\n setDragPosition(clamped)\n },\n [isResizing]\n )\n\n const handleMouseUp = useCallback(() => {\n if (dragPosition !== null && containerRef.current) {\n const containerWidth = containerRef.current.getBoundingClientRect().width\n setDockWidth(containerWidth - dragPosition)\n }\n setIsResizing(false)\n setDragPosition(null)\n }, [dragPosition])\n\n useEffect(() => {\n if (!isResizing) return\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, handleMouseMove, handleMouseUp])\n\n // Below the mobile breakpoint there's no room to split at all — MIN_MAIN_PX\n // + MIN_DOCK_PX alone is 500px, wider than most phones. Show whichever\n // side is active at full width instead of squeezing both into slivers.\n const effectiveDockWidth =\n hasDockedContent && containerWidth > 0\n ? isMobile\n ? containerWidth\n : Math.min(\n Math.max(dockWidth ?? DEFAULT_DOCK_PX, MIN_DOCK_PX),\n containerWidth - MIN_MAIN_PX\n )\n : 0\n const mainHidden = isMobile && hasDockedContent\n\n return (\n <div ref={containerRef} className=\"h-full relative flex\" data-testid={props['data-testid']}>\n <div\n style={{\n width: mainHidden ? 0 : `calc(100% - ${effectiveDockWidth}px)`,\n // Reserve gutter space so the vertical scrollbar doesn't appear and\n // disappear as streaming content crosses the viewport boundary —\n // that toggle reflows the layout and reads as a screen-wide flicker.\n scrollbarGutter: 'stable',\n }}\n className={cn(\n // The CSS container for the page's @-variants (PageContainer must not be one; see there).\n '@container h-full overflow-auto',\n hasDockedContent && !isMobile && 'border-r',\n mainHidden && 'overflow-hidden',\n // Animate opening only. On close the portaled content has already\n // unmounted, so animating leaves an empty strip shrinking while the\n // page behind reflows — reads as flicker over heavy content like the\n // documents grid. Snap closed instead. Resizing is also instant so\n // the divider doesn't lag the cursor.\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n aria-hidden={mainHidden}\n inert={mainHidden}\n data-scroll-container\n >\n {children}\n </div>\n\n {/* Wide grab zone with a visible grip, so the divider is findable and forgiving to hit */}\n {hasDockedContent && !isMobile && (\n <div\n className=\"group flex w-2 flex-shrink-0 cursor-col-resize items-center justify-center\"\n onMouseDown={handleMouseDown}\n data-testid=\"dock-resize-handle\"\n >\n <div className=\"h-12 w-1 rounded-full bg-muted-foreground/40 transition-colors group-hover:bg-primary\" />\n </div>\n )}\n\n <div\n ref={dockZoneRef}\n id=\"dock-zone\"\n style={{ width: effectiveDockWidth }}\n className={cn(\n 'h-full overflow-hidden flex-shrink-0',\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n />\n\n {isResizing && dragPosition !== null && (\n <div\n className=\"absolute top-0 bottom-0 w-0.5 bg-primary z-50 pointer-events-none\"\n style={{ left: dragPosition }}\n />\n )}\n {isResizing && <div className=\"absolute inset-0 z-40 cursor-col-resize\" />}\n </div>\n )\n}\n"]}