@arbidocs/react 0.4.70 → 0.4.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +6 -4
  2. package/dist/ProductionDialog-BRrZ5Lj5.d.cts +84 -0
  3. package/dist/ProductionDialog-DUC9BXWS.d.ts +84 -0
  4. package/dist/annotations/freeze/index.cjs +45 -1100
  5. package/dist/annotations/freeze/index.cjs.map +1 -1
  6. package/dist/annotations/freeze/index.d.cts +2 -85
  7. package/dist/annotations/freeze/index.d.ts +2 -85
  8. package/dist/annotations/freeze/index.js +4 -1084
  9. package/dist/annotations/freeze/index.js.map +1 -1
  10. package/dist/annotations/index.cjs +48 -48
  11. package/dist/annotations/index.d.cts +3 -51
  12. package/dist/annotations/index.d.ts +3 -51
  13. package/dist/annotations/index.js +2 -2
  14. package/dist/artifacts/index.cjs +9 -9
  15. package/dist/artifacts/index.js +2 -2
  16. package/dist/bundle-BnCSbHy2.d.cts +85 -0
  17. package/dist/bundle-BnCSbHy2.d.ts +85 -0
  18. package/dist/bundle-N2JIJ2T6.js +4 -0
  19. package/dist/bundle-N2JIJ2T6.js.map +1 -0
  20. package/dist/bundle-T6BEVYHE.cjs +13 -0
  21. package/dist/bundle-T6BEVYHE.cjs.map +1 -0
  22. package/dist/{chunk-7CL7QHT6.cjs → chunk-GE5TAR7Y.cjs} +26 -25
  23. package/dist/chunk-GE5TAR7Y.cjs.map +1 -0
  24. package/dist/{chunk-3QF5DNAP.js → chunk-IHTBAY57.js} +3 -3
  25. package/dist/{chunk-3QF5DNAP.js.map → chunk-IHTBAY57.js.map} +1 -1
  26. package/dist/{chunk-ZMTLGO3K.cjs → chunk-IIT7DMQL.cjs} +6 -2
  27. package/dist/chunk-IIT7DMQL.cjs.map +1 -0
  28. package/dist/{chunk-SYPUFZGA.js → chunk-IQ5TYPVU.js} +4 -3
  29. package/dist/chunk-IQ5TYPVU.js.map +1 -0
  30. package/dist/{chunk-ULU5LEWF.cjs → chunk-L2PXZWJM.cjs} +25 -25
  31. package/dist/{chunk-ULU5LEWF.cjs.map → chunk-L2PXZWJM.cjs.map} +1 -1
  32. package/dist/{chunk-V4CXOPLB.js → chunk-MHCN7OST.js} +19 -7
  33. package/dist/{chunk-V4CXOPLB.js.map → chunk-MHCN7OST.js.map} +1 -1
  34. package/dist/{chunk-BTRIS3HY.cjs → chunk-QJRP2LLQ.cjs} +19 -6
  35. package/dist/chunk-QJRP2LLQ.cjs.map +1 -0
  36. package/dist/chunk-QJXFRP5R.cjs +1103 -0
  37. package/dist/chunk-QJXFRP5R.cjs.map +1 -0
  38. package/dist/{chunk-J4MX2W4H.js → chunk-WBYNKFUO.js} +6 -3
  39. package/dist/chunk-WBYNKFUO.js.map +1 -0
  40. package/dist/{chunk-LQ5YHB7W.cjs → chunk-WYZJLZ67.cjs} +6 -4
  41. package/dist/chunk-WYZJLZ67.cjs.map +1 -0
  42. package/dist/{chunk-WS6DF5X4.js → chunk-YNNAJJ5Z.js} +6 -4
  43. package/dist/chunk-YNNAJJ5Z.js.map +1 -0
  44. package/dist/chunk-ZJMUNGOY.js +1088 -0
  45. package/dist/chunk-ZJMUNGOY.js.map +1 -0
  46. package/dist/document-tools/index.cjs +226 -11
  47. package/dist/document-tools/index.cjs.map +1 -1
  48. package/dist/document-tools/index.d.cts +139 -9
  49. package/dist/document-tools/index.d.ts +139 -9
  50. package/dist/document-tools/index.js +207 -9
  51. package/dist/document-tools/index.js.map +1 -1
  52. package/dist/{index-BWv_FKi3.d.cts → index-BVMBElCu.d.cts} +82 -1
  53. package/dist/{index-BWv_FKi3.d.ts → index-BVMBElCu.d.ts} +82 -1
  54. package/dist/index.cjs +688 -369
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +208 -4
  57. package/dist/index.d.ts +208 -4
  58. package/dist/index.js +313 -11
  59. package/dist/index.js.map +1 -1
  60. package/dist/ui/index.cjs +137 -133
  61. package/dist/ui/index.d.cts +1 -1
  62. package/dist/ui/index.d.ts +1 -1
  63. package/dist/ui/index.js +2 -2
  64. package/dist/viewers/index.cjs +2 -2
  65. package/dist/viewers/index.js +1 -1
  66. package/package.json +4 -3
  67. package/dist/chunk-7CL7QHT6.cjs.map +0 -1
  68. package/dist/chunk-BTRIS3HY.cjs.map +0 -1
  69. package/dist/chunk-J4MX2W4H.js.map +0 -1
  70. package/dist/chunk-LQ5YHB7W.cjs.map +0 -1
  71. package/dist/chunk-SYPUFZGA.js.map +0 -1
  72. package/dist/chunk-WS6DF5X4.js.map +0 -1
  73. package/dist/chunk-ZMTLGO3K.cjs.map +0 -1
  74. package/dist/store-CqkkD7Ho.d.cts +0 -35
  75. package/dist/store-D1nhbkgk.d.ts +0 -35
@@ -1,7 +1,7 @@
1
1
  import { A as Annotation, e as RedactionStatus, d as CommentReply, b as AnnotationLayer, N as NormRect } from '../model-DIwXRuGC.js';
2
2
  export { a as AnnotationKind, c as AnnotationLayerError, B as BoxAnnotation, C as CommentAnnotation, H as HighlightAnnotation, L as LAYER_SCHEMA_VERSION, R as RedactionAnnotation, S as StampAnnotation, f as annotationRects, g as clampRect, h as emptyLayer, i as isEffectiveRedaction, p as parseAnnotation, j as parseLayer } from '../model-DIwXRuGC.js';
3
- import { A as AnnotationStore } from '../store-D1nhbkgk.js';
4
- export { a as AnnotationStoreOfflineError, c as createLocalStorageStore, b as createMemoryStore } from '../store-D1nhbkgk.js';
3
+ import { A as AnnotationStore } from '../ProductionDialog-DUC9BXWS.js';
4
+ export { a as AnnotationStoreOfflineError, P as ProductionChoices, b as ProductionCorner, c as ProductionDialog, d as ProductionDialogProps, e as ProductionDocument, f as createLocalStorageStore, g as createMemoryStore, m as moveItem, q as qrCornerFor } from '../ProductionDialog-DUC9BXWS.js';
5
5
  import * as React from 'react';
6
6
  import { ReactNode } from 'react';
7
7
 
@@ -352,52 +352,4 @@ interface FreezeDialogProps {
352
352
  }
353
353
  declare function FreezeDialog({ open, onOpenChange, controller, onConfirm, busy, progress, error, }: FreezeDialogProps): React.JSX.Element;
354
354
 
355
- /**
356
- * Asks how to number and package a set of documents as a production. It only collects choices; the
357
- * host runs `buildBundle` (see `@arbidocs/react/annotations/freeze`) and saves the result.
358
- *
359
- * The documents can be put in order (drag a row, or its up/down buttons from the keyboard): that
360
- * order is the numbering order.
361
- */
362
- type ProductionCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
363
- interface ProductionChoices {
364
- layout: 'merged' | 'per-document';
365
- prefix: string;
366
- start: number;
367
- digits: number;
368
- /** Corner of the Bates label; the QR code, when on, takes the opposite bottom corner. */
369
- corner: ProductionCorner;
370
- qr: boolean;
371
- /** An index page first: every document with its Bates range. */
372
- indexPage: boolean;
373
- /** Also save the result as a document in the workspace (it is downloaded either way). */
374
- saveToWorkspace: boolean;
375
- /** Document ids in numbering order. */
376
- order: string[];
377
- }
378
- interface ProductionDocument {
379
- id: string;
380
- name: string;
381
- }
382
- interface ProductionDialogProps {
383
- open: boolean;
384
- onOpenChange: (open: boolean) => void;
385
- /** The documents, in the order they are numbered until the user reorders them. */
386
- documents: ProductionDocument[];
387
- /** Selected documents that cannot be included, with the reason, e.g. "photo.jpg (no PDF)". */
388
- leftOut?: string[];
389
- onConfirm: (choices: ProductionChoices) => void;
390
- busy?: boolean;
391
- progress?: {
392
- done: number;
393
- total: number;
394
- } | null;
395
- error?: string | null;
396
- }
397
- /** The QR code sits in the bottom corner the label is not in (the label may be top or bottom). */
398
- declare function qrCornerFor(corner: ProductionCorner): ProductionCorner;
399
- /** `items` with the entry at `from` moved to `to`. */
400
- declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
401
- declare function ProductionDialog({ open, onOpenChange, documents, leftOut, onConfirm, busy, progress, error, }: ProductionDialogProps): React.JSX.Element;
402
-
403
- export { AUTOSAVE_MS, Annotation, type AnnotationAction, type AnnotationController, AnnotationLayer, AnnotationPageOverlay, type AnnotationPageOverlayProps, type AnnotationPatch, AnnotationStore, type AnnotationTool, AnnotationToolbar, type AnnotationToolbarProps, CommentReply, DEFAULT_SETTINGS, type DragMode, type FreezeChoices, FreezeDialog, type FreezeDialogProps, HIGHLIGHT_COLORS, type LayerHistory, type LayerStatus, MARK_COLORS, type MergeInput, type NewMark, NormRect, type PageSelection, type PageTextMark, type PixelRect, type PixelSize, type ProductionChoices, type ProductionCorner, ProductionDialog, type ProductionDialogProps, type ProductionDocument, REDACTION_LOG_COLUMNS, REDACTION_REASONS, RETRY_MS, type RedactionLogRow, RedactionStatus, STAMP_PRESETS, type ToolSettings, type UseAnnotationLayerOptions, annotationsOnPage, applyAction, canRedo, canUndo, containsPoint, createHistory, dragRect, dragToNorm, intersects, isTooSmall, layerStatusText, mergeLayers, mergeLineRects, moveItem, patchForRect, pendingRedactions, qrCornerFor, readSelection, redactionLogCsv, redactionLogRows, redo, reduceLayer, sameMarks, selectionToPageMarks, singleRect, toNorm, toPixels, undo, useAnnotationLayer, useAnnotationShortcuts, useTextSelectionMarks };
355
+ export { AUTOSAVE_MS, Annotation, type AnnotationAction, type AnnotationController, AnnotationLayer, AnnotationPageOverlay, type AnnotationPageOverlayProps, type AnnotationPatch, AnnotationStore, type AnnotationTool, AnnotationToolbar, type AnnotationToolbarProps, CommentReply, DEFAULT_SETTINGS, type DragMode, type FreezeChoices, FreezeDialog, type FreezeDialogProps, HIGHLIGHT_COLORS, type LayerHistory, type LayerStatus, MARK_COLORS, type MergeInput, type NewMark, NormRect, type PageSelection, type PageTextMark, type PixelRect, type PixelSize, REDACTION_LOG_COLUMNS, REDACTION_REASONS, RETRY_MS, type RedactionLogRow, RedactionStatus, STAMP_PRESETS, type ToolSettings, type UseAnnotationLayerOptions, annotationsOnPage, applyAction, canRedo, canUndo, containsPoint, createHistory, dragRect, dragToNorm, intersects, isTooSmall, layerStatusText, mergeLayers, mergeLineRects, patchForRect, pendingRedactions, readSelection, redactionLogCsv, redactionLogRows, redo, reduceLayer, sameMarks, selectionToPageMarks, singleRect, toNorm, toPixels, undo, useAnnotationLayer, useAnnotationShortcuts, useTextSelectionMarks };
@@ -1,6 +1,6 @@
1
- export { AUTOSAVE_MS, AnnotationPageOverlay, AnnotationStoreOfflineError, AnnotationToolbar, DEFAULT_SETTINGS, FreezeDialog, HIGHLIGHT_COLORS, MARK_COLORS, ProductionDialog, REDACTION_LOG_COLUMNS, REDACTION_REASONS, RETRY_MS, STAMP_PRESETS, annotationsOnPage, applyAction, canRedo, canUndo, containsPoint, createHistory, createLocalStorageStore, createMemoryStore, dragRect, dragToNorm, intersects, isTooSmall, layerStatusText, mergeLayers, mergeLineRects, moveItem, patchForRect, pendingRedactions, qrCornerFor, readSelection, redactionLogCsv, redactionLogRows, redo, reduceLayer, sameMarks, selectionToPageMarks, singleRect, toNorm, toPixels, undo, useAnnotationLayer, useAnnotationShortcuts, useTextSelectionMarks } from '../chunk-3QF5DNAP.js';
1
+ export { AUTOSAVE_MS, AnnotationPageOverlay, AnnotationStoreOfflineError, AnnotationToolbar, DEFAULT_SETTINGS, FreezeDialog, HIGHLIGHT_COLORS, MARK_COLORS, ProductionDialog, REDACTION_LOG_COLUMNS, REDACTION_REASONS, RETRY_MS, STAMP_PRESETS, annotationsOnPage, applyAction, canRedo, canUndo, containsPoint, createHistory, createLocalStorageStore, createMemoryStore, dragRect, dragToNorm, intersects, isTooSmall, layerStatusText, mergeLayers, mergeLineRects, moveItem, patchForRect, pendingRedactions, qrCornerFor, readSelection, redactionLogCsv, redactionLogRows, redo, reduceLayer, sameMarks, selectionToPageMarks, singleRect, toNorm, toPixels, undo, useAnnotationLayer, useAnnotationShortcuts, useTextSelectionMarks } from '../chunk-IHTBAY57.js';
2
2
  export { AnnotationLayerError, LAYER_SCHEMA_VERSION, annotationRects, clampRect, emptyLayer, isEffectiveRedaction, parseAnnotation, parseLayer } from '../chunk-COWZGCL5.js';
3
- import '../chunk-WS6DF5X4.js';
3
+ import '../chunk-YNNAJJ5Z.js';
4
4
  import '../chunk-47CCGUWR.js';
5
5
  import '../chunk-SN5YV6FF.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunk7CL7QHT6_cjs = require('../chunk-7CL7QHT6.cjs');
3
+ var chunkGE5TAR7Y_cjs = require('../chunk-GE5TAR7Y.cjs');
4
4
  var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
5
5
  var chunkT4IJHRRD_cjs = require('../chunk-T4IJHRRD.cjs');
6
6
  var chunk5DCRIWCA_cjs = require('../chunk-5DCRIWCA.cjs');
7
7
  var chunkVOFNX4P6_cjs = require('../chunk-VOFNX4P6.cjs');
8
+ var chunkIIT7DMQL_cjs = require('../chunk-IIT7DMQL.cjs');
8
9
  var chunk5SZ2J2WT_cjs = require('../chunk-5SZ2J2WT.cjs');
9
10
  require('../chunk-Z3LLUO32.cjs');
10
11
  require('../chunk-S6A6FSG7.cjs');
11
- var chunkZMTLGO3K_cjs = require('../chunk-ZMTLGO3K.cjs');
12
12
  var react = require('react');
13
13
  var reactQuery = require('@tanstack/react-query');
14
14
  var jsxRuntime = require('react/jsx-runtime');
@@ -276,7 +276,7 @@ var isRefusal = (error) => {
276
276
  return code === 401 || code === 403;
277
277
  };
278
278
  function useArtifactText(docId, options) {
279
- const arbi = chunkZMTLGO3K_cjs.useArbi();
279
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
280
280
  const { attempts, baseDelayMs, maxDelayMs } = {
281
281
  ...DEFAULT_ARTIFACT_TEXT_RETRY,
282
282
  ...options?.retry
@@ -284,7 +284,7 @@ function useArtifactText(docId, options) {
284
284
  const enabled = (options?.enabled ?? true) && chunkT4IJHRRD_cjs.isDocumentId(docId) && arbi.hasWorkspace;
285
285
  const query = reactQuery.useQuery({
286
286
  // Under the shared `parsedDoc` key, so a document's invalidation reaches it too.
287
- queryKey: [...chunk7CL7QHT6_cjs.arbiQueryKeys.parsedDoc(docId ?? "", "marker"), "artifact-text"],
287
+ queryKey: [...chunkGE5TAR7Y_cjs.arbiQueryKeys.parsedDoc(docId ?? "", "marker"), "artifact-text"],
288
288
  queryFn: async () => {
289
289
  const { docId: plainId, version } = chunkT4IJHRRD_cjs.parseVersionRef(docId);
290
290
  const parsed = await arbi.documents.getParsedContent(
@@ -332,12 +332,12 @@ function useArtifactText(docId, options) {
332
332
  // src/artifacts/useArtifactSession.ts
333
333
  function useArtifactVersions(workspaceId, docId) {
334
334
  const plainId = docId ? chunkT4IJHRRD_cjs.parseVersionRef(docId).docId : null;
335
- const { data: documents } = chunk7CL7QHT6_cjs.useDocuments(workspaceId);
335
+ const { data: documents } = chunkGE5TAR7Y_cjs.useDocuments(workspaceId);
336
336
  const listed = react.useMemo(
337
337
  () => (documents ?? []).find((d) => d.external_id === plainId),
338
338
  [documents, plainId]
339
339
  );
340
- const { data: history } = chunk7CL7QHT6_cjs.useDocumentVersionList(plainId, {
340
+ const { data: history } = chunkGE5TAR7Y_cjs.useDocumentVersionList(plainId, {
341
341
  enabled: !!plainId && documents !== void 0 && !listed
342
342
  });
343
343
  return react.useMemo(
@@ -346,7 +346,7 @@ function useArtifactVersions(workspaceId, docId) {
346
346
  );
347
347
  }
348
348
  function useSaveArtifactVersion() {
349
- const arbi = chunkZMTLGO3K_cjs.useArbi();
349
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
350
350
  const queryClient = reactQuery.useQueryClient();
351
351
  return reactQuery.useMutation({
352
352
  mutationFn: async ({ title, content, versionOf, configId, wpType, workspaceId }) => {
@@ -362,9 +362,9 @@ function useSaveArtifactVersion() {
362
362
  );
363
363
  const docId = result.doc_ext_ids?.[0];
364
364
  if (workspaceId) {
365
- await queryClient.invalidateQueries({ queryKey: chunk7CL7QHT6_cjs.arbiQueryKeys.documents(workspaceId) });
365
+ await queryClient.invalidateQueries({ queryKey: chunkGE5TAR7Y_cjs.arbiQueryKeys.documents(workspaceId) });
366
366
  }
367
- await queryClient.invalidateQueries({ queryKey: chunk7CL7QHT6_cjs.arbiQueryKeys.allDocumentVersions() });
367
+ await queryClient.invalidateQueries({ queryKey: chunkGE5TAR7Y_cjs.arbiQueryKeys.allDocumentVersions() });
368
368
  if (docId) await queryClient.invalidateQueries({ queryKey: ["arbi", "parsedDoc", docId] });
369
369
  return { docId, version: result.version ?? void 0 };
370
370
  }
@@ -1,4 +1,4 @@
1
- import { arbiQueryKeys, useDocuments, useDocumentVersionList } from '../chunk-SYPUFZGA.js';
1
+ import { arbiQueryKeys, useDocuments, useDocumentVersionList } from '../chunk-IQ5TYPVU.js';
2
2
  import { revertRedlineRegion, buildHybridRedlineWithRegions, buildHybridRedlineMarkdown } from '../chunk-74N436VK.js';
3
3
  export { buildHybridRedlineMarkdown, buildHybridRedlineWithRegions, revertRedlineRegion } from '../chunk-74N436VK.js';
4
4
  import { isDocumentId, parseVersionRef, flattenChunks, documentVersions, toArtifactVersions, findVersion, versionLabel } from '../chunk-HKUD2NZN.js';
@@ -7,10 +7,10 @@ import { cleanDraftWithReport } from '../chunk-G6FHNURH.js';
7
7
  export { cleanDraftMarkdown, cleanDraftWithReport, promoteBoldTitle, repairParsedStructure, repairParsedTitle, stripAgentPreamble, unescapeMarkdown, unwrapCitationLinks } from '../chunk-G6FHNURH.js';
8
8
  import { normalizeMarkdown } from '../chunk-WUTL62MC.js';
9
9
  export { normalizeMarkdown } from '../chunk-WUTL62MC.js';
10
+ import { useArbi } from '../chunk-WBYNKFUO.js';
10
11
  import { MarkdownRenderer } from '../chunk-YXSXGTYQ.js';
11
12
  import '../chunk-QRCMKEE6.js';
12
13
  import '../chunk-SN5YV6FF.js';
13
- import { useArbi } from '../chunk-J4MX2W4H.js';
14
14
  import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
15
15
  import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
16
16
  import { jsx } from 'react/jsx-runtime';
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Page stamps for a production set: a Bates label and an optional QR code. Both are drawn as
3
+ * plain vector content on a white plate, in the DISPLAYED frame, so cropped and rotated pages come
4
+ * out upright. They are added to a document that is already frozen: nothing here can bring back
5
+ * content a redaction removed.
6
+ */
7
+
8
+ type StampCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9
+ interface BatesOptions {
10
+ /** Text before the number, e.g. `ACME-`. Plain characters a standard font can draw. */
11
+ prefix?: string;
12
+ /** First number. Default 1. */
13
+ start?: number;
14
+ /** Zero-pad the number to this many digits. Default 6. */
15
+ digits?: number;
16
+ corner?: StampCorner;
17
+ }
18
+ declare function batesLabel(options: BatesOptions, index: number): string;
19
+
20
+ /**
21
+ * Production bundle: take documents that are ALREADY frozen (or never needed freezing) and number
22
+ * them consecutively with a Bates label, optionally adding a QR code that links back to the
23
+ * document in ARBI.
24
+ *
25
+ * `merged` joins the documents into one PDF; `per-document` keeps one PDF each. Either way the
26
+ * numbering runs on across the whole set in the order given, so a label is unique within the
27
+ * production. Splitting a document is deliberately not part of this.
28
+ *
29
+ * `indexPage` adds an index first (every document with its Bates range): the first page(s) of a
30
+ * merged file, or an `index.pdf` of its own ahead of the per-document files. It is not numbered.
31
+ */
32
+
33
+ type BundleLayout = 'merged' | 'per-document';
34
+ interface BundleItem {
35
+ /** Shown in the index and used to name the output file. */
36
+ name: string;
37
+ /** External id of the document this PDF represents. */
38
+ documentId: string;
39
+ /** PDF bytes, normally the output of `freezePdf`. */
40
+ bytes: Uint8Array;
41
+ /** What the QR code opens. Required for every item when `qr` is on. */
42
+ qrUrl?: string;
43
+ }
44
+ interface BundleOptions {
45
+ layout: BundleLayout;
46
+ bates: BatesOptions;
47
+ /** Add a QR code (to each item's `qrUrl`) on every page. Default false. */
48
+ qr?: boolean;
49
+ qrCorner?: StampCorner;
50
+ /** Name of the merged file. Default `production.pdf`. */
51
+ mergedName?: string;
52
+ /** Put an index page (documents and Bates ranges) at the start. Default false. */
53
+ indexPage?: boolean;
54
+ /** ISO timestamp; defaults to now. Injectable for deterministic tests. */
55
+ now?: string;
56
+ /** Who produced the set; recorded in a merged file's metadata. */
57
+ author?: string;
58
+ onProgress?: (done: number, total: number) => void;
59
+ signal?: AbortSignal;
60
+ }
61
+ interface BundleIndexEntry {
62
+ documentId: string;
63
+ name: string;
64
+ /** The output file that holds this document. */
65
+ file: string;
66
+ pages: number;
67
+ firstLabel: string;
68
+ lastLabel: string;
69
+ }
70
+ interface BundleFile {
71
+ name: string;
72
+ bytes: Uint8Array;
73
+ pages: number;
74
+ firstLabel: string;
75
+ lastLabel: string;
76
+ }
77
+ interface BundleResult {
78
+ files: BundleFile[];
79
+ index: BundleIndexEntry[];
80
+ /** Index pages added at the start (0 without `indexPage`). */
81
+ indexPages: number;
82
+ }
83
+ declare function buildBundle(items: BundleItem[], options: BundleOptions): Promise<BundleResult>;
84
+
85
+ export { type BatesOptions as B, type StampCorner as S, type BundleFile as a, type BundleIndexEntry as b, type BundleItem as c, type BundleLayout as d, type BundleOptions as e, type BundleResult as f, batesLabel as g, buildBundle as h };
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Page stamps for a production set: a Bates label and an optional QR code. Both are drawn as
3
+ * plain vector content on a white plate, in the DISPLAYED frame, so cropped and rotated pages come
4
+ * out upright. They are added to a document that is already frozen: nothing here can bring back
5
+ * content a redaction removed.
6
+ */
7
+
8
+ type StampCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9
+ interface BatesOptions {
10
+ /** Text before the number, e.g. `ACME-`. Plain characters a standard font can draw. */
11
+ prefix?: string;
12
+ /** First number. Default 1. */
13
+ start?: number;
14
+ /** Zero-pad the number to this many digits. Default 6. */
15
+ digits?: number;
16
+ corner?: StampCorner;
17
+ }
18
+ declare function batesLabel(options: BatesOptions, index: number): string;
19
+
20
+ /**
21
+ * Production bundle: take documents that are ALREADY frozen (or never needed freezing) and number
22
+ * them consecutively with a Bates label, optionally adding a QR code that links back to the
23
+ * document in ARBI.
24
+ *
25
+ * `merged` joins the documents into one PDF; `per-document` keeps one PDF each. Either way the
26
+ * numbering runs on across the whole set in the order given, so a label is unique within the
27
+ * production. Splitting a document is deliberately not part of this.
28
+ *
29
+ * `indexPage` adds an index first (every document with its Bates range): the first page(s) of a
30
+ * merged file, or an `index.pdf` of its own ahead of the per-document files. It is not numbered.
31
+ */
32
+
33
+ type BundleLayout = 'merged' | 'per-document';
34
+ interface BundleItem {
35
+ /** Shown in the index and used to name the output file. */
36
+ name: string;
37
+ /** External id of the document this PDF represents. */
38
+ documentId: string;
39
+ /** PDF bytes, normally the output of `freezePdf`. */
40
+ bytes: Uint8Array;
41
+ /** What the QR code opens. Required for every item when `qr` is on. */
42
+ qrUrl?: string;
43
+ }
44
+ interface BundleOptions {
45
+ layout: BundleLayout;
46
+ bates: BatesOptions;
47
+ /** Add a QR code (to each item's `qrUrl`) on every page. Default false. */
48
+ qr?: boolean;
49
+ qrCorner?: StampCorner;
50
+ /** Name of the merged file. Default `production.pdf`. */
51
+ mergedName?: string;
52
+ /** Put an index page (documents and Bates ranges) at the start. Default false. */
53
+ indexPage?: boolean;
54
+ /** ISO timestamp; defaults to now. Injectable for deterministic tests. */
55
+ now?: string;
56
+ /** Who produced the set; recorded in a merged file's metadata. */
57
+ author?: string;
58
+ onProgress?: (done: number, total: number) => void;
59
+ signal?: AbortSignal;
60
+ }
61
+ interface BundleIndexEntry {
62
+ documentId: string;
63
+ name: string;
64
+ /** The output file that holds this document. */
65
+ file: string;
66
+ pages: number;
67
+ firstLabel: string;
68
+ lastLabel: string;
69
+ }
70
+ interface BundleFile {
71
+ name: string;
72
+ bytes: Uint8Array;
73
+ pages: number;
74
+ firstLabel: string;
75
+ lastLabel: string;
76
+ }
77
+ interface BundleResult {
78
+ files: BundleFile[];
79
+ index: BundleIndexEntry[];
80
+ /** Index pages added at the start (0 without `indexPage`). */
81
+ indexPages: number;
82
+ }
83
+ declare function buildBundle(items: BundleItem[], options: BundleOptions): Promise<BundleResult>;
84
+
85
+ export { type BatesOptions as B, type StampCorner as S, type BundleFile as a, type BundleIndexEntry as b, type BundleItem as c, type BundleLayout as d, type BundleOptions as e, type BundleResult as f, batesLabel as g, buildBundle as h };
@@ -0,0 +1,4 @@
1
+ export { buildBundle } from './chunk-ZJMUNGOY.js';
2
+ import './chunk-COWZGCL5.js';
3
+ //# sourceMappingURL=bundle-N2JIJ2T6.js.map
4
+ //# sourceMappingURL=bundle-N2JIJ2T6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"bundle-N2JIJ2T6.js"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var chunkQJXFRP5R_cjs = require('./chunk-QJXFRP5R.cjs');
4
+ require('./chunk-SSOPIPEX.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "buildBundle", {
9
+ enumerable: true,
10
+ get: function () { return chunkQJXFRP5R_cjs.buildBundle; }
11
+ });
12
+ //# sourceMappingURL=bundle-T6BEVYHE.cjs.map
13
+ //# sourceMappingURL=bundle-T6BEVYHE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"bundle-T6BEVYHE.cjs"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkZMTLGO3K_cjs = require('./chunk-ZMTLGO3K.cjs');
3
+ var chunkIIT7DMQL_cjs = require('./chunk-IIT7DMQL.cjs');
4
4
  var react = require('react');
5
5
  var reactQuery = require('@tanstack/react-query');
6
6
 
@@ -54,11 +54,12 @@ var arbiQueryKeys = {
54
54
  models: () => ["arbi", "models"],
55
55
  /** The signed-in user's own profile (name, picture, email). */
56
56
  profile: () => ["arbi", "profile"],
57
+ identity: () => ["arbi", "identity"],
57
58
  /** The signed-in user's settings record (notification preferences, flags). */
58
59
  userSettings: () => ["arbi", "userSettings"]
59
60
  };
60
61
  function useWorkspaceUsers(workspaceId, options) {
61
- const arbi = chunkZMTLGO3K_cjs.useArbi();
62
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
62
63
  return reactQuery.useQuery({
63
64
  queryKey: arbiQueryKeys.workspaceUsers(workspaceId ?? ""),
64
65
  enabled: !!workspaceId && (options?.enabled ?? arbi.hasWorkspace),
@@ -71,7 +72,7 @@ function useWorkspaceUsers(workspaceId, options) {
71
72
  });
72
73
  }
73
74
  function useWorkspaces(options) {
74
- const arbi = chunkZMTLGO3K_cjs.useArbi();
75
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
75
76
  return reactQuery.useQuery({
76
77
  queryKey: arbiQueryKeys.workspaces(),
77
78
  queryFn: () => arbi.workspaces.list(),
@@ -79,7 +80,7 @@ function useWorkspaces(options) {
79
80
  });
80
81
  }
81
82
  function useDocuments(workspaceId, options) {
82
- const arbi = chunkZMTLGO3K_cjs.useArbi();
83
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
83
84
  return reactQuery.useQuery({
84
85
  queryKey: arbiQueryKeys.documents(workspaceId ?? ""),
85
86
  queryFn: () => arbi.documents.list(),
@@ -87,7 +88,7 @@ function useDocuments(workspaceId, options) {
87
88
  });
88
89
  }
89
90
  function useDocumentVersionList(docId, options) {
90
- const arbi = chunkZMTLGO3K_cjs.useArbi();
91
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
91
92
  return reactQuery.useQuery({
92
93
  queryKey: arbiQueryKeys.documentVersions(docId ?? ""),
93
94
  queryFn: () => arbi.documents.versions(docId),
@@ -95,7 +96,7 @@ function useDocumentVersionList(docId, options) {
95
96
  });
96
97
  }
97
98
  function useConversations(workspaceId, options) {
98
- const arbi = chunkZMTLGO3K_cjs.useArbi();
99
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
99
100
  return reactQuery.useQuery({
100
101
  queryKey: arbiQueryKeys.conversations(workspaceId ?? ""),
101
102
  queryFn: () => arbi.conversations.list(),
@@ -104,7 +105,7 @@ function useConversations(workspaceId, options) {
104
105
  });
105
106
  }
106
107
  function useConversationThreads(workspaceId, conversationId, options) {
107
- const arbi = chunkZMTLGO3K_cjs.useArbi();
108
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
108
109
  return reactQuery.useQuery({
109
110
  queryKey: arbiQueryKeys.conversationThreads(workspaceId ?? "", conversationId ?? ""),
110
111
  queryFn: () => arbi.conversations.getThreads(conversationId),
@@ -114,7 +115,7 @@ function useConversationThreads(workspaceId, conversationId, options) {
114
115
  });
115
116
  }
116
117
  function useTags(workspaceId, options) {
117
- const arbi = chunkZMTLGO3K_cjs.useArbi();
118
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
118
119
  return reactQuery.useQuery({
119
120
  queryKey: arbiQueryKeys.tags(workspaceId ?? ""),
120
121
  queryFn: () => arbi.tags.list(),
@@ -122,7 +123,7 @@ function useTags(workspaceId, options) {
122
123
  });
123
124
  }
124
125
  function useThumbnails(docIds, options) {
125
- const arbi = chunkZMTLGO3K_cjs.useArbi();
126
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
126
127
  return reactQuery.useQuery({
127
128
  queryKey: arbiQueryKeys.thumbnails(docIds),
128
129
  queryFn: () => arbi.documents.getThumbnails(docIds),
@@ -131,7 +132,7 @@ function useThumbnails(docIds, options) {
131
132
  });
132
133
  }
133
134
  function useParsedDocument(docId, stage = "final", options) {
134
- const arbi = chunkZMTLGO3K_cjs.useArbi();
135
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
135
136
  return reactQuery.useQuery({
136
137
  queryKey: arbiQueryKeys.parsedDoc(docId ?? "", stage),
137
138
  queryFn: () => arbi.documents.getParsedContent(docId, stage),
@@ -139,13 +140,13 @@ function useParsedDocument(docId, stage = "final", options) {
139
140
  });
140
141
  }
141
142
  function useAssistantQuery() {
142
- const arbi = chunkZMTLGO3K_cjs.useArbi();
143
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
143
144
  return reactQuery.useMutation({
144
145
  mutationFn: ({ question, ...options }) => arbi.assistant.query(question, options)
145
146
  });
146
147
  }
147
148
  function useAgents(options) {
148
- const arbi = chunkZMTLGO3K_cjs.useArbi();
149
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
149
150
  return reactQuery.useQuery({
150
151
  queryKey: arbiQueryKeys.agents(),
151
152
  queryFn: () => arbi.agents.list(),
@@ -153,7 +154,7 @@ function useAgents(options) {
153
154
  });
154
155
  }
155
156
  function useDeleteAgents() {
156
- const arbi = chunkZMTLGO3K_cjs.useArbi();
157
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
157
158
  const qc = reactQuery.useQueryClient();
158
159
  return reactQuery.useMutation({
159
160
  mutationFn: ({ agentExtIds }) => arbi.agents.delete(agentExtIds),
@@ -172,7 +173,7 @@ function useDeleteAgents() {
172
173
  });
173
174
  }
174
175
  function useSessions(options) {
175
- const arbi = chunkZMTLGO3K_cjs.useArbi();
176
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
176
177
  return reactQuery.useQuery({
177
178
  queryKey: arbiQueryKeys.sessions(),
178
179
  queryFn: () => arbi.sessions.list(),
@@ -180,7 +181,7 @@ function useSessions(options) {
180
181
  });
181
182
  }
182
183
  function useHealth(options) {
183
- const arbi = chunkZMTLGO3K_cjs.useArbi();
184
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
184
185
  return reactQuery.useQuery({
185
186
  queryKey: arbiQueryKeys.health(),
186
187
  queryFn: () => arbi.health.check(),
@@ -188,7 +189,7 @@ function useHealth(options) {
188
189
  });
189
190
  }
190
191
  function useFacts(workspaceId, options) {
191
- const arbi = chunkZMTLGO3K_cjs.useArbi();
192
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
192
193
  return reactQuery.useQuery({
193
194
  queryKey: arbiQueryKeys.facts(workspaceId ?? ""),
194
195
  queryFn: () => arbi.facts.list(),
@@ -196,7 +197,7 @@ function useFacts(workspaceId, options) {
196
197
  });
197
198
  }
198
199
  function useConfigs(options) {
199
- const arbi = chunkZMTLGO3K_cjs.useArbi();
200
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
200
201
  return reactQuery.useQuery({
201
202
  queryKey: arbiQueryKeys.configs(),
202
203
  queryFn: () => arbi.agentConfig.list(),
@@ -204,7 +205,7 @@ function useConfigs(options) {
204
205
  });
205
206
  }
206
207
  function useActivity(options) {
207
- const arbi = chunkZMTLGO3K_cjs.useArbi();
208
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
208
209
  return reactQuery.useQuery({
209
210
  queryKey: arbiQueryKeys.activity(),
210
211
  queryFn: () => arbi.dm.listActivity({ limit: options?.limit, offset: options?.offset }),
@@ -212,7 +213,7 @@ function useActivity(options) {
212
213
  });
213
214
  }
214
215
  function useProjects(options) {
215
- const arbi = chunkZMTLGO3K_cjs.useArbi();
216
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
216
217
  return reactQuery.useQuery({
217
218
  queryKey: arbiQueryKeys.projects(),
218
219
  queryFn: () => arbi.projects.list(),
@@ -220,7 +221,7 @@ function useProjects(options) {
220
221
  });
221
222
  }
222
223
  function useProjectUsage(projectExtId, monthsBack = 0, options) {
223
- const arbi = chunkZMTLGO3K_cjs.useArbi();
224
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
224
225
  const usage = reactQuery.useQuery({
225
226
  queryKey: arbiQueryKeys.projectUsage(projectExtId ?? "", monthsBack),
226
227
  queryFn: () => arbi.projects.usage(projectExtId, monthsBack),
@@ -232,7 +233,7 @@ function useProjectUsage(projectExtId, monthsBack = 0, options) {
232
233
  return { ...usage, metered };
233
234
  }
234
235
  function useProjectsUsage(projectExtIds, monthsBack = 0, options) {
235
- const arbi = chunkZMTLGO3K_cjs.useArbi();
236
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
236
237
  const enabled = (options?.enabled ?? true) && arbi.isLoggedIn;
237
238
  const projects = useProjects({ enabled: enabled && projectExtIds.length > 0 });
238
239
  const results = reactQuery.useQueries({
@@ -306,7 +307,7 @@ function useProjectsUsage(projectExtIds, monthsBack = 0, options) {
306
307
  }, [signature]);
307
308
  }
308
309
  function useProjectInvoices(projectExtId, options) {
309
- const arbi = chunkZMTLGO3K_cjs.useArbi();
310
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
310
311
  return reactQuery.useQuery({
311
312
  queryKey: arbiQueryKeys.projectInvoices(projectExtId ?? ""),
312
313
  queryFn: () => arbi.projects.invoices(projectExtId),
@@ -314,7 +315,7 @@ function useProjectInvoices(projectExtId, options) {
314
315
  });
315
316
  }
316
317
  function useUserUsageToday(options) {
317
- const arbi = chunkZMTLGO3K_cjs.useArbi();
318
+ const arbi = chunkIIT7DMQL_cjs.useArbi();
318
319
  return reactQuery.useQuery({
319
320
  queryKey: arbiQueryKeys.userUsageToday(),
320
321
  queryFn: () => arbi.user.usageToday(),
@@ -349,5 +350,5 @@ exports.useThumbnails = useThumbnails;
349
350
  exports.useUserUsageToday = useUserUsageToday;
350
351
  exports.useWorkspaceUsers = useWorkspaceUsers;
351
352
  exports.useWorkspaces = useWorkspaces;
352
- //# sourceMappingURL=chunk-7CL7QHT6.cjs.map
353
- //# sourceMappingURL=chunk-7CL7QHT6.cjs.map
353
+ //# sourceMappingURL=chunk-GE5TAR7Y.cjs.map
354
+ //# sourceMappingURL=chunk-GE5TAR7Y.cjs.map