@arbidocs/blocks 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedCallDock-74BBCKXO.js → ConnectedCallDock-GY7CTNJT.js} +11 -11
- package/dist/{ConnectedCallDock-74BBCKXO.js.map → ConnectedCallDock-GY7CTNJT.js.map} +1 -1
- package/dist/{ConnectedCallDock-7O6VPYVI.cjs → ConnectedCallDock-SJGJDFPB.cjs} +20 -20
- package/dist/{ConnectedCallDock-7O6VPYVI.cjs.map → ConnectedCallDock-SJGJDFPB.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-2HCE5YD2.cjs → ConnectedCallRoom-FRHLPH7N.cjs} +12 -12
- package/dist/{ConnectedCallRoom-2HCE5YD2.cjs.map → ConnectedCallRoom-FRHLPH7N.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-KAHBN5KO.js → ConnectedCallRoom-SAPQSOT2.js} +11 -11
- package/dist/{ConnectedCallRoom-KAHBN5KO.js.map → ConnectedCallRoom-SAPQSOT2.js.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-A7PMTYD7.cjs → ConnectedNativeDocxComparison-7CSRYT24.cjs} +11 -11
- package/dist/{ConnectedNativeDocxComparison-A7PMTYD7.cjs.map → ConnectedNativeDocxComparison-7CSRYT24.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-CWEW7GV3.js → ConnectedNativeDocxComparison-E4I5FOVX.js} +10 -10
- package/dist/{ConnectedNativeDocxComparison-CWEW7GV3.js.map → ConnectedNativeDocxComparison-E4I5FOVX.js.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-6EBF7U4E.js → ConnectedNativeDocxEditor-7WRXTLMN.js} +9 -9
- package/dist/{ConnectedNativeDocxEditor-6EBF7U4E.js.map → ConnectedNativeDocxEditor-7WRXTLMN.js.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-IWXEOAIF.cjs → ConnectedNativeDocxEditor-YGV2D2VD.cjs} +11 -11
- package/dist/{ConnectedNativeDocxEditor-IWXEOAIF.cjs.map → ConnectedNativeDocxEditor-YGV2D2VD.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-WRGCCU5H.cjs → ConnectedStreamedWordArtifact-DTCG4EGG.cjs} +11 -11
- package/dist/ConnectedStreamedWordArtifact-DTCG4EGG.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-27ISQYHI.js → ConnectedStreamedWordArtifact-N6EWJNLW.js} +10 -10
- package/dist/ConnectedStreamedWordArtifact-N6EWJNLW.js.map +1 -0
- package/dist/NativeDocxEditor-ATPL3Q3O.js +1 -1
- package/dist/NativeDocxEditor-R4EIHWNL.cjs +1 -1
- package/dist/{WorkspaceTableView-FROHEPCT.cjs → WorkspaceTableView-LY2ATQQV.cjs} +9 -9
- package/dist/{WorkspaceTableView-FROHEPCT.cjs.map → WorkspaceTableView-LY2ATQQV.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-3TIMUU2J.js → WorkspaceTableView-PKNWJ7R4.js} +7 -7
- package/dist/{WorkspaceTableView-3TIMUU2J.js.map → WorkspaceTableView-PKNWJ7R4.js.map} +1 -1
- package/dist/agents/index.cjs +330 -330
- package/dist/agents/index.js +8 -8
- package/dist/calls/index.cjs +135 -135
- package/dist/calls/index.js +11 -11
- package/dist/chat/index.cjs +84 -84
- package/dist/chat/index.js +4 -4
- package/dist/{chunk-3XA7EDPS.cjs → chunk-2COVCCQI.cjs} +20 -20
- package/dist/{chunk-3XA7EDPS.cjs.map → chunk-2COVCCQI.cjs.map} +1 -1
- package/dist/{chunk-IFE4MZXD.js → chunk-3H4UW7A2.js} +3 -3
- package/dist/{chunk-IFE4MZXD.js.map → chunk-3H4UW7A2.js.map} +1 -1
- package/dist/{chunk-LPUQHIVP.cjs → chunk-3VW7ZXQ6.cjs} +4 -4
- package/dist/{chunk-LPUQHIVP.cjs.map → chunk-3VW7ZXQ6.cjs.map} +1 -1
- package/dist/{chunk-4KMYUM7Q.cjs → chunk-3Y5SJU72.cjs} +5 -5
- package/dist/{chunk-4KMYUM7Q.cjs.map → chunk-3Y5SJU72.cjs.map} +1 -1
- package/dist/{chunk-5D32XL3E.cjs → chunk-44NNWY5A.cjs} +4 -4
- package/dist/{chunk-5D32XL3E.cjs.map → chunk-44NNWY5A.cjs.map} +1 -1
- package/dist/{chunk-HJQLVCIK.cjs → chunk-6BBZP4ES.cjs} +3 -3
- package/dist/{chunk-HJQLVCIK.cjs.map → chunk-6BBZP4ES.cjs.map} +1 -1
- package/dist/{chunk-OD3UJ7XR.js → chunk-7BRFJQM3.js} +3 -3
- package/dist/{chunk-OD3UJ7XR.js.map → chunk-7BRFJQM3.js.map} +1 -1
- package/dist/{chunk-2BNWISLH.cjs → chunk-A6HE5SC6.cjs} +4 -4
- package/dist/{chunk-2BNWISLH.cjs.map → chunk-A6HE5SC6.cjs.map} +1 -1
- package/dist/{chunk-34LBKTII.js → chunk-ALPP65FF.js} +4 -4
- package/dist/{chunk-34LBKTII.js.map → chunk-ALPP65FF.js.map} +1 -1
- package/dist/{chunk-ZSW6FZG5.cjs → chunk-AR6RMAYK.cjs} +10 -10
- package/dist/{chunk-ZSW6FZG5.cjs.map → chunk-AR6RMAYK.cjs.map} +1 -1
- package/dist/{chunk-HTOYFP3D.js → chunk-BBWTXMGX.js} +6 -6
- package/dist/{chunk-HTOYFP3D.js.map → chunk-BBWTXMGX.js.map} +1 -1
- package/dist/{chunk-BWKBLCWC.js → chunk-BGM2HN2A.js} +5 -5
- package/dist/{chunk-BWKBLCWC.js.map → chunk-BGM2HN2A.js.map} +1 -1
- package/dist/{chunk-BKNHCORH.js → chunk-CKPF2Z5Q.js} +3 -3
- package/dist/{chunk-BKNHCORH.js.map → chunk-CKPF2Z5Q.js.map} +1 -1
- package/dist/{chunk-MDFXGRLY.cjs → chunk-CNVXXZ46.cjs} +9 -9
- package/dist/{chunk-MDFXGRLY.cjs.map → chunk-CNVXXZ46.cjs.map} +1 -1
- package/dist/{chunk-XSA46YJV.js → chunk-DBY5MDKA.js} +3 -3
- package/dist/{chunk-XSA46YJV.js.map → chunk-DBY5MDKA.js.map} +1 -1
- package/dist/{chunk-KJXJRX33.js → chunk-DDCMLHXF.js} +4 -4
- package/dist/chunk-DDCMLHXF.js.map +1 -0
- package/dist/{chunk-ZAVEMQ37.cjs → chunk-DWZXSPMB.cjs} +3 -3
- package/dist/{chunk-ZAVEMQ37.cjs.map → chunk-DWZXSPMB.cjs.map} +1 -1
- package/dist/{chunk-NHY4AKA4.js → chunk-EFFHKEC4.js} +4 -4
- package/dist/{chunk-NHY4AKA4.js.map → chunk-EFFHKEC4.js.map} +1 -1
- package/dist/{chunk-J6JED6TA.cjs → chunk-EWSZIZVN.cjs} +50 -50
- package/dist/{chunk-J6JED6TA.cjs.map → chunk-EWSZIZVN.cjs.map} +1 -1
- package/dist/{chunk-CSUKLEQH.js → chunk-EZRXRCQT.js} +3 -3
- package/dist/{chunk-CSUKLEQH.js.map → chunk-EZRXRCQT.js.map} +1 -1
- package/dist/{chunk-2RSUVU5V.js → chunk-F2UTXERG.js} +3 -3
- package/dist/{chunk-2RSUVU5V.js.map → chunk-F2UTXERG.js.map} +1 -1
- package/dist/{chunk-NNPFFPBF.js → chunk-FGGACOGH.js} +3 -3
- package/dist/{chunk-NNPFFPBF.js.map → chunk-FGGACOGH.js.map} +1 -1
- package/dist/{chunk-R5YS2UZ3.cjs → chunk-GGVTPFUB.cjs} +3 -3
- package/dist/{chunk-R5YS2UZ3.cjs.map → chunk-GGVTPFUB.cjs.map} +1 -1
- package/dist/{chunk-DRLRR44Q.js → chunk-H3V7TTKK.js} +6 -6
- package/dist/{chunk-DRLRR44Q.js.map → chunk-H3V7TTKK.js.map} +1 -1
- package/dist/{chunk-7GAS4N7L.js → chunk-HI3XOW5W.js} +3 -3
- package/dist/{chunk-7GAS4N7L.js.map → chunk-HI3XOW5W.js.map} +1 -1
- package/dist/{chunk-RMLU363Q.cjs → chunk-IRV3CE3M.cjs} +4 -4
- package/dist/{chunk-RMLU363Q.cjs.map → chunk-IRV3CE3M.cjs.map} +1 -1
- package/dist/{chunk-LHWKA2XI.cjs → chunk-JNOMGRKB.cjs} +3 -3
- package/dist/{chunk-LHWKA2XI.cjs.map → chunk-JNOMGRKB.cjs.map} +1 -1
- package/dist/{chunk-XHJAYCPQ.js → chunk-JTJCCL2E.js} +3 -3
- package/dist/{chunk-XHJAYCPQ.js.map → chunk-JTJCCL2E.js.map} +1 -1
- package/dist/{chunk-QE7MS7NA.js → chunk-KMIDM6BP.js} +4 -4
- package/dist/{chunk-QE7MS7NA.js.map → chunk-KMIDM6BP.js.map} +1 -1
- package/dist/{chunk-32W6STZ2.cjs → chunk-MKDUGIEH.cjs} +5 -5
- package/dist/{chunk-32W6STZ2.cjs.map → chunk-MKDUGIEH.cjs.map} +1 -1
- package/dist/{chunk-4MQKXHMC.js → chunk-NACDM6WA.js} +3 -3
- package/dist/{chunk-4MQKXHMC.js.map → chunk-NACDM6WA.js.map} +1 -1
- package/dist/{chunk-VMXLNBHF.js → chunk-NGKCVBS2.js} +3 -3
- package/dist/{chunk-VMXLNBHF.js.map → chunk-NGKCVBS2.js.map} +1 -1
- package/dist/{chunk-QEE4DOEU.cjs → chunk-PTY7E22L.cjs} +15 -15
- package/dist/{chunk-QEE4DOEU.cjs.map → chunk-PTY7E22L.cjs.map} +1 -1
- package/dist/{chunk-26EQQQBX.js → chunk-QRNZYYF3.js} +7 -7
- package/dist/{chunk-26EQQQBX.js.map → chunk-QRNZYYF3.js.map} +1 -1
- package/dist/{chunk-PAW2PC2M.cjs → chunk-RHYFUBYS.cjs} +75 -75
- package/dist/{chunk-PAW2PC2M.cjs.map → chunk-RHYFUBYS.cjs.map} +1 -1
- package/dist/{chunk-BMFXDDJG.cjs → chunk-RSIYQNV6.cjs} +7 -7
- package/dist/{chunk-BMFXDDJG.cjs.map → chunk-RSIYQNV6.cjs.map} +1 -1
- package/dist/{chunk-AU6ZSYW6.js → chunk-SM774TX7.js} +3 -3
- package/dist/{chunk-AU6ZSYW6.js.map → chunk-SM774TX7.js.map} +1 -1
- package/dist/{chunk-JBG5MFVX.cjs → chunk-TRGBOGMU.cjs} +5 -5
- package/dist/{chunk-JBG5MFVX.cjs.map → chunk-TRGBOGMU.cjs.map} +1 -1
- package/dist/{chunk-LDRHUYRE.cjs → chunk-U4DNZENJ.cjs} +9 -9
- package/dist/{chunk-LDRHUYRE.cjs.map → chunk-U4DNZENJ.cjs.map} +1 -1
- package/dist/{chunk-ECERC6TI.js → chunk-VHJHY7TT.js} +3 -3
- package/dist/{chunk-ECERC6TI.js.map → chunk-VHJHY7TT.js.map} +1 -1
- package/dist/{chunk-UIZZFZ5Z.cjs → chunk-XAS4VRBY.cjs} +3 -3
- package/dist/{chunk-UIZZFZ5Z.cjs.map → chunk-XAS4VRBY.cjs.map} +1 -1
- package/dist/{chunk-YSNQWUQQ.js → chunk-XKQG6QSZ.js} +4 -4
- package/dist/{chunk-YSNQWUQQ.js.map → chunk-XKQG6QSZ.js.map} +1 -1
- package/dist/{chunk-WT2AGQYY.cjs → chunk-Y3ZEQVBP.cjs} +4 -4
- package/dist/{chunk-WT2AGQYY.cjs.map → chunk-Y3ZEQVBP.cjs.map} +1 -1
- package/dist/{chunk-2WKAUDZZ.js → chunk-YAJSGPGV.js} +3 -3
- package/dist/{chunk-2WKAUDZZ.js.map → chunk-YAJSGPGV.js.map} +1 -1
- package/dist/{chunk-QK2HR3LC.js → chunk-YTB7JUKU.js} +5 -5
- package/dist/{chunk-QK2HR3LC.js.map → chunk-YTB7JUKU.js.map} +1 -1
- package/dist/{chunk-IFAIUKQQ.cjs → chunk-YZMTUJEE.cjs} +4 -4
- package/dist/{chunk-IFAIUKQQ.cjs.map → chunk-YZMTUJEE.cjs.map} +1 -1
- package/dist/{chunk-OK3UJMO4.cjs → chunk-Z2XZ2D4N.cjs} +4 -4
- package/dist/chunk-Z2XZ2D4N.cjs.map +1 -0
- package/dist/{chunk-DAEDRTIN.cjs → chunk-Z6MKHM6V.cjs} +4 -4
- package/dist/{chunk-DAEDRTIN.cjs.map → chunk-Z6MKHM6V.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +68 -68
- package/dist/collaboration/index.js +2 -2
- package/dist/connect/docx.cjs +13 -13
- package/dist/connect/docx.js +9 -9
- package/dist/connect/index.cjs +1121 -1037
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +201 -117
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/viewer.cjs +75 -75
- package/dist/connect/viewer.js +14 -14
- package/dist/connection/files/grid/documentGridBus.d.ts +12 -10
- package/dist/connection/messenger/ConnectedChatThread.d.ts +3 -1
- package/dist/connection/messenger/ConnectedMessenger.d.ts +21 -3
- package/dist/document-tools/index.cjs +20 -20
- package/dist/document-tools/index.js +3 -3
- package/dist/docx/index.cjs +1 -1
- package/dist/docx/index.js +1 -1
- package/dist/facts/index.cjs +58 -58
- package/dist/facts/index.js +6 -6
- package/dist/files/index.cjs +224 -224
- package/dist/files/index.js +4 -4
- package/dist/home/index.cjs +30 -30
- package/dist/home/index.js +5 -5
- package/dist/index.cjs +598 -598
- package/dist/index.js +16 -16
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +159 -159
- package/dist/settings/index.js +4 -4
- package/dist/shell/index.cjs +2 -2
- package/dist/shell/index.js +2 -2
- package/dist/studio/index.cjs +6 -6
- package/dist/studio/index.js +5 -5
- package/dist/workflow-canvas/index.cjs +21 -21
- package/dist/workflow-canvas/index.js +8 -8
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedStreamedWordArtifact-27ISQYHI.js.map +0 -1
- package/dist/ConnectedStreamedWordArtifact-WRGCCU5H.cjs.map +0 -1
- package/dist/chunk-KJXJRX33.js.map +0 -1
- package/dist/chunk-OK3UJMO4.cjs.map +0 -1
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
var chunk464YPRAE_cjs = require('./chunk-464YPRAE.cjs');
|
|
5
5
|
var chunkUS356PMS_cjs = require('./chunk-US356PMS.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkAR6RMAYK_cjs = require('./chunk-AR6RMAYK.cjs');
|
|
7
7
|
var chunk2VHYOTWW_cjs = require('./chunk-2VHYOTWW.cjs');
|
|
8
8
|
var chunk5DXTO7CE_cjs = require('./chunk-5DXTO7CE.cjs');
|
|
9
9
|
var chunkLMXMUWPA_cjs = require('./chunk-LMXMUWPA.cjs');
|
|
10
10
|
var chunkMB3S2ETI_cjs = require('./chunk-MB3S2ETI.cjs');
|
|
11
|
-
var chunk25YFJLFP_cjs = require('./chunk-25YFJLFP.cjs');
|
|
12
11
|
var chunkUUMUCWFR_cjs = require('./chunk-UUMUCWFR.cjs');
|
|
12
|
+
var chunk25YFJLFP_cjs = require('./chunk-25YFJLFP.cjs');
|
|
13
13
|
var chunkKDG6FER6_cjs = require('./chunk-KDG6FER6.cjs');
|
|
14
14
|
var react = require('react');
|
|
15
15
|
var reactQuery = require('@tanstack/react-query');
|
|
@@ -44,7 +44,7 @@ function toWorkflowFieldDocument(doc) {
|
|
|
44
44
|
function useConnectedWorkflowScopeSource() {
|
|
45
45
|
const { data: docs } = chunk5DXTO7CE_cjs.useListedDocuments();
|
|
46
46
|
const { data: tags } = chunk5DXTO7CE_cjs.useConnectedTags();
|
|
47
|
-
return react.useMemo(() =>
|
|
47
|
+
return react.useMemo(() => chunkAR6RMAYK_cjs.buildWorkflowScopeSource(docs, chunkAR6RMAYK_cjs.documentScopeLabels(tags)), [docs, tags]);
|
|
48
48
|
}
|
|
49
49
|
function useConnectedAgentOptions() {
|
|
50
50
|
const { data: agents } = react$1.useAgents();
|
|
@@ -101,7 +101,7 @@ function ConnectedWorkflowDocumentsField({
|
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
103
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
-
|
|
104
|
+
chunkAR6RMAYK_cjs.WorkflowDocumentsField,
|
|
105
105
|
{
|
|
106
106
|
field,
|
|
107
107
|
value,
|
|
@@ -123,7 +123,7 @@ function ConnectedWorkflowLauncher({
|
|
|
123
123
|
const scopeSource = useConnectedWorkflowScopeSource();
|
|
124
124
|
const agents = useConnectedAgentOptions();
|
|
125
125
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
-
|
|
126
|
+
chunkAR6RMAYK_cjs.WorkflowLauncher,
|
|
127
127
|
{
|
|
128
128
|
...props,
|
|
129
129
|
scopeSource,
|
|
@@ -245,7 +245,7 @@ var DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS = {
|
|
|
245
245
|
var messageOf = (error) => error instanceof Error ? error.message : "";
|
|
246
246
|
function ConnectedWorkflowsTable({
|
|
247
247
|
filter,
|
|
248
|
-
describeTrigger = (w) =>
|
|
248
|
+
describeTrigger = (w) => chunkAR6RMAYK_cjs.workflowTriggerType(w).replaceAll("_", " "),
|
|
249
249
|
formatDate = chunkKDG6FER6_cjs.fmtDate,
|
|
250
250
|
onViewRuns,
|
|
251
251
|
connectedLabels,
|
|
@@ -307,7 +307,7 @@ function ConnectedWorkflowsTable({
|
|
|
307
307
|
await act(workflow, () => remove.mutateAsync(workflow.external_id));
|
|
308
308
|
};
|
|
309
309
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
-
|
|
310
|
+
chunkAR6RMAYK_cjs.WorkflowsTable,
|
|
311
311
|
{
|
|
312
312
|
...tableProps,
|
|
313
313
|
workflows,
|
|
@@ -564,5 +564,5 @@ exports.useConnectedWorkflowScopeSource = useConnectedWorkflowScopeSource;
|
|
|
564
564
|
exports.useConnectedWorkspaceRole = useConnectedWorkspaceRole;
|
|
565
565
|
exports.useDocxCommentTarget = useDocxCommentTarget;
|
|
566
566
|
exports.useNativeDocxSupport = useNativeDocxSupport;
|
|
567
|
-
//# sourceMappingURL=chunk-
|
|
568
|
-
//# sourceMappingURL=chunk-
|
|
567
|
+
//# sourceMappingURL=chunk-CNVXXZ46.cjs.map
|
|
568
|
+
//# sourceMappingURL=chunk-CNVXXZ46.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowLauncher.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","useCallback","jsxs","Fragment","jsx","WorkflowDocumentsField","WorkflowLauncher","DocumentPicker","useArbi","buildDeepLinkUrl","parseDeepLinkPath","useWorkspaceUsers","workflowTriggerType","fmtDate","useWorkflows","useConnectedConversations","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useEffect","WorkflowsTable","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","builtinHouseTemplate","isCandidate","useRegisterOpenDocument","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","loadDocxFonts","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY,MAAM,IAAA;AAEjB,SAAS,oBAAA,GAA0C;AACxD,EAAA,OAAOA,yBAAA,GAAU,IAAA,IAAQ,UAAA;AAC3B;AAGO,SAAS,oBAAA,GAAyE;AACvF,EAAA,MAAM,SAAA,GAAY,oBAAA,EAAqB,CAAE,gBAAA,IAAoB,SAAA;AAC7D,EAAA,OAAO,SAAA,EAAU;AACnB;ACZA,IAAM,gBAAA,mBAAmB,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,KAAA,EAA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AA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,kBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-MDFXGRLY.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nexport function useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\n />\n )}\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport { workflowTriggerType } from '../agents/tasks/workflowRows'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n> {\n /** Which saved workflows to list (e.g. those on a schedule). Default: all. */\n filter?: (workflow: WorkflowResponse) => boolean\n /** When a workflow starts, in the host's words. Default: its trigger type. */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger = (w) => workflowTriggerType(w).replaceAll('_', ' '),\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => (filter ? saved.filter(filter) : saved), [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={describeTrigger}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/NativeDocxEditor'\nimport {\n builtinHouseTemplate,\n type HouseTemplate,\n type HouseTemplateHost,\n} from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n return builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../../docx/fonts'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent && !props.compact\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn't available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id) => {\n await (onDocumentsChanged\n ? onDocumentsChanged([id], 'version')\n : refreshDocuments(queries, arbi, [id]))\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowLauncher.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","useCallback","jsxs","Fragment","jsx","WorkflowDocumentsField","WorkflowLauncher","DocumentPicker","useArbi","buildDeepLinkUrl","parseDeepLinkPath","useWorkspaceUsers","workflowTriggerType","fmtDate","useWorkflows","useConnectedConversations","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useEffect","WorkflowsTable","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","builtinHouseTemplate","isCandidate","useRegisterOpenDocument","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","loadDocxFonts","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY,MAAM,IAAA;AAEjB,SAAS,oBAAA,GAA0C;AACxD,EAAA,OAAOA,yBAAA,GAAU,IAAA,IAAQ,UAAA;AAC3B;AAGO,SAAS,oBAAA,GAAyE;AACvF,EAAA,MAAM,SAAA,GAAY,oBAAA,EAAqB,CAAE,gBAAA,IAAoB,SAAA;AAC7D,EAAA,OAAO,SAAA,EAAU;AACnB;ACZA,IAAM,gBAAA,mBAAmB,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAC,CAAA;AAG9E,SAAS,wBAAwB,GAAA,EAA+C;AAErF,EAAA,MAAM,UAAU,gBAAA,CAAiB,GAAA,CAAA,CAAK,IAAI,SAAA,IAAa,EAAA,EAAI,aAAa,CAAA;AACxE,EAAA,OAAO;AAAA,IACL,IAAI,GAAA,CAAI,WAAA;AAAA,IACR,OAAO,GAAA,CAAI,YAAA,EAAc,KAAA,IAAS,GAAA,CAAI,aAAa,GAAA,CAAI,WAAA;AAAA,IACvD,UAAU,GAAA,CAAI,SAAA;AAAA,IACd,KAAA,EAAO,OAAA,GAAU,IAAA,GAAQ,GAAA,CAAI,OAAA,IAAW,IAAA;AAAA,IACxC,MAAA,EAAQ,OAAA,G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AA,EAAa;AAAA,UAChF,MAAA,EAAQ,MAAA;AAAA,UACR,OAAA,EAAS,EAAE,cAAA,EAAgB,kBAAA,EAAmB;AAAA,UAC9C,IAAA,EAAM,KAAK,SAAA,CAAU;AAAA,YACnB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,aAAa,OAAA,CAAQ,WAAA;AAAA,YACrB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,eAAe,OAAA,CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,QAAA,MAAA,CAAO,sBAAsB,SAAS,CAAA;AACtC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG,MAAA;AAAA,MACrF,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,UAAA;AAAA,MACA,iBAAiB,OAAA,CAAQ,eAAA;AAAA,MACzB;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,IAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,kBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-CNVXXZ46.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nexport function useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\n />\n )}\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport { workflowTriggerType } from '../agents/tasks/workflowRows'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n> {\n /** Which saved workflows to list (e.g. those on a schedule). Default: all. */\n filter?: (workflow: WorkflowResponse) => boolean\n /** When a workflow starts, in the host's words. Default: its trigger type. */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger = (w) => workflowTriggerType(w).replaceAll('_', ' '),\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => (filter ? saved.filter(filter) : saved), [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={describeTrigger}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/NativeDocxEditor'\nimport {\n builtinHouseTemplate,\n type HouseTemplate,\n type HouseTemplateHost,\n} from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n return builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../../docx/fonts'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent && !props.compact\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn't available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id) => {\n await (onDocumentsChanged\n ? onDocumentsChanged([id], 'version')\n : refreshDocuments(queries, arbi, [id]))\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAssistantDock, useChatSurface } from './chunk-
|
|
2
|
+
import { useAssistantDock, useChatSurface } from './chunk-CKPF2Z5Q.js';
|
|
3
3
|
import { Toaster } from './chunk-OKERRHLH.js';
|
|
4
4
|
import { Search, Pin, X, Loader2, MessageSquare, CheckCircle, Tag, User, Bot, Check } from 'lucide-react';
|
|
5
5
|
import { HoverCardContent, cn, Input, Button, Badge, PassageCard, Tabs, TabsList, TabsTrigger, TabsContent } from '@arbidocs/react/ui';
|
|
@@ -571,5 +571,5 @@ function AssistantToaster(props) {
|
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
export { AssistantToaster, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, ConversationSearchView, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, LabelPinRow, PinnedDocChip, useDismissibleCard };
|
|
574
|
-
//# sourceMappingURL=chunk-
|
|
575
|
-
//# sourceMappingURL=chunk-
|
|
574
|
+
//# sourceMappingURL=chunk-DBY5MDKA.js.map
|
|
575
|
+
//# sourceMappingURL=chunk-DBY5MDKA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chat/PinnedDocChip.tsx","../src/chat/ConversationSearchView.tsx","../src/chat/ContextPanel.tsx","../src/lib/useDismissibleCard.ts","../src/chat/LabelPinRow.tsx","../src/chat/AssistantToaster.tsx"],"names":["jsxs","jsx","X","ContextPanelContent","cn","Fragment","ContextSearchInput","Search","ContextActionButton","Button","TagIcon"],"mappings":";;;;;;;AAUO,IAAM,8BAAA,GAAsD;AAAA,EACjE,KAAA,EAAO,OAAA;AAAA,EACP,aAAA,EAAe,CAAC,KAAA,KAAU,CAAA,MAAA,EAAS,KAAK,CAAA;AAC1C;AAiBO,SAAS,aAAA,CAAc;AAAA,EAC5B,KAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA,GAAS;AACX,CAAA,EAAuB;AACrB,EAAA,MAAM,CAAA,GAAI,EAAE,GAAG,8BAAA,EAAgC,GAAG,MAAA,EAAO;AACzD,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,QAAA,EAAU,CAAA;AAAA,MACV,WAAA,EAAU,iBAAA;AAAA,MACV,OAAA,EAAS,CAAC,CAAA,KAAM;AACd,QAAA,CAAA,CAAE,eAAA,EAAgB;AAClB,QAAA,OAAA,EAAQ;AAAA,MACV,CAAA;AAAA,MACA,SAAA,EAAW,CAAC,CAAA,KAAM;AAChB,QAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,UAAA,CAAA,CAAE,eAAA,EAAgB;AAClB,UAAA,OAAA,EAAQ;AAAA,QACV;AAAA,MACF,CAAA;AAAA,MACA,OAAO,CAAA,CAAE,KAAA;AAAA,MACT,YAAA,EAAY,CAAA,CAAE,aAAA,CAAc,KAAK,CAAA;AAAA,MACjC,SAAA,EAAW,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yBAAA,EAA2B,QAAA,EAAA,KAAA,CAAM,QAAQ,MAAA,EAAO;AAAA;AAAA,aAAA;AAAA,YAlC3D,KAAA,CAAM;AAAA,WAmCb;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,GACH;AAEJ;AC7FO,SAAS,iBAAiB,KAAA,EAA8B;AAC7D,EAAA,MAAM,OAAO,gBAAA,EAAiB;AAC9B,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,cAAA,EAAe;AAC3C,EAAA,uBAAOA,IAAC,OAAA,EAAA,EAAS,GAAG,OAAO,QAAA,EAAU,IAAA,CAAK,UAAU,eAAA,EAAiB,CAAA;AACvE","file":"chunk-XSA46YJV.js","sourcesContent":["import { Pin, X } 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 PinnedDocChipLabels {\n unpin: string\n /** Accessible name; `title` is the pinned document's name. */\n unpinDocument: (title: string) => string\n}\n\nexport const DEFAULT_PINNED_DOC_CHIP_LABELS: PinnedDocChipLabels = {\n unpin: 'Unpin',\n unpinDocument: (title) => `Unpin ${title}`,\n}\n\nexport interface PinnedDocChipProps {\n title: string\n onUnpin: () => void\n className?: string\n labels?: Partial<PinnedDocChipLabels>\n testId?: string\n}\n\n/**\n * The pinned-document chip that lives inside a composer's attach button: shows which document\n * holds the full-context pin and unpins it in ONE tap (the X is always visible, so touch and\n * keyboard reach it). It is a span with button semantics because it sits inside the attach\n * `<button>`, where nested buttons are invalid; `stopPropagation` keeps the tap from also\n * triggering the parent.\n */\nexport function PinnedDocChip({\n title,\n onUnpin,\n className,\n labels,\n testId = 'unpin-document-button',\n}: PinnedDocChipProps) {\n const l = { ...DEFAULT_PINNED_DOC_CHIP_LABELS, ...labels }\n return (\n <span\n role=\"button\"\n tabIndex={0}\n data-slot=\"pinned-doc-chip\"\n onClick={(e) => {\n e.stopPropagation()\n onUnpin()\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation()\n onUnpin()\n }\n }}\n title={l.unpin}\n aria-label={l.unpinDocument(title)}\n className={cn(\n '-mx-0.5 flex min-w-0 items-center gap-1 rounded-sm px-1 text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n className\n )}\n data-testid={testId}\n >\n <Pin className=\"h-3 w-3 shrink-0 fill-primary\" />\n <X className=\"order-last h-3 w-3 shrink-0 text-muted-foreground\" />\n <span className=\"truncate text-sm\">{title}</span>\n </span>\n )\n}\n","import { useMemo, type ComponentType, type ReactNode } from 'react'\nimport { Bot, Loader2, MessageSquare, Search, User, X } from 'lucide-react'\n\nimport { Button, PassageCard } from '@arbidocs/react/ui'\n\n/** One matching message of a conversation. */\nexport interface ConversationSearchMatch {\n id: string\n role: string\n score: number\n snippet: string\n}\n\n/** A conversation with the messages that matched the query. */\nexport interface ConversationSearchGroup {\n id: string\n title?: string | null\n matches: ConversationSearchMatch[]\n}\n\n/** Every fixed string of the conversation search. */\nexport interface ConversationSearchLabels {\n placeholder: string\n search: string\n searching: string\n matched: (count: number, query: string) => string\n matchCount: (count: number) => string\n untitled: string\n you: string\n assistant: string\n clear: string\n noResults: (query: string) => string\n reindexHint: ReactNode\n backToList: string\n}\n\nexport const DEFAULT_CONVERSATION_SEARCH_LABELS: ConversationSearchLabels = {\n placeholder: 'Search your conversations...',\n search: 'Search',\n searching: 'Searching conversations…',\n matched: (count, query) => `${count} conversation${count === 1 ? '' : 's'} matched “${query}”`,\n matchCount: (count) => `${count} match${count === 1 ? '' : 'es'}`,\n untitled: 'Untitled conversation',\n you: 'You',\n assistant: 'Assistant',\n clear: 'Clear',\n noResults: (query) => `No conversations matched “${query}”.`,\n reindexHint: (\n <>\n Older conversations may need indexing — try <span className=\"font-medium\">Re-index</span>.\n </>\n ),\n backToList: 'Back to list',\n}\n\nexport interface ConversationSearchViewProps {\n query: string\n onQueryChange: (query: string) => void\n /** Enter (without Shift) or the submit button. */\n onSubmit: () => void\n canSubmit: boolean\n isSearching: boolean\n /** The query the shown results answer; empty while no search has run. */\n submittedQuery: string\n /** Results of `submittedQuery`. */\n groups: ConversationSearchGroup[]\n onOpenConversation: (conversationId: string, messageId?: string) => void\n /** Back to the idle body. */\n onClear: () => void\n /** Shown beneath the bar until a search is run (e.g. the history list). */\n children?: ReactNode\n /** Wraps the results area (e.g. an error boundary). */\n ResultsBoundary?: ComponentType<{ children: ReactNode }>\n labels?: Partial<ConversationSearchLabels>\n}\n\nfunction RoleChip({ isUser, labels }: { isUser: boolean; labels: ConversationSearchLabels }) {\n const Icon = isUser ? User : Bot\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-medium text-muted-foreground\">\n <Icon className=\"size-3\" />\n {isUser ? labels.you : labels.assistant}\n </span>\n )\n}\n\nconst Passthrough = ({ children }: { children: ReactNode }) => <>{children}</>\n\n/**\n * Search across past conversations: a search bar, then either the idle body (history list) or\n * the matches grouped by conversation. Opening a group or a hit is the host's navigation.\n */\nexport function ConversationSearchView({\n query,\n onQueryChange,\n onSubmit,\n canSubmit,\n isSearching,\n submittedQuery,\n groups,\n onOpenConversation,\n onClear,\n children,\n ResultsBoundary = Passthrough,\n labels,\n}: ConversationSearchViewProps) {\n const l = useMemo(() => ({ ...DEFAULT_CONVERSATION_SEARCH_LABELS, ...labels }), [labels])\n const hasResults = !!submittedQuery && !isSearching && groups.length > 0\n\n return (\n <div\n data-slot=\"conversation-search\"\n className=\"flex h-full flex-col\"\n data-testid=\"conversation-search-page\"\n >\n <div className=\"flex items-start gap-3 px-6 py-4\">\n <form\n onSubmit={(e) => {\n e.preventDefault()\n onSubmit()\n }}\n className=\"flex-1\"\n >\n <div className=\"flex items-start gap-2 rounded-md border border-input bg-muted px-3 py-1.5 focus-within:ring-2 focus-within:ring-ring\">\n <textarea\n rows={1}\n value={query}\n onChange={(e) => {\n onQueryChange(e.target.value)\n e.target.style.height = 'auto'\n e.target.style.height = `${e.target.scrollHeight}px`\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n onSubmit()\n }\n }}\n placeholder={l.placeholder}\n aria-label={l.search}\n className=\"flex-1 resize-none overflow-hidden border-0 bg-transparent p-0 text-base leading-relaxed text-foreground outline-none placeholder:text-muted-foreground\"\n data-testid=\"conversation-search-input\"\n />\n <div className=\"flex flex-shrink-0 items-center gap-1\">\n <Button\n type=\"submit\"\n size=\"icon\"\n disabled={!canSubmit}\n className=\"size-7 pointer-coarse:size-11\"\n data-testid=\"conversation-search-submit-button\"\n title={l.search}\n aria-label={l.search}\n >\n {isSearching ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </Button>\n </div>\n </div>\n </form>\n </div>\n\n {!submittedQuery ? (\n <div className=\"flex-1 overflow-hidden\">{children}</div>\n ) : (\n <ResultsBoundary>\n <main className=\"flex-1 overflow-auto px-6 pb-6\">\n {isSearching ? (\n <div className=\"flex items-center justify-center gap-2 py-16 text-muted-foreground\">\n <Loader2 className=\"size-5 animate-spin\" />\n {l.searching}\n </div>\n ) : hasResults ? (\n <div className=\"space-y-4\" data-testid=\"conversation-search-results\">\n <div className=\"flex items-center justify-between gap-3\">\n <p className=\"text-sm text-muted-foreground\">\n {l.matched(groups.length, submittedQuery)}\n </p>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1 text-muted-foreground pointer-coarse:h-11\"\n onClick={onClear}\n data-testid=\"conversation-search-clear\"\n >\n <X className=\"size-3.5\" />\n {l.clear}\n </Button>\n </div>\n {groups.map((group) => (\n <div\n key={group.id}\n className=\"rounded-lg border border-border bg-card\"\n data-testid=\"conversation-search-group\"\n >\n <button\n type=\"button\"\n onClick={() => onOpenConversation(group.id)}\n className=\"flex w-full items-center justify-between gap-3 rounded-t-lg px-4 py-2.5 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring pointer-coarse:min-h-11\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <MessageSquare className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\">{group.title || l.untitled}</span>\n </span>\n <span className=\"flex-shrink-0 text-xs text-muted-foreground\">\n {l.matchCount(group.matches.length)}\n </span>\n </button>\n <div className=\"space-y-2 border-t border-border p-3\">\n {group.matches.map((m) => (\n <PassageCard\n key={m.id}\n header={<RoleChip isUser={m.role === 'user'} labels={l} />}\n score={m.score}\n onClick={() => onOpenConversation(group.id, m.id)}\n data-testid=\"conversation-search-hit\"\n >\n <p className=\"line-clamp-3 text-sm text-foreground/90\">{m.snippet}</p>\n </PassageCard>\n ))}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div\n className=\"py-16 text-center text-muted-foreground\"\n data-testid=\"conversation-search-no-results\"\n >\n <MessageSquare className=\"mx-auto mb-3 size-8 opacity-40\" />\n <p>{l.noResults(submittedQuery)}</p>\n <p className=\"mt-1 text-sm\">{l.reindexHint}</p>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"mt-3 gap-1 text-muted-foreground pointer-coarse:h-11\"\n onClick={onClear}\n >\n <X className=\"size-3.5\" />\n {l.backToList}\n </Button>\n </div>\n )}\n </main>\n </ResultsBoundary>\n )}\n </div>\n )\n}\n","import {\n forwardRef,\n Fragment,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type MouseEventHandler,\n type ReactNode,\n} from 'react'\nimport { Check, CheckCircle, Search } from 'lucide-react'\nimport {\n Badge,\n Button,\n HoverCardContent,\n Input,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n type ButtonProps,\n} from '@arbidocs/react/ui'\n\n/**\n * Parts of the composer's \"in this chat\" panels (files, facts): a card that opens upward from the\n * composer, a grouped pick list, and below it the labels, search and bulk actions.\n */\n\n/** The card itself: width follows the chat input (`--chat-input-width`), bounded on small screens. */\nexport const ContextPanelContent = forwardRef<\n ElementRef<typeof HoverCardContent>,\n ComponentPropsWithoutRef<typeof HoverCardContent>\n>(function ContextPanelContent({ className, onClick, ...props }, ref) {\n return (\n <HoverCardContent\n ref={ref}\n side=\"top\"\n align=\"start\"\n data-slot=\"context-panel\"\n // Clicks inside must not bubble (via the React portal) to a click-to-toggle wrapper.\n onClick={(e) => {\n e.stopPropagation()\n onClick?.(e)\n }}\n className={cn(\n 'w-[var(--chat-input-width,var(--radix-hover-card-content-available-width))] max-h-[var(--radix-hover-card-content-available-height)] max-w-[95vw] overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-3 shadow-lg',\n className\n )}\n {...props}\n />\n )\n})\n\nexport interface ContextPickerGroup {\n key: string\n heading: string\n /** Id of the heading element. */\n testId?: string\n /** Shown after the heading as `(n)`. */\n count: number\n children: ReactNode\n}\n\nexport interface ContextPickerListProps {\n groups: ContextPickerGroup[]\n /** Shown instead of the groups when every group is empty. */\n emptyText: string\n testId: string\n className?: string\n}\n\n/**\n * Two (or more) headed groups, e.g. \"In this conversation\" then \"In this workspace\". Each heading\n * pins to the top of the scroller and is pushed out by the next one; the second parks below the\n * first (32px = a heading's own height), so both stay visible however far down you scroll.\n */\nexport function ContextPickerList({\n groups,\n emptyText,\n testId,\n className,\n}: ContextPickerListProps) {\n const isEmpty = groups.every((g) => g.count === 0)\n return (\n <div\n className={cn('max-h-[400px] space-y-1 overflow-y-auto', className)}\n data-slot=\"context-picker-list\"\n data-testid={testId}\n onClick={(e) => e.stopPropagation()}\n >\n {isEmpty ? (\n <p className=\"p-2 text-sm text-muted-foreground\">{emptyText}</p>\n ) : (\n groups.map((g, index) => (\n <Fragment key={g.key}>\n <div\n className={cn(\n 'sticky z-10 bg-muted px-2 py-1.5 text-sm font-medium text-muted-foreground',\n index === 0 ? 'top-0' : 'top-8'\n )}\n data-testid={g.testId}\n >\n {g.heading} ({g.count})\n </div>\n {g.children}\n </Fragment>\n ))\n )}\n </div>\n )\n}\n\nfunction CheckGlyph({ isChecked, className }: { isChecked: boolean; className?: string }) {\n return (\n <span\n className={cn(\n 'flex size-3.5 shrink-0 items-center justify-center rounded-sm border',\n isChecked ? 'border-primary bg-primary text-primary-foreground' : 'border-input',\n className\n )}\n >\n {isChecked && <Check className=\"size-3\" />}\n </span>\n )\n}\n\nexport interface ContextPickerRowProps {\n isSelected: boolean\n onToggle: () => void\n testId?: string\n children: ReactNode\n}\n\n/** A whole-row toggle (e.g. a fact): check glyph then clamped text. */\nexport function ContextPickerRow({\n isSelected,\n onToggle,\n testId,\n children,\n}: ContextPickerRowProps) {\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onToggle()\n }}\n aria-pressed={isSelected}\n data-testid={testId}\n className={cn(\n 'flex w-full items-start gap-2 rounded p-2 text-left text-sm transition-colors pointer-coarse:min-h-11',\n isSelected ? 'bg-primary/10' : 'bg-card hover:bg-muted'\n )}\n >\n <CheckGlyph isChecked={isSelected} className=\"mt-0.5\" />\n <span className=\"line-clamp-2 min-w-0 text-foreground\">{children}</span>\n </button>\n )\n}\n\nexport interface ContextCheckRowProps {\n isSelected: boolean\n /** The check toggle: accessible name (e.g. \"Add to conversation\"), handler and test id. */\n toggle: { label: string; onToggle: () => void; testId?: string }\n /** Status glyph between the toggle and the content. */\n status?: ReactNode\n testId?: string\n /** The row's content (e.g. a document pill that opens the document). */\n children: ReactNode\n}\n\n/** A row with its own check toggle plus a content slot (e.g. a document, which opens on click). */\nexport function ContextCheckRow({\n isSelected,\n toggle,\n status,\n testId,\n children,\n}: ContextCheckRowProps) {\n return (\n <div\n className=\"flex items-center gap-2 rounded px-1 py-0.5\"\n data-slot=\"context-check-row\"\n data-testid={testId}\n >\n <button\n type=\"button\"\n aria-label={toggle.label}\n aria-pressed={isSelected}\n onClick={toggle.onToggle}\n data-testid={toggle.testId}\n className=\"flex shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-11\"\n >\n <CheckGlyph isChecked={isSelected} />\n </button>\n {status}\n {children}\n </div>\n )\n}\n\nexport interface ContextSelectListProps {\n children: ReactNode\n}\n\n/** Compact single-select list (e.g. choose the document to pin). */\nexport function ContextSelectList({ children }: ContextSelectListProps) {\n return <div className=\"max-h-[150px] space-y-2 overflow-y-auto\">{children}</div>\n}\n\nexport interface ContextSelectRowProps {\n isSelected: boolean\n onSelect: MouseEventHandler<HTMLButtonElement>\n status?: ReactNode\n title: string\n testId?: string\n}\n\nexport function ContextSelectRow({\n isSelected,\n onSelect,\n status,\n title,\n testId,\n}: ContextSelectRowProps) {\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onSelect(e)\n }}\n aria-pressed={isSelected}\n data-testid={testId}\n className={cn(\n 'flex w-full items-center gap-2 rounded p-2 text-left text-sm transition-colors pointer-coarse:min-h-11',\n isSelected ? 'border border-primary/30 bg-primary/10' : 'bg-card hover:bg-muted'\n )}\n >\n {status}\n <span className=\"min-w-0 flex-1 truncate text-foreground\" title={title}>\n {title}\n </span>\n {isSelected && <CheckCircle className=\"size-3.5 shrink-0 text-primary\" />}\n </button>\n )\n}\n\nexport interface ContextPanelFooterProps {\n /** Label shortcut chips (host-supplied row). */\n labels?: ReactNode\n /** The search box. */\n search: ReactNode\n /** Icon + title of the panel; omit when tabs already name it. */\n title?: ReactNode\n /** The action buttons, right aligned. */\n actions: ReactNode\n}\n\n/** Everything below the list: the panel opens upward, so its controls sit nearest the button. */\nexport function ContextPanelFooter({ labels, search, title, actions }: ContextPanelFooterProps) {\n return (\n <div className=\"mt-3 space-y-2 border-t border-border pt-3\" data-slot=\"context-panel-footer\">\n {labels}\n {search}\n <div\n className={cn(\n 'flex flex-wrap items-center gap-x-2 gap-y-1.5',\n title ? 'justify-between' : 'justify-end'\n )}\n >\n {title && (\n <div className=\"flex min-w-0 items-center gap-2 text-sm font-medium text-foreground\">\n {title}\n </div>\n )}\n <div className=\"flex flex-wrap items-center gap-1.5\">{actions}</div>\n </div>\n </div>\n )\n}\n\nexport const ContextSearchInput = forwardRef<\n HTMLInputElement,\n ComponentPropsWithoutRef<typeof Input>\n>(function ContextSearchInput({ className, onClick, ...props }, ref) {\n return (\n <div className=\"relative\" onClick={(e) => e.stopPropagation()}>\n <Search className=\"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\" />\n <Input\n ref={ref}\n className={cn('h-7 bg-background pl-7 text-sm', className)}\n onClick={onClick}\n {...props}\n />\n </div>\n )\n})\n\nexport interface ContextActionButtonProps extends Omit<ButtonProps, 'size'> {\n icon?: ReactNode\n /** Badge after the label; hidden at 0 / undefined. */\n count?: number\n /** Put the icon after the label (bulk Add / Remove) rather than before it. */\n isIconTrailing?: boolean\n}\n\n/** Compact action of the panel footer (stops click propagation so the card stays open). */\nexport const ContextActionButton = forwardRef<HTMLButtonElement, ContextActionButtonProps>(\n function ContextActionButton(\n { icon, count, isIconTrailing, onClick, children, className, variant = 'outline', ...props },\n ref\n ) {\n return (\n <Button\n ref={ref}\n variant={variant}\n size=\"sm\"\n className={cn('flex h-6 items-center gap-1 px-2 text-sm pointer-coarse:h-11', className)}\n onClick={(e) => {\n e.stopPropagation()\n onClick?.(e)\n }}\n {...props}\n >\n {!isIconTrailing && icon}\n {children}\n {isIconTrailing && icon}\n {count != null && count > 0 && (\n <Badge variant=\"outline\" className=\"badge-count ml-1\">\n {count}\n </Badge>\n )}\n </Button>\n )\n }\n)\n\nexport interface ContextTab {\n value: string\n /** Visible tab name, e.g. \"Documents\". */\n label: string\n /** Count shown in the tab label. */\n count: number\n testId?: string\n content: ReactNode\n}\n\nexport interface ContextPanelTabsProps {\n tabs: ContextTab[]\n value: string\n onValueChange: (value: string) => void\n testId?: string\n /** Extra classes for the tab strip (e.g. leave room for a sheet's close button). */\n listClassName?: string\n}\n\n/** The panel's tab strip (Radix tabs: roving tabindex, arrow keys) and the active tab's content. */\nexport function ContextPanelTabs({\n tabs,\n value,\n onValueChange,\n testId,\n listClassName,\n}: ContextPanelTabsProps) {\n return (\n <Tabs value={value} onValueChange={onValueChange} data-testid={testId}>\n <TabsList\n className={cn('grid h-auto w-full grid-cols-2 pointer-coarse:h-auto', listClassName)}\n >\n {tabs.map((t) => (\n <TabsTrigger key={t.value} value={t.value} data-testid={t.testId} className=\"gap-1.5\">\n {t.label}\n <Badge variant=\"outline\" className=\"badge-count\">\n {t.count}\n </Badge>\n </TabsTrigger>\n ))}\n </TabsList>\n {tabs.map((t) => (\n <TabsContent key={t.value} value={t.value} className=\"mt-3\">\n {t.content}\n </TabsContent>\n ))}\n </Tabs>\n )\n}\n","import { useEffect, type RefObject } from 'react'\n\nexport interface UseDismissibleCardOptions {\n isOpen: boolean\n onClose: () => void\n /** The card's content: clicks inside never dismiss. */\n contentRef: RefObject<HTMLElement | null>\n /** Focused when the card opens (the panel is opened to find something: typing just works). */\n focusRef?: RefObject<HTMLElement | null>\n}\n\n/**\n * Behaviour of a click-opened card: focus its search box on open, Escape closes it, and a press\n * outside it (or outside any portaled popper that belongs to it, e.g. a dropdown menu opened from\n * inside) closes it too. Bound only while open.\n */\nexport function useDismissibleCard({\n isOpen,\n onClose,\n contentRef,\n focusRef,\n}: UseDismissibleCardOptions): void {\n // rAF lets the portaled content mount before focusing.\n useEffect(() => {\n if (!isOpen) return\n const id = requestAnimationFrame(() => focusRef?.current?.focus())\n return () => cancelAnimationFrame(id)\n }, [isOpen, focusRef])\n\n useEffect(() => {\n if (!isOpen) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return\n e.stopPropagation()\n onClose()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isOpen, onClose])\n\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (e: MouseEvent) => {\n const target = e.target as HTMLElement | null\n if (!target) return\n if (contentRef.current?.contains(target)) return\n if (target.closest('[data-radix-popper-content-wrapper]')) return\n onClose()\n }\n document.addEventListener('mousedown', onPointerDown)\n return () => document.removeEventListener('mousedown', onPointerDown)\n }, [isOpen, onClose, contentRef])\n}\n","import { Tag as TagIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\n\nexport interface PinnableLabel {\n id: string\n name: string\n /** The label's own colour (any CSS colour): the same hue everywhere the label appears. */\n color: string\n /** Ids of the items carrying this label. */\n itemIds: string[]\n}\n\nexport interface LabelPinRowLabels {\n remove: (count: number, name: string) => string\n add: (count: number, name: string) => string\n}\n\nexport const DEFAULT_LABEL_PIN_ROW_LABELS: LabelPinRowLabels = {\n remove: (count, name) => `Remove the ${count} “${name}” item(s) from this chat`,\n add: (count, name) => `Add the ${count} “${name}” item(s) to this chat`,\n}\n\nexport interface LabelPinRowProps {\n labels: PinnableLabel[]\n /** Ids currently in the conversation. */\n selectedIds: string[]\n /** Add every id (already de-duplicated against the chat). */\n onAdd: (ids: string[]) => void\n /** Remove every id. */\n onRemove: (ids: string[]) => void\n testId?: string\n copy?: Partial<LabelPinRowLabels>\n}\n\n/**\n * Label shortcuts inside the in-chat panels: one chip per label in use; clicking it pins\n * everything carrying that label. A chip whose items are ALL in the chat reads as active and\n * clicking it takes them back out, so a label is a toggle rather than a one-way add.\n */\nexport function LabelPinRow({\n labels,\n selectedIds,\n onAdd,\n onRemove,\n testId = 'label-pin-row',\n copy,\n}: LabelPinRowProps) {\n const l = { ...DEFAULT_LABEL_PIN_ROW_LABELS, ...copy }\n const usable = labels.filter((label) => label.itemIds.length > 0)\n if (usable.length === 0) return null\n\n const selectedSet = new Set(selectedIds)\n\n return (\n <div\n className=\"flex flex-wrap items-center gap-1\"\n data-slot=\"label-pin-row\"\n data-testid={testId}\n >\n <TagIcon className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n {usable.map((label) => {\n const allIn = label.itemIds.every((id) => selectedSet.has(id))\n return (\n <button\n key={label.id}\n type=\"button\"\n aria-pressed={allIn}\n title={\n allIn\n ? l.remove(label.itemIds.length, label.name)\n : l.add(label.itemIds.length, label.name)\n }\n onClick={() =>\n allIn\n ? onRemove(label.itemIds)\n : onAdd(label.itemIds.filter((id) => !selectedSet.has(id)))\n }\n className={cn(\n 'flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n allIn ? 'text-white' : 'bg-muted text-foreground hover:brightness-95'\n )}\n // Pinned reads as the label filled in with its own colour; at rest it's the muted\n // pill with the colour on the dot, matching the label pills on documents and facts.\n style={\n allIn\n ? { backgroundColor: label.color, borderColor: label.color }\n : { borderColor: `${label.color}66` }\n }\n data-testid={`${testId}-${label.id}`}\n >\n {!allIn && (\n <span\n className=\"size-1.5 shrink-0 rounded-full\"\n style={{ backgroundColor: label.color }}\n aria-hidden\n />\n )}\n <span className=\"max-w-[120px] truncate\">{label.name}</span>\n <span className=\"tabular-nums opacity-70\">{label.itemIds.length}</span>\n </button>\n )\n })}\n </div>\n )\n}\n","import { Toaster, type ShellToasterProps } from '../shell/Toaster'\nimport { useAssistantDock } from './AssistantDock'\nimport { useChatSurface } from './chat-surface'\n\nexport type AssistantToasterProps = Omit<ShellToasterProps, 'dockOpen'>\n\n/**\n * The shell `Toaster` wired to the assistant dock: while the dock is open (and offered: a mounted\n * page chat hides it) a right-aligned toast stack slides clear of it. Pass `dockWidth` when the\n * `AssistantDock` has a custom `width`.\n */\nexport function AssistantToaster(props: AssistantToasterProps) {\n const dock = useAssistantDock()\n const { isDockAvailable } = useChatSurface()\n return <Toaster {...props} dockOpen={dock.isOpen && isDockAvailable} />\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/chat/PinnedDocChip.tsx","../src/chat/ConversationSearchView.tsx","../src/chat/ContextPanel.tsx","../src/lib/useDismissibleCard.ts","../src/chat/LabelPinRow.tsx","../src/chat/AssistantToaster.tsx"],"names":["jsxs","jsx","X","ContextPanelContent","cn","Fragment","ContextSearchInput","Search","ContextActionButton","Button","TagIcon"],"mappings":";;;;;;;AAUO,IAAM,8BAAA,GAAsD;AAAA,E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OAAA,EAAA,EAAS,GAAG,OAAO,QAAA,EAAU,IAAA,CAAK,UAAU,eAAA,EAAiB,CAAA;AACvE","file":"chunk-DBY5MDKA.js","sourcesContent":["import { Pin, X } 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 PinnedDocChipLabels {\n unpin: string\n /** Accessible name; `title` is the pinned document's name. */\n unpinDocument: (title: string) => string\n}\n\nexport const DEFAULT_PINNED_DOC_CHIP_LABELS: PinnedDocChipLabels = {\n unpin: 'Unpin',\n unpinDocument: (title) => `Unpin ${title}`,\n}\n\nexport interface PinnedDocChipProps {\n title: string\n onUnpin: () => void\n className?: string\n labels?: Partial<PinnedDocChipLabels>\n testId?: string\n}\n\n/**\n * The pinned-document chip that lives inside a composer's attach button: shows which document\n * holds the full-context pin and unpins it in ONE tap (the X is always visible, so touch and\n * keyboard reach it). It is a span with button semantics because it sits inside the attach\n * `<button>`, where nested buttons are invalid; `stopPropagation` keeps the tap from also\n * triggering the parent.\n */\nexport function PinnedDocChip({\n title,\n onUnpin,\n className,\n labels,\n testId = 'unpin-document-button',\n}: PinnedDocChipProps) {\n const l = { ...DEFAULT_PINNED_DOC_CHIP_LABELS, ...labels }\n return (\n <span\n role=\"button\"\n tabIndex={0}\n data-slot=\"pinned-doc-chip\"\n onClick={(e) => {\n e.stopPropagation()\n onUnpin()\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation()\n onUnpin()\n }\n }}\n title={l.unpin}\n aria-label={l.unpinDocument(title)}\n className={cn(\n '-mx-0.5 flex min-w-0 items-center gap-1 rounded-sm px-1 text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n className\n )}\n data-testid={testId}\n >\n <Pin className=\"h-3 w-3 shrink-0 fill-primary\" />\n <X className=\"order-last h-3 w-3 shrink-0 text-muted-foreground\" />\n <span className=\"truncate text-sm\">{title}</span>\n </span>\n )\n}\n","import { useMemo, type ComponentType, type ReactNode } from 'react'\nimport { Bot, Loader2, MessageSquare, Search, User, X } from 'lucide-react'\n\nimport { Button, PassageCard } from '@arbidocs/react/ui'\n\n/** One matching message of a conversation. */\nexport interface ConversationSearchMatch {\n id: string\n role: string\n score: number\n snippet: string\n}\n\n/** A conversation with the messages that matched the query. */\nexport interface ConversationSearchGroup {\n id: string\n title?: string | null\n matches: ConversationSearchMatch[]\n}\n\n/** Every fixed string of the conversation search. */\nexport interface ConversationSearchLabels {\n placeholder: string\n search: string\n searching: string\n matched: (count: number, query: string) => string\n matchCount: (count: number) => string\n untitled: string\n you: string\n assistant: string\n clear: string\n noResults: (query: string) => string\n reindexHint: ReactNode\n backToList: string\n}\n\nexport const DEFAULT_CONVERSATION_SEARCH_LABELS: ConversationSearchLabels = {\n placeholder: 'Search your conversations...',\n search: 'Search',\n searching: 'Searching conversations…',\n matched: (count, query) => `${count} conversation${count === 1 ? '' : 's'} matched “${query}”`,\n matchCount: (count) => `${count} match${count === 1 ? '' : 'es'}`,\n untitled: 'Untitled conversation',\n you: 'You',\n assistant: 'Assistant',\n clear: 'Clear',\n noResults: (query) => `No conversations matched “${query}”.`,\n reindexHint: (\n <>\n Older conversations may need indexing — try <span className=\"font-medium\">Re-index</span>.\n </>\n ),\n backToList: 'Back to list',\n}\n\nexport interface ConversationSearchViewProps {\n query: string\n onQueryChange: (query: string) => void\n /** Enter (without Shift) or the submit button. */\n onSubmit: () => void\n canSubmit: boolean\n isSearching: boolean\n /** The query the shown results answer; empty while no search has run. */\n submittedQuery: string\n /** Results of `submittedQuery`. */\n groups: ConversationSearchGroup[]\n onOpenConversation: (conversationId: string, messageId?: string) => void\n /** Back to the idle body. */\n onClear: () => void\n /** Shown beneath the bar until a search is run (e.g. the history list). */\n children?: ReactNode\n /** Wraps the results area (e.g. an error boundary). */\n ResultsBoundary?: ComponentType<{ children: ReactNode }>\n labels?: Partial<ConversationSearchLabels>\n}\n\nfunction RoleChip({ isUser, labels }: { isUser: boolean; labels: ConversationSearchLabels }) {\n const Icon = isUser ? User : Bot\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-medium text-muted-foreground\">\n <Icon className=\"size-3\" />\n {isUser ? labels.you : labels.assistant}\n </span>\n )\n}\n\nconst Passthrough = ({ children }: { children: ReactNode }) => <>{children}</>\n\n/**\n * Search across past conversations: a search bar, then either the idle body (history list) or\n * the matches grouped by conversation. Opening a group or a hit is the host's navigation.\n */\nexport function ConversationSearchView({\n query,\n onQueryChange,\n onSubmit,\n canSubmit,\n isSearching,\n submittedQuery,\n groups,\n onOpenConversation,\n onClear,\n children,\n ResultsBoundary = Passthrough,\n labels,\n}: ConversationSearchViewProps) {\n const l = useMemo(() => ({ ...DEFAULT_CONVERSATION_SEARCH_LABELS, ...labels }), [labels])\n const hasResults = !!submittedQuery && !isSearching && groups.length > 0\n\n return (\n <div\n data-slot=\"conversation-search\"\n className=\"flex h-full flex-col\"\n data-testid=\"conversation-search-page\"\n >\n <div className=\"flex items-start gap-3 px-6 py-4\">\n <form\n onSubmit={(e) => {\n e.preventDefault()\n onSubmit()\n }}\n className=\"flex-1\"\n >\n <div className=\"flex items-start gap-2 rounded-md border border-input bg-muted px-3 py-1.5 focus-within:ring-2 focus-within:ring-ring\">\n <textarea\n rows={1}\n value={query}\n onChange={(e) => {\n onQueryChange(e.target.value)\n e.target.style.height = 'auto'\n e.target.style.height = `${e.target.scrollHeight}px`\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n onSubmit()\n }\n }}\n placeholder={l.placeholder}\n aria-label={l.search}\n className=\"flex-1 resize-none overflow-hidden border-0 bg-transparent p-0 text-base leading-relaxed text-foreground outline-none placeholder:text-muted-foreground\"\n data-testid=\"conversation-search-input\"\n />\n <div className=\"flex flex-shrink-0 items-center gap-1\">\n <Button\n type=\"submit\"\n size=\"icon\"\n disabled={!canSubmit}\n className=\"size-7 pointer-coarse:size-11\"\n data-testid=\"conversation-search-submit-button\"\n title={l.search}\n aria-label={l.search}\n >\n {isSearching ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </Button>\n </div>\n </div>\n </form>\n </div>\n\n {!submittedQuery ? (\n <div className=\"flex-1 overflow-hidden\">{children}</div>\n ) : (\n <ResultsBoundary>\n <main className=\"flex-1 overflow-auto px-6 pb-6\">\n {isSearching ? (\n <div className=\"flex items-center justify-center gap-2 py-16 text-muted-foreground\">\n <Loader2 className=\"size-5 animate-spin\" />\n {l.searching}\n </div>\n ) : hasResults ? (\n <div className=\"space-y-4\" data-testid=\"conversation-search-results\">\n <div className=\"flex items-center justify-between gap-3\">\n <p className=\"text-sm text-muted-foreground\">\n {l.matched(groups.length, submittedQuery)}\n </p>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1 text-muted-foreground pointer-coarse:h-11\"\n onClick={onClear}\n data-testid=\"conversation-search-clear\"\n >\n <X className=\"size-3.5\" />\n {l.clear}\n </Button>\n </div>\n {groups.map((group) => (\n <div\n key={group.id}\n className=\"rounded-lg border border-border bg-card\"\n data-testid=\"conversation-search-group\"\n >\n <button\n type=\"button\"\n onClick={() => onOpenConversation(group.id)}\n className=\"flex w-full items-center justify-between gap-3 rounded-t-lg px-4 py-2.5 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring pointer-coarse:min-h-11\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <MessageSquare className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\">{group.title || l.untitled}</span>\n </span>\n <span className=\"flex-shrink-0 text-xs text-muted-foreground\">\n {l.matchCount(group.matches.length)}\n </span>\n </button>\n <div className=\"space-y-2 border-t border-border p-3\">\n {group.matches.map((m) => (\n <PassageCard\n key={m.id}\n header={<RoleChip isUser={m.role === 'user'} labels={l} />}\n score={m.score}\n onClick={() => onOpenConversation(group.id, m.id)}\n data-testid=\"conversation-search-hit\"\n >\n <p className=\"line-clamp-3 text-sm text-foreground/90\">{m.snippet}</p>\n </PassageCard>\n ))}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div\n className=\"py-16 text-center text-muted-foreground\"\n data-testid=\"conversation-search-no-results\"\n >\n <MessageSquare className=\"mx-auto mb-3 size-8 opacity-40\" />\n <p>{l.noResults(submittedQuery)}</p>\n <p className=\"mt-1 text-sm\">{l.reindexHint}</p>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"mt-3 gap-1 text-muted-foreground pointer-coarse:h-11\"\n onClick={onClear}\n >\n <X className=\"size-3.5\" />\n {l.backToList}\n </Button>\n </div>\n )}\n </main>\n </ResultsBoundary>\n )}\n </div>\n )\n}\n","import {\n forwardRef,\n Fragment,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type MouseEventHandler,\n type ReactNode,\n} from 'react'\nimport { Check, CheckCircle, Search } from 'lucide-react'\nimport {\n Badge,\n Button,\n HoverCardContent,\n Input,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n type ButtonProps,\n} from '@arbidocs/react/ui'\n\n/**\n * Parts of the composer's \"in this chat\" panels (files, facts): a card that opens upward from the\n * composer, a grouped pick list, and below it the labels, search and bulk actions.\n */\n\n/** The card itself: width follows the chat input (`--chat-input-width`), bounded on small screens. */\nexport const ContextPanelContent = forwardRef<\n ElementRef<typeof HoverCardContent>,\n ComponentPropsWithoutRef<typeof HoverCardContent>\n>(function ContextPanelContent({ className, onClick, ...props }, ref) {\n return (\n <HoverCardContent\n ref={ref}\n side=\"top\"\n align=\"start\"\n data-slot=\"context-panel\"\n // Clicks inside must not bubble (via the React portal) to a click-to-toggle wrapper.\n onClick={(e) => {\n e.stopPropagation()\n onClick?.(e)\n }}\n className={cn(\n 'w-[var(--chat-input-width,var(--radix-hover-card-content-available-width))] max-h-[var(--radix-hover-card-content-available-height)] max-w-[95vw] overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-3 shadow-lg',\n className\n )}\n {...props}\n />\n )\n})\n\nexport interface ContextPickerGroup {\n key: string\n heading: string\n /** Id of the heading element. */\n testId?: string\n /** Shown after the heading as `(n)`. */\n count: number\n children: ReactNode\n}\n\nexport interface ContextPickerListProps {\n groups: ContextPickerGroup[]\n /** Shown instead of the groups when every group is empty. */\n emptyText: string\n testId: string\n className?: string\n}\n\n/**\n * Two (or more) headed groups, e.g. \"In this conversation\" then \"In this workspace\". Each heading\n * pins to the top of the scroller and is pushed out by the next one; the second parks below the\n * first (32px = a heading's own height), so both stay visible however far down you scroll.\n */\nexport function ContextPickerList({\n groups,\n emptyText,\n testId,\n className,\n}: ContextPickerListProps) {\n const isEmpty = groups.every((g) => g.count === 0)\n return (\n <div\n className={cn('max-h-[400px] space-y-1 overflow-y-auto', className)}\n data-slot=\"context-picker-list\"\n data-testid={testId}\n onClick={(e) => e.stopPropagation()}\n >\n {isEmpty ? (\n <p className=\"p-2 text-sm text-muted-foreground\">{emptyText}</p>\n ) : (\n groups.map((g, index) => (\n <Fragment key={g.key}>\n <div\n className={cn(\n 'sticky z-10 bg-muted px-2 py-1.5 text-sm font-medium text-muted-foreground',\n index === 0 ? 'top-0' : 'top-8'\n )}\n data-testid={g.testId}\n >\n {g.heading} ({g.count})\n </div>\n {g.children}\n </Fragment>\n ))\n )}\n </div>\n )\n}\n\nfunction CheckGlyph({ isChecked, className }: { isChecked: boolean; className?: string }) {\n return (\n <span\n className={cn(\n 'flex size-3.5 shrink-0 items-center justify-center rounded-sm border',\n isChecked ? 'border-primary bg-primary text-primary-foreground' : 'border-input',\n className\n )}\n >\n {isChecked && <Check className=\"size-3\" />}\n </span>\n )\n}\n\nexport interface ContextPickerRowProps {\n isSelected: boolean\n onToggle: () => void\n testId?: string\n children: ReactNode\n}\n\n/** A whole-row toggle (e.g. a fact): check glyph then clamped text. */\nexport function ContextPickerRow({\n isSelected,\n onToggle,\n testId,\n children,\n}: ContextPickerRowProps) {\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onToggle()\n }}\n aria-pressed={isSelected}\n data-testid={testId}\n className={cn(\n 'flex w-full items-start gap-2 rounded p-2 text-left text-sm transition-colors pointer-coarse:min-h-11',\n isSelected ? 'bg-primary/10' : 'bg-card hover:bg-muted'\n )}\n >\n <CheckGlyph isChecked={isSelected} className=\"mt-0.5\" />\n <span className=\"line-clamp-2 min-w-0 text-foreground\">{children}</span>\n </button>\n )\n}\n\nexport interface ContextCheckRowProps {\n isSelected: boolean\n /** The check toggle: accessible name (e.g. \"Add to conversation\"), handler and test id. */\n toggle: { label: string; onToggle: () => void; testId?: string }\n /** Status glyph between the toggle and the content. */\n status?: ReactNode\n testId?: string\n /** The row's content (e.g. a document pill that opens the document). */\n children: ReactNode\n}\n\n/** A row with its own check toggle plus a content slot (e.g. a document, which opens on click). */\nexport function ContextCheckRow({\n isSelected,\n toggle,\n status,\n testId,\n children,\n}: ContextCheckRowProps) {\n return (\n <div\n className=\"flex items-center gap-2 rounded px-1 py-0.5\"\n data-slot=\"context-check-row\"\n data-testid={testId}\n >\n <button\n type=\"button\"\n aria-label={toggle.label}\n aria-pressed={isSelected}\n onClick={toggle.onToggle}\n data-testid={toggle.testId}\n className=\"flex shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-11\"\n >\n <CheckGlyph isChecked={isSelected} />\n </button>\n {status}\n {children}\n </div>\n )\n}\n\nexport interface ContextSelectListProps {\n children: ReactNode\n}\n\n/** Compact single-select list (e.g. choose the document to pin). */\nexport function ContextSelectList({ children }: ContextSelectListProps) {\n return <div className=\"max-h-[150px] space-y-2 overflow-y-auto\">{children}</div>\n}\n\nexport interface ContextSelectRowProps {\n isSelected: boolean\n onSelect: MouseEventHandler<HTMLButtonElement>\n status?: ReactNode\n title: string\n testId?: string\n}\n\nexport function ContextSelectRow({\n isSelected,\n onSelect,\n status,\n title,\n testId,\n}: ContextSelectRowProps) {\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onSelect(e)\n }}\n aria-pressed={isSelected}\n data-testid={testId}\n className={cn(\n 'flex w-full items-center gap-2 rounded p-2 text-left text-sm transition-colors pointer-coarse:min-h-11',\n isSelected ? 'border border-primary/30 bg-primary/10' : 'bg-card hover:bg-muted'\n )}\n >\n {status}\n <span className=\"min-w-0 flex-1 truncate text-foreground\" title={title}>\n {title}\n </span>\n {isSelected && <CheckCircle className=\"size-3.5 shrink-0 text-primary\" />}\n </button>\n )\n}\n\nexport interface ContextPanelFooterProps {\n /** Label shortcut chips (host-supplied row). */\n labels?: ReactNode\n /** The search box. */\n search: ReactNode\n /** Icon + title of the panel; omit when tabs already name it. */\n title?: ReactNode\n /** The action buttons, right aligned. */\n actions: ReactNode\n}\n\n/** Everything below the list: the panel opens upward, so its controls sit nearest the button. */\nexport function ContextPanelFooter({ labels, search, title, actions }: ContextPanelFooterProps) {\n return (\n <div className=\"mt-3 space-y-2 border-t border-border pt-3\" data-slot=\"context-panel-footer\">\n {labels}\n {search}\n <div\n className={cn(\n 'flex flex-wrap items-center gap-x-2 gap-y-1.5',\n title ? 'justify-between' : 'justify-end'\n )}\n >\n {title && (\n <div className=\"flex min-w-0 items-center gap-2 text-sm font-medium text-foreground\">\n {title}\n </div>\n )}\n <div className=\"flex flex-wrap items-center gap-1.5\">{actions}</div>\n </div>\n </div>\n )\n}\n\nexport const ContextSearchInput = forwardRef<\n HTMLInputElement,\n ComponentPropsWithoutRef<typeof Input>\n>(function ContextSearchInput({ className, onClick, ...props }, ref) {\n return (\n <div className=\"relative\" onClick={(e) => e.stopPropagation()}>\n <Search className=\"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\" />\n <Input\n ref={ref}\n className={cn('h-7 bg-background pl-7 text-sm', className)}\n onClick={onClick}\n {...props}\n />\n </div>\n )\n})\n\nexport interface ContextActionButtonProps extends Omit<ButtonProps, 'size'> {\n icon?: ReactNode\n /** Badge after the label; hidden at 0 / undefined. */\n count?: number\n /** Put the icon after the label (bulk Add / Remove) rather than before it. */\n isIconTrailing?: boolean\n}\n\n/** Compact action of the panel footer (stops click propagation so the card stays open). */\nexport const ContextActionButton = forwardRef<HTMLButtonElement, ContextActionButtonProps>(\n function ContextActionButton(\n { icon, count, isIconTrailing, onClick, children, className, variant = 'outline', ...props },\n ref\n ) {\n return (\n <Button\n ref={ref}\n variant={variant}\n size=\"sm\"\n className={cn('flex h-6 items-center gap-1 px-2 text-sm pointer-coarse:h-11', className)}\n onClick={(e) => {\n e.stopPropagation()\n onClick?.(e)\n }}\n {...props}\n >\n {!isIconTrailing && icon}\n {children}\n {isIconTrailing && icon}\n {count != null && count > 0 && (\n <Badge variant=\"outline\" className=\"badge-count ml-1\">\n {count}\n </Badge>\n )}\n </Button>\n )\n }\n)\n\nexport interface ContextTab {\n value: string\n /** Visible tab name, e.g. \"Documents\". */\n label: string\n /** Count shown in the tab label. */\n count: number\n testId?: string\n content: ReactNode\n}\n\nexport interface ContextPanelTabsProps {\n tabs: ContextTab[]\n value: string\n onValueChange: (value: string) => void\n testId?: string\n /** Extra classes for the tab strip (e.g. leave room for a sheet's close button). */\n listClassName?: string\n}\n\n/** The panel's tab strip (Radix tabs: roving tabindex, arrow keys) and the active tab's content. */\nexport function ContextPanelTabs({\n tabs,\n value,\n onValueChange,\n testId,\n listClassName,\n}: ContextPanelTabsProps) {\n return (\n <Tabs value={value} onValueChange={onValueChange} data-testid={testId}>\n <TabsList\n className={cn('grid h-auto w-full grid-cols-2 pointer-coarse:h-auto', listClassName)}\n >\n {tabs.map((t) => (\n <TabsTrigger key={t.value} value={t.value} data-testid={t.testId} className=\"gap-1.5\">\n {t.label}\n <Badge variant=\"outline\" className=\"badge-count\">\n {t.count}\n </Badge>\n </TabsTrigger>\n ))}\n </TabsList>\n {tabs.map((t) => (\n <TabsContent key={t.value} value={t.value} className=\"mt-3\">\n {t.content}\n </TabsContent>\n ))}\n </Tabs>\n )\n}\n","import { useEffect, type RefObject } from 'react'\n\nexport interface UseDismissibleCardOptions {\n isOpen: boolean\n onClose: () => void\n /** The card's content: clicks inside never dismiss. */\n contentRef: RefObject<HTMLElement | null>\n /** Focused when the card opens (the panel is opened to find something: typing just works). */\n focusRef?: RefObject<HTMLElement | null>\n}\n\n/**\n * Behaviour of a click-opened card: focus its search box on open, Escape closes it, and a press\n * outside it (or outside any portaled popper that belongs to it, e.g. a dropdown menu opened from\n * inside) closes it too. Bound only while open.\n */\nexport function useDismissibleCard({\n isOpen,\n onClose,\n contentRef,\n focusRef,\n}: UseDismissibleCardOptions): void {\n // rAF lets the portaled content mount before focusing.\n useEffect(() => {\n if (!isOpen) return\n const id = requestAnimationFrame(() => focusRef?.current?.focus())\n return () => cancelAnimationFrame(id)\n }, [isOpen, focusRef])\n\n useEffect(() => {\n if (!isOpen) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return\n e.stopPropagation()\n onClose()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isOpen, onClose])\n\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (e: MouseEvent) => {\n const target = e.target as HTMLElement | null\n if (!target) return\n if (contentRef.current?.contains(target)) return\n if (target.closest('[data-radix-popper-content-wrapper]')) return\n onClose()\n }\n document.addEventListener('mousedown', onPointerDown)\n return () => document.removeEventListener('mousedown', onPointerDown)\n }, [isOpen, onClose, contentRef])\n}\n","import { Tag as TagIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\n\nexport interface PinnableLabel {\n id: string\n name: string\n /** The label's own colour (any CSS colour): the same hue everywhere the label appears. */\n color: string\n /** Ids of the items carrying this label. */\n itemIds: string[]\n}\n\nexport interface LabelPinRowLabels {\n remove: (count: number, name: string) => string\n add: (count: number, name: string) => string\n}\n\nexport const DEFAULT_LABEL_PIN_ROW_LABELS: LabelPinRowLabels = {\n remove: (count, name) => `Remove the ${count} “${name}” item(s) from this chat`,\n add: (count, name) => `Add the ${count} “${name}” item(s) to this chat`,\n}\n\nexport interface LabelPinRowProps {\n labels: PinnableLabel[]\n /** Ids currently in the conversation. */\n selectedIds: string[]\n /** Add every id (already de-duplicated against the chat). */\n onAdd: (ids: string[]) => void\n /** Remove every id. */\n onRemove: (ids: string[]) => void\n testId?: string\n copy?: Partial<LabelPinRowLabels>\n}\n\n/**\n * Label shortcuts inside the in-chat panels: one chip per label in use; clicking it pins\n * everything carrying that label. A chip whose items are ALL in the chat reads as active and\n * clicking it takes them back out, so a label is a toggle rather than a one-way add.\n */\nexport function LabelPinRow({\n labels,\n selectedIds,\n onAdd,\n onRemove,\n testId = 'label-pin-row',\n copy,\n}: LabelPinRowProps) {\n const l = { ...DEFAULT_LABEL_PIN_ROW_LABELS, ...copy }\n const usable = labels.filter((label) => label.itemIds.length > 0)\n if (usable.length === 0) return null\n\n const selectedSet = new Set(selectedIds)\n\n return (\n <div\n className=\"flex flex-wrap items-center gap-1\"\n data-slot=\"label-pin-row\"\n data-testid={testId}\n >\n <TagIcon className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n {usable.map((label) => {\n const allIn = label.itemIds.every((id) => selectedSet.has(id))\n return (\n <button\n key={label.id}\n type=\"button\"\n aria-pressed={allIn}\n title={\n allIn\n ? l.remove(label.itemIds.length, label.name)\n : l.add(label.itemIds.length, label.name)\n }\n onClick={() =>\n allIn\n ? onRemove(label.itemIds)\n : onAdd(label.itemIds.filter((id) => !selectedSet.has(id)))\n }\n className={cn(\n 'flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n allIn ? 'text-white' : 'bg-muted text-foreground hover:brightness-95'\n )}\n // Pinned reads as the label filled in with its own colour; at rest it's the muted\n // pill with the colour on the dot, matching the label pills on documents and facts.\n style={\n allIn\n ? { backgroundColor: label.color, borderColor: label.color }\n : { borderColor: `${label.color}66` }\n }\n data-testid={`${testId}-${label.id}`}\n >\n {!allIn && (\n <span\n className=\"size-1.5 shrink-0 rounded-full\"\n style={{ backgroundColor: label.color }}\n aria-hidden\n />\n )}\n <span className=\"max-w-[120px] truncate\">{label.name}</span>\n <span className=\"tabular-nums opacity-70\">{label.itemIds.length}</span>\n </button>\n )\n })}\n </div>\n )\n}\n","import { Toaster, type ShellToasterProps } from '../shell/Toaster'\nimport { useAssistantDock } from './AssistantDock'\nimport { useChatSurface } from './chat-surface'\n\nexport type AssistantToasterProps = Omit<ShellToasterProps, 'dockOpen'>\n\n/**\n * The shell `Toaster` wired to the assistant dock: while the dock is open (and offered: a mounted\n * page chat hides it) a right-aligned toast stack slides clear of it. Pass `dockWidth` when the\n * `AssistantDock` has a custom `width`.\n */\nexport function AssistantToaster(props: AssistantToasterProps) {\n const dock = useAssistantDock()\n const { isDockAvailable } = useChatSurface()\n return <Toaster {...props} dockOpen={dock.isOpen && isDockAvailable} />\n}\n"]}
|