@epam/ai-dial-quotations 1.2.0-dev.285 → 1.2.0-dev.288

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/index.css CHANGED
@@ -1,2 +1,2 @@
1
1
  ._card_1kph1_1{background:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc))}._quote_1kph1_5{color:var(--cc-quote-text,var(--text-secondary,#57647a))}._title_1kph1_9{color:var(--cc-title-text,var(--text-primary,#161b2d))}._switcher_1kph1_13{color:var(--cc-switcher-text,var(--text-secondary,#57647a))}._sourceName_1kph1_17{color:var(--cc-source-name-text,var(--text-primary,#161b2d))}td ._trigger_1ud83_1,th ._trigger_1ud83_1{max-width:100%;margin-inline-start:0}td ._trigger_1ud83_1>*,th ._trigger_1ud83_1>*{min-width:0;max-width:100%}
2
- /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
2
+ /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { useCitationMarkdownComponents } from './hooks/useCitationMarkdownCompon
12
12
  export type { UseCitationMarkdownComponentsCallbacks } from './hooks/useCitationMarkdownComponents/useCitationMarkdownComponents';
13
13
  export { gatherSameSourceAnnotations, groupAnnotations, groupAnnotationsByCitId, groupAnnotationsBySource, } from './utils/group-annotations-by-source';
14
14
  export type { AnnotationGroup } from './utils/group-annotations-by-source';
15
- export { annotationHighlightId, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
15
+ export { annotationHighlightId, annotationHighlightIds, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
16
16
  export type { DocxOfficeHighlightLocation, DocxTableRowOfficeHighlightLocation, ExcelOfficeHighlightLocation, OfficeHighlightLocation, PptxOfficeHighlightLocation, PptxTableRowOfficeHighlightLocation, } from './models/office-highlight';
17
17
  export { injectCitationSentinels, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
18
18
  export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC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yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
package/index.js CHANGED
@@ -1,55 +1,55 @@
1
1
  import { MIMEType as e, MarkdownRenderer as t, buildCssVars as n, isAnnotationSelector as r, mergeClasses as i, normalizePersistedHtmlTagAttachmentType as a, normalizeRawAnnotations as o } from "@epam/ai-dial-chat-shared";
2
2
  import { DIAL_KIT_ICON_STROKE as s, DialItemType as c, Dropdown as l, ElementSize as u, EllipsisTooltip as d, FileIcon as f, GhostIconButton as p, LinkButton as m, NeutralButton as h, PrimaryButton as g } from "@epam/ai-dial-ui-kit";
3
3
  import { IconChevronLeft as _, IconChevronRight as v } from "@tabler/icons-react";
4
- import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as te, useMemo as C, useRef as w, useState as T } from "react";
5
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
4
+ import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
5
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
- var k = {
7
+ var A = {
8
8
  citationCard: "dial-quotations-citation-card",
9
9
  citationDropdown: "dial-quotations-citation-dropdown",
10
10
  citationMarker: "dial-quotations-citation-marker"
11
- }, A = (e) => {
11
+ }, j = (e) => {
12
12
  try {
13
13
  return decodeURIComponent(e);
14
14
  } catch {
15
15
  return e;
16
16
  }
17
- }, j = (e) => {
17
+ }, M = (e) => {
18
18
  try {
19
19
  let t = new URL(e);
20
- return t.pathname.split("/").map((e) => A(e)).filter(Boolean).at(-1) ?? t.hostname;
20
+ return t.pathname.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? t.hostname;
21
21
  } catch {
22
- return e.split("/").map((e) => A(e)).filter(Boolean).at(-1) ?? e;
22
+ return e.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? e;
23
23
  }
24
- }, M = /\.([a-z0-9]{1,10})$/i, N = (e) => {
25
- let t = e == null ? null : M.exec(e.trim());
24
+ }, N = /\.([a-z0-9]{1,10})$/i, P = (e) => {
25
+ let t = e == null ? null : N.exec(e.trim());
26
26
  return t == null ? void 0 : `.${t[1].toLowerCase()}`;
27
- }, ne = (e) => {
27
+ }, te = (e) => {
28
28
  let t = e.body?.source?.attachment, n = t?.url;
29
- return (n == null ? void 0 : N(j(n))) ?? N(t?.title);
30
- }, P = (e, t) => e.body?.source?.attachment?.title ?? j(t), F = (e) => {
29
+ return (n == null ? void 0 : P(M(n))) ?? P(t?.title);
30
+ }, F = (e, t) => e.body?.source?.attachment?.title ?? M(t), I = (e) => {
31
31
  let t = e.target?.selector;
32
32
  return t?.type === "html_tag" ? t : void 0;
33
- }, re = (e) => F(e) != null, I = (e) => {
33
+ }, L = (e) => I(e) != null, R = (e) => {
34
34
  let t = /* @__PURE__ */ new Map();
35
35
  for (let n of e) {
36
- if (re(n)) continue;
36
+ if (L(n)) continue;
37
37
  let e = n.body?.source?.attachment?.url;
38
38
  if (e == null) continue;
39
39
  let r = t.get(e);
40
40
  r ? r.annotations.push(n) : t.set(e, {
41
41
  groupKey: e,
42
42
  sourceUrl: e,
43
- sourceName: P(n, e),
43
+ sourceName: F(n, e),
44
44
  annotations: [n],
45
45
  primaryAnnotation: n
46
46
  });
47
47
  }
48
48
  return Array.from(t.values());
49
- }, L = (e) => {
49
+ }, z = (e) => {
50
50
  let t = /* @__PURE__ */ new Map();
51
51
  for (let n of e) {
52
- let e = F(n)?.id;
52
+ let e = I(n)?.id;
53
53
  if (e == null) continue;
54
54
  let r = n.body?.source?.attachment?.url;
55
55
  if (r == null) continue;
@@ -57,160 +57,160 @@ var k = {
57
57
  i ? i.annotations.push(n) : t.set(e, {
58
58
  groupKey: `cit:${e}`,
59
59
  sourceUrl: r,
60
- sourceName: P(n, r),
60
+ sourceName: F(n, r),
61
61
  annotations: [n],
62
62
  primaryAnnotation: n
63
63
  });
64
64
  }
65
65
  return Array.from(t.values());
66
- }, ie = (e) => [...L(e), ...I(e)], R = (e, t) => {
66
+ }, B = (e) => [...z(e), ...R(e)], V = (e, t) => {
67
67
  let n = e.body?.source?.attachment?.url;
68
68
  return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
69
- }, z = {
69
+ }, H = {
70
70
  card: "_card_1kph1_1",
71
71
  quote: "_quote_1kph1_5",
72
72
  title: "_title_1kph1_9",
73
73
  switcher: "_switcher_1kph1_13",
74
74
  sourceName: "_sourceName_1kph1_17"
75
- }, B = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, isDownloadEnabled: y = !0, headerIcon: b, labels: x, typography: C, colors: E }) => {
76
- let A = r.annotations.length, j = r.annotations[a] ?? r.primaryAnnotation, M = A > 1, N = j.body?.source?.attachment?.type, P = l == null || N === e.HTML || N === e.XHTML, F = P ? void 0 : ne(j), re = F ?? r.sourceName, I = b ?? (F == null ? void 0 : /* @__PURE__ */ D(f, {
75
+ }, U = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, isDownloadEnabled: y = !0, headerIcon: b, labels: x, typography: w, colors: D }) => {
76
+ let j = r.annotations.length, M = r.annotations[a] ?? r.primaryAnnotation, N = j > 1, P = M.body?.source?.attachment?.type, F = l == null || P === e.HTML || P === e.XHTML, I = F ? void 0 : te(M), L = I ?? r.sourceName, R = b ?? (I == null ? void 0 : /* @__PURE__ */ O(f, {
77
77
  type: c.File,
78
- name: F,
79
- fileExtension: F,
78
+ name: I,
79
+ fileExtension: I,
80
80
  size: 16,
81
81
  decorative: !0,
82
82
  className: "shrink-0"
83
- })), L = C?.sourceNameClassName ?? "dial-tiny-text", ie = C?.titleClassName ?? "dial-body-semi-text", R = C?.quoteClassName ?? "dial-small-text", B = C?.quoteStrongClassName ?? "dial-small-semi-text", V = C?.switcherClassName ?? "dial-tiny-text", H = n({
84
- "--cc-card-bg": E?.cardBackground,
85
- "--cc-quote-text": E?.quoteText,
86
- "--cc-title-text": E?.titleText,
87
- "--cc-switcher-text": E?.switcherText,
88
- "--cc-source-name-text": E?.sourceNameText
89
- }), U = j.body?.quote, W = ee(), G = w(null), [K, q] = T(!1), [J, Y] = T(!1);
83
+ })), z = w?.sourceNameClassName ?? "dial-tiny-text", B = w?.titleClassName ?? "dial-body-semi-text", V = w?.quoteClassName ?? "dial-small-text", U = w?.quoteStrongClassName ?? "dial-small-semi-text", W = w?.switcherClassName ?? "dial-tiny-text", G = n({
84
+ "--cc-card-bg": D?.cardBackground,
85
+ "--cc-quote-text": D?.quoteText,
86
+ "--cc-title-text": D?.titleText,
87
+ "--cc-switcher-text": D?.switcherText,
88
+ "--cc-source-name-text": D?.sourceNameText
89
+ }), K = M.body?.quote, q = ee(), J = T(null), [Y, X] = E(!1), [ne, re] = E(!1);
90
90
  return S(() => {
91
- q(!1);
92
- }, [a, U]), te(() => {
93
- let e = G.current;
94
- if (!e || K) return;
95
- let t = () => Y(e.scrollHeight > e.clientHeight + 1);
91
+ X(!1);
92
+ }, [a, K]), C(() => {
93
+ let e = J.current;
94
+ if (!e || Y) return;
95
+ let t = () => re(e.scrollHeight > e.clientHeight + 1);
96
96
  t();
97
97
  let n = new ResizeObserver(t);
98
98
  return n.observe(e), () => n.disconnect();
99
- }, [U, K]), /* @__PURE__ */ O("div", {
99
+ }, [K, Y]), /* @__PURE__ */ k("div", {
100
100
  role: "dialog",
101
101
  "aria-modal": "true",
102
102
  "aria-label": x.ariaLabel,
103
- style: H,
104
- className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", z.card, k.citationCard),
103
+ style: G,
104
+ className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", H.card, A.citationCard),
105
105
  children: [
106
- /* @__PURE__ */ O("div", {
106
+ /* @__PURE__ */ k("div", {
107
107
  className: "flex items-center justify-between gap-2",
108
- children: [/* @__PURE__ */ O("div", {
108
+ children: [/* @__PURE__ */ k("div", {
109
109
  className: "flex min-w-0 items-center gap-1",
110
- children: [I, /* @__PURE__ */ D(d, {
111
- text: re,
112
- className: i(L, "min-w-0", z.sourceName)
110
+ children: [R, /* @__PURE__ */ O(d, {
111
+ text: L,
112
+ className: i(z, "min-w-0", H.sourceName)
113
113
  })]
114
- }), M && /* @__PURE__ */ O("div", {
114
+ }), N && /* @__PURE__ */ k("div", {
115
115
  className: "flex shrink-0 items-center gap-1",
116
116
  children: [
117
- /* @__PURE__ */ D(p, {
118
- icon: /* @__PURE__ */ D(_, {
117
+ /* @__PURE__ */ O(p, {
118
+ icon: /* @__PURE__ */ O(_, {
119
119
  size: 14,
120
120
  className: "rtl:scale-x-[-1]",
121
121
  stroke: s
122
122
  }),
123
123
  size: u.Small,
124
124
  "aria-label": x.previousCitation,
125
- onClick: () => o((a - 1 + A) % A)
125
+ onClick: () => o((a - 1 + j) % j)
126
126
  }),
127
- /* @__PURE__ */ D("span", {
128
- className: i(V, z.switcher),
129
- children: x.formatSwitcherText(a + 1, A)
127
+ /* @__PURE__ */ O("span", {
128
+ className: i(W, H.switcher),
129
+ children: x.formatSwitcherText(a + 1, j)
130
130
  }),
131
- /* @__PURE__ */ D(p, {
132
- icon: /* @__PURE__ */ D(v, {
131
+ /* @__PURE__ */ O(p, {
132
+ icon: /* @__PURE__ */ O(v, {
133
133
  size: 14,
134
134
  className: "rtl:scale-x-[-1]",
135
135
  stroke: s
136
136
  }),
137
137
  size: u.Small,
138
138
  "aria-label": x.nextCitation,
139
- onClick: () => o((a + 1) % A)
139
+ onClick: () => o((a + 1) % j)
140
140
  })
141
141
  ]
142
142
  })]
143
143
  }),
144
- (j.body?.title || j.body?.quote || M) && /* @__PURE__ */ O("div", {
144
+ (M.body?.title || M.body?.quote || N) && /* @__PURE__ */ k("div", {
145
145
  className: "flex flex-col gap-3",
146
- children: [j.body?.title && /* @__PURE__ */ D("p", {
147
- className: i(ie, z.title, "break-words"),
148
- children: j.body.title
149
- }), (U || M) && /* @__PURE__ */ O("div", {
146
+ children: [M.body?.title && /* @__PURE__ */ O("p", {
147
+ className: i(B, H.title, "break-words"),
148
+ children: M.body.title
149
+ }), (K || N) && /* @__PURE__ */ k("div", {
150
150
  className: "flex flex-col items-start gap-1",
151
- children: [/* @__PURE__ */ D("div", {
152
- ref: G,
153
- id: W,
154
- tabIndex: K ? 0 : void 0,
155
- className: i(R, z.quote, "w-full break-words", K ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6"),
156
- children: U && /* @__PURE__ */ D(t, {
157
- content: U,
151
+ children: [/* @__PURE__ */ O("div", {
152
+ ref: J,
153
+ id: q,
154
+ tabIndex: Y ? 0 : void 0,
155
+ className: i(V, H.quote, "w-full break-words", Y ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6"),
156
+ children: K && /* @__PURE__ */ O(t, {
157
+ content: K,
158
158
  classNames: {
159
- p: i(R, z.quote),
160
- ul: i(R, "ps-[1.5em]"),
161
- ol: R,
162
- strong: B
159
+ p: i(V, H.quote),
160
+ ul: i(V, "ps-[1.5em]"),
161
+ ol: V,
162
+ strong: U
163
163
  }
164
164
  })
165
- }), J && /* @__PURE__ */ D(m, {
166
- label: K ? x.showLess : x.showMore,
165
+ }), ne && /* @__PURE__ */ O(m, {
166
+ label: Y ? x.showLess : x.showMore,
167
167
  size: u.Small,
168
- "aria-expanded": K,
169
- "aria-controls": W,
170
- onClick: () => q((e) => !e)
168
+ "aria-expanded": Y,
169
+ "aria-controls": q,
170
+ onClick: () => X((e) => !e)
171
171
  })]
172
172
  })]
173
173
  }),
174
- /* @__PURE__ */ O("div", {
174
+ /* @__PURE__ */ k("div", {
175
175
  className: "flex justify-start gap-2",
176
- children: [l && /* @__PURE__ */ D(g, {
176
+ children: [l && /* @__PURE__ */ O(g, {
177
177
  label: x.preview,
178
178
  size: u.Small,
179
- onClick: () => l(j)
180
- }), (P || y) && /* @__PURE__ */ D(g, {
181
- label: P ? x.openInBrowser : x.download,
179
+ onClick: () => l(M)
180
+ }), (F || y) && /* @__PURE__ */ O(g, {
181
+ label: F ? x.openInBrowser : x.download,
182
182
  size: u.Small,
183
- onClick: () => h(j)
183
+ onClick: () => h(M)
184
184
  })]
185
185
  })
186
186
  ]
187
187
  });
188
- }, V = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ D(h, {
188
+ }, W = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ O(h, {
189
189
  size: u.Small,
190
- className: i("max-w-[240px]", k.citationMarker),
190
+ className: i("max-w-[240px]", A.citationMarker),
191
191
  textClassName: "min-w-0 truncate",
192
192
  iconBefore: n,
193
- label: /* @__PURE__ */ D("span", {
193
+ label: /* @__PURE__ */ O("span", {
194
194
  className: a,
195
195
  children: e > 1 ? r.labelWithOverflow : r.label
196
196
  }),
197
197
  "aria-label": r.ariaLabel,
198
198
  onClick: t
199
- }), H = y(null), U = H.Provider, W = () => {
200
- let e = x(H);
199
+ }), G = y(null), K = G.Provider, q = () => {
200
+ let e = x(G);
201
201
  if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
202
202
  return e;
203
- }, G = { trigger: "_trigger_1ud83_1" }, K = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, icon: s, headerIcon: c, cardLabels: u, markerLabels: d, cardTypography: f, markerLabelClassName: p }) => {
204
- let m = W(), h = ee(), g = m.isOpen(h), _ = m.getActiveIndex(e.groupKey), v = e.annotations[_] ?? e.primaryAnnotation, y = n?.(v) ?? !0, x = b((e) => {
203
+ }, J = { trigger: "_trigger_1ud83_1" }, Y = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, icon: s, headerIcon: c, cardLabels: u, markerLabels: d, cardTypography: f, markerLabelClassName: p }) => {
204
+ let m = q(), h = ee(), g = m.isOpen(h), _ = m.getActiveIndex(e.groupKey), v = e.annotations[_] ?? e.primaryAnnotation, y = n?.(v) ?? !0, x = b((e) => {
205
205
  e || m.closePopup(h);
206
- }, [m, h]), S = C(() => t && y ? (e) => {
206
+ }, [m, h]), S = w(() => t && y ? (e) => {
207
207
  t(e), m.closePopup(h);
208
208
  } : void 0, [
209
209
  t,
210
210
  y,
211
211
  m,
212
212
  h
213
- ]), te = b(() => {
213
+ ]), C = b(() => {
214
214
  if (o && S) {
215
215
  S(v);
216
216
  return;
@@ -222,7 +222,7 @@ var k = {
222
222
  v,
223
223
  m,
224
224
  h
225
- ]), w = b(() => /* @__PURE__ */ D(B, {
225
+ ]), T = b(() => /* @__PURE__ */ O(U, {
226
226
  group: e,
227
227
  activeIndex: _,
228
228
  onIndexChange: (t) => m.setActiveIndex(e.groupKey, t),
@@ -243,25 +243,25 @@ var k = {
243
243
  u,
244
244
  f
245
245
  ]);
246
- return /* @__PURE__ */ D(l, {
246
+ return /* @__PURE__ */ O(l, {
247
247
  open: g,
248
248
  onOpenChange: x,
249
249
  trigger: [],
250
250
  placement: "bottom-end",
251
251
  matchReferenceWidth: !1,
252
- className: i("ms-1 inline-flex align-middle", G.trigger),
253
- listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", k.citationDropdown),
254
- renderOverlay: w,
255
- children: /* @__PURE__ */ D(V, {
252
+ className: i("ms-1 inline-flex align-middle", J.trigger),
253
+ listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", A.citationDropdown),
254
+ renderOverlay: T,
255
+ children: /* @__PURE__ */ O(W, {
256
256
  sourceName: e.sourceName,
257
257
  annotationCount: e.annotations.length,
258
- onOpen: te,
258
+ onOpen: C,
259
259
  icon: s,
260
260
  labels: d,
261
261
  labelClassName: p
262
262
  })
263
263
  });
264
- }, q = (e) => {
264
+ }, X = (e) => {
265
265
  let t = e.trim();
266
266
  if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
267
267
  let n = [], r = "";
@@ -270,11 +270,11 @@ var k = {
270
270
  i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
271
271
  }
272
272
  if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
273
- }, J = (e) => {
273
+ }, ne = (e) => {
274
274
  if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
275
275
  let { text: t, occurrence: n, slide: r } = e;
276
276
  if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
277
- let i = q(t);
277
+ let i = X(t);
278
278
  if (i != null) {
279
279
  if (e.type === "docx_text_anchor") return {
280
280
  type: "docx_text_anchor",
@@ -288,13 +288,13 @@ var k = {
288
288
  slide: r
289
289
  };
290
290
  }
291
- }, Y = {
291
+ }, re = {
292
292
  backgroundColor: "transparent",
293
293
  borderColor: "var(--stroke-accent, #1D4ED8)",
294
294
  borderWidth: "2px",
295
295
  opacity: .5,
296
296
  hoverOpacity: .5
297
- }, ae = (e) => {
297
+ }, ie = (e) => {
298
298
  if (typeof e != "object" || !e) return;
299
299
  let t = e, { lt: n, wh: r } = t;
300
300
  if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
@@ -313,7 +313,7 @@ var k = {
313
313
  x2: i + o,
314
314
  y2: a + s
315
315
  };
316
- }, X = (e) => {
316
+ }, Z = (e) => {
317
317
  if (!r(e)) return;
318
318
  let t = e, n;
319
319
  if (t.type === "pdf_bbox") {
@@ -324,7 +324,7 @@ var k = {
324
324
  x2: i,
325
325
  y2: a
326
326
  });
327
- } else t.type === "pdf_region" && (n = ae(t.bbox));
327
+ } else t.type === "pdf_region" && (n = ie(t.bbox));
328
328
  if (n == null) return;
329
329
  let i = t.page;
330
330
  if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
@@ -339,51 +339,63 @@ var k = {
339
339
  x2: n.x2,
340
340
  y2: n.y2
341
341
  };
342
- }, oe = (e) => {
342
+ }, ae = (e) => {
343
343
  if (!r(e)) return;
344
344
  let t = e;
345
345
  if (t.type !== "pdf_bbox" && t.type !== "pdf_region") return;
346
346
  let n = t.page;
347
347
  return typeof n == "number" && Number.isInteger(n) && n >= 1 ? n : void 0;
348
- }, Z = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(Z).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${Z(t)}`).join(",")}}`, se = (e) => {
348
+ }, Q = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(Q).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${Q(t)}`).join(",")}}`, oe = (e) => {
349
349
  let t = 5381;
350
350
  for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
351
351
  return (t >>> 0).toString(36);
352
- }, ce = (e) => {
352
+ }, se = (e) => {
353
353
  let t = e.body?.selector;
354
354
  if (t == null) return;
355
355
  let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
356
- let t = X(e);
356
+ let t = Z(e);
357
357
  return t == null ? [] : [t];
358
358
  }), r = xe(e);
359
- if (!(n.length === 0 && r.length === 0)) return Z([n, r]);
359
+ if (!(n.length === 0 && r.length === 0)) return Q([n, r]);
360
+ }, ce = (e) => {
361
+ let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = se(e);
362
+ if (!(r == null && i == null)) return oe(`${r ?? ""}|${i ?? ""}`);
360
363
  }, le = (e) => {
361
- let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ce(e);
362
- if (!(r == null && i == null)) return se(`${r ?? ""}|${i ?? ""}`);
363
- }, ue = (e) => e.flatMap((e, t) => {
364
- let n = e.body?.selector;
365
- if (n == null) return [];
366
- let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
367
- if (!r(e)) return [];
368
- let t = X(e);
369
- return t == null ? [] : [t];
364
+ let t = de(e);
365
+ return e.flatMap((e, n) => {
366
+ let i = e.body?.selector;
367
+ if (i == null) return [];
368
+ let a = (Array.isArray(i) ? i : [i]).flatMap((e) => {
369
+ if (!r(e)) return [];
370
+ let t = Z(e);
371
+ return t == null ? [] : [t];
372
+ });
373
+ return a.length === 0 ? [] : [{
374
+ id: t[n],
375
+ bboxes: a,
376
+ style: re
377
+ }];
378
+ });
379
+ }, ue = (e, t) => e.index == null ? ce(e) ?? String(t) : String(e.index), de = (e) => {
380
+ let t = e.map((e, t) => ue(e, t)), n = new Set(t), r = /* @__PURE__ */ new Set();
381
+ return t.map((e) => {
382
+ if (!r.has(e)) return r.add(e), e;
383
+ let t = 1;
384
+ for (; n.has(`${e}-${t}`);) t += 1;
385
+ let i = `${e}-${t}`;
386
+ return n.add(i), r.add(i), i;
370
387
  });
371
- return i.length === 0 ? [] : [{
372
- id: de(e, t),
373
- bboxes: i,
374
- style: Y
375
- }];
376
- }), de = (e, t) => e.index == null ? le(e) ?? String(t) : String(e.index), fe = (e) => {
388
+ }, fe = (e) => {
377
389
  let t = e.body?.selector;
378
390
  if (t == null) return;
379
391
  let n = Array.isArray(t) ? t : [t];
380
392
  for (let e of n) {
381
393
  if (!r(e)) continue;
382
- let t = X(e);
394
+ let t = Z(e);
383
395
  if (t != null) return t.page;
384
396
  }
385
397
  for (let e of n) {
386
- let t = oe(e);
398
+ let t = ae(e);
387
399
  if (t != null) return t;
388
400
  }
389
401
  }, pe = (e) => {
@@ -456,14 +468,14 @@ var k = {
456
468
  let t = be(e);
457
469
  return t ? [t] : [];
458
470
  }
459
- let t = J(e);
471
+ let t = ne(e);
460
472
  return t ? [t] : [];
461
473
  });
462
- }, Se = (e, t) => C(() => t ? [] : pe(e), [t, e]), Ce = {
474
+ }, Se = (e, t) => w(() => t ? [] : pe(e), [t, e]), Ce = {
463
475
  openOwnerKey: null,
464
476
  activeIndexByGroup: {}
465
477
  }, we = () => {
466
- let [e, t] = T(Ce), n = b((e) => {
478
+ let [e, t] = E(Ce), n = b((e) => {
467
479
  t((t) => ({
468
480
  ...t,
469
481
  openOwnerKey: e
@@ -482,7 +494,7 @@ var k = {
482
494
  }
483
495
  }));
484
496
  }, []);
485
- return C(() => ({
497
+ return w(() => ({
486
498
  openPopup: n,
487
499
  closePopup: r,
488
500
  setActiveIndex: i,
@@ -507,7 +519,7 @@ var k = {
507
519
  }).sort((e, t) => t.pos - e.pos), r = e;
508
520
  for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
509
521
  return r;
510
- }, De = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, Oe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ke = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ae = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""), Q = (e, t) => {
522
+ }, De = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, Oe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ke = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ae = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""), $ = (e, t) => {
511
523
  if (typeof e == "string") {
512
524
  let n = e.split(Te);
513
525
  if (n.length === 1) return e;
@@ -517,37 +529,37 @@ var k = {
517
529
  }), r;
518
530
  }
519
531
  return Array.isArray(e) ? e.flatMap((e) => {
520
- let n = Q(e, t);
532
+ let n = $(e, t);
521
533
  return Array.isArray(n) ? n : [n];
522
534
  }) : e;
523
- }, Ne = {}, Pe = [], $ = (e) => {
535
+ }, Ne = {}, Pe = [], Fe = (e) => {
524
536
  let t = e.primaryAnnotation.target?.selector;
525
537
  return t?.type === "html_tag" ? t.id : void 0;
526
- }, Fe = (e, t) => /* @__PURE__ */ O(E, { children: [
538
+ }, Ie = (e, t) => /* @__PURE__ */ k(D, { children: [
527
539
  e == null ? "<cit>" : `<cit data-id="${e}">`,
528
540
  t,
529
541
  "</cit>"
530
- ] }), Ie = (e, t, n, r = !1, a = !1, o = Pe) => {
531
- let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p = C(() => r ? Me(e) : je(t.length > 0 ? Ee(e, t) : e), [
542
+ ] }), Le = (e, t, n, r = !1, a = !1, o = Pe) => {
543
+ let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p = w(() => r ? Me(e) : je(t.length > 0 ? Ee(e, t) : e), [
532
544
  e,
533
545
  t,
534
546
  r
535
547
  ]), m = p.includes("<cit");
536
548
  return {
537
549
  processedContent: p,
538
- markdownComponents: C(() => {
550
+ markdownComponents: w(() => {
539
551
  let e = /* @__PURE__ */ new Map();
540
552
  for (let t of o) {
541
- let n = $(t);
553
+ let n = Fe(t);
542
554
  n != null && e.set(n, t);
543
555
  }
544
556
  for (let n of t) {
545
- let t = $(n);
557
+ let t = Fe(n);
546
558
  t != null && e.set(t, n);
547
559
  }
548
560
  let n = (e) => {
549
561
  let { cardLabels: t, markerLabels: n } = f(e);
550
- return /* @__PURE__ */ D(K, {
562
+ return /* @__PURE__ */ O(Y, {
551
563
  group: e,
552
564
  onPreview: (t) => s(t, e),
553
565
  isPreviewable: c,
@@ -562,19 +574,19 @@ var k = {
562
574
  return r ? n(r) : null;
563
575
  }, p = { cit: (t) => {
564
576
  let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
565
- return r ? n(r) : Fe(t["data-id"], t.children);
577
+ return r ? n(r) : Ie(t["data-id"], t.children);
566
578
  } };
567
579
  return t.length === 0 && o.length === 0 ? m ? p : Ne : {
568
580
  ...p,
569
- p: ({ children: e, ...t }) => /* @__PURE__ */ D("p", {
581
+ p: ({ children: e, ...t }) => /* @__PURE__ */ O("p", {
570
582
  ...t,
571
583
  className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
572
- children: Q(e, r)
584
+ children: $(e, r)
573
585
  }),
574
- li: ({ children: e, ...t }) => /* @__PURE__ */ D("li", {
586
+ li: ({ children: e, ...t }) => /* @__PURE__ */ O("li", {
575
587
  ...t,
576
588
  className: "mb-1.5 last:mb-0",
577
- children: Q(e, r)
589
+ children: $(e, r)
578
590
  })
579
591
  };
580
592
  }, [
@@ -590,14 +602,14 @@ var k = {
590
602
  m
591
603
  ])
592
604
  };
593
- }, Le = (e) => e.url == null && e.reference_url != null, Re = /^(.*\.pdf)(?:#page=(\d+))?$/i, ze = (e) => {
594
- let t = Re.exec(e);
605
+ }, Re = (e) => e.url == null && e.reference_url != null, ze = /^(.*\.pdf)(?:#page=(\d+))?$/i, Be = (e) => {
606
+ let t = ze.exec(e);
595
607
  return t ? {
596
608
  baseUrl: t[1],
597
609
  page: t[2] == null ? null : Number(t[2])
598
610
  } : null;
599
- }, Be = (t) => I((t ?? []).filter(Le).map((t) => {
600
- let n = t.reference_url, r = ze(n) != null;
611
+ }, Ve = (t) => R((t ?? []).filter(Re).map((t) => {
612
+ let n = t.reference_url, r = Be(n) != null;
601
613
  return { body: {
602
614
  quote: t.data,
603
615
  source: {
@@ -611,4 +623,4 @@ var k = {
611
623
  } };
612
624
  }));
613
625
  //#endregion
614
- export { B as CitationCard, U as CitationCardProvider, K as CitationDropdown, V as CitationMarker, k as QUOTATIONS_CLASS, de as annotationHighlightId, xe as annotationToOfficeHighlightLocations, ue as annotationsToPdfHighlights, R as gatherSameSourceAnnotations, fe as getAnnotationPdfPage, Be as getReferenceAttachmentGroups, ie as groupAnnotations, L as groupAnnotationsByCitId, I as groupAnnotationsBySource, Ee as injectCitationSentinels, me as isDocxRangeSelector, _e as isExcelRcRangeSelector, he as isPptxRangeSelector, Le as isReferenceOnlyAttachment, ze as parsePdfPageReference, Q as replaceSentinelsInChildren, pe as resolveMessageAnnotations, Me as stripCitTagsWhileStreaming, Se as useAnnotations, we as useCitationCard, W as useCitationCardContext, Ie as useCitationMarkdownComponents };
626
+ export { U as CitationCard, K as CitationCardProvider, Y as CitationDropdown, W as CitationMarker, A as QUOTATIONS_CLASS, ue as annotationHighlightId, de as annotationHighlightIds, xe as annotationToOfficeHighlightLocations, le as annotationsToPdfHighlights, V as gatherSameSourceAnnotations, fe as getAnnotationPdfPage, Ve as getReferenceAttachmentGroups, B as groupAnnotations, z as groupAnnotationsByCitId, R as groupAnnotationsBySource, Ee as injectCitationSentinels, me as isDocxRangeSelector, _e as isExcelRcRangeSelector, he as isPptxRangeSelector, Re as isReferenceOnlyAttachment, Be as parsePdfPageReference, $ as replaceSentinelsInChildren, pe as resolveMessageAnnotations, Me as stripCitTagsWhileStreaming, Se as useAnnotations, we as useCitationCard, q as useCitationCardContext, Le as useCitationMarkdownComponents };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-quotations",
3
3
  "description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
4
- "version": "1.2.0-dev.285",
4
+ "version": "1.2.0-dev.288",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^19.2.8",
26
- "@epam/ai-dial-chat-shared": "1.2.0-dev.285",
26
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.288",
27
27
  "@epam/ai-dial-ui-kit": "^0.15.0-dev.36"
28
28
  },
29
29
  "repository": {
@@ -5,19 +5,21 @@ import { OfficeHighlightLocation } from '../models/office-highlight';
5
5
  * Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
6
6
  * Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
7
7
  * (`lt`/`wh` and legacy `left`/`top`/`width`/`height`); annotations whose
8
- * `body.selector` contains none of these are skipped. The highlight `id` comes
9
- * from `annotationHighlightId`, so it identifies the annotation itself rather
10
- * than its position in this particular input list.
8
+ * `body.selector` contains none of these are skipped. Each highlight `id` is
9
+ * the entry's id from `annotationHighlightIds(annotations)`, unique within
10
+ * this input list.
11
11
  */
12
12
  export declare const annotationsToPdfHighlights: (annotations: Annotation[]) => InputHighlightData[];
13
13
  /**
14
- * Returns a stable string ID for a given annotation, matching the IDs
15
- * `annotationsToPdfHighlights` produces (it calls this function) and the ones
16
- * the Office highlight path assigns.
14
+ * Returns a stable string ID for a given annotation — the id
15
+ * `annotationHighlightIds` (and so `annotationsToPdfHighlights` and the Office
16
+ * highlight path) assigns it whenever no earlier entry of the same list
17
+ * already holds that id.
17
18
  *
18
19
  * Resolved in order:
19
- * 1. `annotation.index` when the wire supplied one — already unique within the
20
- * message, and short.
20
+ * 1. `annotation.index` when the wire supplied one — short, but not guaranteed
21
+ * unique: a payload may repeat an `index`, which `annotationHighlightIds`
22
+ * disambiguates.
21
23
  * 2. Otherwise an id derived from the annotation's own identity: its `cit` tag
22
24
  * id plus a digest of its selectors. Two annotations differing in either
23
25
  * part get different ids; two agreeing in both describe the same cited
@@ -34,6 +36,12 @@ export declare const annotationsToPdfHighlights: (annotations: Annotation[]) =>
34
36
  * never sent over the wire.
35
37
  */
36
38
  export declare const annotationHighlightId: (annotation: Annotation, fallbackIndex: number) => string;
39
+ /**
40
+ * Returns one highlight id per entry of `annotations`, unique within the list:
41
+ * the entry's `annotationHighlightId` when no earlier entry holds it, otherwise
42
+ * that id with a `-<n>` suffix no other entry's id uses.
43
+ */
44
+ export declare const annotationHighlightIds: (annotations: Annotation[]) => string[];
37
45
  /**
38
46
  * Returns the PDF page to open for the annotation, or `undefined` when none
39
47
  * exists. Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate
@@ -1 +1 @@
1
- {"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAmM1E;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,EAoBjB,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,YAAY,UAAU,EACtB,eAAe,MAAM,KACpB,MAG+D,CAAC;AAEnE;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MAAM,GAAG,SAeX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,UAAU,EAoBtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAA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