@epam/ai-dial-quotations 1.2.0-dev.82 → 1.2.0-dev.85
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.map +1 -1
- package/components/CitationDropdown/CitationDropdown.d.ts +2 -0
- package/components/CitationDropdown/CitationDropdown.d.ts.map +1 -1
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts +2 -0
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts.map +1 -1
- package/index.js +100 -97
- package/package.json +2 -2
|
@@ -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,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtC,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,2DAA2D;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/D,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iKAAiK;IACjK,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,KAAK,EAAE,eAAe,CAAC;IACvB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,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,
|
|
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;AAEtC,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,2DAA2D;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/D,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iKAAiK;IACjK,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,KAAK,EAAE,eAAe,CAAC;IACvB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,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"}
|
|
@@ -12,6 +12,8 @@ export interface CitationDropdownProps {
|
|
|
12
12
|
* group has nothing previewable — the "Preview" button is hidden.
|
|
13
13
|
*/
|
|
14
14
|
onPreview?: (annotation: Annotation) => void;
|
|
15
|
+
/** Whether the host can preview the active annotation. Defaults to allowing preview when `onPreview` is provided. */
|
|
16
|
+
isPreviewable?: (annotation: Annotation) => boolean;
|
|
15
17
|
/** Called when the user clicks "Open in browser" for an annotation. */
|
|
16
18
|
onOpenInBrowser: (annotation: Annotation) => void;
|
|
17
19
|
/** Optional icon rendered before the marker's label. */
|
|
@@ -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,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAGnE,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,
|
|
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,EAA+B,MAAM,OAAO,CAAC;AAGnE,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,qHAAqH;IACrH,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;IACpD,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,CA6EtD,CAAC"}
|
|
@@ -7,6 +7,8 @@ import { AnnotationGroup } from '../../utils/group-annotations-by-source';
|
|
|
7
7
|
export interface UseCitationMarkdownComponentsCallbacks {
|
|
8
8
|
/** Called when a citation marker's preview action is invoked, with the clicked annotation and its group. */
|
|
9
9
|
onPreview(annotation: Annotation, group: AnnotationGroup): void;
|
|
10
|
+
/** Whether the host can preview an annotation. Defaults to allowing preview. */
|
|
11
|
+
isPreviewable?(annotation: Annotation): boolean;
|
|
10
12
|
/** Called when a citation marker's open-in-browser action is invoked. */
|
|
11
13
|
onOpenInBrowser(annotation: Annotation): void;
|
|
12
14
|
/** Builds the translated label bundles used by a given citation group's card and marker. */
|
|
@@ -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,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,KAC1B;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;
|
|
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,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,KAC1B;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAgG5D,CAAC"}
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var T = {
|
|
|
15
15
|
switcher: "_switcher_1kph1_13",
|
|
16
16
|
sourceName: "_sourceName_1kph1_17"
|
|
17
17
|
}, D = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: d, onOpenInBrowser: p, headerIcon: g, labels: y, typography: b, colors: x }) => {
|
|
18
|
-
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, D =
|
|
18
|
+
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, D = C.body?.source?.attachment?.type, O = d == null || D === e.HTML || D === e.XHTML, k = b?.sourceNameClassName ?? "dial-tiny-text", A = b?.titleClassName ?? "dial-body-semi-text", j = b?.quoteClassName ?? "dial-small-text", M = b?.quoteStrongClassName ?? "dial-small-semi-text", N = b?.switcherClassName ?? "dial-tiny-text", P = n({
|
|
19
19
|
"--cc-card-bg": x?.cardBackground,
|
|
20
20
|
"--cc-quote-text": x?.quoteText,
|
|
21
21
|
"--cc-title-text": x?.titleText,
|
|
@@ -26,7 +26,7 @@ var T = {
|
|
|
26
26
|
role: "dialog",
|
|
27
27
|
"aria-modal": "true",
|
|
28
28
|
"aria-label": y.ariaLabel,
|
|
29
|
-
style:
|
|
29
|
+
style: P,
|
|
30
30
|
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", E.card, T.citationCard),
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ v("div", {
|
|
@@ -114,41 +114,42 @@ var T = {
|
|
|
114
114
|
let e = x(k);
|
|
115
115
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
116
116
|
return e;
|
|
117
|
-
}, M = { content: "_content_xzs0h_1" }, N = ({ group: e, onPreview: t,
|
|
118
|
-
let
|
|
119
|
-
e ||
|
|
120
|
-
}, [
|
|
121
|
-
t(e),
|
|
117
|
+
}, M = { content: "_content_xzs0h_1" }, N = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, icon: a, headerIcon: o, cardLabels: s, markerLabels: c, cardTypography: l, markerLabelClassName: u }) => {
|
|
118
|
+
let d = j(), f = S(), m = d.isOpen(f), h = d.getActiveIndex(e.groupKey), g = e.annotations[h] ?? e.primaryAnnotation, v = n?.(g) ?? !0, y = b((e) => {
|
|
119
|
+
e || d.closePopup(f);
|
|
120
|
+
}, [d, f]), x = C(() => t && v ? (e) => {
|
|
121
|
+
t(e), d.closePopup(f);
|
|
122
122
|
} : void 0, [
|
|
123
123
|
t,
|
|
124
|
-
|
|
125
|
-
d
|
|
124
|
+
v,
|
|
125
|
+
d,
|
|
126
|
+
f
|
|
126
127
|
]);
|
|
127
128
|
return /* @__PURE__ */ _(p, {
|
|
128
|
-
open:
|
|
129
|
-
onOpenChange:
|
|
129
|
+
open: m,
|
|
130
|
+
onOpenChange: y,
|
|
130
131
|
triggerClassName: "ms-1 inline-flex align-middle",
|
|
131
132
|
contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none", M.content, T.citationDropdown),
|
|
132
133
|
tooltip: /* @__PURE__ */ _(D, {
|
|
133
134
|
group: e,
|
|
134
|
-
activeIndex:
|
|
135
|
-
onIndexChange: (t) =>
|
|
136
|
-
onPreview:
|
|
137
|
-
onOpenInBrowser:
|
|
138
|
-
headerIcon:
|
|
139
|
-
labels:
|
|
140
|
-
typography:
|
|
135
|
+
activeIndex: h,
|
|
136
|
+
onIndexChange: (t) => d.setActiveIndex(e.groupKey, t),
|
|
137
|
+
onPreview: x,
|
|
138
|
+
onOpenInBrowser: r,
|
|
139
|
+
headerIcon: o,
|
|
140
|
+
labels: s,
|
|
141
|
+
typography: l
|
|
141
142
|
}),
|
|
142
143
|
children: /* @__PURE__ */ _(O, {
|
|
143
144
|
sourceName: e.sourceName,
|
|
144
145
|
annotationCount: e.annotations.length,
|
|
145
|
-
onOpen: () =>
|
|
146
|
-
icon:
|
|
147
|
-
labels:
|
|
148
|
-
labelClassName:
|
|
146
|
+
onOpen: () => d.openPopup(f),
|
|
147
|
+
icon: a,
|
|
148
|
+
labels: c,
|
|
149
|
+
labelClassName: u
|
|
149
150
|
})
|
|
150
151
|
});
|
|
151
|
-
},
|
|
152
|
+
}, P = (e) => {
|
|
152
153
|
let t = e.trim();
|
|
153
154
|
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
154
155
|
let n = [], r = "";
|
|
@@ -157,11 +158,11 @@ var T = {
|
|
|
157
158
|
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
158
159
|
}
|
|
159
160
|
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
160
|
-
},
|
|
161
|
+
}, ee = (e) => {
|
|
161
162
|
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
162
163
|
let { text: t, occurrence: n, slide: r } = e;
|
|
163
164
|
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
164
|
-
let i =
|
|
165
|
+
let i = P(t);
|
|
165
166
|
if (i != null) {
|
|
166
167
|
if (e.type === "docx_text_anchor") return {
|
|
167
168
|
type: "docx_text_anchor",
|
|
@@ -175,13 +176,13 @@ var T = {
|
|
|
175
176
|
slide: r
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
|
-
},
|
|
179
|
+
}, te = {
|
|
179
180
|
backgroundColor: "transparent",
|
|
180
181
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
181
182
|
borderWidth: "2px",
|
|
182
183
|
opacity: .5,
|
|
183
184
|
hoverOpacity: .5
|
|
184
|
-
},
|
|
185
|
+
}, ne = (e) => {
|
|
185
186
|
if (typeof e != "object" || !e) return;
|
|
186
187
|
let t = e, { lt: n, wh: r } = t;
|
|
187
188
|
if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
|
|
@@ -200,7 +201,7 @@ var T = {
|
|
|
200
201
|
x2: i + o,
|
|
201
202
|
y2: a + s
|
|
202
203
|
};
|
|
203
|
-
},
|
|
204
|
+
}, F = (e) => {
|
|
204
205
|
if (!r(e)) return;
|
|
205
206
|
let t = e, n;
|
|
206
207
|
if (t.type === "pdf_bbox") {
|
|
@@ -211,7 +212,7 @@ var T = {
|
|
|
211
212
|
x2: i,
|
|
212
213
|
y2: a
|
|
213
214
|
});
|
|
214
|
-
} else t.type === "pdf_region" && (n =
|
|
215
|
+
} else t.type === "pdf_region" && (n = ne(t.bbox));
|
|
215
216
|
if (n == null) return;
|
|
216
217
|
let i = t.page;
|
|
217
218
|
if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
|
|
@@ -226,63 +227,63 @@ var T = {
|
|
|
226
227
|
x2: n.x2,
|
|
227
228
|
y2: n.y2
|
|
228
229
|
};
|
|
229
|
-
},
|
|
230
|
+
}, I = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(I).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${I(t)}`).join(",")}}`, re = (e) => {
|
|
230
231
|
let t = 5381;
|
|
231
232
|
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
232
233
|
return (t >>> 0).toString(36);
|
|
233
|
-
},
|
|
234
|
+
}, ie = (e) => {
|
|
234
235
|
let t = e.body?.selector;
|
|
235
236
|
if (t == null) return;
|
|
236
237
|
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
237
|
-
let t =
|
|
238
|
+
let t = F(e);
|
|
238
239
|
return t == null ? [] : [t];
|
|
239
|
-
}), r =
|
|
240
|
-
if (!(n.length === 0 && r.length === 0)) return
|
|
241
|
-
},
|
|
242
|
-
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i =
|
|
243
|
-
if (!(r == null && i == null)) return
|
|
244
|
-
},
|
|
240
|
+
}), r = U(e);
|
|
241
|
+
if (!(n.length === 0 && r.length === 0)) return I([n, r]);
|
|
242
|
+
}, ae = (e) => {
|
|
243
|
+
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ie(e);
|
|
244
|
+
if (!(r == null && i == null)) return re(`${r ?? ""}|${i ?? ""}`);
|
|
245
|
+
}, oe = (e) => e.flatMap((e, t) => {
|
|
245
246
|
let n = e.body?.selector;
|
|
246
247
|
if (n == null) return [];
|
|
247
248
|
let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
|
|
248
249
|
if (!r(e)) return [];
|
|
249
|
-
let t =
|
|
250
|
+
let t = F(e);
|
|
250
251
|
return t == null ? [] : [t];
|
|
251
252
|
});
|
|
252
253
|
return i.length === 0 ? [] : [{
|
|
253
|
-
id:
|
|
254
|
+
id: L(e, t),
|
|
254
255
|
bboxes: i,
|
|
255
|
-
style:
|
|
256
|
+
style: te
|
|
256
257
|
}];
|
|
257
|
-
}),
|
|
258
|
+
}), L = (e, t) => e.index == null ? ae(e) ?? String(t) : String(e.index), se = (e) => {
|
|
258
259
|
let t = e.body?.selector;
|
|
259
260
|
if (t == null) return;
|
|
260
261
|
let n = Array.isArray(t) ? t : [t];
|
|
261
262
|
for (let e of n) {
|
|
262
263
|
if (!r(e)) continue;
|
|
263
|
-
let t =
|
|
264
|
+
let t = F(e);
|
|
264
265
|
if (t != null) return t.page;
|
|
265
266
|
}
|
|
266
|
-
},
|
|
267
|
+
}, R = (e) => {
|
|
267
268
|
let t = e.custom_content?.annotations;
|
|
268
269
|
if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
|
|
269
270
|
let n = e.custom_fields;
|
|
270
271
|
if (typeof n != "object" || !n) return [];
|
|
271
272
|
let r = n.annotations;
|
|
272
273
|
return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
|
|
273
|
-
},
|
|
274
|
+
}, z = (e) => {
|
|
274
275
|
if (e.type !== "docx_text_range") return !1;
|
|
275
276
|
let t = e;
|
|
276
277
|
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";
|
|
277
|
-
},
|
|
278
|
+
}, B = (e) => {
|
|
278
279
|
if (e.type !== "pptx_text_range") return !1;
|
|
279
280
|
let t = e;
|
|
280
281
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
281
|
-
},
|
|
282
|
+
}, V = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", H = (e) => {
|
|
282
283
|
if (e.type !== "excel_rc_range") return !1;
|
|
283
284
|
let t = e;
|
|
284
|
-
return typeof t.sheet == "string" &&
|
|
285
|
-
},
|
|
285
|
+
return typeof t.sheet == "string" && V(t.start) && (t.end === void 0 || t.end === null || V(t.end));
|
|
286
|
+
}, ce = (e) => {
|
|
286
287
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
287
288
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
288
289
|
type: "docx_text_range",
|
|
@@ -292,7 +293,7 @@ var T = {
|
|
|
292
293
|
endExclusive: i,
|
|
293
294
|
text: a
|
|
294
295
|
};
|
|
295
|
-
},
|
|
296
|
+
}, le = (e) => {
|
|
296
297
|
let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
|
|
297
298
|
if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
298
299
|
type: "pptx_text_range",
|
|
@@ -302,7 +303,7 @@ var T = {
|
|
|
302
303
|
endExclusive: i,
|
|
303
304
|
text: a
|
|
304
305
|
};
|
|
305
|
-
},
|
|
306
|
+
}, ue = (e) => {
|
|
306
307
|
let { sheet: t, start: n, end: r } = e;
|
|
307
308
|
if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
|
|
308
309
|
if (r == null) return {
|
|
@@ -317,30 +318,30 @@ var T = {
|
|
|
317
318
|
end: r
|
|
318
319
|
};
|
|
319
320
|
}
|
|
320
|
-
},
|
|
321
|
+
}, U = (e) => {
|
|
321
322
|
let t = e.body?.selector;
|
|
322
323
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
323
324
|
if (!r(e)) return [];
|
|
324
|
-
if (
|
|
325
|
-
let t =
|
|
325
|
+
if (z(e)) {
|
|
326
|
+
let t = ce(e);
|
|
326
327
|
return t ? [t] : [];
|
|
327
328
|
}
|
|
328
|
-
if (
|
|
329
|
-
let t =
|
|
329
|
+
if (B(e)) {
|
|
330
|
+
let t = le(e);
|
|
330
331
|
return t ? [t] : [];
|
|
331
332
|
}
|
|
332
|
-
if (
|
|
333
|
-
let t =
|
|
333
|
+
if (H(e)) {
|
|
334
|
+
let t = ue(e);
|
|
334
335
|
return t ? [t] : [];
|
|
335
336
|
}
|
|
336
|
-
let t =
|
|
337
|
+
let t = ee(e);
|
|
337
338
|
return t ? [t] : [];
|
|
338
339
|
});
|
|
339
|
-
},
|
|
340
|
+
}, de = (e, t) => C(() => t ? [] : R(e), [t, e]), fe = {
|
|
340
341
|
openOwnerKey: null,
|
|
341
342
|
activeIndexByGroup: {}
|
|
342
|
-
},
|
|
343
|
-
let [e, t] = w(
|
|
343
|
+
}, pe = () => {
|
|
344
|
+
let [e, t] = w(fe), n = b((e) => {
|
|
344
345
|
t((t) => ({
|
|
345
346
|
...t,
|
|
346
347
|
openOwnerKey: e
|
|
@@ -371,7 +372,7 @@ var T = {
|
|
|
371
372
|
i,
|
|
372
373
|
e
|
|
373
374
|
]);
|
|
374
|
-
},
|
|
375
|
+
}, me = /⟦C(\d+)⟧/g, W = (e, t) => {
|
|
375
376
|
let n = t.map((e, t) => ({
|
|
376
377
|
g: e,
|
|
377
378
|
idx: t
|
|
@@ -384,9 +385,9 @@ var T = {
|
|
|
384
385
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
385
386
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
386
387
|
return r;
|
|
387
|
-
},
|
|
388
|
+
}, he = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, ge = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, _e = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, ve = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), G = (e) => e.replace(_e, (e) => ge.test(e) ? e : ve(e)), K = (e) => G(e).replace(he, ""), q = (e, t) => {
|
|
388
389
|
if (typeof e == "string") {
|
|
389
|
-
let n = e.split(
|
|
390
|
+
let n = e.split(me);
|
|
390
391
|
if (n.length === 1) return e;
|
|
391
392
|
let r = [];
|
|
392
393
|
return n.forEach((e, n) => {
|
|
@@ -394,57 +395,58 @@ var T = {
|
|
|
394
395
|
}), r;
|
|
395
396
|
}
|
|
396
397
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
397
|
-
let n =
|
|
398
|
+
let n = q(e, t);
|
|
398
399
|
return Array.isArray(n) ? n : [n];
|
|
399
400
|
}) : e;
|
|
400
|
-
},
|
|
401
|
+
}, ye = (e) => {
|
|
401
402
|
let t = e.primaryAnnotation.target?.selector;
|
|
402
403
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
403
|
-
},
|
|
404
|
+
}, be = (e, t) => /* @__PURE__ */ v(g, { children: [
|
|
404
405
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
405
406
|
t,
|
|
406
407
|
"</cit>"
|
|
407
|
-
] }),
|
|
408
|
-
let { onPreview: o,
|
|
408
|
+
] }), xe = (e, t, n, r = !1, a = !1) => {
|
|
409
|
+
let { onPreview: o, isPreviewable: s, onOpenInBrowser: c, buildLabels: l } = n, u = C(() => r ? K(e) : G(t.length > 0 ? W(e, t) : e), [
|
|
409
410
|
e,
|
|
410
411
|
t,
|
|
411
412
|
r
|
|
412
|
-
]),
|
|
413
|
+
]), d = u.includes("<cit");
|
|
413
414
|
return {
|
|
414
|
-
processedContent:
|
|
415
|
+
processedContent: u,
|
|
415
416
|
markdownComponents: C(() => {
|
|
416
417
|
let e = /* @__PURE__ */ new Map();
|
|
417
418
|
for (let n of t) {
|
|
418
|
-
let t =
|
|
419
|
+
let t = ye(n);
|
|
419
420
|
t != null && e.set(t, n);
|
|
420
421
|
}
|
|
421
422
|
let n = (e) => {
|
|
422
|
-
let { cardLabels: t, markerLabels: n } =
|
|
423
|
+
let { cardLabels: t, markerLabels: n } = l(e);
|
|
423
424
|
return /* @__PURE__ */ _(N, {
|
|
424
425
|
group: e,
|
|
425
426
|
onPreview: (t) => o(t, e),
|
|
426
|
-
|
|
427
|
+
isPreviewable: s,
|
|
428
|
+
onOpenInBrowser: c,
|
|
427
429
|
cardLabels: t,
|
|
428
430
|
markerLabels: n
|
|
429
431
|
}, `citation-${e.groupKey}`);
|
|
430
432
|
}, r = (e) => {
|
|
431
433
|
let r = t[e];
|
|
432
434
|
return r ? n(r) : null;
|
|
433
|
-
},
|
|
435
|
+
}, u = { cit: (t) => {
|
|
434
436
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
435
|
-
return r ? n(r) :
|
|
437
|
+
return r ? n(r) : be(t["data-id"], t.children);
|
|
436
438
|
} };
|
|
437
|
-
return t.length === 0 ?
|
|
438
|
-
...
|
|
439
|
+
return t.length === 0 ? d ? u : {} : {
|
|
440
|
+
...u,
|
|
439
441
|
p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
|
|
440
442
|
...t,
|
|
441
443
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
442
|
-
children:
|
|
444
|
+
children: q(e, r)
|
|
443
445
|
}),
|
|
444
446
|
li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
|
|
445
447
|
...t,
|
|
446
448
|
className: "mb-1.5 last:mb-0",
|
|
447
|
-
children:
|
|
449
|
+
children: q(e, r)
|
|
448
450
|
})
|
|
449
451
|
};
|
|
450
452
|
}, [
|
|
@@ -452,46 +454,47 @@ var T = {
|
|
|
452
454
|
o,
|
|
453
455
|
s,
|
|
454
456
|
c,
|
|
457
|
+
l,
|
|
455
458
|
a,
|
|
456
|
-
|
|
459
|
+
d
|
|
457
460
|
])
|
|
458
461
|
};
|
|
459
|
-
},
|
|
462
|
+
}, J = (e) => {
|
|
460
463
|
try {
|
|
461
464
|
return decodeURIComponent(e);
|
|
462
465
|
} catch {
|
|
463
466
|
return e;
|
|
464
467
|
}
|
|
465
|
-
},
|
|
468
|
+
}, Se = (e) => {
|
|
466
469
|
try {
|
|
467
470
|
let t = new URL(e);
|
|
468
|
-
return t.pathname.split("/").map((e) =>
|
|
471
|
+
return t.pathname.split("/").map((e) => J(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
469
472
|
} catch {
|
|
470
|
-
return e.split("/").map((e) =>
|
|
473
|
+
return e.split("/").map((e) => J(e)).filter(Boolean).at(-1) ?? e;
|
|
471
474
|
}
|
|
472
|
-
},
|
|
475
|
+
}, Y = (e, t) => e.body?.source?.attachment?.title ?? Se(t), X = (e) => {
|
|
473
476
|
let t = e.target?.selector;
|
|
474
477
|
return t?.type === "html_tag" ? t : void 0;
|
|
475
|
-
},
|
|
478
|
+
}, Ce = (e) => X(e) != null, Z = (e) => {
|
|
476
479
|
let t = /* @__PURE__ */ new Map();
|
|
477
480
|
for (let n of e) {
|
|
478
|
-
if (
|
|
481
|
+
if (Ce(n)) continue;
|
|
479
482
|
let e = n.body?.source?.attachment?.url;
|
|
480
483
|
if (e == null) continue;
|
|
481
484
|
let r = t.get(e);
|
|
482
485
|
r ? r.annotations.push(n) : t.set(e, {
|
|
483
486
|
groupKey: e,
|
|
484
487
|
sourceUrl: e,
|
|
485
|
-
sourceName:
|
|
488
|
+
sourceName: Y(n, e),
|
|
486
489
|
annotations: [n],
|
|
487
490
|
primaryAnnotation: n
|
|
488
491
|
});
|
|
489
492
|
}
|
|
490
493
|
return Array.from(t.values());
|
|
491
|
-
},
|
|
494
|
+
}, Q = (e) => {
|
|
492
495
|
let t = /* @__PURE__ */ new Map();
|
|
493
496
|
for (let n of e) {
|
|
494
|
-
let e =
|
|
497
|
+
let e = X(n)?.id;
|
|
495
498
|
if (e == null) continue;
|
|
496
499
|
let r = n.body?.source?.attachment?.url;
|
|
497
500
|
if (r == null) continue;
|
|
@@ -499,22 +502,22 @@ var T = {
|
|
|
499
502
|
i ? i.annotations.push(n) : t.set(e, {
|
|
500
503
|
groupKey: `cit:${e}`,
|
|
501
504
|
sourceUrl: r,
|
|
502
|
-
sourceName:
|
|
505
|
+
sourceName: Y(n, r),
|
|
503
506
|
annotations: [n],
|
|
504
507
|
primaryAnnotation: n
|
|
505
508
|
});
|
|
506
509
|
}
|
|
507
510
|
return Array.from(t.values());
|
|
508
|
-
},
|
|
511
|
+
}, we = (e) => [...Q(e), ...Z(e)], Te = (e, t) => {
|
|
509
512
|
let n = e.body?.source?.attachment?.url;
|
|
510
513
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
511
|
-
},
|
|
514
|
+
}, Ee = (e) => e.url == null && e.reference_url != null, De = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
|
|
512
515
|
let t = De.exec(e);
|
|
513
516
|
return t ? {
|
|
514
517
|
baseUrl: t[1],
|
|
515
518
|
page: t[2] == null ? null : Number(t[2])
|
|
516
519
|
} : null;
|
|
517
|
-
}, Oe = (t) =>
|
|
520
|
+
}, Oe = (t) => Z((t ?? []).filter(Ee).map((t) => {
|
|
518
521
|
let n = t.reference_url, r = $(n) != null;
|
|
519
522
|
return { body: {
|
|
520
523
|
quote: t.data,
|
|
@@ -529,4 +532,4 @@ var T = {
|
|
|
529
532
|
} };
|
|
530
533
|
}));
|
|
531
534
|
//#endregion
|
|
532
|
-
export { D as CitationCard, A as CitationCardProvider, N as CitationDropdown, O as CitationMarker, T as QUOTATIONS_CLASS,
|
|
535
|
+
export { D as CitationCard, A as CitationCardProvider, N as CitationDropdown, O as CitationMarker, T as QUOTATIONS_CLASS, L as annotationHighlightId, U as annotationToOfficeHighlightLocations, oe as annotationsToPdfHighlights, Te as gatherSameSourceAnnotations, se as getAnnotationPdfPage, Oe as getReferenceAttachmentGroups, we as groupAnnotations, Q as groupAnnotationsByCitId, Z as groupAnnotationsBySource, W as injectCitationSentinels, z as isDocxRangeSelector, H as isExcelRcRangeSelector, B as isPptxRangeSelector, Ee as isReferenceOnlyAttachment, $ as parsePdfPageReference, q as replaceSentinelsInChildren, R as resolveMessageAnnotations, K as stripCitTagsWhileStreaming, de as useAnnotations, pe as useCitationCard, j as useCitationCardContext, xe 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.85",
|
|
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.85",
|
|
27
27
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.9"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|