@epam/ai-dial-quotations 1.1.0-dev.475 → 1.1.0-dev.479
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/components/CitationCard/CitationCard.d.ts +0 -2
- package/components/CitationCard/CitationCard.d.ts.map +1 -1
- package/components/CitationDropdown/CitationDropdown.d.ts +0 -2
- package/components/CitationDropdown/CitationDropdown.d.ts.map +1 -1
- package/components/CitationMarker/CitationMarker.d.ts +0 -2
- package/components/CitationMarker/CitationMarker.d.ts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +96 -108
- package/package.json +5 -5
|
@@ -71,6 +71,4 @@ export interface CitationCardProps {
|
|
|
71
71
|
}
|
|
72
72
|
/** Popup card displaying a citation's title, quoted excerpt, and navigation controls. */
|
|
73
73
|
export declare const CitationCard: FC<CitationCardProps>;
|
|
74
|
-
declare const _default: import('react').NamedExoticComponent<CitationCardProps>;
|
|
75
|
-
export default _default;
|
|
76
74
|
//# sourceMappingURL=CitationCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationCard.d.ts","sourceRoot":"","sources":["../../../src/components/CitationCard/CitationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAe5D,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"CitationCard.d.ts","sourceRoot":"","sources":["../../../src/components/CitationCard/CitationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAe5D,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG/E,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,2DA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,2EAA2E;IAC3E,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,wEAAwE;IACxE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,4BAA4B;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,gCAAgC;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAqJ9C,CAAC"}
|
|
@@ -29,6 +29,4 @@ export interface CitationDropdownProps {
|
|
|
29
29
|
}
|
|
30
30
|
/** Combines `CitationMarker` and `CitationCard` into a tooltip-based dropdown. Requires a `CitationCardProvider` ancestor. */
|
|
31
31
|
export declare const CitationDropdown: FC<CitationDropdownProps>;
|
|
32
|
-
declare const _default: import('react').NamedExoticComponent<CitationDropdownProps>;
|
|
33
|
-
export default _default;
|
|
34
32
|
//# sourceMappingURL=CitationDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/CitationDropdown/CitationDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"CitationDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/CitationDropdown/CitationDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,EAAE,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAG1C,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,KAAK,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,uEAAuE;IACvE,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,wDAAwD;IACxD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uFAAuF;IACvF,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,+CAA+C;IAC/C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,yDAAyD;IACzD,YAAY,EAAE,oBAAoB,CAAC;IACnC,2DAA2D;IAC3D,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,8HAA8H;AAC9H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAuEtD,CAAC"}
|
|
@@ -25,6 +25,4 @@ export interface CitationMarkerProps {
|
|
|
25
25
|
}
|
|
26
26
|
/** Inline button that opens the citation popup for a source group. */
|
|
27
27
|
export declare const CitationMarker: FC<CitationMarkerProps>;
|
|
28
|
-
declare const _default: import('react').NamedExoticComponent<CitationMarkerProps>;
|
|
29
|
-
export default _default;
|
|
30
28
|
//# sourceMappingURL=CitationMarker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtC,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,mEAAmE;IACnE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,4BAA4B;IAC5B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAwBlD,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CitationCard } from './components/CitationCard/CitationCard';
|
|
2
|
-
export type { CitationCardLabels, CitationCardProps, CitationCardTypography, } from './components/CitationCard/CitationCard';
|
|
2
|
+
export type { CitationCardColors, CitationCardLabels, CitationCardProps, CitationCardTypography, } from './components/CitationCard/CitationCard';
|
|
3
3
|
export { CitationMarker } from './components/CitationMarker/CitationMarker';
|
|
4
4
|
export type { CitationMarkerLabels, CitationMarkerProps, } from './components/CitationMarker/CitationMarker';
|
|
5
5
|
export { CitationDropdown } from './components/CitationDropdown/CitationDropdown';
|
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,iBAAiB,EACjB,sBAAsB,G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,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
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, ElementSize as c, EllipsisTooltip as l, GhostIconButton as u, NeutralButton as d, PrimaryButton as f, Tooltip as p } from "@epam/ai-dial-ui-kit";
|
|
3
3
|
import { IconChevronLeft as m, IconChevronRight as h } from "@tabler/icons-react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
var
|
|
4
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as y, useCallback as b, useContext as x, useMemo as S, useState as C } from "react";
|
|
6
|
+
var w = {
|
|
7
7
|
card: "_card_1kph1_1",
|
|
8
8
|
quote: "_quote_1kph1_5",
|
|
9
9
|
title: "_title_1kph1_9",
|
|
10
10
|
switcher: "_switcher_1kph1_13",
|
|
11
11
|
sourceName: "_sourceName_1kph1_17"
|
|
12
|
-
},
|
|
13
|
-
let
|
|
14
|
-
"--cc-card-bg":
|
|
15
|
-
"--cc-quote-text":
|
|
16
|
-
"--cc-title-text":
|
|
17
|
-
"--cc-switcher-text":
|
|
18
|
-
"--cc-source-name-text":
|
|
12
|
+
}, T = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: d, onOpenInBrowser: p, headerIcon: g, labels: y, typography: b, colors: x }) => {
|
|
13
|
+
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, T = S > 1, E = r.primaryAnnotation.body?.source?.attachment?.type, D = d == null || E === e.HTML || E === e.XHTML, O = b?.sourceNameClassName ?? "dial-tiny-text", k = b?.titleClassName ?? "dial-body-semi-text", A = b?.quoteClassName ?? "dial-small-text", j = b?.quoteStrongClassName ?? "dial-small-semi-text", M = b?.switcherClassName ?? "dial-tiny-text", N = n({
|
|
14
|
+
"--cc-card-bg": x?.cardBackground,
|
|
15
|
+
"--cc-quote-text": x?.quoteText,
|
|
16
|
+
"--cc-title-text": x?.titleText,
|
|
17
|
+
"--cc-switcher-text": x?.switcherText,
|
|
18
|
+
"--cc-source-name-text": x?.sourceNameText
|
|
19
19
|
});
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ v("div", {
|
|
21
21
|
role: "dialog",
|
|
22
22
|
"aria-modal": "true",
|
|
23
|
-
"aria-label":
|
|
23
|
+
"aria-label": y.ariaLabel,
|
|
24
24
|
style: N,
|
|
25
|
-
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
25
|
+
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", w.card),
|
|
26
26
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ v("div", {
|
|
28
28
|
className: "flex items-center justify-between gap-2",
|
|
29
|
-
children: [/* @__PURE__ */
|
|
29
|
+
children: [/* @__PURE__ */ v("div", {
|
|
30
30
|
className: "flex min-w-0 items-center gap-1",
|
|
31
|
-
children: [g, /* @__PURE__ */
|
|
31
|
+
children: [g, /* @__PURE__ */ _(l, {
|
|
32
32
|
text: r.sourceName,
|
|
33
|
-
className: i(O, "min-w-0",
|
|
33
|
+
className: i(O, "min-w-0", w.sourceName)
|
|
34
34
|
})]
|
|
35
|
-
}),
|
|
35
|
+
}), T && /* @__PURE__ */ v("div", {
|
|
36
36
|
className: "flex shrink-0 items-center gap-1",
|
|
37
37
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
icon: /* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ _(u, {
|
|
39
|
+
icon: /* @__PURE__ */ _(m, {
|
|
40
40
|
size: 14,
|
|
41
41
|
className: "rtl:scale-x-[-1]",
|
|
42
42
|
stroke: s
|
|
43
43
|
}),
|
|
44
44
|
size: c.Small,
|
|
45
|
-
"aria-label":
|
|
46
|
-
onClick: () => o((a - 1 +
|
|
45
|
+
"aria-label": y.previousCitation,
|
|
46
|
+
onClick: () => o((a - 1 + S) % S)
|
|
47
47
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
className: i(M,
|
|
50
|
-
children:
|
|
48
|
+
/* @__PURE__ */ _("span", {
|
|
49
|
+
className: i(M, w.switcher),
|
|
50
|
+
children: y.formatSwitcherText(a + 1, S)
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
icon: /* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ _(u, {
|
|
53
|
+
icon: /* @__PURE__ */ _(h, {
|
|
54
54
|
size: 14,
|
|
55
55
|
className: "rtl:scale-x-[-1]",
|
|
56
56
|
stroke: s
|
|
57
57
|
}),
|
|
58
58
|
size: c.Small,
|
|
59
|
-
"aria-label":
|
|
60
|
-
onClick: () => o((a + 1) %
|
|
59
|
+
"aria-label": y.nextCitation,
|
|
60
|
+
onClick: () => o((a + 1) % S)
|
|
61
61
|
})
|
|
62
62
|
]
|
|
63
63
|
})]
|
|
64
64
|
}),
|
|
65
|
-
(
|
|
65
|
+
(C.body?.title || C.body?.quote || T) && /* @__PURE__ */ v("div", {
|
|
66
66
|
className: "flex flex-col gap-3",
|
|
67
|
-
children: [
|
|
68
|
-
className: i(k,
|
|
69
|
-
children:
|
|
70
|
-
}), (
|
|
71
|
-
className: i(A,
|
|
72
|
-
children:
|
|
73
|
-
content:
|
|
67
|
+
children: [C.body?.title && /* @__PURE__ */ _("p", {
|
|
68
|
+
className: i(k, w.title, "break-words"),
|
|
69
|
+
children: C.body.title
|
|
70
|
+
}), (C.body?.quote || T) && /* @__PURE__ */ _("div", {
|
|
71
|
+
className: i(A, w.quote, "line-clamp-6 break-words", T && "min-h-[3lh]"),
|
|
72
|
+
children: C.body?.quote && /* @__PURE__ */ _(t, {
|
|
73
|
+
content: C.body.quote,
|
|
74
74
|
classNames: {
|
|
75
|
-
p: i(A,
|
|
75
|
+
p: i(A, w.quote),
|
|
76
76
|
ul: i(A, "ps-3"),
|
|
77
77
|
ol: i(A, "ps-3"),
|
|
78
78
|
strong: j
|
|
@@ -80,58 +80,50 @@ var T = {
|
|
|
80
80
|
})
|
|
81
81
|
})]
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ v("div", {
|
|
84
84
|
className: "flex justify-start gap-2",
|
|
85
|
-
children: [d && /* @__PURE__ */
|
|
86
|
-
label:
|
|
85
|
+
children: [d && /* @__PURE__ */ _(f, {
|
|
86
|
+
label: y.preview,
|
|
87
87
|
size: c.Small,
|
|
88
|
-
onClick: () => d(
|
|
89
|
-
}), /* @__PURE__ */
|
|
90
|
-
label: D ?
|
|
88
|
+
onClick: () => d(C)
|
|
89
|
+
}), /* @__PURE__ */ _(f, {
|
|
90
|
+
label: D ? y.openInBrowser : y.download,
|
|
91
91
|
size: c.Small,
|
|
92
|
-
onClick: () => p(
|
|
92
|
+
onClick: () => p(C)
|
|
93
93
|
})]
|
|
94
94
|
})
|
|
95
95
|
]
|
|
96
96
|
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/components/CitationMarker/CitationMarker.tsx
|
|
101
|
-
var D = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: i = "dial-caption-text" }) => {
|
|
102
|
-
let a = /* @__PURE__ */ w("span", {
|
|
97
|
+
}, E = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: i = "dial-caption-text" }) => {
|
|
98
|
+
let a = /* @__PURE__ */ v("span", {
|
|
103
99
|
className: "flex items-center gap-1",
|
|
104
|
-
children: [n, /* @__PURE__ */
|
|
100
|
+
children: [n, /* @__PURE__ */ _("span", {
|
|
105
101
|
className: i,
|
|
106
102
|
children: e > 1 ? r.labelWithOverflow : r.label
|
|
107
103
|
})]
|
|
108
104
|
});
|
|
109
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ _(d, {
|
|
110
106
|
size: c.Small,
|
|
111
107
|
label: a,
|
|
112
108
|
"aria-label": r.ariaLabel,
|
|
113
109
|
onClick: t
|
|
114
110
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/context/CitationCardContext.tsx
|
|
119
|
-
var O = g(null), k = O.Provider, A = () => {
|
|
120
|
-
let e = y(O);
|
|
111
|
+
}, D = y(null), O = D.Provider, k = () => {
|
|
112
|
+
let e = x(D);
|
|
121
113
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
122
114
|
return e;
|
|
123
|
-
},
|
|
124
|
-
let u =
|
|
115
|
+
}, A = { content: "_content_xzs0h_1" }, j = ({ group: e, onPreview: t, onOpenInBrowser: n, icon: r, headerIcon: a, cardLabels: o, markerLabels: s, cardTypography: c, markerLabelClassName: l }) => {
|
|
116
|
+
let u = k(), d = u.isOpen(e.groupKey), f = u.getActiveIndex(e.groupKey), m = b((e) => {
|
|
125
117
|
e || u.closePopup();
|
|
126
|
-
}, [u]), h =
|
|
118
|
+
}, [u]), h = S(() => t ? (e) => {
|
|
127
119
|
t(e), u.closePopup();
|
|
128
120
|
} : void 0, [t, u]);
|
|
129
|
-
return /* @__PURE__ */
|
|
121
|
+
return /* @__PURE__ */ _(p, {
|
|
130
122
|
open: d,
|
|
131
123
|
onOpenChange: m,
|
|
132
124
|
triggerClassName: "ms-1 inline-flex align-middle",
|
|
133
|
-
contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none",
|
|
134
|
-
tooltip: /* @__PURE__ */
|
|
125
|
+
contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none", A.content),
|
|
126
|
+
tooltip: /* @__PURE__ */ _(T, {
|
|
135
127
|
group: e,
|
|
136
128
|
activeIndex: f,
|
|
137
129
|
onIndexChange: (t) => u.setActiveIndex(e.groupKey, t),
|
|
@@ -141,7 +133,7 @@ var O = g(null), k = O.Provider, A = () => {
|
|
|
141
133
|
labels: o,
|
|
142
134
|
typography: c
|
|
143
135
|
}),
|
|
144
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ _(E, {
|
|
145
137
|
sourceName: e.sourceName,
|
|
146
138
|
annotationCount: e.annotations.length,
|
|
147
139
|
onOpen: () => u.openPopup(e.groupKey),
|
|
@@ -150,17 +142,13 @@ var O = g(null), k = O.Provider, A = () => {
|
|
|
150
142
|
labelClassName: l
|
|
151
143
|
})
|
|
152
144
|
});
|
|
153
|
-
}
|
|
154
|
-
_(M);
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/utils/annotation.ts
|
|
157
|
-
var N = {
|
|
145
|
+
}, M = {
|
|
158
146
|
backgroundColor: "transparent",
|
|
159
147
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
160
148
|
borderWidth: "2px",
|
|
161
149
|
opacity: .5,
|
|
162
150
|
hoverOpacity: .5
|
|
163
|
-
},
|
|
151
|
+
}, N = (e) => e.flatMap((e, t) => {
|
|
164
152
|
let n = e.body?.selector;
|
|
165
153
|
if (n == null) return [];
|
|
166
154
|
let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
|
|
@@ -182,30 +170,30 @@ var N = {
|
|
|
182
170
|
return i.length === 0 ? [] : [{
|
|
183
171
|
id: String(e.index ?? t),
|
|
184
172
|
bboxes: i,
|
|
185
|
-
style:
|
|
173
|
+
style: M
|
|
186
174
|
}];
|
|
187
|
-
}),
|
|
175
|
+
}), ee = (e, t) => String(e.index ?? t), te = (e) => {
|
|
188
176
|
let t = e.body?.selector;
|
|
189
177
|
if (t != null) return (Array.isArray(t) ? t : [t]).find((e) => r(e) && e.type === "pdf_bbox" && typeof e.page == "number" && Number.isInteger(e.page) && e.page >= 1)?.page;
|
|
190
|
-
},
|
|
178
|
+
}, P = (e) => {
|
|
191
179
|
let t = e.custom_content?.annotations;
|
|
192
180
|
if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
|
|
193
181
|
let n = e.custom_fields;
|
|
194
182
|
if (typeof n != "object" || !n) return [];
|
|
195
183
|
let r = n.annotations;
|
|
196
184
|
return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
|
|
197
|
-
},
|
|
185
|
+
}, F = (e) => {
|
|
198
186
|
if (e.type !== "docx_text_range") return !1;
|
|
199
187
|
let t = e;
|
|
200
188
|
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";
|
|
201
|
-
},
|
|
189
|
+
}, I = (e) => {
|
|
202
190
|
if (e.type !== "pptx_text_range") return !1;
|
|
203
191
|
let t = e;
|
|
204
192
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
205
|
-
},
|
|
193
|
+
}, L = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", R = (e) => {
|
|
206
194
|
if (e.type !== "excel_rc_range") return !1;
|
|
207
195
|
let t = e;
|
|
208
|
-
return typeof t.sheet == "string" &&
|
|
196
|
+
return typeof t.sheet == "string" && L(t.start) && (t.end === void 0 || t.end === null || L(t.end));
|
|
209
197
|
}, ne = (e) => {
|
|
210
198
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
211
199
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
@@ -245,35 +233,35 @@ var N = {
|
|
|
245
233
|
let t = e.body?.selector;
|
|
246
234
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
247
235
|
if (!r(e)) return [];
|
|
248
|
-
if (
|
|
236
|
+
if (F(e)) {
|
|
249
237
|
let t = ne(e);
|
|
250
238
|
return t ? [t] : [];
|
|
251
239
|
}
|
|
252
|
-
if (
|
|
240
|
+
if (I(e)) {
|
|
253
241
|
let t = re(e);
|
|
254
242
|
return t ? [t] : [];
|
|
255
243
|
}
|
|
256
|
-
if (
|
|
244
|
+
if (R(e)) {
|
|
257
245
|
let t = ie(e);
|
|
258
246
|
return t ? [t] : [];
|
|
259
247
|
}
|
|
260
248
|
return [];
|
|
261
249
|
});
|
|
262
|
-
}, oe = (e, t) =>
|
|
250
|
+
}, oe = (e, t) => S(() => t ? [] : P(e), [t, e]), se = {
|
|
263
251
|
openGroupKey: null,
|
|
264
252
|
activeIndexByGroup: {}
|
|
265
253
|
}, ce = () => {
|
|
266
|
-
let [e, t] =
|
|
254
|
+
let [e, t] = C(se), n = b((e) => {
|
|
267
255
|
t((t) => ({
|
|
268
256
|
...t,
|
|
269
257
|
openGroupKey: e
|
|
270
258
|
}));
|
|
271
|
-
}, []), r =
|
|
259
|
+
}, []), r = b(() => {
|
|
272
260
|
t((e) => ({
|
|
273
261
|
...e,
|
|
274
262
|
openGroupKey: null
|
|
275
263
|
}));
|
|
276
|
-
}, []), i =
|
|
264
|
+
}, []), i = b((e, n) => {
|
|
277
265
|
t((t) => ({
|
|
278
266
|
...t,
|
|
279
267
|
activeIndexByGroup: {
|
|
@@ -282,7 +270,7 @@ var N = {
|
|
|
282
270
|
}
|
|
283
271
|
}));
|
|
284
272
|
}, []);
|
|
285
|
-
return
|
|
273
|
+
return S(() => ({
|
|
286
274
|
openPopup: n,
|
|
287
275
|
closePopup: r,
|
|
288
276
|
setActiveIndex: i,
|
|
@@ -294,7 +282,7 @@ var N = {
|
|
|
294
282
|
i,
|
|
295
283
|
e
|
|
296
284
|
]);
|
|
297
|
-
}, le = /⟦C(\d+)⟧/g,
|
|
285
|
+
}, le = /⟦C(\d+)⟧/g, z = (e, t) => {
|
|
298
286
|
let n = t.map((e, t) => ({
|
|
299
287
|
g: e,
|
|
300
288
|
idx: t
|
|
@@ -307,7 +295,7 @@ var N = {
|
|
|
307
295
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
308
296
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
309
297
|
return r;
|
|
310
|
-
},
|
|
298
|
+
}, B = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, V = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, H = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, U = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), W = (e) => e.replace(H, (e) => V.test(e) ? e : U(e)), G = (e) => W(e).replace(B, ""), K = (e, t) => {
|
|
311
299
|
if (typeof e == "string") {
|
|
312
300
|
let n = e.split(le);
|
|
313
301
|
if (n.length === 1) return e;
|
|
@@ -320,30 +308,30 @@ var N = {
|
|
|
320
308
|
let n = K(e, t);
|
|
321
309
|
return Array.isArray(n) ? n : [n];
|
|
322
310
|
}) : e;
|
|
323
|
-
},
|
|
311
|
+
}, ue = (e) => {
|
|
324
312
|
let t = e.primaryAnnotation.target?.selector;
|
|
325
313
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
326
|
-
},
|
|
314
|
+
}, de = (e, t) => /* @__PURE__ */ v(g, { children: [
|
|
327
315
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
328
316
|
t,
|
|
329
317
|
"</cit>"
|
|
330
|
-
] }),
|
|
331
|
-
let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l =
|
|
318
|
+
] }), fe = (e, t, n, r = !1, a = !1) => {
|
|
319
|
+
let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = S(() => r ? G(e) : W(t.length > 0 ? z(e, t) : e), [
|
|
332
320
|
e,
|
|
333
321
|
t,
|
|
334
322
|
r
|
|
335
323
|
]), u = l.includes("<cit");
|
|
336
324
|
return {
|
|
337
325
|
processedContent: l,
|
|
338
|
-
markdownComponents:
|
|
326
|
+
markdownComponents: S(() => {
|
|
339
327
|
let e = /* @__PURE__ */ new Map();
|
|
340
328
|
for (let n of t) {
|
|
341
|
-
let t =
|
|
329
|
+
let t = ue(n);
|
|
342
330
|
t != null && e.set(t, n);
|
|
343
331
|
}
|
|
344
332
|
let n = (e) => {
|
|
345
333
|
let { cardLabels: t, markerLabels: n } = c(e);
|
|
346
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ _(j, {
|
|
347
335
|
group: e,
|
|
348
336
|
onPreview: (t) => o(t, e),
|
|
349
337
|
onOpenInBrowser: s,
|
|
@@ -355,16 +343,16 @@ var N = {
|
|
|
355
343
|
return r ? n(r) : null;
|
|
356
344
|
}, l = { cit: (t) => {
|
|
357
345
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
358
|
-
return r ? n(r) :
|
|
346
|
+
return r ? n(r) : de(t["data-id"], t.children);
|
|
359
347
|
} };
|
|
360
348
|
return t.length === 0 ? u ? l : {} : {
|
|
361
349
|
...l,
|
|
362
|
-
p: ({ children: e, ...t }) => /* @__PURE__ */
|
|
350
|
+
p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
|
|
363
351
|
...t,
|
|
364
352
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
365
353
|
children: K(e, r)
|
|
366
354
|
}),
|
|
367
|
-
li: ({ children: e, ...t }) => /* @__PURE__ */
|
|
355
|
+
li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
|
|
368
356
|
...t,
|
|
369
357
|
className: "mb-1.5 last:mb-0",
|
|
370
358
|
children: K(e, r)
|
|
@@ -385,20 +373,20 @@ var N = {
|
|
|
385
373
|
} catch {
|
|
386
374
|
return e;
|
|
387
375
|
}
|
|
388
|
-
},
|
|
376
|
+
}, pe = (e) => {
|
|
389
377
|
try {
|
|
390
378
|
let t = new URL(e);
|
|
391
379
|
return t.pathname.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
392
380
|
} catch {
|
|
393
381
|
return e.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? e;
|
|
394
382
|
}
|
|
395
|
-
}, J = (e, t) => e.body?.source?.attachment?.title ??
|
|
383
|
+
}, J = (e, t) => e.body?.source?.attachment?.title ?? pe(t), Y = (e) => {
|
|
396
384
|
let t = e.target?.selector;
|
|
397
385
|
return t?.type === "html_tag" ? t : void 0;
|
|
398
|
-
},
|
|
386
|
+
}, me = (e) => Y(e) != null, X = (e) => {
|
|
399
387
|
let t = /* @__PURE__ */ new Map();
|
|
400
388
|
for (let n of e) {
|
|
401
|
-
if (
|
|
389
|
+
if (me(n)) continue;
|
|
402
390
|
let e = n.body?.source?.attachment?.url;
|
|
403
391
|
if (e == null) continue;
|
|
404
392
|
let r = t.get(e);
|
|
@@ -428,16 +416,16 @@ var N = {
|
|
|
428
416
|
});
|
|
429
417
|
}
|
|
430
418
|
return Array.from(t.values());
|
|
431
|
-
},
|
|
419
|
+
}, he = (e) => [...Z(e), ...X(e)], ge = (e, t) => {
|
|
432
420
|
let n = e.body?.source?.attachment?.url;
|
|
433
421
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
434
|
-
}, Q = (e) => e.url == null && e.reference_url != null,
|
|
435
|
-
let t =
|
|
422
|
+
}, Q = (e) => e.url == null && e.reference_url != null, _e = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
|
|
423
|
+
let t = _e.exec(e);
|
|
436
424
|
return t ? {
|
|
437
425
|
baseUrl: t[1],
|
|
438
426
|
page: t[2] == null ? null : Number(t[2])
|
|
439
427
|
} : null;
|
|
440
|
-
},
|
|
428
|
+
}, ve = (t) => X((t ?? []).filter(Q).map((t) => {
|
|
441
429
|
let n = t.reference_url, r = $(n) != null;
|
|
442
430
|
return { body: {
|
|
443
431
|
quote: t.data,
|
|
@@ -452,4 +440,4 @@ var N = {
|
|
|
452
440
|
} };
|
|
453
441
|
}));
|
|
454
442
|
//#endregion
|
|
455
|
-
export {
|
|
443
|
+
export { T as CitationCard, O as CitationCardProvider, j as CitationDropdown, E as CitationMarker, ee as annotationHighlightId, ae as annotationToOfficeHighlightLocations, N as annotationsToPdfHighlights, ge as gatherSameSourceAnnotations, te as getAnnotationPdfPage, ve as getReferenceAttachmentGroups, he as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, z as injectCitationSentinels, F as isDocxRangeSelector, R as isExcelRcRangeSelector, I as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, K as replaceSentinelsInChildren, P as resolveMessageAnnotations, G as stripCitTagsWhileStreaming, oe as useAnnotations, ce as useCitationCard, k as useCitationCardContext, fe 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.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.479",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/pdf-highlighter-kit": "^0.0.
|
|
22
|
+
"@epam/pdf-highlighter-kit": "^0.0.19"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"react": "^19.
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
27
|
-
"@epam/ai-dial-ui-kit": "^0.14.
|
|
25
|
+
"react": "^19.2.8",
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.479",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.14.2"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|