@arbidocs/react 0.3.107 → 0.3.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +383 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -3
- package/dist/index.d.ts +116 -3
- package/dist/index.js +381 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -632,6 +632,8 @@ var arbiQueryKeys = {
|
|
|
632
632
|
documents: (workspaceId) => ["arbi", "documents", workspaceId],
|
|
633
633
|
conversations: (workspaceId) => ["arbi", "conversations", workspaceId],
|
|
634
634
|
tags: (workspaceId) => ["arbi", "tags", workspaceId],
|
|
635
|
+
thumbnails: (docIds) => ["arbi", "thumbnails", [...docIds].sort().join(",")],
|
|
636
|
+
parsedDoc: (docId, stage) => ["arbi", "parsedDoc", docId, stage],
|
|
635
637
|
agents: () => ["arbi", "agents"],
|
|
636
638
|
sessions: () => ["arbi", "sessions"],
|
|
637
639
|
health: () => ["arbi", "health"],
|
|
@@ -671,6 +673,23 @@ function useTags(workspaceId, options) {
|
|
|
671
673
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
672
674
|
});
|
|
673
675
|
}
|
|
676
|
+
function useThumbnails(docIds, options) {
|
|
677
|
+
const arbi = useArbi();
|
|
678
|
+
return reactQuery.useQuery({
|
|
679
|
+
queryKey: arbiQueryKeys.thumbnails(docIds),
|
|
680
|
+
queryFn: () => arbi.documents.getThumbnails(docIds),
|
|
681
|
+
enabled: (options?.enabled ?? true) && docIds.length > 0 && arbi.hasWorkspace,
|
|
682
|
+
staleTime: 5 * 6e4
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
function useParsedDocument(docId, stage = "final", options) {
|
|
686
|
+
const arbi = useArbi();
|
|
687
|
+
return reactQuery.useQuery({
|
|
688
|
+
queryKey: arbiQueryKeys.parsedDoc(docId ?? "", stage),
|
|
689
|
+
queryFn: () => arbi.documents.getParsedContent(docId, stage),
|
|
690
|
+
enabled: (options?.enabled ?? true) && !!docId && arbi.hasWorkspace
|
|
691
|
+
});
|
|
692
|
+
}
|
|
674
693
|
function useAssistantQuery() {
|
|
675
694
|
const arbi = useArbi();
|
|
676
695
|
return reactQuery.useMutation({
|
|
@@ -3240,6 +3259,366 @@ function DocumentTable({
|
|
|
3240
3259
|
}
|
|
3241
3260
|
) });
|
|
3242
3261
|
}
|
|
3262
|
+
var STATUS_VARIANTS2 = {
|
|
3263
|
+
completed: "default",
|
|
3264
|
+
empty: "secondary",
|
|
3265
|
+
"low-content": "secondary",
|
|
3266
|
+
processing: "outline",
|
|
3267
|
+
queued: "outline",
|
|
3268
|
+
failed: "destructive",
|
|
3269
|
+
skipped: "destructive"
|
|
3270
|
+
};
|
|
3271
|
+
var IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"]);
|
|
3272
|
+
var VIDEO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
|
|
3273
|
+
var AUDIO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
|
|
3274
|
+
var EMAIL_EXTENSIONS2 = /* @__PURE__ */ new Set(["eml", "msg"]);
|
|
3275
|
+
function fileIcon(fileName) {
|
|
3276
|
+
const ext = fileName?.split(".").pop()?.toLowerCase();
|
|
3277
|
+
const size = 44;
|
|
3278
|
+
if (ext && VIDEO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsxRuntime.jsx(VidIcon, { size });
|
|
3279
|
+
if (ext && AUDIO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsxRuntime.jsx(AudIcon, { size });
|
|
3280
|
+
if (ext && IMAGE_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsxRuntime.jsx(ImgIcon, { size });
|
|
3281
|
+
if (ext && EMAIL_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsxRuntime.jsx(EmlIcon, { size });
|
|
3282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PdfIcon, { size });
|
|
3283
|
+
}
|
|
3284
|
+
function docTitle(doc) {
|
|
3285
|
+
return doc.doc_metadata?.title || doc.file_name || "Untitled";
|
|
3286
|
+
}
|
|
3287
|
+
function DocumentGallery({
|
|
3288
|
+
workspaceId,
|
|
3289
|
+
documents,
|
|
3290
|
+
onOpenDocument,
|
|
3291
|
+
selectedIds,
|
|
3292
|
+
onSelectionChange,
|
|
3293
|
+
minTileWidth = 180,
|
|
3294
|
+
className
|
|
3295
|
+
}) {
|
|
3296
|
+
const query = useDocuments(workspaceId, { enabled: !documents });
|
|
3297
|
+
const rows = documents ?? query.data ?? [];
|
|
3298
|
+
const isLoading = !documents && query.isLoading;
|
|
3299
|
+
const tagsQuery = useTags(workspaceId);
|
|
3300
|
+
const tagNameById = React__namespace.default.useMemo(() => {
|
|
3301
|
+
const map = /* @__PURE__ */ new Map();
|
|
3302
|
+
for (const t of tagsQuery.data ?? []) {
|
|
3303
|
+
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
3304
|
+
}
|
|
3305
|
+
return map;
|
|
3306
|
+
}, [tagsQuery.data]);
|
|
3307
|
+
const docIds = React__namespace.default.useMemo(
|
|
3308
|
+
() => rows.map((d) => d.external_id).filter((id) => !!id),
|
|
3309
|
+
[rows]
|
|
3310
|
+
);
|
|
3311
|
+
const thumbsQuery = useThumbnails(docIds);
|
|
3312
|
+
const thumbs = thumbsQuery.data ?? {};
|
|
3313
|
+
const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
|
|
3314
|
+
const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
|
|
3315
|
+
const viewingDocId = useArbiUiStore((s) => s.viewingDocId);
|
|
3316
|
+
const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
|
|
3317
|
+
const effectiveSelected = selectedIds ?? storeSelected;
|
|
3318
|
+
const emitSelection = onSelectionChange ?? storeSetSelected;
|
|
3319
|
+
const selectedSet = React__namespace.default.useMemo(() => new Set(effectiveSelected), [effectiveSelected]);
|
|
3320
|
+
const toggleSelected = React__namespace.default.useCallback(
|
|
3321
|
+
(id) => {
|
|
3322
|
+
const next = new Set(effectiveSelected);
|
|
3323
|
+
if (next.has(id)) next.delete(id);
|
|
3324
|
+
else next.add(id);
|
|
3325
|
+
emitSelection([...next]);
|
|
3326
|
+
},
|
|
3327
|
+
[effectiveSelected, emitSelection]
|
|
3328
|
+
);
|
|
3329
|
+
const openDocument = React__namespace.default.useCallback(
|
|
3330
|
+
(id) => {
|
|
3331
|
+
setViewingDocId(id);
|
|
3332
|
+
onOpenDocument?.(id);
|
|
3333
|
+
},
|
|
3334
|
+
[onOpenDocument, setViewingDocId]
|
|
3335
|
+
);
|
|
3336
|
+
if (isLoading) {
|
|
3337
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3338
|
+
"div",
|
|
3339
|
+
{
|
|
3340
|
+
className: cn(
|
|
3341
|
+
"flex items-center justify-center p-8 text-sm text-muted-foreground",
|
|
3342
|
+
className
|
|
3343
|
+
),
|
|
3344
|
+
children: "Loading documents\u2026"
|
|
3345
|
+
}
|
|
3346
|
+
);
|
|
3347
|
+
}
|
|
3348
|
+
if (rows.length === 0) {
|
|
3349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3350
|
+
"div",
|
|
3351
|
+
{
|
|
3352
|
+
className: cn(
|
|
3353
|
+
"flex items-center justify-center p-8 text-sm text-muted-foreground",
|
|
3354
|
+
className
|
|
3355
|
+
),
|
|
3356
|
+
children: "No documents"
|
|
3357
|
+
}
|
|
3358
|
+
);
|
|
3359
|
+
}
|
|
3360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3361
|
+
"div",
|
|
3362
|
+
{
|
|
3363
|
+
"data-testid": "document-gallery",
|
|
3364
|
+
className: cn("grid gap-4", className),
|
|
3365
|
+
style: { gridTemplateColumns: `repeat(auto-fill, minmax(${minTileWidth}px, 1fr))` },
|
|
3366
|
+
children: rows.map((doc) => {
|
|
3367
|
+
const id = doc.external_id;
|
|
3368
|
+
if (!id) return null;
|
|
3369
|
+
const title = docTitle(doc);
|
|
3370
|
+
const thumb = thumbs[id];
|
|
3371
|
+
const selected = selectedSet.has(id);
|
|
3372
|
+
const viewing = viewingDocId === id;
|
|
3373
|
+
const status = doc.status;
|
|
3374
|
+
const doctags = doc.doctags ?? [];
|
|
3375
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3376
|
+
"div",
|
|
3377
|
+
{
|
|
3378
|
+
"data-doc-id": id,
|
|
3379
|
+
"data-testid": "document-gallery-card",
|
|
3380
|
+
role: "button",
|
|
3381
|
+
tabIndex: 0,
|
|
3382
|
+
onClick: () => openDocument(id),
|
|
3383
|
+
onKeyDown: (e) => {
|
|
3384
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3385
|
+
e.preventDefault();
|
|
3386
|
+
openDocument(id);
|
|
3387
|
+
}
|
|
3388
|
+
},
|
|
3389
|
+
className: cn(
|
|
3390
|
+
"group relative flex flex-col overflow-hidden rounded-lg border bg-card text-left shadow-sm transition",
|
|
3391
|
+
"hover:shadow-md hover:border-ring focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3392
|
+
viewing && "ring-2 ring-ring",
|
|
3393
|
+
selected && "border-ring"
|
|
3394
|
+
),
|
|
3395
|
+
children: [
|
|
3396
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3397
|
+
"label",
|
|
3398
|
+
{
|
|
3399
|
+
className: "absolute left-2 top-2 z-10 flex h-5 w-5 items-center justify-center rounded bg-background/80 shadow-sm backdrop-blur",
|
|
3400
|
+
onClick: (e) => e.stopPropagation(),
|
|
3401
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3402
|
+
"input",
|
|
3403
|
+
{
|
|
3404
|
+
type: "checkbox",
|
|
3405
|
+
"aria-label": `Select ${title}`,
|
|
3406
|
+
checked: selected,
|
|
3407
|
+
onChange: () => toggleSelected(id),
|
|
3408
|
+
className: "h-3.5 w-3.5 cursor-pointer accent-current"
|
|
3409
|
+
}
|
|
3410
|
+
)
|
|
3411
|
+
}
|
|
3412
|
+
),
|
|
3413
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex aspect-[3/4] items-center justify-center overflow-hidden bg-muted", children: thumb ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3414
|
+
"img",
|
|
3415
|
+
{
|
|
3416
|
+
src: thumb,
|
|
3417
|
+
alt: title,
|
|
3418
|
+
loading: "lazy",
|
|
3419
|
+
className: "h-full w-full object-cover object-top"
|
|
3420
|
+
}
|
|
3421
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-2 text-muted-foreground", children: fileIcon(doc.file_name) }) }),
|
|
3422
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-2 p-3", children: [
|
|
3423
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "line-clamp-2 text-sm font-medium leading-snug", title, children: title }),
|
|
3424
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-auto flex flex-wrap items-center gap-1", children: [
|
|
3425
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: STATUS_VARIANTS2[status.toLowerCase()] ?? "secondary", children: status }) : null,
|
|
3426
|
+
doctags.slice(0, 3).map((dt) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3427
|
+
TagEntity,
|
|
3428
|
+
{
|
|
3429
|
+
size: "sm",
|
|
3430
|
+
tag: {
|
|
3431
|
+
external_id: dt.tag_ext_id,
|
|
3432
|
+
name: tagNameById.get(dt.tag_ext_id) ?? dt.tag_ext_id.slice(0, 8)
|
|
3433
|
+
}
|
|
3434
|
+
},
|
|
3435
|
+
dt.tag_ext_id
|
|
3436
|
+
)),
|
|
3437
|
+
doctags.length > 3 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
3438
|
+
"+",
|
|
3439
|
+
doctags.length - 3
|
|
3440
|
+
] }) : null
|
|
3441
|
+
] })
|
|
3442
|
+
] })
|
|
3443
|
+
]
|
|
3444
|
+
},
|
|
3445
|
+
id
|
|
3446
|
+
);
|
|
3447
|
+
})
|
|
3448
|
+
}
|
|
3449
|
+
);
|
|
3450
|
+
}
|
|
3451
|
+
function DocumentReview({
|
|
3452
|
+
docId,
|
|
3453
|
+
doc,
|
|
3454
|
+
workspaceId,
|
|
3455
|
+
stage = "final",
|
|
3456
|
+
onClose,
|
|
3457
|
+
className
|
|
3458
|
+
}) {
|
|
3459
|
+
const parsedQuery = useParsedDocument(docId, stage);
|
|
3460
|
+
const tagsQuery = useTags(workspaceId);
|
|
3461
|
+
const tagNameById = React__namespace.default.useMemo(() => {
|
|
3462
|
+
const map = /* @__PURE__ */ new Map();
|
|
3463
|
+
for (const t of tagsQuery.data ?? []) {
|
|
3464
|
+
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
3465
|
+
}
|
|
3466
|
+
return map;
|
|
3467
|
+
}, [tagsQuery.data]);
|
|
3468
|
+
const title = doc?.doc_metadata?.title || doc?.file_name || "Document";
|
|
3469
|
+
const { findings, chunkToTag } = React__namespace.default.useMemo(() => {
|
|
3470
|
+
const list = [];
|
|
3471
|
+
const chunkTag = /* @__PURE__ */ new Map();
|
|
3472
|
+
for (const dt of doc?.doctags ?? []) {
|
|
3473
|
+
const citations = dt.citations ?? {};
|
|
3474
|
+
for (const [citId, cit] of Object.entries(citations)) {
|
|
3475
|
+
const chunkIds = cit?.chunk_ids ?? [];
|
|
3476
|
+
if (chunkIds.length === 0) continue;
|
|
3477
|
+
list.push({
|
|
3478
|
+
key: `${dt.tag_ext_id}:${citId}`,
|
|
3479
|
+
tagExtId: dt.tag_ext_id,
|
|
3480
|
+
statement: cit.statement,
|
|
3481
|
+
chunkIds
|
|
3482
|
+
});
|
|
3483
|
+
for (const cid of chunkIds) if (!chunkTag.has(cid)) chunkTag.set(cid, dt.tag_ext_id);
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
return { findings: list, chunkToTag: chunkTag };
|
|
3487
|
+
}, [doc?.doctags]);
|
|
3488
|
+
const pages = React__namespace.default.useMemo(() => {
|
|
3489
|
+
const chunks = parsedQuery.data?.chunks ?? [];
|
|
3490
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
3491
|
+
for (const c of chunks) {
|
|
3492
|
+
const p = c.metadata?.page_number ?? 0;
|
|
3493
|
+
if (!byPage.has(p)) byPage.set(p, []);
|
|
3494
|
+
byPage.get(p).push(c);
|
|
3495
|
+
}
|
|
3496
|
+
return [...byPage.entries()].sort((a, b) => a[0] - b[0]);
|
|
3497
|
+
}, [parsedQuery.data]);
|
|
3498
|
+
const scrollRef = React__namespace.default.useRef(null);
|
|
3499
|
+
const [flash, setFlash] = React__namespace.default.useState(null);
|
|
3500
|
+
const jumpToChunk = React__namespace.default.useCallback((chunkId) => {
|
|
3501
|
+
const el = scrollRef.current?.querySelector(`[data-chunk-id="${chunkId}"]`);
|
|
3502
|
+
if (!el) return;
|
|
3503
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
3504
|
+
setFlash(chunkId);
|
|
3505
|
+
window.setTimeout(() => setFlash((c) => c === chunkId ? null : c), 1600);
|
|
3506
|
+
}, []);
|
|
3507
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3508
|
+
"div",
|
|
3509
|
+
{
|
|
3510
|
+
"data-testid": "document-review",
|
|
3511
|
+
className: cn(
|
|
3512
|
+
"flex h-full min-h-0 flex-col overflow-hidden rounded-lg border bg-card",
|
|
3513
|
+
className
|
|
3514
|
+
),
|
|
3515
|
+
children: [
|
|
3516
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-b px-4 py-3", children: [
|
|
3517
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3518
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-semibold", title, children: title }),
|
|
3519
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
3520
|
+
parsedQuery.data?.metadata?.total_number_of_pages ? `${parsedQuery.data.metadata.total_number_of_pages} pages` : `${pages.length} pages`,
|
|
3521
|
+
findings.length ? ` \xB7 ${findings.length} findings` : ""
|
|
3522
|
+
] })
|
|
3523
|
+
] }),
|
|
3524
|
+
doc?.status ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", children: doc.status }) : null,
|
|
3525
|
+
onClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3526
|
+
"button",
|
|
3527
|
+
{
|
|
3528
|
+
type: "button",
|
|
3529
|
+
"aria-label": "Close review",
|
|
3530
|
+
"data-testid": "document-review-close",
|
|
3531
|
+
onClick: onClose,
|
|
3532
|
+
className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3533
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4" })
|
|
3534
|
+
}
|
|
3535
|
+
) : null
|
|
3536
|
+
] }),
|
|
3537
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1", children: [
|
|
3538
|
+
findings.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3539
|
+
"aside",
|
|
3540
|
+
{
|
|
3541
|
+
className: "hidden w-64 shrink-0 overflow-y-auto border-r p-3 md:block",
|
|
3542
|
+
"data-testid": "document-review-findings",
|
|
3543
|
+
children: [
|
|
3544
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "AI findings" }),
|
|
3545
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: findings.map((f) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3546
|
+
"div",
|
|
3547
|
+
{
|
|
3548
|
+
role: "button",
|
|
3549
|
+
tabIndex: 0,
|
|
3550
|
+
"data-testid": "review-finding",
|
|
3551
|
+
onClick: () => jumpToChunk(f.chunkIds[0]),
|
|
3552
|
+
onKeyDown: (e) => {
|
|
3553
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3554
|
+
e.preventDefault();
|
|
3555
|
+
jumpToChunk(f.chunkIds[0]);
|
|
3556
|
+
}
|
|
3557
|
+
},
|
|
3558
|
+
className: "w-full cursor-pointer rounded-md border p-2 text-left text-xs transition hover:border-ring hover:bg-muted/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3559
|
+
children: [
|
|
3560
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3561
|
+
TagEntity,
|
|
3562
|
+
{
|
|
3563
|
+
size: "sm",
|
|
3564
|
+
tag: {
|
|
3565
|
+
external_id: f.tagExtId,
|
|
3566
|
+
name: tagNameById.get(f.tagExtId) ?? f.tagExtId.slice(0, 8)
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
),
|
|
3570
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 line-clamp-3 text-muted-foreground", children: f.statement })
|
|
3571
|
+
]
|
|
3572
|
+
}
|
|
3573
|
+
) }, f.key)) })
|
|
3574
|
+
]
|
|
3575
|
+
}
|
|
3576
|
+
) : null,
|
|
3577
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "min-w-0 flex-1 overflow-y-auto px-6 py-4", children: parsedQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Loading document\u2026" }) : parsedQuery.isError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Could not load this document\u2019s content." }) : pages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "No readable content." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto max-w-3xl space-y-8", children: pages.map(([pageNum, chunks]) => /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
|
|
3578
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
|
|
3579
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
3580
|
+
"Page ",
|
|
3581
|
+
pageNum
|
|
3582
|
+
] }),
|
|
3583
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-px flex-1 bg-border" })
|
|
3584
|
+
] }),
|
|
3585
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: chunks.map((c, i) => {
|
|
3586
|
+
const cid = c.metadata?.chunk_ext_id;
|
|
3587
|
+
const tagExtId = cid ? chunkToTag.get(cid) : void 0;
|
|
3588
|
+
const highlighted = !!tagExtId;
|
|
3589
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3590
|
+
"div",
|
|
3591
|
+
{
|
|
3592
|
+
"data-chunk-id": cid,
|
|
3593
|
+
"data-testid": highlighted ? "review-chunk-cited" : "review-chunk",
|
|
3594
|
+
className: cn(
|
|
3595
|
+
"scroll-mt-4 rounded-md px-2 py-1 transition-colors",
|
|
3596
|
+
highlighted && "bg-[var(--color-ai-accent-soft,theme(colors.amber.100))] ring-1 ring-inset ring-border",
|
|
3597
|
+
flash === cid && "ring-2 ring-ring"
|
|
3598
|
+
),
|
|
3599
|
+
children: [
|
|
3600
|
+
highlighted ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3601
|
+
TagEntity,
|
|
3602
|
+
{
|
|
3603
|
+
size: "sm",
|
|
3604
|
+
tag: {
|
|
3605
|
+
external_id: tagExtId,
|
|
3606
|
+
name: tagNameById.get(tagExtId) ?? tagExtId.slice(0, 8)
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
) }) : null,
|
|
3610
|
+
/* @__PURE__ */ jsxRuntime.jsx(AiMarkdown, { className: "prose prose-sm max-w-none dark:prose-invert", children: c.content })
|
|
3611
|
+
]
|
|
3612
|
+
},
|
|
3613
|
+
cid ?? i
|
|
3614
|
+
);
|
|
3615
|
+
}) })
|
|
3616
|
+
] }, pageNum)) }) })
|
|
3617
|
+
] })
|
|
3618
|
+
]
|
|
3619
|
+
}
|
|
3620
|
+
);
|
|
3621
|
+
}
|
|
3243
3622
|
|
|
3244
3623
|
Object.defineProperty(exports, "Arbi", {
|
|
3245
3624
|
enumerable: true,
|
|
@@ -3271,6 +3650,8 @@ exports.CardTitle = CardTitle;
|
|
|
3271
3650
|
exports.DocQaPanel = DocQaPanel;
|
|
3272
3651
|
exports.DocSearch = DocSearch;
|
|
3273
3652
|
exports.DocumentEntity = DocumentEntity;
|
|
3653
|
+
exports.DocumentGallery = DocumentGallery;
|
|
3654
|
+
exports.DocumentReview = DocumentReview;
|
|
3274
3655
|
exports.DocumentTable = DocumentTable;
|
|
3275
3656
|
exports.EmlIcon = EmlIcon;
|
|
3276
3657
|
exports.EntityPill = EntityPill;
|
|
@@ -3307,10 +3688,12 @@ exports.useDeleteAgents = useDeleteAgents;
|
|
|
3307
3688
|
exports.useDocuments = useDocuments;
|
|
3308
3689
|
exports.useHealth = useHealth;
|
|
3309
3690
|
exports.useMemories = useMemories;
|
|
3691
|
+
exports.useParsedDocument = useParsedDocument;
|
|
3310
3692
|
exports.useSemanticSearch = useSemanticSearch;
|
|
3311
3693
|
exports.useSessions = useSessions;
|
|
3312
3694
|
exports.useTags = useTags;
|
|
3313
3695
|
exports.useTasks = useTasks;
|
|
3696
|
+
exports.useThumbnails = useThumbnails;
|
|
3314
3697
|
exports.useWorkspaceDocs = useWorkspaceDocs;
|
|
3315
3698
|
exports.useWorkspaces = useWorkspaces;
|
|
3316
3699
|
//# sourceMappingURL=index.cjs.map
|