@epam/ai-dial-quotations 1.2.0-dev.316 → 1.2.0-dev.319

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAO3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,6FAA6F;AAC7F,MAAM,WAAW,sCAAsC;IACrD,4GAA4G;IAC5G,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAoH5D,CAAC"}
1
+ {"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQ3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,6FAA6F;AAC7F,MAAM,WAAW,sCAAsC;IACrD,4GAA4G;IAC5G,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAwG5D,CAAC"}
package/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { gatherSameSourceAnnotations, groupAnnotations, groupAnnotationsByCitId,
14
14
  export type { AnnotationGroup } from './utils/group-annotations-by-source';
15
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
- export { injectCitationSentinels, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
17
+ export { injectCitationSentinels, replaceCitTagsWithSourceNames, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
18
18
  export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
19
19
  export type { PdfPageReference } from './utils/reference-attachment';
20
20
  export { QUOTATIONS_CLASS } from './constants/public-class-names';
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;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;AAGlI,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,oCAAoC,EACpC,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,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"}
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;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;AAGlI,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,oCAAoC,EACpC,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,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 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";
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 ne, useState as w } from "react";
5
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
- var A = {
7
+ var O = {
8
8
  citationCard: "dial-quotations-citation-card",
9
9
  citationDropdown: "dial-quotations-citation-dropdown",
10
10
  citationMarker: "dial-quotations-citation-marker"
11
- }, j = (e) => {
11
+ }, k = (e) => {
12
12
  try {
13
13
  return decodeURIComponent(e);
14
14
  } catch {
15
15
  return e;
16
16
  }
17
- }, M = (e) => {
17
+ }, A = (e) => {
18
18
  try {
19
19
  let t = new URL(e);
20
- return t.pathname.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? t.hostname;
20
+ return t.pathname.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? t.hostname;
21
21
  } catch {
22
- return e.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? e;
22
+ return e.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? e;
23
23
  }
24
- }, N = /\.([a-z0-9]{1,10})$/i, P = (e) => {
25
- let t = e == null ? null : N.exec(e.trim());
24
+ }, j = /\.([a-z0-9]{1,10})$/i, M = (e) => {
25
+ let t = e == null ? null : j.exec(e.trim());
26
26
  return t == null ? void 0 : `.${t[1].toLowerCase()}`;
27
- }, te = (e) => {
27
+ }, re = (e) => {
28
28
  let t = e.body?.source?.attachment, n = t?.url;
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) => {
29
+ return (n == null ? void 0 : M(A(n))) ?? M(t?.title);
30
+ }, N = (e, t) => e.body?.source?.attachment?.title ?? A(t), P = (e) => {
31
31
  let t = e.target?.selector;
32
32
  return t?.type === "html_tag" ? t : void 0;
33
- }, L = (e) => I(e) != null, R = (e) => {
33
+ }, F = (e) => P(e) != null, I = (e) => {
34
34
  let t = /* @__PURE__ */ new Map();
35
35
  for (let n of e) {
36
- if (L(n)) continue;
36
+ if (F(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: F(n, e),
43
+ sourceName: N(n, e),
44
44
  annotations: [n],
45
45
  primaryAnnotation: n
46
46
  });
47
47
  }
48
48
  return Array.from(t.values());
49
- }, z = (e) => {
49
+ }, L = (e) => {
50
50
  let t = /* @__PURE__ */ new Map();
51
51
  for (let n of e) {
52
- let e = I(n)?.id;
52
+ let e = P(n)?.id;
53
53
  if (e == null) continue;
54
54
  let r = n.body?.source?.attachment?.url;
55
55
  if (r == null) continue;
@@ -57,109 +57,109 @@ var A = {
57
57
  i ? i.annotations.push(n) : t.set(e, {
58
58
  groupKey: `cit:${e}`,
59
59
  sourceUrl: r,
60
- sourceName: F(n, r),
60
+ sourceName: N(n, r),
61
61
  annotations: [n],
62
62
  primaryAnnotation: n
63
63
  });
64
64
  }
65
65
  return Array.from(t.values());
66
- }, B = (e) => [...z(e), ...R(e)], V = (e, t) => {
66
+ }, ie = (e) => [...L(e), ...I(e)], R = (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
- }, H = {
69
+ }, z = {
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
- }, 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, {
75
+ }, B = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, isDownloadEnabled: y = !0, headerIcon: b, labels: x, typography: C, colors: T }) => {
76
+ let k = r.annotations.length, A = r.annotations[a] ?? r.primaryAnnotation, j = k > 1, M = A.body?.source?.attachment?.type, N = l == null || M === e.HTML || M === e.XHTML, P = N ? void 0 : re(A), F = P ?? r.sourceName, I = b ?? (P == null ? void 0 : /* @__PURE__ */ E(f, {
77
77
  type: c.File,
78
- name: I,
79
- fileExtension: I,
78
+ name: P,
79
+ fileExtension: P,
80
80
  size: 16,
81
81
  decorative: !0,
82
82
  className: "shrink-0"
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);
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": T?.cardBackground,
85
+ "--cc-quote-text": T?.quoteText,
86
+ "--cc-title-text": T?.titleText,
87
+ "--cc-switcher-text": T?.switcherText,
88
+ "--cc-source-name-text": T?.sourceNameText
89
+ }), U = A.body?.quote, W = ee(), G = ne(null), [K, q] = w(!1), [J, Y] = w(!1);
90
90
  return S(() => {
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);
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);
96
96
  t();
97
97
  let n = new ResizeObserver(t);
98
98
  return n.observe(e), () => n.disconnect();
99
- }, [K, Y]), /* @__PURE__ */ k("div", {
99
+ }, [U, K]), /* @__PURE__ */ D("div", {
100
100
  role: "dialog",
101
101
  "aria-modal": "true",
102
102
  "aria-label": x.ariaLabel,
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),
103
+ style: H,
104
+ className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", z.card, O.citationCard),
105
105
  children: [
106
- /* @__PURE__ */ k("div", {
106
+ /* @__PURE__ */ D("div", {
107
107
  className: "flex items-center justify-between gap-2",
108
- children: [/* @__PURE__ */ k("div", {
108
+ children: [/* @__PURE__ */ D("div", {
109
109
  className: "flex min-w-0 items-center gap-1",
110
- children: [R, /* @__PURE__ */ O(d, {
111
- text: L,
112
- className: i(z, "min-w-0", H.sourceName)
110
+ children: [I, /* @__PURE__ */ E(d, {
111
+ text: F,
112
+ className: i(L, "min-w-0", z.sourceName)
113
113
  })]
114
- }), N && /* @__PURE__ */ k("div", {
114
+ }), j && /* @__PURE__ */ D("div", {
115
115
  className: "flex shrink-0 items-center gap-1",
116
116
  children: [
117
- /* @__PURE__ */ O(p, {
118
- icon: /* @__PURE__ */ O(_, {
117
+ /* @__PURE__ */ E(p, {
118
+ icon: /* @__PURE__ */ E(_, {
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 + j) % j)
125
+ onClick: () => o((a - 1 + k) % k)
126
126
  }),
127
- /* @__PURE__ */ O("span", {
128
- className: i(W, H.switcher),
129
- children: x.formatSwitcherText(a + 1, j)
127
+ /* @__PURE__ */ E("span", {
128
+ className: i(V, z.switcher),
129
+ children: x.formatSwitcherText(a + 1, k)
130
130
  }),
131
- /* @__PURE__ */ O(p, {
132
- icon: /* @__PURE__ */ O(v, {
131
+ /* @__PURE__ */ E(p, {
132
+ icon: /* @__PURE__ */ E(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) % j)
139
+ onClick: () => o((a + 1) % k)
140
140
  })
141
141
  ]
142
142
  })]
143
143
  }),
144
- (M.body?.title || M.body?.quote || N) && /* @__PURE__ */ k("div", {
144
+ (A.body?.title || A.body?.quote || j) && /* @__PURE__ */ D("div", {
145
145
  className: "flex flex-col gap-3",
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", {
146
+ children: [A.body?.title && /* @__PURE__ */ E("p", {
147
+ className: i(ie, z.title, "break-words"),
148
+ children: A.body.title
149
+ }), (U || j) && /* @__PURE__ */ D("div", {
150
150
  className: "flex flex-col items-start gap-1",
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,
151
+ children: [/* @__PURE__ */ E("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__ */ E(t, {
157
+ content: U,
158
158
  classNames: {
159
- p: i(V, H.quote),
160
- ul: i(V, "ps-[1.5em]"),
161
- ol: V,
162
- strong: U
159
+ p: i(R, z.quote),
160
+ ul: i(R, "ps-[1.5em]"),
161
+ ol: R,
162
+ strong: B
163
163
  },
164
164
  codeBlockCopyLabel: x.codeBlockCopyLabel,
165
165
  codeBlockCopiedLabel: x.codeBlockCopiedLabel,
@@ -167,55 +167,55 @@ var A = {
167
167
  tableScrollRegionAriaLabel: x.tableScrollRegionAriaLabel,
168
168
  mathScrollRegionAriaLabel: x.mathScrollRegionAriaLabel
169
169
  })
170
- }), ne && /* @__PURE__ */ O(m, {
171
- label: Y ? x.showLess : x.showMore,
170
+ }), J && /* @__PURE__ */ E(m, {
171
+ label: K ? x.showLess : x.showMore,
172
172
  size: u.Small,
173
- "aria-expanded": Y,
174
- "aria-controls": q,
175
- onClick: () => X((e) => !e)
173
+ "aria-expanded": K,
174
+ "aria-controls": W,
175
+ onClick: () => q((e) => !e)
176
176
  })]
177
177
  })]
178
178
  }),
179
- /* @__PURE__ */ k("div", {
179
+ /* @__PURE__ */ D("div", {
180
180
  className: "flex justify-start gap-2",
181
- children: [l && /* @__PURE__ */ O(g, {
181
+ children: [l && /* @__PURE__ */ E(g, {
182
182
  label: x.preview,
183
183
  size: u.Small,
184
- onClick: () => l(M)
185
- }), (F || y) && /* @__PURE__ */ O(g, {
186
- label: F ? x.openInBrowser : x.download,
184
+ onClick: () => l(A)
185
+ }), (N || y) && /* @__PURE__ */ E(g, {
186
+ label: N ? x.openInBrowser : x.download,
187
187
  size: u.Small,
188
- onClick: () => h(M)
188
+ onClick: () => h(A)
189
189
  })]
190
190
  })
191
191
  ]
192
192
  });
193
- }, W = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ O(h, {
193
+ }, V = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ E(h, {
194
194
  size: u.Small,
195
- className: i("max-w-[240px]", A.citationMarker),
195
+ className: i("max-w-[240px]", O.citationMarker),
196
196
  textClassName: "min-w-0 truncate",
197
197
  iconBefore: n,
198
- label: /* @__PURE__ */ O("span", {
198
+ label: /* @__PURE__ */ E("span", {
199
199
  className: a,
200
200
  children: e > 1 ? r.labelWithOverflow : r.label
201
201
  }),
202
202
  "aria-label": r.ariaLabel,
203
203
  onClick: t
204
- }), G = y(null), K = G.Provider, q = () => {
205
- let e = x(G);
204
+ }), H = y(null), U = H.Provider, W = () => {
205
+ let e = x(H);
206
206
  if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
207
207
  return e;
208
- }, 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 }) => {
209
- 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) => {
208
+ }, 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 }) => {
209
+ 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) => {
210
210
  e || m.closePopup(h);
211
- }, [m, h]), S = w(() => t && y ? (e) => {
211
+ }, [m, h]), S = C(() => t && y ? (e) => {
212
212
  t(e), m.closePopup(h);
213
213
  } : void 0, [
214
214
  t,
215
215
  y,
216
216
  m,
217
217
  h
218
- ]), C = b(() => {
218
+ ]), te = b(() => {
219
219
  if (o && S) {
220
220
  S(v);
221
221
  return;
@@ -227,7 +227,7 @@ var A = {
227
227
  v,
228
228
  m,
229
229
  h
230
- ]), T = b(() => /* @__PURE__ */ O(U, {
230
+ ]), ne = b(() => /* @__PURE__ */ E(B, {
231
231
  group: e,
232
232
  activeIndex: _,
233
233
  onIndexChange: (t) => m.setActiveIndex(e.groupKey, t),
@@ -248,25 +248,25 @@ var A = {
248
248
  u,
249
249
  f
250
250
  ]);
251
- return /* @__PURE__ */ O(l, {
251
+ return /* @__PURE__ */ E(l, {
252
252
  open: g,
253
253
  onOpenChange: x,
254
254
  trigger: [],
255
255
  placement: "bottom-end",
256
256
  matchReferenceWidth: !1,
257
- className: i("ms-1 inline-flex align-middle", J.trigger),
258
- listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", A.citationDropdown),
259
- renderOverlay: T,
260
- children: /* @__PURE__ */ O(W, {
257
+ className: i("ms-1 inline-flex align-middle", G.trigger),
258
+ listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", O.citationDropdown),
259
+ renderOverlay: ne,
260
+ children: /* @__PURE__ */ E(V, {
261
261
  sourceName: e.sourceName,
262
262
  annotationCount: e.annotations.length,
263
- onOpen: C,
263
+ onOpen: te,
264
264
  icon: s,
265
265
  labels: d,
266
266
  labelClassName: p
267
267
  })
268
268
  });
269
- }, X = (e) => {
269
+ }, q = (e) => {
270
270
  let t = e.trim();
271
271
  if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
272
272
  let n = [], r = "";
@@ -275,11 +275,11 @@ var A = {
275
275
  i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
276
276
  }
277
277
  if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
278
- }, ne = (e) => {
278
+ }, J = (e) => {
279
279
  if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
280
280
  let { text: t, occurrence: n, slide: r } = e;
281
281
  if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
282
- let i = X(t);
282
+ let i = q(t);
283
283
  if (i != null) {
284
284
  if (e.type === "docx_text_anchor") return {
285
285
  type: "docx_text_anchor",
@@ -293,13 +293,13 @@ var A = {
293
293
  slide: r
294
294
  };
295
295
  }
296
- }, re = {
296
+ }, Y = {
297
297
  backgroundColor: "transparent",
298
298
  borderColor: "var(--stroke-accent, #1D4ED8)",
299
299
  borderWidth: "2px",
300
300
  opacity: .5,
301
301
  hoverOpacity: .5
302
- }, ie = (e) => {
302
+ }, ae = (e) => {
303
303
  if (typeof e != "object" || !e) return;
304
304
  let t = e, { lt: n, wh: r } = t;
305
305
  if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
@@ -318,7 +318,7 @@ var A = {
318
318
  x2: i + o,
319
319
  y2: a + s
320
320
  };
321
- }, Z = (e) => {
321
+ }, X = (e) => {
322
322
  if (!r(e)) return;
323
323
  let t = e, n;
324
324
  if (t.type === "pdf_bbox") {
@@ -329,7 +329,7 @@ var A = {
329
329
  x2: i,
330
330
  y2: a
331
331
  });
332
- } else t.type === "pdf_region" && (n = ie(t.bbox));
332
+ } else t.type === "pdf_region" && (n = ae(t.bbox));
333
333
  if (n == null) return;
334
334
  let i = t.page;
335
335
  if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
@@ -344,45 +344,45 @@ var A = {
344
344
  x2: n.x2,
345
345
  y2: n.y2
346
346
  };
347
- }, ae = (e) => {
347
+ }, oe = (e) => {
348
348
  if (!r(e)) return;
349
349
  let t = e;
350
350
  if (t.type !== "pdf_bbox" && t.type !== "pdf_region") return;
351
351
  let n = t.page;
352
352
  return typeof n == "number" && Number.isInteger(n) && n >= 1 ? n : void 0;
353
- }, 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) => {
353
+ }, 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) => {
354
354
  let t = 5381;
355
355
  for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
356
356
  return (t >>> 0).toString(36);
357
- }, se = (e) => {
357
+ }, ce = (e) => {
358
358
  let t = e.body?.selector;
359
359
  if (t == null) return;
360
360
  let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
361
- let t = Z(e);
361
+ let t = X(e);
362
362
  return t == null ? [] : [t];
363
363
  }), r = xe(e);
364
- if (!(n.length === 0 && r.length === 0)) return Q([n, r]);
365
- }, ce = (e) => {
366
- let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = se(e);
367
- if (!(r == null && i == null)) return oe(`${r ?? ""}|${i ?? ""}`);
364
+ if (!(n.length === 0 && r.length === 0)) return Z([n, r]);
368
365
  }, le = (e) => {
369
- let t = de(e);
366
+ let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ce(e);
367
+ if (!(r == null && i == null)) return se(`${r ?? ""}|${i ?? ""}`);
368
+ }, ue = (e) => {
369
+ let t = fe(e);
370
370
  return e.flatMap((e, n) => {
371
371
  let i = e.body?.selector;
372
372
  if (i == null) return [];
373
373
  let a = (Array.isArray(i) ? i : [i]).flatMap((e) => {
374
374
  if (!r(e)) return [];
375
- let t = Z(e);
375
+ let t = X(e);
376
376
  return t == null ? [] : [t];
377
377
  });
378
378
  return a.length === 0 ? [] : [{
379
379
  id: t[n],
380
380
  bboxes: a,
381
- style: re
381
+ style: Y
382
382
  }];
383
383
  });
384
- }, ue = (e, t) => e.index == null ? ce(e) ?? String(t) : String(e.index), de = (e) => {
385
- let t = e.map((e, t) => ue(e, t)), n = new Set(t), r = /* @__PURE__ */ new Set();
384
+ }, de = (e, t) => e.index == null ? le(e) ?? String(t) : String(e.index), fe = (e) => {
385
+ let t = e.map((e, t) => de(e, t)), n = new Set(t), r = /* @__PURE__ */ new Set();
386
386
  return t.map((e) => {
387
387
  if (!r.has(e)) return r.add(e), e;
388
388
  let t = 1;
@@ -390,38 +390,38 @@ var A = {
390
390
  let i = `${e}-${t}`;
391
391
  return n.add(i), r.add(i), i;
392
392
  });
393
- }, fe = (e) => {
393
+ }, pe = (e) => {
394
394
  let t = e.body?.selector;
395
395
  if (t == null) return;
396
396
  let n = Array.isArray(t) ? t : [t];
397
397
  for (let e of n) {
398
398
  if (!r(e)) continue;
399
- let t = Z(e);
399
+ let t = X(e);
400
400
  if (t != null) return t.page;
401
401
  }
402
402
  for (let e of n) {
403
- let t = ae(e);
403
+ let t = oe(e);
404
404
  if (t != null) return t;
405
405
  }
406
- }, pe = (e) => {
406
+ }, me = (e) => {
407
407
  let t = e.custom_content?.annotations;
408
408
  if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
409
409
  let n = e.custom_fields;
410
410
  if (typeof n != "object" || !n) return [];
411
411
  let r = n.annotations;
412
412
  return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
413
- }, me = (e) => {
413
+ }, he = (e) => {
414
414
  if (e.type !== "docx_text_range") return !1;
415
415
  let t = e;
416
416
  return typeof t.story == "string" && Array.isArray(t.path) && t.path.every((e) => typeof e == "number") && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
417
- }, he = (e) => {
417
+ }, ge = (e) => {
418
418
  if (e.type !== "pptx_text_range") return !1;
419
419
  let t = e;
420
420
  return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
421
- }, ge = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", _e = (e) => {
421
+ }, Q = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", _e = (e) => {
422
422
  if (e.type !== "excel_rc_range") return !1;
423
423
  let t = e;
424
- return typeof t.sheet == "string" && ge(t.start) && (t.end === void 0 || t.end === null || ge(t.end));
424
+ return typeof t.sheet == "string" && Q(t.start) && (t.end === void 0 || t.end === null || Q(t.end));
425
425
  }, ve = (e) => {
426
426
  let { story: t, path: n, start: r, end: i, text: a } = e;
427
427
  if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
@@ -461,11 +461,11 @@ var A = {
461
461
  let t = e.body?.selector;
462
462
  return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
463
463
  if (!r(e)) return [];
464
- if (me(e)) {
464
+ if (he(e)) {
465
465
  let t = ve(e);
466
466
  return t ? [t] : [];
467
467
  }
468
- if (he(e)) {
468
+ if (ge(e)) {
469
469
  let t = ye(e);
470
470
  return t ? [t] : [];
471
471
  }
@@ -473,14 +473,14 @@ var A = {
473
473
  let t = be(e);
474
474
  return t ? [t] : [];
475
475
  }
476
- let t = ne(e);
476
+ let t = J(e);
477
477
  return t ? [t] : [];
478
478
  });
479
- }, Se = (e, t) => w(() => t ? [] : pe(e), [t, e]), Ce = {
479
+ }, Se = (e, t) => C(() => t ? [] : me(e), [t, e]), Ce = {
480
480
  openOwnerKey: null,
481
481
  activeIndexByGroup: {}
482
482
  }, we = () => {
483
- let [e, t] = E(Ce), n = b((e) => {
483
+ let [e, t] = w(Ce), n = b((e) => {
484
484
  t((t) => ({
485
485
  ...t,
486
486
  openOwnerKey: e
@@ -499,7 +499,7 @@ var A = {
499
499
  }
500
500
  }));
501
501
  }, []);
502
- return w(() => ({
502
+ return C(() => ({
503
503
  openPopup: n,
504
504
  closePopup: r,
505
505
  setActiveIndex: i,
@@ -524,7 +524,24 @@ var A = {
524
524
  }).sort((e, t) => t.pos - e.pos), r = e;
525
525
  for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
526
526
  return r;
527
- }, 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) => {
527
+ }, 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, ""), Ne = (e) => {
528
+ let t = e.primaryAnnotation.target?.selector;
529
+ return t?.type === "html_tag" ? t.id : void 0;
530
+ }, Pe = (e, t = []) => {
531
+ let n = /* @__PURE__ */ new Map();
532
+ for (let r of [...t, ...e]) {
533
+ let e = Ne(r);
534
+ e != null && n.set(e, r);
535
+ }
536
+ return n;
537
+ }, Fe = /<cit\s+data-id=(?:"([^"]+)"|'([^']+)')\s*>\s*<\/cit>/g, Ie = (e) => e.replace(/[\\`*_[\]<>|]/g, "\\$&"), Le = (e, t, n = []) => {
538
+ if (!e.includes("<cit")) return e;
539
+ let r = Pe(t, n);
540
+ return r.size === 0 ? e : e.replace(Fe, (e, t, n) => {
541
+ let i = r.get(t ?? n ?? "");
542
+ return i ? Ie(i.sourceName) : e;
543
+ });
544
+ }, $ = (e, t) => {
528
545
  if (typeof e == "string") {
529
546
  let n = e.split(Te);
530
547
  if (n.length === 1) return e;
@@ -537,34 +554,22 @@ var A = {
537
554
  let n = $(e, t);
538
555
  return Array.isArray(n) ? n : [n];
539
556
  }) : e;
540
- }, Ne = {}, Pe = [], Fe = (e) => {
541
- let t = e.primaryAnnotation.target?.selector;
542
- return t?.type === "html_tag" ? t.id : void 0;
543
- }, Ie = (e, t) => /* @__PURE__ */ k(D, { children: [
557
+ }, Re = {}, ze = [], Be = (e, t) => /* @__PURE__ */ D(T, { children: [
544
558
  e == null ? "<cit>" : `<cit data-id="${e}">`,
545
559
  t,
546
560
  "</cit>"
547
- ] }), Le = (e, t, n, r = !1, a = !1, o = Pe) => {
548
- 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), [
561
+ ] }), Ve = (e, t, n, r = !1, a = !1, o = ze) => {
562
+ 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), [
549
563
  e,
550
564
  t,
551
565
  r
552
566
  ]), m = p.includes("<cit");
553
567
  return {
554
568
  processedContent: p,
555
- markdownComponents: w(() => {
556
- let e = /* @__PURE__ */ new Map();
557
- for (let t of o) {
558
- let n = Fe(t);
559
- n != null && e.set(n, t);
560
- }
561
- for (let n of t) {
562
- let t = Fe(n);
563
- t != null && e.set(t, n);
564
- }
565
- let n = (e) => {
569
+ markdownComponents: C(() => {
570
+ let e = Pe(t, o), n = (e) => {
566
571
  let { cardLabels: t, markerLabels: n } = f(e);
567
- return /* @__PURE__ */ O(Y, {
572
+ return /* @__PURE__ */ E(K, {
568
573
  group: e,
569
574
  onPreview: (t) => s(t, e),
570
575
  isPreviewable: c,
@@ -579,16 +584,16 @@ var A = {
579
584
  return r ? n(r) : null;
580
585
  }, p = { cit: (t) => {
581
586
  let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
582
- return r ? n(r) : Ie(t["data-id"], t.children);
587
+ return r ? n(r) : Be(t["data-id"], t.children);
583
588
  } };
584
- return t.length === 0 && o.length === 0 ? m ? p : Ne : {
589
+ return t.length === 0 && o.length === 0 ? m ? p : Re : {
585
590
  ...p,
586
- p: ({ children: e, ...t }) => /* @__PURE__ */ O("p", {
591
+ p: ({ children: e, ...t }) => /* @__PURE__ */ E("p", {
587
592
  ...t,
588
593
  className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
589
594
  children: $(e, r)
590
595
  }),
591
- li: ({ children: e, ...t }) => /* @__PURE__ */ O("li", {
596
+ li: ({ children: e, ...t }) => /* @__PURE__ */ E("li", {
592
597
  ...t,
593
598
  className: "mb-1.5 last:mb-0",
594
599
  children: $(e, r)
@@ -607,14 +612,14 @@ var A = {
607
612
  m
608
613
  ])
609
614
  };
610
- }, Re = (e) => e.url == null && e.reference_url != null, ze = /^(.*\.pdf)(?:#page=(\d+))?$/i, Be = (e) => {
611
- let t = ze.exec(e);
615
+ }, He = (e) => e.url == null && e.reference_url != null, Ue = /^(.*\.pdf)(?:#page=(\d+))?$/i, We = (e) => {
616
+ let t = Ue.exec(e);
612
617
  return t ? {
613
618
  baseUrl: t[1],
614
619
  page: t[2] == null ? null : Number(t[2])
615
620
  } : null;
616
- }, Ve = (t) => R((t ?? []).filter(Re).map((t) => {
617
- let n = t.reference_url, r = Be(n) != null;
621
+ }, Ge = (t) => I((t ?? []).filter(He).map((t) => {
622
+ let n = t.reference_url, r = We(n) != null;
618
623
  return { body: {
619
624
  quote: t.data,
620
625
  source: {
@@ -628,4 +633,4 @@ var A = {
628
633
  } };
629
634
  }));
630
635
  //#endregion
631
- 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 };
636
+ export { B as CitationCard, U as CitationCardProvider, K as CitationDropdown, V as CitationMarker, O as QUOTATIONS_CLASS, de as annotationHighlightId, fe as annotationHighlightIds, xe as annotationToOfficeHighlightLocations, ue as annotationsToPdfHighlights, R as gatherSameSourceAnnotations, pe as getAnnotationPdfPage, Ge as getReferenceAttachmentGroups, ie as groupAnnotations, L as groupAnnotationsByCitId, I as groupAnnotationsBySource, Ee as injectCitationSentinels, he as isDocxRangeSelector, _e as isExcelRcRangeSelector, ge as isPptxRangeSelector, He as isReferenceOnlyAttachment, We as parsePdfPageReference, Le as replaceCitTagsWithSourceNames, $ as replaceSentinelsInChildren, me as resolveMessageAnnotations, Me as stripCitTagsWhileStreaming, Se as useAnnotations, we as useCitationCard, W as useCitationCardContext, Ve 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.316",
4
+ "version": "1.2.0-dev.319",
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.316",
26
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.319",
27
27
  "@epam/ai-dial-ui-kit": "^0.15.0-dev.39"
28
28
  },
29
29
  "repository": {
@@ -22,6 +22,15 @@ export declare const escapeUnsupportedCitTags: (content: string) => string;
22
22
  * preventing an incomplete opening tag from swallowing the streamed suffix.
23
23
  */
24
24
  export declare const stripCitTagsWhileStreaming: (content: string) => string;
25
+ /** Returns `html_tag` groups keyed by the `data-id` of the `<cit>` element they resolve; a message's own `groups` win over `fallbackGroups` on a colliding id. */
26
+ export declare const buildCitGroupsByTagId: (groups: AnnotationGroup[], fallbackGroups?: AnnotationGroup[]) => Map<string, AnnotationGroup>;
27
+ /**
28
+ * Returns `content` with every supported `<cit data-id="…"></cit>` element
29
+ * that resolves to a group replaced by that group's `sourceName` as plain
30
+ * Markdown text — the label its citation marker shows on screen. Unresolved
31
+ * tags are left untouched.
32
+ */
33
+ export declare const replaceCitTagsWithSourceNames: (content: string, groups: AnnotationGroup[], fallbackGroups?: AnnotationGroup[]) => string;
25
34
  /**
26
35
  * Recursively walks a React child tree and replaces sentinel strings with
27
36
  * the result of `renderMarker(idx)`. Handles string children, arrays, and
@@ -1 +1 @@
1
- {"version":3,"file":"citation-injection.d.ts","sourceRoot":"","sources":["../../src/utils/citation-injection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAUrE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,KACxB,MAwBF,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAGxD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,KAAG,MAE5D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,SAAS,EACnB,cAAc,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,KACvC,SA0BF,CAAC"}
1
+ {"version":3,"file":"citation-injection.d.ts","sourceRoot":"","sources":["../../src/utils/citation-injection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAUrE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,KACxB,MAwBF,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAGxD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,KAAG,MAE5D,CAAC;AAeF,kKAAkK;AAClK,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,KACrC,GAAG,CAAC,MAAM,EAAE,eAAe,CAQ7B,CAAC;AAUF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,KACrC,MAqBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,SAAS,EACnB,cAAc,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,KACvC,SA0BF,CAAC"}