@epam/ai-dial-quotations 1.2.0-dev.318 → 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,
|
|
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
|
|
5
|
-
import { Fragment as
|
|
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
|
|
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
|
-
},
|
|
11
|
+
}, k = (e) => {
|
|
12
12
|
try {
|
|
13
13
|
return decodeURIComponent(e);
|
|
14
14
|
} catch {
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, A = (e) => {
|
|
18
18
|
try {
|
|
19
19
|
let t = new URL(e);
|
|
20
|
-
return t.pathname.split("/").map((e) =>
|
|
20
|
+
return t.pathname.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
21
21
|
} catch {
|
|
22
|
-
return e.split("/").map((e) =>
|
|
22
|
+
return e.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? e;
|
|
23
23
|
}
|
|
24
|
-
},
|
|
25
|
-
let t = e == null ? null :
|
|
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
|
-
},
|
|
27
|
+
}, re = (e) => {
|
|
28
28
|
let t = e.body?.source?.attachment, n = t?.url;
|
|
29
|
-
return (n == null ? void 0 :
|
|
30
|
-
},
|
|
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
|
-
},
|
|
33
|
+
}, F = (e) => P(e) != null, I = (e) => {
|
|
34
34
|
let t = /* @__PURE__ */ new Map();
|
|
35
35
|
for (let n of e) {
|
|
36
|
-
if (
|
|
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:
|
|
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
|
-
},
|
|
49
|
+
}, L = (e) => {
|
|
50
50
|
let t = /* @__PURE__ */ new Map();
|
|
51
51
|
for (let n of e) {
|
|
52
|
-
let e =
|
|
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:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
76
|
-
let
|
|
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:
|
|
79
|
-
fileExtension:
|
|
78
|
+
name: P,
|
|
79
|
+
fileExtension: P,
|
|
80
80
|
size: 16,
|
|
81
81
|
decorative: !0,
|
|
82
82
|
className: "shrink-0"
|
|
83
|
-
})),
|
|
84
|
-
"--cc-card-bg":
|
|
85
|
-
"--cc-quote-text":
|
|
86
|
-
"--cc-title-text":
|
|
87
|
-
"--cc-switcher-text":
|
|
88
|
-
"--cc-source-name-text":
|
|
89
|
-
}),
|
|
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
|
-
|
|
92
|
-
}, [a,
|
|
93
|
-
let e =
|
|
94
|
-
if (!e ||
|
|
95
|
-
let t = () =>
|
|
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
|
-
}, [
|
|
99
|
+
}, [U, K]), /* @__PURE__ */ D("div", {
|
|
100
100
|
role: "dialog",
|
|
101
101
|
"aria-modal": "true",
|
|
102
102
|
"aria-label": x.ariaLabel,
|
|
103
|
-
style:
|
|
104
|
-
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
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__ */
|
|
106
|
+
/* @__PURE__ */ D("div", {
|
|
107
107
|
className: "flex items-center justify-between gap-2",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ D("div", {
|
|
109
109
|
className: "flex min-w-0 items-center gap-1",
|
|
110
|
-
children: [
|
|
111
|
-
text:
|
|
112
|
-
className: i(
|
|
110
|
+
children: [I, /* @__PURE__ */ E(d, {
|
|
111
|
+
text: F,
|
|
112
|
+
className: i(L, "min-w-0", z.sourceName)
|
|
113
113
|
})]
|
|
114
|
-
}),
|
|
114
|
+
}), j && /* @__PURE__ */ D("div", {
|
|
115
115
|
className: "flex shrink-0 items-center gap-1",
|
|
116
116
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
icon: /* @__PURE__ */
|
|
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 +
|
|
125
|
+
onClick: () => o((a - 1 + k) % k)
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
className: i(
|
|
129
|
-
children: x.formatSwitcherText(a + 1,
|
|
127
|
+
/* @__PURE__ */ E("span", {
|
|
128
|
+
className: i(V, z.switcher),
|
|
129
|
+
children: x.formatSwitcherText(a + 1, k)
|
|
130
130
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
icon: /* @__PURE__ */
|
|
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) %
|
|
139
|
+
onClick: () => o((a + 1) % k)
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
})]
|
|
143
143
|
}),
|
|
144
|
-
(
|
|
144
|
+
(A.body?.title || A.body?.quote || j) && /* @__PURE__ */ D("div", {
|
|
145
145
|
className: "flex flex-col gap-3",
|
|
146
|
-
children: [
|
|
147
|
-
className: i(
|
|
148
|
-
children:
|
|
149
|
-
}), (
|
|
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__ */
|
|
152
|
-
ref:
|
|
153
|
-
id:
|
|
154
|
-
tabIndex:
|
|
155
|
-
className: i(
|
|
156
|
-
children:
|
|
157
|
-
content:
|
|
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(
|
|
160
|
-
ul: i(
|
|
161
|
-
ol:
|
|
162
|
-
strong:
|
|
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
|
-
}),
|
|
171
|
-
label:
|
|
170
|
+
}), J && /* @__PURE__ */ E(m, {
|
|
171
|
+
label: K ? x.showLess : x.showMore,
|
|
172
172
|
size: u.Small,
|
|
173
|
-
"aria-expanded":
|
|
174
|
-
"aria-controls":
|
|
175
|
-
onClick: () =>
|
|
173
|
+
"aria-expanded": K,
|
|
174
|
+
"aria-controls": W,
|
|
175
|
+
onClick: () => q((e) => !e)
|
|
176
176
|
})]
|
|
177
177
|
})]
|
|
178
178
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ D("div", {
|
|
180
180
|
className: "flex justify-start gap-2",
|
|
181
|
-
children: [l && /* @__PURE__ */
|
|
181
|
+
children: [l && /* @__PURE__ */ E(g, {
|
|
182
182
|
label: x.preview,
|
|
183
183
|
size: u.Small,
|
|
184
|
-
onClick: () => l(
|
|
185
|
-
}), (
|
|
186
|
-
label:
|
|
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(
|
|
188
|
+
onClick: () => h(A)
|
|
189
189
|
})]
|
|
190
190
|
})
|
|
191
191
|
]
|
|
192
192
|
});
|
|
193
|
-
},
|
|
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]",
|
|
195
|
+
className: i("max-w-[240px]", O.citationMarker),
|
|
196
196
|
textClassName: "min-w-0 truncate",
|
|
197
197
|
iconBefore: n,
|
|
198
|
-
label: /* @__PURE__ */
|
|
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
|
-
}),
|
|
205
|
-
let e = x(
|
|
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
|
-
},
|
|
209
|
-
let m =
|
|
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 =
|
|
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
|
-
]),
|
|
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
|
-
]),
|
|
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__ */
|
|
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",
|
|
258
|
-
listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none",
|
|
259
|
-
renderOverlay:
|
|
260
|
-
children: /* @__PURE__ */
|
|
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:
|
|
263
|
+
onOpen: te,
|
|
264
264
|
icon: s,
|
|
265
265
|
labels: d,
|
|
266
266
|
labelClassName: p
|
|
267
267
|
})
|
|
268
268
|
});
|
|
269
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
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:
|
|
381
|
+
style: Y
|
|
382
382
|
}];
|
|
383
383
|
});
|
|
384
|
-
},
|
|
385
|
-
let t = e.map((e, t) =>
|
|
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
|
-
},
|
|
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 =
|
|
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 =
|
|
403
|
+
let t = oe(e);
|
|
404
404
|
if (t != null) return t;
|
|
405
405
|
}
|
|
406
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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" &&
|
|
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 (
|
|
464
|
+
if (he(e)) {
|
|
465
465
|
let t = ve(e);
|
|
466
466
|
return t ? [t] : [];
|
|
467
467
|
}
|
|
468
|
-
if (
|
|
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 =
|
|
476
|
+
let t = J(e);
|
|
477
477
|
return t ? [t] : [];
|
|
478
478
|
});
|
|
479
|
-
}, Se = (e, t) =>
|
|
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] =
|
|
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
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""),
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">"), 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
|
-
},
|
|
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
|
-
] }),
|
|
548
|
-
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p =
|
|
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:
|
|
556
|
-
let e =
|
|
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__ */
|
|
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) :
|
|
587
|
+
return r ? n(r) : Be(t["data-id"], t.children);
|
|
583
588
|
} };
|
|
584
|
-
return t.length === 0 && o.length === 0 ? m ? p :
|
|
589
|
+
return t.length === 0 && o.length === 0 ? m ? p : Re : {
|
|
585
590
|
...p,
|
|
586
|
-
p: ({ children: e, ...t }) => /* @__PURE__ */
|
|
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__ */
|
|
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
|
-
},
|
|
611
|
-
let t =
|
|
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
|
-
},
|
|
617
|
-
let n = t.reference_url, r =
|
|
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 {
|
|
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.
|
|
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.
|
|
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":"
|
|
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"}
|