@arbidocs/blocks 0.4.92 → 0.4.94

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 (85) hide show
  1. package/dist/agents/index.cjs +209 -209
  2. package/dist/agents/index.js +4 -4
  3. package/dist/{chunk-6XS5IJ5R.cjs → chunk-3OXWJ3CZ.cjs} +5 -5
  4. package/dist/{chunk-6XS5IJ5R.cjs.map → chunk-3OXWJ3CZ.cjs.map} +1 -1
  5. package/dist/chunk-AF6RDAJF.js +14 -0
  6. package/dist/chunk-AF6RDAJF.js.map +1 -0
  7. package/dist/chunk-AOFATOT3.cjs +196 -0
  8. package/dist/chunk-AOFATOT3.cjs.map +1 -0
  9. package/dist/chunk-D3QPYKZG.js +173 -0
  10. package/dist/chunk-D3QPYKZG.js.map +1 -0
  11. package/dist/{chunk-2ZDFVRGV.cjs → chunk-E2AAIMXO.cjs} +975 -61
  12. package/dist/chunk-E2AAIMXO.cjs.map +1 -0
  13. package/dist/{chunk-DDYXFALG.cjs → chunk-KKU7MUWE.cjs} +5 -5
  14. package/dist/{chunk-DDYXFALG.cjs.map → chunk-KKU7MUWE.cjs.map} +1 -1
  15. package/dist/{chunk-EHF63UYP.cjs → chunk-LENXDIMY.cjs} +33 -65
  16. package/dist/chunk-LENXDIMY.cjs.map +1 -0
  17. package/dist/chunk-RC25WMVB.cjs +16 -0
  18. package/dist/chunk-RC25WMVB.cjs.map +1 -0
  19. package/dist/{chunk-5YXG342J.cjs → chunk-RPCQBET5.cjs} +3 -3
  20. package/dist/{chunk-5YXG342J.cjs.map → chunk-RPCQBET5.cjs.map} +1 -1
  21. package/dist/{chunk-YFPIJUV3.cjs → chunk-RZGVMV6B.cjs} +5 -5
  22. package/dist/{chunk-YFPIJUV3.cjs.map → chunk-RZGVMV6B.cjs.map} +1 -1
  23. package/dist/{chunk-W2R7YVFM.js → chunk-WXLKMEMB.js} +970 -65
  24. package/dist/chunk-WXLKMEMB.js.map +1 -0
  25. package/dist/{chunk-BX62HJZU.js → chunk-YPKSLTL5.js} +3 -3
  26. package/dist/{chunk-BX62HJZU.js.map → chunk-YPKSLTL5.js.map} +1 -1
  27. package/dist/{chunk-5RQOVALO.js → chunk-Z3G65XHZ.js} +21 -52
  28. package/dist/chunk-Z3G65XHZ.js.map +1 -0
  29. package/dist/{chunk-W7NZRZ54.js → chunk-Z7OMEYDG.js} +3 -3
  30. package/dist/{chunk-W7NZRZ54.js.map → chunk-Z7OMEYDG.js.map} +1 -1
  31. package/dist/{chunk-UDLMLU6T.js → chunk-ZNDAXSDP.js} +3 -3
  32. package/dist/{chunk-UDLMLU6T.js.map → chunk-ZNDAXSDP.js.map} +1 -1
  33. package/dist/{chunk-5NQIBJPP.js → chunk-ZNGDEQBN.js} +5 -5
  34. package/dist/{chunk-5NQIBJPP.js.map → chunk-ZNGDEQBN.js.map} +1 -1
  35. package/dist/connect/docx.cjs +8 -6
  36. package/dist/connect/docx.cjs.map +1 -1
  37. package/dist/connect/docx.js +6 -4
  38. package/dist/connect/docx.js.map +1 -1
  39. package/dist/connect/index.cjs +44 -44
  40. package/dist/connect/index.cjs.map +1 -1
  41. package/dist/connect/index.js +14 -14
  42. package/dist/connect/index.js.map +1 -1
  43. package/dist/docx/NativeDocxEditor.d.ts +6 -0
  44. package/dist/docx/definitions/DefinedTerms.d.ts +50 -0
  45. package/dist/docx/definitions/commands.d.ts +78 -0
  46. package/dist/docx/definitions/fragment.d.ts +29 -0
  47. package/dist/docx/definitions/port.d.ts +76 -0
  48. package/dist/docx/index.cjs +53 -15
  49. package/dist/docx/index.cjs.map +1 -1
  50. package/dist/docx/index.d.ts +3 -0
  51. package/dist/docx/index.js +5 -3
  52. package/dist/docx/index.js.map +1 -1
  53. package/dist/facts/index.cjs +9 -14
  54. package/dist/facts/index.cjs.map +1 -1
  55. package/dist/facts/index.js +5 -12
  56. package/dist/facts/index.js.map +1 -1
  57. package/dist/files/index.cjs +2 -2
  58. package/dist/files/index.js +2 -2
  59. package/dist/home/index.cjs +1 -1
  60. package/dist/home/index.js +1 -1
  61. package/dist/index.cjs +845 -705
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.js +100 -13
  64. package/dist/index.js.map +1 -1
  65. package/dist/settings/index.cjs +35 -35
  66. package/dist/settings/index.js +3 -3
  67. package/dist/shell/index.cjs +1 -1
  68. package/dist/shell/index.js +1 -1
  69. package/dist/studio/index.cjs +1 -1
  70. package/dist/studio/index.js +1 -1
  71. package/dist/tags/definitions.d.ts +92 -0
  72. package/dist/tags/glossary.d.ts +44 -0
  73. package/dist/tags/index.d.ts +2 -0
  74. package/dist/tags/ooxml.d.ts +46 -0
  75. package/dist/tags/tagTableDocx.d.ts +1 -1
  76. package/dist/workflow-canvas/index.cjs +11 -11
  77. package/dist/workflow-canvas/index.js +4 -4
  78. package/dist/workspaces/index.cjs +1 -1
  79. package/dist/workspaces/index.js +1 -1
  80. package/package.json +4 -4
  81. package/src/docx/README.md +11 -0
  82. package/dist/chunk-2ZDFVRGV.cjs.map +0 -1
  83. package/dist/chunk-5RQOVALO.js.map +0 -1
  84. package/dist/chunk-EHF63UYP.cjs.map +0 -1
  85. package/dist/chunk-W2R7YVFM.js.map +0 -1
@@ -2,6 +2,7 @@ import { type DocxMention, type DocxAgentCommentRequest, type DocxMentionDeliver
2
2
  import React from 'react';
3
3
  import { type FontConfiguration } from '@docx-editor.dev/react';
4
4
  import type { DocxCollaborationSession } from '@arbidocs/coedit';
5
+ import type { DefinitionSource } from '../tags/definitions';
5
6
  /**
6
7
  * The editor path of a document's DOCX bytes. A version reference (`doc-…@v2`, a read-only
7
8
  * snapshot of an older version) reads that version; a plain id the current one.
@@ -38,6 +39,11 @@ export interface NativeDocxAdapter {
38
39
  mentions?: readonly DocxMention[];
39
40
  requestAgent?: (documentId: string, request: DocxAgentCommentRequest) => Promise<DocxMentionDelivery | void>;
40
41
  getAgentStatus?: (responseId: string) => Promise<DocxAgentRunStatus>;
42
+ /**
43
+ * The workspace's definitions: facts labelled "Definitions". Present: the Insert tab offers
44
+ * Defined term and Update definitions, and typing `@@` in the body opens the term type-ahead.
45
+ */
46
+ definitions?: () => Promise<DefinitionSource[]>;
41
47
  }
42
48
  export interface NativeDocxEditorProps {
43
49
  adapter: NativeDocxAdapter;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Defined terms in the Word editor: a type-ahead of the workspace's definitions (typing `@@` in the
3
+ * body, or Insert › Defined term), a hover card on an inserted term, and Update definitions. Mount
4
+ * `DefinedTermsProvider` inside `DocxEditor.Root`; the ribbon's buttons read it from context.
5
+ */
6
+ import React from 'react';
7
+ import { type DefinitionSource } from '../../tags/definitions';
8
+ import { type UpdateDefinitionsResult } from './commands';
9
+ /** Typing this in the body opens the type-ahead. */
10
+ export declare const DEFINED_TERM_TRIGGER = "@@";
11
+ export interface DefinedTermsLabels {
12
+ insert: string;
13
+ update: string;
14
+ search: string;
15
+ allAgreements: string;
16
+ loading: string;
17
+ empty: string;
18
+ noMatch: string;
19
+ hint: string;
20
+ preferred: string;
21
+ alsoIn: (source: string) => string;
22
+ updated: string;
23
+ updateSummary: (r: UpdateDefinitionsResult) => string;
24
+ unusedTitle: string;
25
+ unusedNone: string;
26
+ unknownTitle: string;
27
+ show: string;
28
+ close: string;
29
+ }
30
+ export declare const DEFAULT_DEFINED_TERMS_LABELS: DefinedTermsLabels;
31
+ interface DefinedTermsContextValue {
32
+ /** Open the type-ahead at the caret, with a search box. */
33
+ openPicker: (anchor?: HTMLElement | null) => void;
34
+ /** Update the Definitions section and show what changed. */
35
+ update: () => void;
36
+ labels: DefinedTermsLabels;
37
+ }
38
+ /** The defined-term commands, or `null` where the editor has no definitions to offer. */
39
+ export declare const useDefinedTerms: () => DefinedTermsContextValue | null;
40
+ export interface DefinedTermsProviderProps {
41
+ children: React.ReactNode;
42
+ /** The workspace's definition facts. Absent: no defined-term features. */
43
+ load?: () => Promise<DefinitionSource[]>;
44
+ /** Editing is possible (not a snapshot, a stream or a read-only document). */
45
+ editable: boolean;
46
+ notify?: (message: string, kind: 'success' | 'error') => void;
47
+ labels?: Partial<DefinedTermsLabels>;
48
+ }
49
+ export declare function DefinedTermsProvider({ children, load, editable, notify, labels, }: DefinedTermsProviderProps): React.JSX.Element;
50
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * The defined-term commands: insert a term as a link to its definition (adding the definition to
3
+ * the document's Definitions section when it is not there yet), and update the section from the
4
+ * definition facts. Written against {@link DefinitionsPort}, so they run on the live editor and on
5
+ * the in-memory model the tests use alike.
6
+ *
7
+ * Where the Definitions section is: the first top-level paragraph titled "Definitions",
8
+ * "Definitions and interpretation", "Interpretation", "Defined terms" or "Glossary" (clause numbers
9
+ * ignored), up to the next heading. A document without one gets a "Definitions" heading at its end:
10
+ * appended, it never splits the clause being drafted, and it is where a reader of a draft looks
11
+ * for a schedule of terms. Inside the section, definitions are kept in alphabetical order.
12
+ */
13
+ import { type Definition } from '../../tags/definitions';
14
+ import type { DefinitionsPort, DocParagraph, DocPoint } from './port';
15
+ /** Title of a Definitions section the commands create. */
16
+ export declare const DEFINITIONS_HEADING = "Definitions";
17
+ /** Whether a paragraph titles a Definitions section. */
18
+ export declare function isDefinitionsTitle(paragraph: DocParagraph): boolean;
19
+ /** The Definitions section: its title's index and the paragraphs after it, up to the next heading. */
20
+ export interface DefinitionsSection {
21
+ title: number;
22
+ /** First paragraph after the title. */
23
+ start: number;
24
+ /** Index after the section's last paragraph (the next heading, a table, or the end). */
25
+ end: number;
26
+ }
27
+ export declare function findDefinitionsSection(paragraphs: readonly DocParagraph[]): DefinitionsSection | null;
28
+ /**
29
+ * Where a definition of `term` goes in the section, alphabetically: before the first definition
30
+ * whose term sorts after it, else after the last definition (else right after the title).
31
+ */
32
+ export declare function insertionIndex(paragraphs: readonly DocParagraph[], section: DefinitionsSection, term: string, skip?: ReadonlySet<string>): number;
33
+ /**
34
+ * Add a definition paragraph to the Definitions section (made at the end of the document when there
35
+ * is none), in alphabetical order. Answers where `keep` moved to.
36
+ */
37
+ export declare function addDefinition(port: DefinitionsPort, definition: Definition, keep?: DocPoint): DocPoint | undefined;
38
+ export interface InsertTermResult {
39
+ /** The definition was not in the document yet and was added to its Definitions section. */
40
+ addedDefinition: boolean;
41
+ }
42
+ /**
43
+ * Insert a defined term at the caret: the term as an internal link to its definition's bookmark
44
+ * (its definition as the link's tooltip), the definition added to the Definitions section first
45
+ * when the document does not have it. `replace` characters before the caret (a typed `@@query`)
46
+ * are removed first. The caret ends after the term.
47
+ */
48
+ export declare function insertDefinedTerm(port: DefinitionsPort, definition: Definition, options?: {
49
+ replace?: number;
50
+ }): InsertTermResult;
51
+ /** A definition in the section that nothing in the document uses. */
52
+ export interface UnusedDefinition {
53
+ term: string;
54
+ paragraphId: string;
55
+ }
56
+ export interface UpdateDefinitionsResult {
57
+ /** Terms whose definitions were added (linked from the text, missing from the section). */
58
+ added: string[];
59
+ /** Terms whose wording changed to the fact's current text. */
60
+ refreshed: string[];
61
+ /** Terms moved back into alphabetical order. */
62
+ reordered: string[];
63
+ /** Definitions in the section never used in the rest of the document (left in place). */
64
+ unused: UnusedDefinition[];
65
+ /** Linked bookmarks whose definition fact no longer exists or is no longer a definition. */
66
+ unknown: string[];
67
+ }
68
+ /**
69
+ * Update the Definitions section from the definition facts (`definitions`, by fact id): add the
70
+ * definitions the text links to but the section lacks, refresh the wording of the ones it has,
71
+ * put them back in alphabetical order, and report — without removing anything — the definitions
72
+ * in the section the rest of the document never uses.
73
+ */
74
+ export declare function updateDefinitions(port: DefinitionsPort, definitions: ReadonlyMap<string, Definition>): UpdateDefinitionsResult;
75
+ /** Term groups keyed for quick lookup of the definition a bookmark points at. */
76
+ export declare function definitionsById(definitions: readonly Definition[]): Map<string, Definition>;
77
+ /** The definition an internal link points at, from its bookmark name. */
78
+ export declare function definitionOfAnchor(anchor: string, definitions: ReadonlyMap<string, Definition>): Definition | undefined;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Defined-term content as WordprocessingML, and the clipboard fragment that carries it into the
3
+ * editor. The engine has no "insert bookmark" command, but its paste lands an embedded `.docx`
4
+ * fragment with everything in it — `w:bookmarkStart`/`w:bookmarkEnd` and `w:hyperlink w:anchor`
5
+ * included — freshening bookmark ids as it goes. So the term link, the bookmarked definition and a
6
+ * new Definitions heading are written here and pasted.
7
+ */
8
+ import type { Definition } from '../../tags/definitions';
9
+ /** Character style of an inserted term: a dotted underline, so a defined term reads as one. */
10
+ export declare const DEFINED_TERM_STYLE = "DefinedTerm";
11
+ /** What Word shows on hover over a term: its definition, as one line of at most 255 characters. */
12
+ export declare function definitionTooltip(definition: Pick<Definition, 'term' | 'rest'>): string;
13
+ /** The definition paragraph's text as the document shows it: `“Shares” means the issued shares.` */
14
+ export declare const definitionParagraphText: (definition: Pick<Definition, "term" | "rest">) => string;
15
+ /**
16
+ * A definition paragraph: the quoted term in bold, bookmarked (`bookmark`), then the definition as
17
+ * the fact writes it. `id` is the bookmark id inside the fragment; the paste renumbers it.
18
+ */
19
+ export declare function definitionParagraphXml(definition: Pick<Definition, 'term' | 'rest'>, bookmark: string, id?: number): string;
20
+ /** A heading paragraph: the document's own heading style when it has one, else bold text. */
21
+ export declare function headingParagraphXml(text: string, styleId?: string): string;
22
+ /** The term as an internal link to its definition's bookmark, with the definition as its tooltip. */
23
+ export declare function termLinkXml(term: string, bookmark: string, tooltip: string): string;
24
+ /**
25
+ * Clipboard HTML carrying `body` (paragraph XML) as the editor's own fragment. `covered` says the
26
+ * last paragraph mark is part of it: the paste then ends with a whole paragraph (a block inserted
27
+ * before the caret's paragraph) instead of running into the text after the caret (inline).
28
+ */
29
+ export declare function fragmentHtml(body: string, covered: boolean): string;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The few things the defined-term commands need from a live Word editor, behind an interface so
3
+ * the commands are tested against a small in-memory model rather than the engine.
4
+ */
5
+ import type { DocxEditorInstance } from '@docx-editor.dev/core';
6
+ /** A position: a paragraph (the engine's node id) and a UTF-16 offset into its text. */
7
+ export interface DocPoint {
8
+ paragraphId: string;
9
+ offset: number;
10
+ }
11
+ /** An internal link in a paragraph. */
12
+ export interface DocLink {
13
+ anchor: string;
14
+ text: string;
15
+ }
16
+ /** One paragraph, in document order. */
17
+ export interface DocParagraph {
18
+ id: string;
19
+ text: string;
20
+ /** Styled as a heading (a `Heading n` style or an outline level). */
21
+ heading: boolean;
22
+ styleId?: string;
23
+ /** A paragraph of the body itself, not inside a table. */
24
+ topLevel: boolean;
25
+ /** Names of the bookmarks that start in it. */
26
+ bookmarks: string[];
27
+ /** Its internal links (`w:hyperlink w:anchor`). */
28
+ links: DocLink[];
29
+ }
30
+ export interface DefinitionsPort {
31
+ /** Every body paragraph, in document order (table cells included, `topLevel: false`). */
32
+ paragraphs(): DocParagraph[];
33
+ /** The caret, or `null` when the selection is a range or there is none. */
34
+ caret(): DocPoint | null;
35
+ setCaret(point: DocPoint): void;
36
+ /** Delete everything between two points (across paragraphs: the marks between them go too). */
37
+ deleteRange(from: DocPoint, to: DocPoint): void;
38
+ /**
39
+ * Paste paragraph XML at the caret. `covered`: the fragment ends with a whole paragraph, so at
40
+ * the start of a paragraph it lands as paragraphs before it. Otherwise it runs inline.
41
+ */
42
+ paste(body: string, text: string, covered: boolean): boolean;
43
+ /** Split the caret's paragraph (Enter), the caret moving into the new one. */
44
+ splitParagraph(): void;
45
+ }
46
+ type Node = {
47
+ id: string;
48
+ kind: string;
49
+ localName?: string;
50
+ value?: string;
51
+ attributes?: readonly {
52
+ localName: string;
53
+ value: string;
54
+ }[];
55
+ children?: readonly Node[];
56
+ };
57
+ /** The paragraphs of a part's body, read from the engine's OOXML tree. */
58
+ export declare function readParagraphs(root: Node): DocParagraph[];
59
+ /** The port over a live editor. Writes go through the editor's own commands and paste. */
60
+ export declare function editorPort(editor: DocxEditorInstance): DefinitionsPort;
61
+ /**
62
+ * Run `fn` with direct editing. The engine pastes rich content (bookmarks, links) only outside
63
+ * Suggesting mode, so a suggesting editor switches for the command and back; a read-only one refuses.
64
+ */
65
+ export declare function withDirectEditing<T>(editor: DocxEditorInstance, fn: () => T): T;
66
+ /**
67
+ * Keep the caret where a command left it across the collaboration room's next re-install.
68
+ *
69
+ * A paste lands as a package-level write; in a collaboration room the engine then re-installs the
70
+ * document, numbering its paragraph nodes afresh by position. The selection keeps its old node id,
71
+ * which after a paragraph was inserted above it names a different paragraph, so the next keystroke
72
+ * would go nowhere. The paragraph's own `w14:paraId` survives the re-install: the caret is put back
73
+ * on it once, unless the person has moved it meanwhile.
74
+ */
75
+ export declare function holdCaret(editor: DocxEditorInstance, timeoutMs?: number): void;
76
+ export {};
@@ -1,8 +1,10 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk6XS5IJ5R_cjs = require('../chunk-6XS5IJ5R.cjs');
5
- var chunk2ZDFVRGV_cjs = require('../chunk-2ZDFVRGV.cjs');
4
+ var chunk3OXWJ3CZ_cjs = require('../chunk-3OXWJ3CZ.cjs');
5
+ var chunkE2AAIMXO_cjs = require('../chunk-E2AAIMXO.cjs');
6
+ require('../chunk-AOFATOT3.cjs');
7
+ require('../chunk-RC25WMVB.cjs');
6
8
  require('../chunk-7UTB4PHM.cjs');
7
9
  require('../chunk-MHVNT4J3.cjs');
8
10
  require('../chunk-DES3K4SD.cjs');
@@ -58,7 +60,7 @@ function NativeDocxComparison({
58
60
  if (!documentId)
59
61
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
60
62
  return /* @__PURE__ */ jsxRuntime.jsx(
61
- chunk2ZDFVRGV_cjs.NativeDocxEditor,
63
+ chunkE2AAIMXO_cjs.NativeDocxEditor,
62
64
  {
63
65
  adapter,
64
66
  documentId,
@@ -70,51 +72,87 @@ function NativeDocxComparison({
70
72
 
71
73
  Object.defineProperty(exports, "StreamedWordArtifact", {
72
74
  enumerable: true,
73
- get: function () { return chunk6XS5IJ5R_cjs.StreamedWordArtifact; }
75
+ get: function () { return chunk3OXWJ3CZ_cjs.StreamedWordArtifact; }
76
+ });
77
+ Object.defineProperty(exports, "DEFAULT_DEFINED_TERMS_LABELS", {
78
+ enumerable: true,
79
+ get: function () { return chunkE2AAIMXO_cjs.DEFAULT_DEFINED_TERMS_LABELS; }
80
+ });
81
+ Object.defineProperty(exports, "DEFINED_TERM_TRIGGER", {
82
+ enumerable: true,
83
+ get: function () { return chunkE2AAIMXO_cjs.DEFINED_TERM_TRIGGER; }
84
+ });
85
+ Object.defineProperty(exports, "DefinedTermsProvider", {
86
+ enumerable: true,
87
+ get: function () { return chunkE2AAIMXO_cjs.DefinedTermsProvider; }
74
88
  });
75
89
  Object.defineProperty(exports, "DocxCommentActivity", {
76
90
  enumerable: true,
77
- get: function () { return chunk2ZDFVRGV_cjs.DocxCommentActivity; }
91
+ get: function () { return chunkE2AAIMXO_cjs.DocxCommentActivity; }
78
92
  });
79
93
  Object.defineProperty(exports, "DocxEditorReview", {
80
94
  enumerable: true,
81
- get: function () { return chunk2ZDFVRGV_cjs.DocxEditorReview; }
95
+ get: function () { return chunkE2AAIMXO_cjs.DocxEditorReview; }
82
96
  });
83
97
  Object.defineProperty(exports, "DocxMentions", {
84
98
  enumerable: true,
85
- get: function () { return chunk2ZDFVRGV_cjs.DocxMentions; }
99
+ get: function () { return chunkE2AAIMXO_cjs.DocxMentions; }
86
100
  });
87
101
  Object.defineProperty(exports, "DocxParticipants", {
88
102
  enumerable: true,
89
- get: function () { return chunk2ZDFVRGV_cjs.DocxParticipants; }
103
+ get: function () { return chunkE2AAIMXO_cjs.DocxParticipants; }
90
104
  });
91
105
  Object.defineProperty(exports, "DocxRibbon", {
92
106
  enumerable: true,
93
- get: function () { return chunk2ZDFVRGV_cjs.DocxRibbon; }
107
+ get: function () { return chunkE2AAIMXO_cjs.DocxRibbon; }
94
108
  });
95
109
  Object.defineProperty(exports, "NativeDocxEditor", {
96
110
  enumerable: true,
97
- get: function () { return chunk2ZDFVRGV_cjs.NativeDocxEditor; }
111
+ get: function () { return chunkE2AAIMXO_cjs.NativeDocxEditor; }
112
+ });
113
+ Object.defineProperty(exports, "editorPort", {
114
+ enumerable: true,
115
+ get: function () { return chunkE2AAIMXO_cjs.editorPort; }
116
+ });
117
+ Object.defineProperty(exports, "findDefinitionsSection", {
118
+ enumerable: true,
119
+ get: function () { return chunkE2AAIMXO_cjs.findDefinitionsSection; }
120
+ });
121
+ Object.defineProperty(exports, "insertDefinedTerm", {
122
+ enumerable: true,
123
+ get: function () { return chunkE2AAIMXO_cjs.insertDefinedTerm; }
98
124
  });
99
125
  Object.defineProperty(exports, "loadDocxFonts", {
100
126
  enumerable: true,
101
- get: function () { return chunk2ZDFVRGV_cjs.loadDocxFonts; }
127
+ get: function () { return chunkE2AAIMXO_cjs.loadDocxFonts; }
102
128
  });
103
129
  Object.defineProperty(exports, "normalizeDocxExport", {
104
130
  enumerable: true,
105
- get: function () { return chunk2ZDFVRGV_cjs.normalizeDocxExport; }
131
+ get: function () { return chunkE2AAIMXO_cjs.normalizeDocxExport; }
106
132
  });
107
133
  Object.defineProperty(exports, "reviewModule", {
108
134
  enumerable: true,
109
- get: function () { return chunk2ZDFVRGV_cjs.reviewModule; }
135
+ get: function () { return chunkE2AAIMXO_cjs.reviewModule; }
136
+ });
137
+ Object.defineProperty(exports, "updateDefinitions", {
138
+ enumerable: true,
139
+ get: function () { return chunkE2AAIMXO_cjs.updateDefinitions; }
140
+ });
141
+ Object.defineProperty(exports, "useDefinedTerms", {
142
+ enumerable: true,
143
+ get: function () { return chunkE2AAIMXO_cjs.useDefinedTerms; }
110
144
  });
111
145
  Object.defineProperty(exports, "useReview", {
112
146
  enumerable: true,
113
- get: function () { return chunk2ZDFVRGV_cjs.useReview; }
147
+ get: function () { return chunkE2AAIMXO_cjs.useReview; }
114
148
  });
115
149
  Object.defineProperty(exports, "useReviewItem", {
116
150
  enumerable: true,
117
- get: function () { return chunk2ZDFVRGV_cjs.useReviewItem; }
151
+ get: function () { return chunkE2AAIMXO_cjs.useReviewItem; }
152
+ });
153
+ Object.defineProperty(exports, "withDirectEditing", {
154
+ enumerable: true,
155
+ get: function () { return chunkE2AAIMXO_cjs.withDirectEditing; }
118
156
  });
119
157
  Object.defineProperty(exports, "DocxEditor", {
120
158
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAOA,0BAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAUA,0BAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAGO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,MAAM,IAAA,GAAOC,cAAA,CAAO,EAAE,OAAA,EAAS,YAAY,CAAA;AAC3C,EAAA,IAAA,CAAK,OAAA,GAAU,EAAE,OAAA,EAAS,UAAA,EAAW;AACrC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAIC,iBAAS,EAAE,CAAA;AAC/C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,iBAAS,EAAE,CAAA;AACrC,EAAA,MAAM,CAA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OAAA,EACtC,QAAA,EAAA;AAAA,sBAAAC,cAAA,CAAC,OAAG,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,sBACVA,cAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,UAAA,CAAW,CAAC,KAAA,KAAU,KAAA,GAAQ,CAAC,CAAA,EAAG,QAAA,EAAA,kBAAA,EAAgB;AAAA,KAAA,EAC3E,CAAA;AAEJ,EAAA,IAAI,CAAC,UAAA;AACH,IAAA,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEA,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"index.cjs","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAOA,0BAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAUA,0BAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK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file":"index.cjs","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
@@ -9,3 +9,6 @@ export { loadDocxFonts } from './fonts';
9
9
  export { normalizeDocxExport } from './export';
10
10
  export { StreamedWordArtifact, type StreamedWordArtifactProps } from './StreamedWordArtifact';
11
11
  export { NativeDocxComparison, type NativeDocxComparisonProps } from './NativeDocxComparison';
12
+ export { DefinedTermsProvider, useDefinedTerms, DEFINED_TERM_TRIGGER, DEFAULT_DEFINED_TERMS_LABELS, type DefinedTermsProviderProps, type DefinedTermsLabels, } from './definitions/DefinedTerms';
13
+ export { insertDefinedTerm, updateDefinitions, findDefinitionsSection, type UpdateDefinitionsResult, } from './definitions/commands';
14
+ export { editorPort, withDirectEditing, type DefinitionsPort } from './definitions/port';
@@ -1,7 +1,9 @@
1
1
  "use client";
2
- export { StreamedWordArtifact } from '../chunk-BX62HJZU.js';
3
- import { NativeDocxEditor } from '../chunk-W2R7YVFM.js';
4
- export { DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, loadDocxFonts, normalizeDocxExport, reviewModule, useReview, useReviewItem } from '../chunk-W2R7YVFM.js';
2
+ export { StreamedWordArtifact } from '../chunk-YPKSLTL5.js';
3
+ import { NativeDocxEditor } from '../chunk-WXLKMEMB.js';
4
+ export { DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, editorPort, findDefinitionsSection, insertDefinedTerm, loadDocxFonts, normalizeDocxExport, reviewModule, updateDefinitions, useDefinedTerms, useReview, useReviewItem, withDirectEditing } from '../chunk-WXLKMEMB.js';
5
+ import '../chunk-D3QPYKZG.js';
6
+ import '../chunk-AF6RDAJF.js';
5
7
  import '../chunk-AA3PT6KR.js';
6
8
  import '../chunk-7F6CBP3Z.js';
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AC,KAAA,KAAU,KAAA,GAAQ,CAAC,CAAA,EAAG,QAAA,EAAA,kBAAA,EAAgB;AAAA,KAAA,EAC3E,CAAA;AAEJ,EAAA,IAAI,CAAC,UAAA;AACH,IAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"index.js","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["error"],"mappings":";;;;;;;;;;;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAO,gBAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAU,gBAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAGO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,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CAAC,WAAW,QAAA,CAASA,MAAAA,YAAiB,QAAQA,MAAAA,CAAM,OAAA,GAAU,MAAA,CAAOA,MAAK,CAAC,CAAA;AAAA,IACjF,CAAC,CAAA;AACH,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,IAAA;AAAA,IACd,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAC,CAAA;AAC/B,EAAA,IAAI,KAAA;AACF,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,MAAK,OAAA,EACtC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,OAAG,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,sBACV,GAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,UAAA,CAAW,CAAC,KAAA,KAAU,KAAA,GAAQ,CAAC,CAAA,EAAG,QAAA,EAAA,kBAAA,EAAgB;AAAA,KAAA,EAC3E,CAAA;AAEJ,EAAA,IAAI,CAAC,UAAA;AACH,IAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"index.js","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
@@ -4,13 +4,14 @@
4
4
  var chunk2WLXQGWC_cjs = require('../chunk-2WLXQGWC.cjs');
5
5
  var chunkOUW6G4O2_cjs = require('../chunk-OUW6G4O2.cjs');
6
6
  var chunkVPPX5XUF_cjs = require('../chunk-VPPX5XUF.cjs');
7
+ var chunkRC25WMVB_cjs = require('../chunk-RC25WMVB.cjs');
7
8
  var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
8
9
  var chunkV4ISCZJ7_cjs = require('../chunk-V4ISCZJ7.cjs');
9
10
  var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
10
- var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
11
11
  require('../chunk-C54XEN5T.cjs');
12
- var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
13
12
  var chunkIXALYQT7_cjs = require('../chunk-IXALYQT7.cjs');
13
+ var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
14
+ var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
14
15
  require('../chunk-FX3K6LNZ.cjs');
15
16
  var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
16
17
  require('../chunk-DES3K4SD.cjs');
@@ -19,15 +20,6 @@ var ui = require('@arbidocs/react/ui');
19
20
  var jsxRuntime = require('react/jsx-runtime');
20
21
  var react = require('react');
21
22
 
22
- // src/facts/fact-text.ts
23
- var WHITESPACE_CODE_POINTS = /* @__PURE__ */ new Set([32, 9, 160]);
24
- function decodeWhitespaceEntities(text) {
25
- if (!text) return "";
26
- return text.replace(/&#x([0-9a-f]+);|&#(\d+);/gi, (match, hex, dec) => {
27
- const code = hex ? parseInt(hex, 16) : parseInt(dec, 10);
28
- return WHITESPACE_CODE_POINTS.has(code) ? String.fromCodePoint(code) : match;
29
- });
30
- }
31
23
  var DEFAULT_FACT_COLUMN_LABELS = {
32
24
  inChatHeaderTooltip: "Facts added to this chat are always in context for this chat",
33
25
  inChatTitle: "In this chat \u2014 always in context for it. Click to remove from chat.",
@@ -144,7 +136,7 @@ function createFactColumns(slots) {
144
136
  filter: "agTextColumnFilter",
145
137
  // Decode the editor's whitespace entities (`&#x20;` for a trailing space) so the tooltip
146
138
  // reads as typed, not as raw markdown references.
147
- tooltipValueGetter: (p) => decodeWhitespaceEntities(p.data?.text),
139
+ tooltipValueGetter: (p) => chunkRC25WMVB_cjs.decodeWhitespaceEntities(p.data?.text),
148
140
  // Editable only via the grid api (Rename in the row's menu); clicks never open the editor
149
141
  // (suppressClickEdit on the grid).
150
142
  editable: true,
@@ -173,7 +165,7 @@ function createFactColumns(slots) {
173
165
  "data-testid": chunkMHVNT4J3_cjs.testIdOr(ids?.text?.(fact.external_id), {
174
166
  testId: `facts-grid-text-${fact.external_id}`
175
167
  }),
176
- children: decodeWhitespaceEntities(fact.text)
168
+ children: chunkRC25WMVB_cjs.decodeWhitespaceEntities(fact.text)
177
169
  }
178
170
  ),
179
171
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "facts-row-kebab absolute right-0.5 top-1/2 -translate-y-1/2", children: slots.renderRowActions(fact, params) })
@@ -2260,6 +2252,10 @@ function FactSearchResult({
2260
2252
  ] });
2261
2253
  }
2262
2254
 
2255
+ Object.defineProperty(exports, "decodeWhitespaceEntities", {
2256
+ enumerable: true,
2257
+ get: function () { return chunkRC25WMVB_cjs.decodeWhitespaceEntities; }
2258
+ });
2263
2259
  Object.defineProperty(exports, "DEFAULT_FACTS_FILTER_INPUT_LABELS", {
2264
2260
  enumerable: true,
2265
2261
  get: function () { return chunk2EI7NCUA_cjs.DEFAULT_FILTER_INPUT_LABELS; }
@@ -2316,7 +2312,6 @@ exports.FactsToolbar = FactsToolbar;
2316
2312
  exports.FactsViewToggle = FactsViewToggle;
2317
2313
  exports.ISO_DATE_FILTER_PARAMS = ISO_DATE_FILTER_PARAMS;
2318
2314
  exports.createFactColumns = createFactColumns;
2319
- exports.decodeWhitespaceEntities = decodeWhitespaceEntities;
2320
2315
  exports.detectTimezone = detectTimezone;
2321
2316
  exports.factDateFieldsToSpan = factDateFieldsToSpan;
2322
2317
  exports.factDateSpanToFields = factDateSpanToFields;