@epam/ai-dial-quotations 1.2.0-dev.270 → 1.2.0-dev.271

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.
@@ -15,6 +15,8 @@ export interface CitationCardLabels {
15
15
  preview: string;
16
16
  /** Label for the "Open in browser" button. */
17
17
  openInBrowser: string;
18
+ /** Label for the "Download" button. */
19
+ download: string;
18
20
  /** Label for the toggle that expands a quote cut off at the collapsed height. */
19
21
  showMore: string;
20
22
  /** Label for the toggle that collapses an expanded quote. */
@@ -57,11 +59,13 @@ export interface CitationCardProps {
57
59
  /**
58
60
  * Called when the user clicks the "Preview" button. Omit when the group has
59
61
  * nothing previewable (e.g. reference-only chunks) — the "Preview" button is
60
- * hidden and an "Open in browser" button is shown instead.
62
+ * hidden and the remaining button is always labelled "Open in browser".
61
63
  */
62
64
  onPreview?: (annotation: Annotation) => void;
63
- /** Called when the user clicks the "Open in browser" button, shown for web links and non-previewable sources. */
65
+ /** Called when the user clicks the "Open in browser"/"Download" button. */
64
66
  onOpenInBrowser: (annotation: Annotation) => void;
67
+ /** Whether a previewable file shows the "Download" button. Web links keep "Open in browser" regardless. Defaults to `true`. */
68
+ isDownloadEnabled?: boolean;
65
69
  /**
66
70
  * Optional icon rendered before the header text (the file extension for a
67
71
  * previewable file, otherwise the source name). When omitted, a previewable
@@ -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;AAkB5D,OAAO,EACL,EAAE,EACF,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,yCAAyC,CAAC;AAGjD,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,gBAAg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AE,CAAC,iBAAiB,CAsN9C,CAAC"}
@@ -16,6 +16,8 @@ export interface CitationDropdownProps {
16
16
  isPreviewable?: (annotation: Annotation) => boolean;
17
17
  /** Called when the user clicks "Open in browser" for an annotation. */
18
18
  onOpenInBrowser: (annotation: Annotation) => void;
19
+ /** Whether the card shows the "Download" button for a previewable file. Defaults to `true`. */
20
+ isDownloadEnabled?: boolean;
19
21
  /** Whether the host's preview panel is open; a marker click then previews the active annotation directly instead of showing the card. Defaults to `false`. */
20
22
  isPreviewOpen?: boolean;
21
23
  /** 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,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,8JAA8J;IAC9J,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,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,4HAA4H;AAC5H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAyGtD,CAAC"}
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,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8JAA8J;IAC9J,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,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,4HAA4H;AAC5H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA4GtD,CAAC"}
@@ -11,6 +11,8 @@ export interface UseCitationMarkdownComponentsCallbacks {
11
11
  isPreviewable?(annotation: Annotation): boolean;
12
12
  /** Called when a citation marker's open-in-browser action is invoked. */
13
13
  onOpenInBrowser(annotation: Annotation): void;
14
+ /** Whether citation cards show the "Download" button for a previewable file. Defaults to `true`. */
15
+ isDownloadEnabled?: boolean;
14
16
  /** Whether the host's preview panel is open; a marker click then previews directly instead of showing the card. Defaults to `false`. */
15
17
  isPreviewOpen?: boolean;
16
18
  /** 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,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAiH5D,CAAC"}
1
+ {"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAO3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,6FAA6F;AAC7F,MAAM,WAAW,sCAAsC;IACrD,4GAA4G;IAC5G,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAoH5D,CAAC"}
package/index.css CHANGED
@@ -1,2 +1,2 @@
1
1
  ._card_1kph1_1{background:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc))}._quote_1kph1_5{color:var(--cc-quote-text,var(--text-secondary,#57647a))}._title_1kph1_9{color:var(--cc-title-text,var(--text-primary,#161b2d))}._switcher_1kph1_13{color:var(--cc-switcher-text,var(--text-secondary,#57647a))}._sourceName_1kph1_17{color:var(--cc-source-name-text,var(--text-primary,#161b2d))}td ._trigger_1ud83_1,th ._trigger_1ud83_1{max-width:100%;margin-inline-start:0}td ._trigger_1ud83_1>*,th ._trigger_1ud83_1>*{min-width:0;max-width:100%}
2
- /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.min-h-\[3lh\]{min-height:3lh}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-3{padding-inline-start:.75rem}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
2
+ /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.min-h-\[3lh\]{min-height:3lh}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
package/index.js CHANGED
@@ -1,46 +1,46 @@
1
1
  import { MIMEType as e, MarkdownRenderer as t, buildCssVars as n, isAnnotationSelector as r, mergeClasses as i, normalizePersistedHtmlTagAttachmentType as a, normalizeRawAnnotations as o } from "@epam/ai-dial-chat-shared";
2
2
  import { DIAL_KIT_ICON_STROKE as s, DialItemType as c, Dropdown as l, ElementSize as u, EllipsisTooltip as d, FileIcon as f, GhostIconButton as p, LinkButton as m, NeutralButton as h, PrimaryButton as g } from "@epam/ai-dial-ui-kit";
3
3
  import { IconChevronLeft as _, IconChevronRight as v } from "@tabler/icons-react";
4
- import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as te, useMemo as C, useRef as ne, useState as w } from "react";
5
- import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
4
+ import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as te, useMemo as C, useRef as w, useState as T } from "react";
5
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
- var O = {
7
+ var k = {
8
8
  citationCard: "dial-quotations-citation-card",
9
9
  citationDropdown: "dial-quotations-citation-dropdown",
10
10
  citationMarker: "dial-quotations-citation-marker"
11
- }, k = (e) => {
11
+ }, A = (e) => {
12
12
  try {
13
13
  return decodeURIComponent(e);
14
14
  } catch {
15
15
  return e;
16
16
  }
17
- }, A = (e) => {
17
+ }, j = (e) => {
18
18
  try {
19
19
  let t = new URL(e);
20
- return t.pathname.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? t.hostname;
20
+ return t.pathname.split("/").map((e) => A(e)).filter(Boolean).at(-1) ?? t.hostname;
21
21
  } catch {
22
- return e.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? e;
22
+ return e.split("/").map((e) => A(e)).filter(Boolean).at(-1) ?? e;
23
23
  }
24
- }, j = /\.([a-z0-9]{1,10})$/i, M = (e) => {
25
- let t = e == null ? null : j.exec(e.trim());
24
+ }, M = /\.([a-z0-9]{1,10})$/i, N = (e) => {
25
+ let t = e == null ? null : M.exec(e.trim());
26
26
  return t == null ? void 0 : `.${t[1].toLowerCase()}`;
27
- }, re = (e) => {
27
+ }, ne = (e) => {
28
28
  let t = e.body?.source?.attachment, n = t?.url;
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) => {
29
+ return (n == null ? void 0 : N(j(n))) ?? N(t?.title);
30
+ }, P = (e, t) => e.body?.source?.attachment?.title ?? j(t), F = (e) => {
31
31
  let t = e.target?.selector;
32
32
  return t?.type === "html_tag" ? t : void 0;
33
- }, F = (e) => P(e) != null, I = (e) => {
33
+ }, re = (e) => F(e) != null, I = (e) => {
34
34
  let t = /* @__PURE__ */ new Map();
35
35
  for (let n of e) {
36
- if (F(n)) continue;
36
+ if (re(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: N(n, e),
43
+ sourceName: P(n, e),
44
44
  annotations: [n],
45
45
  primaryAnnotation: n
46
46
  });
@@ -49,7 +49,7 @@ var O = {
49
49
  }, L = (e) => {
50
50
  let t = /* @__PURE__ */ new Map();
51
51
  for (let n of e) {
52
- let e = P(n)?.id;
52
+ let e = F(n)?.id;
53
53
  if (e == null) continue;
54
54
  let r = n.body?.source?.attachment?.url;
55
55
  if (r == null) continue;
@@ -57,36 +57,36 @@ var O = {
57
57
  i ? i.annotations.push(n) : t.set(e, {
58
58
  groupKey: `cit:${e}`,
59
59
  sourceUrl: r,
60
- sourceName: N(n, r),
60
+ sourceName: P(n, r),
61
61
  annotations: [n],
62
62
  primaryAnnotation: n
63
63
  });
64
64
  }
65
65
  return Array.from(t.values());
66
- }, R = (e) => [...L(e), ...I(e)], z = (e, t) => {
66
+ }, ie = (e) => [...L(e), ...I(e)], R = (e, t) => {
67
67
  let n = e.body?.source?.attachment?.url;
68
68
  return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
69
- }, B = {
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
- }, V = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, headerIcon: y, labels: b, typography: x, colors: C }) => {
76
- let T = r.annotations.length, k = r.annotations[a] ?? r.primaryAnnotation, A = T > 1, j = k.body?.source?.attachment?.type, M = l == null || j === e.HTML || j === e.XHTML, N = M ? void 0 : re(k), P = N ?? r.sourceName, F = y ?? (N == null ? void 0 : /* @__PURE__ */ E(f, {
75
+ }, B = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, isDownloadEnabled: y = !0, headerIcon: b, labels: x, typography: C, colors: E }) => {
76
+ let A = r.annotations.length, j = r.annotations[a] ?? r.primaryAnnotation, M = A > 1, N = j.body?.source?.attachment?.type, P = l == null || N === e.HTML || N === e.XHTML, F = P ? void 0 : ne(j), re = F ?? r.sourceName, I = b ?? (F == null ? void 0 : /* @__PURE__ */ D(f, {
77
77
  type: c.File,
78
- name: N,
79
- fileExtension: N,
78
+ name: F,
79
+ fileExtension: F,
80
80
  size: 16,
81
81
  decorative: !0,
82
82
  className: "shrink-0"
83
- })), I = x?.sourceNameClassName ?? "dial-tiny-text", L = x?.titleClassName ?? "dial-body-semi-text", R = x?.quoteClassName ?? "dial-small-text", z = x?.quoteStrongClassName ?? "dial-small-semi-text", V = x?.switcherClassName ?? "dial-tiny-text", H = n({
84
- "--cc-card-bg": C?.cardBackground,
85
- "--cc-quote-text": C?.quoteText,
86
- "--cc-title-text": C?.titleText,
87
- "--cc-switcher-text": C?.switcherText,
88
- "--cc-source-name-text": C?.sourceNameText
89
- }), U = k.body?.quote, W = ee(), G = ne(null), [K, q] = w(!1), [J, Y] = w(!1);
83
+ })), L = C?.sourceNameClassName ?? "dial-tiny-text", ie = C?.titleClassName ?? "dial-body-semi-text", R = C?.quoteClassName ?? "dial-small-text", B = C?.quoteStrongClassName ?? "dial-small-semi-text", V = C?.switcherClassName ?? "dial-tiny-text", H = n({
84
+ "--cc-card-bg": E?.cardBackground,
85
+ "--cc-quote-text": E?.quoteText,
86
+ "--cc-title-text": E?.titleText,
87
+ "--cc-switcher-text": E?.switcherText,
88
+ "--cc-source-name-text": E?.sourceNameText
89
+ }), U = j.body?.quote, W = ee(), G = w(null), [K, q] = T(!1), [J, Y] = T(!1);
90
90
  return S(() => {
91
91
  q(!1);
92
92
  }, [a, U]), te(() => {
@@ -96,74 +96,74 @@ var O = {
96
96
  t();
97
97
  let n = new ResizeObserver(t);
98
98
  return n.observe(e), () => n.disconnect();
99
- }, [U, K]), /* @__PURE__ */ D("div", {
99
+ }, [U, K]), /* @__PURE__ */ O("div", {
100
100
  role: "dialog",
101
101
  "aria-modal": "true",
102
- "aria-label": b.ariaLabel,
102
+ "aria-label": x.ariaLabel,
103
103
  style: H,
104
- className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", B.card, O.citationCard),
104
+ className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", z.card, k.citationCard),
105
105
  children: [
106
- /* @__PURE__ */ D("div", {
106
+ /* @__PURE__ */ O("div", {
107
107
  className: "flex items-center justify-between gap-2",
108
- children: [/* @__PURE__ */ D("div", {
108
+ children: [/* @__PURE__ */ O("div", {
109
109
  className: "flex min-w-0 items-center gap-1",
110
- children: [F, /* @__PURE__ */ E(d, {
111
- text: P,
112
- className: i(I, "min-w-0", B.sourceName)
110
+ children: [I, /* @__PURE__ */ D(d, {
111
+ text: re,
112
+ className: i(L, "min-w-0", z.sourceName)
113
113
  })]
114
- }), A && /* @__PURE__ */ D("div", {
114
+ }), M && /* @__PURE__ */ O("div", {
115
115
  className: "flex shrink-0 items-center gap-1",
116
116
  children: [
117
- /* @__PURE__ */ E(p, {
118
- icon: /* @__PURE__ */ E(_, {
117
+ /* @__PURE__ */ D(p, {
118
+ icon: /* @__PURE__ */ D(_, {
119
119
  size: 14,
120
120
  className: "rtl:scale-x-[-1]",
121
121
  stroke: s
122
122
  }),
123
123
  size: u.Small,
124
- "aria-label": b.previousCitation,
125
- onClick: () => o((a - 1 + T) % T)
124
+ "aria-label": x.previousCitation,
125
+ onClick: () => o((a - 1 + A) % A)
126
126
  }),
127
- /* @__PURE__ */ E("span", {
128
- className: i(V, B.switcher),
129
- children: b.formatSwitcherText(a + 1, T)
127
+ /* @__PURE__ */ D("span", {
128
+ className: i(V, z.switcher),
129
+ children: x.formatSwitcherText(a + 1, A)
130
130
  }),
131
- /* @__PURE__ */ E(p, {
132
- icon: /* @__PURE__ */ E(v, {
131
+ /* @__PURE__ */ D(p, {
132
+ icon: /* @__PURE__ */ D(v, {
133
133
  size: 14,
134
134
  className: "rtl:scale-x-[-1]",
135
135
  stroke: s
136
136
  }),
137
137
  size: u.Small,
138
- "aria-label": b.nextCitation,
139
- onClick: () => o((a + 1) % T)
138
+ "aria-label": x.nextCitation,
139
+ onClick: () => o((a + 1) % A)
140
140
  })
141
141
  ]
142
142
  })]
143
143
  }),
144
- (k.body?.title || k.body?.quote || A) && /* @__PURE__ */ D("div", {
144
+ (j.body?.title || j.body?.quote || M) && /* @__PURE__ */ O("div", {
145
145
  className: "flex flex-col gap-3",
146
- children: [k.body?.title && /* @__PURE__ */ E("p", {
147
- className: i(L, B.title, "break-words"),
148
- children: k.body.title
149
- }), (U || A) && /* @__PURE__ */ D("div", {
146
+ children: [j.body?.title && /* @__PURE__ */ D("p", {
147
+ className: i(ie, z.title, "break-words"),
148
+ children: j.body.title
149
+ }), (U || M) && /* @__PURE__ */ O("div", {
150
150
  className: "flex flex-col items-start gap-1",
151
- children: [/* @__PURE__ */ E("div", {
151
+ children: [/* @__PURE__ */ D("div", {
152
152
  ref: G,
153
153
  id: W,
154
154
  tabIndex: K ? 0 : void 0,
155
- className: i(R, B.quote, "w-full break-words", K ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6", A && "min-h-[3lh]"),
156
- children: U && /* @__PURE__ */ E(t, {
155
+ className: i(R, z.quote, "w-full break-words", K ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6", M && "min-h-[3lh]"),
156
+ children: U && /* @__PURE__ */ D(t, {
157
157
  content: U,
158
158
  classNames: {
159
- p: i(R, B.quote),
160
- ul: i(R, "ps-3"),
161
- ol: i(R, "ps-3"),
162
- strong: z
159
+ p: i(R, z.quote),
160
+ ul: i(R, "ps-[1.5em]"),
161
+ ol: R,
162
+ strong: B
163
163
  }
164
164
  })
165
- }), J && /* @__PURE__ */ E(m, {
166
- label: K ? b.showLess : b.showMore,
165
+ }), J && /* @__PURE__ */ D(m, {
166
+ label: K ? x.showLess : x.showMore,
167
167
  size: u.Small,
168
168
  "aria-expanded": K,
169
169
  "aria-controls": W,
@@ -171,95 +171,97 @@ var O = {
171
171
  })]
172
172
  })]
173
173
  }),
174
- /* @__PURE__ */ D("div", {
174
+ /* @__PURE__ */ O("div", {
175
175
  className: "flex justify-start gap-2",
176
- children: [l && /* @__PURE__ */ E(g, {
177
- label: b.preview,
176
+ children: [l && /* @__PURE__ */ D(g, {
177
+ label: x.preview,
178
178
  size: u.Small,
179
- onClick: () => l(k)
180
- }), M && /* @__PURE__ */ E(g, {
181
- label: b.openInBrowser,
179
+ onClick: () => l(j)
180
+ }), (P || y) && /* @__PURE__ */ D(g, {
181
+ label: P ? x.openInBrowser : x.download,
182
182
  size: u.Small,
183
- onClick: () => h(k)
183
+ onClick: () => h(j)
184
184
  })]
185
185
  })
186
186
  ]
187
187
  });
188
- }, H = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ E(h, {
188
+ }, V = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ D(h, {
189
189
  size: u.Small,
190
- className: i("max-w-[240px]", O.citationMarker),
190
+ className: i("max-w-[240px]", k.citationMarker),
191
191
  textClassName: "min-w-0 truncate",
192
192
  iconBefore: n,
193
- label: /* @__PURE__ */ E("span", {
193
+ label: /* @__PURE__ */ D("span", {
194
194
  className: a,
195
195
  children: e > 1 ? r.labelWithOverflow : r.label
196
196
  }),
197
197
  "aria-label": r.ariaLabel,
198
198
  onClick: t
199
- }), U = y(null), W = U.Provider, G = () => {
200
- let e = x(U);
199
+ }), H = y(null), U = H.Provider, W = () => {
200
+ let e = x(H);
201
201
  if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
202
202
  return e;
203
- }, K = { trigger: "_trigger_1ud83_1" }, q = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isPreviewOpen: a = !1, icon: o, headerIcon: s, cardLabels: c, markerLabels: u, cardTypography: d, markerLabelClassName: f }) => {
204
- let p = G(), m = ee(), h = p.isOpen(m), g = p.getActiveIndex(e.groupKey), _ = e.annotations[g] ?? e.primaryAnnotation, v = n?.(_) ?? !0, y = b((e) => {
205
- e || p.closePopup(m);
206
- }, [p, m]), x = C(() => t && v ? (e) => {
207
- t(e), p.closePopup(m);
203
+ }, G = { trigger: "_trigger_1ud83_1" }, K = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, icon: s, headerIcon: c, cardLabels: u, markerLabels: d, cardTypography: f, markerLabelClassName: p }) => {
204
+ let m = W(), h = ee(), g = m.isOpen(h), _ = m.getActiveIndex(e.groupKey), v = e.annotations[_] ?? e.primaryAnnotation, y = n?.(v) ?? !0, x = b((e) => {
205
+ e || m.closePopup(h);
206
+ }, [m, h]), S = C(() => t && y ? (e) => {
207
+ t(e), m.closePopup(h);
208
208
  } : void 0, [
209
209
  t,
210
- v,
211
- p,
212
- m
213
- ]), S = b(() => {
214
- if (a && x) {
215
- x(_);
210
+ y,
211
+ m,
212
+ h
213
+ ]), te = b(() => {
214
+ if (o && S) {
215
+ S(v);
216
216
  return;
217
217
  }
218
- p.openPopup(m);
218
+ m.openPopup(h);
219
219
  }, [
220
- a,
221
- x,
222
- _,
223
- p,
224
- m
225
- ]), te = b(() => /* @__PURE__ */ E(V, {
220
+ o,
221
+ S,
222
+ v,
223
+ m,
224
+ h
225
+ ]), w = b(() => /* @__PURE__ */ D(B, {
226
226
  group: e,
227
- activeIndex: g,
228
- onIndexChange: (t) => p.setActiveIndex(e.groupKey, t),
229
- onPreview: x,
227
+ activeIndex: _,
228
+ onIndexChange: (t) => m.setActiveIndex(e.groupKey, t),
229
+ onPreview: S,
230
230
  onOpenInBrowser: r,
231
- headerIcon: s,
232
- labels: c,
233
- typography: d
231
+ isDownloadEnabled: a,
232
+ headerIcon: c,
233
+ labels: u,
234
+ typography: f
234
235
  }), [
235
236
  e,
236
- g,
237
- p,
238
- x,
237
+ _,
238
+ m,
239
+ S,
239
240
  r,
240
- s,
241
+ a,
241
242
  c,
242
- d
243
+ u,
244
+ f
243
245
  ]);
244
- return /* @__PURE__ */ E(l, {
245
- open: h,
246
- onOpenChange: y,
246
+ return /* @__PURE__ */ D(l, {
247
+ open: g,
248
+ onOpenChange: x,
247
249
  trigger: [],
248
250
  placement: "bottom-end",
249
251
  matchReferenceWidth: !1,
250
- className: i("ms-1 inline-flex align-middle", K.trigger),
251
- listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", O.citationDropdown),
252
- renderOverlay: te,
253
- children: /* @__PURE__ */ E(H, {
252
+ className: i("ms-1 inline-flex align-middle", G.trigger),
253
+ listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", k.citationDropdown),
254
+ renderOverlay: w,
255
+ children: /* @__PURE__ */ D(V, {
254
256
  sourceName: e.sourceName,
255
257
  annotationCount: e.annotations.length,
256
- onOpen: S,
257
- icon: o,
258
- labels: u,
259
- labelClassName: f
258
+ onOpen: te,
259
+ icon: s,
260
+ labels: d,
261
+ labelClassName: p
260
262
  })
261
263
  });
262
- }, J = (e) => {
264
+ }, q = (e) => {
263
265
  let t = e.trim();
264
266
  if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
265
267
  let n = [], r = "";
@@ -268,11 +270,11 @@ var O = {
268
270
  i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
269
271
  }
270
272
  if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
271
- }, Y = (e) => {
273
+ }, J = (e) => {
272
274
  if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
273
275
  let { text: t, occurrence: n, slide: r } = e;
274
276
  if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
275
- let i = J(t);
277
+ let i = q(t);
276
278
  if (i != null) {
277
279
  if (e.type === "docx_text_anchor") return {
278
280
  type: "docx_text_anchor",
@@ -286,7 +288,7 @@ var O = {
286
288
  slide: r
287
289
  };
288
290
  }
289
- }, ie = {
291
+ }, Y = {
290
292
  backgroundColor: "transparent",
291
293
  borderColor: "var(--stroke-accent, #1D4ED8)",
292
294
  borderWidth: "2px",
@@ -353,7 +355,7 @@ var O = {
353
355
  let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
354
356
  let t = X(e);
355
357
  return t == null ? [] : [t];
356
- }), r = be(e);
358
+ }), r = xe(e);
357
359
  if (!(n.length === 0 && r.length === 0)) return Z([n, r]);
358
360
  }, le = (e) => {
359
361
  let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ce(e);
@@ -369,7 +371,7 @@ var O = {
369
371
  return i.length === 0 ? [] : [{
370
372
  id: de(e, t),
371
373
  bboxes: i,
372
- style: ie
374
+ style: Y
373
375
  }];
374
376
  }), de = (e, t) => e.index == null ? le(e) ?? String(t) : String(e.index), fe = (e) => {
375
377
  let t = e.body?.selector;
@@ -391,19 +393,19 @@ var O = {
391
393
  if (typeof n != "object" || !n) return [];
392
394
  let r = n.annotations;
393
395
  return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
394
- }, Q = (e) => {
396
+ }, me = (e) => {
395
397
  if (e.type !== "docx_text_range") return !1;
396
398
  let t = e;
397
399
  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";
398
- }, me = (e) => {
400
+ }, he = (e) => {
399
401
  if (e.type !== "pptx_text_range") return !1;
400
402
  let t = e;
401
403
  return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
402
- }, he = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", ge = (e) => {
404
+ }, ge = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", _e = (e) => {
403
405
  if (e.type !== "excel_rc_range") return !1;
404
406
  let t = e;
405
- return typeof t.sheet == "string" && he(t.start) && (t.end === void 0 || t.end === null || he(t.end));
406
- }, _e = (e) => {
407
+ return typeof t.sheet == "string" && ge(t.start) && (t.end === void 0 || t.end === null || ge(t.end));
408
+ }, ve = (e) => {
407
409
  let { story: t, path: n, start: r, end: i, text: a } = e;
408
410
  if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
409
411
  type: "docx_text_range",
@@ -413,7 +415,7 @@ var O = {
413
415
  endExclusive: i,
414
416
  text: a
415
417
  };
416
- }, ve = (e) => {
418
+ }, ye = (e) => {
417
419
  let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
418
420
  if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
419
421
  type: "pptx_text_range",
@@ -423,7 +425,7 @@ var O = {
423
425
  endExclusive: i,
424
426
  text: a
425
427
  };
426
- }, ye = (e) => {
428
+ }, be = (e) => {
427
429
  let { sheet: t, start: n, end: r } = e;
428
430
  if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
429
431
  if (r == null) return {
@@ -438,30 +440,30 @@ var O = {
438
440
  end: r
439
441
  };
440
442
  }
441
- }, be = (e) => {
443
+ }, xe = (e) => {
442
444
  let t = e.body?.selector;
443
445
  return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
444
446
  if (!r(e)) return [];
445
- if (Q(e)) {
446
- let t = _e(e);
447
- return t ? [t] : [];
448
- }
449
447
  if (me(e)) {
450
448
  let t = ve(e);
451
449
  return t ? [t] : [];
452
450
  }
453
- if (ge(e)) {
451
+ if (he(e)) {
454
452
  let t = ye(e);
455
453
  return t ? [t] : [];
456
454
  }
457
- let t = Y(e);
455
+ if (_e(e)) {
456
+ let t = be(e);
457
+ return t ? [t] : [];
458
+ }
459
+ let t = J(e);
458
460
  return t ? [t] : [];
459
461
  });
460
- }, xe = (e, t) => C(() => t ? [] : pe(e), [t, e]), Se = {
462
+ }, Se = (e, t) => C(() => t ? [] : pe(e), [t, e]), Ce = {
461
463
  openOwnerKey: null,
462
464
  activeIndexByGroup: {}
463
- }, Ce = () => {
464
- let [e, t] = w(Se), n = b((e) => {
465
+ }, we = () => {
466
+ let [e, t] = T(Ce), n = b((e) => {
465
467
  t((t) => ({
466
468
  ...t,
467
469
  openOwnerKey: e
@@ -492,7 +494,7 @@ var O = {
492
494
  i,
493
495
  e
494
496
  ]);
495
- }, we = /⟦C(\d+)⟧/g, Te = (e, t) => {
497
+ }, Te = /⟦C(\d+)⟧/g, Ee = (e, t) => {
496
498
  let n = t.map((e, t) => ({
497
499
  g: e,
498
500
  idx: t
@@ -505,9 +507,9 @@ var O = {
505
507
  }).sort((e, t) => t.pos - e.pos), r = e;
506
508
  for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
507
509
  return r;
508
- }, Ee = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, De = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, Oe = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, ke = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Ae = (e) => e.replace(Oe, (e) => De.test(e) ? e : ke(e)), je = (e) => Ae(e).replace(Ee, ""), $ = (e, t) => {
510
+ }, De = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, Oe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ke = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ae = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""), Q = (e, t) => {
509
511
  if (typeof e == "string") {
510
- let n = e.split(we);
512
+ let n = e.split(Te);
511
513
  if (n.length === 1) return e;
512
514
  let r = [];
513
515
  return n.forEach((e, n) => {
@@ -515,63 +517,64 @@ var O = {
515
517
  }), r;
516
518
  }
517
519
  return Array.isArray(e) ? e.flatMap((e) => {
518
- let n = $(e, t);
520
+ let n = Q(e, t);
519
521
  return Array.isArray(n) ? n : [n];
520
522
  }) : e;
521
- }, Me = {}, Ne = [], Pe = (e) => {
523
+ }, Ne = {}, Pe = [], $ = (e) => {
522
524
  let t = e.primaryAnnotation.target?.selector;
523
525
  return t?.type === "html_tag" ? t.id : void 0;
524
- }, Fe = (e, t) => /* @__PURE__ */ D(T, { children: [
526
+ }, Fe = (e, t) => /* @__PURE__ */ O(E, { children: [
525
527
  e == null ? "<cit>" : `<cit data-id="${e}">`,
526
528
  t,
527
529
  "</cit>"
528
- ] }), Ie = (e, t, n, r = !1, a = !1, o = Ne) => {
529
- let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isPreviewOpen: u = !1, buildLabels: d } = n, f = C(() => r ? je(e) : Ae(t.length > 0 ? Te(e, t) : e), [
530
+ ] }), Ie = (e, t, n, r = !1, a = !1, o = Pe) => {
531
+ let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p = C(() => r ? Me(e) : je(t.length > 0 ? Ee(e, t) : e), [
530
532
  e,
531
533
  t,
532
534
  r
533
- ]), p = f.includes("<cit");
535
+ ]), m = p.includes("<cit");
534
536
  return {
535
- processedContent: f,
537
+ processedContent: p,
536
538
  markdownComponents: C(() => {
537
539
  let e = /* @__PURE__ */ new Map();
538
540
  for (let t of o) {
539
- let n = Pe(t);
541
+ let n = $(t);
540
542
  n != null && e.set(n, t);
541
543
  }
542
544
  for (let n of t) {
543
- let t = Pe(n);
545
+ let t = $(n);
544
546
  t != null && e.set(t, n);
545
547
  }
546
548
  let n = (e) => {
547
- let { cardLabels: t, markerLabels: n } = d(e);
548
- return /* @__PURE__ */ E(q, {
549
+ let { cardLabels: t, markerLabels: n } = f(e);
550
+ return /* @__PURE__ */ D(K, {
549
551
  group: e,
550
552
  onPreview: (t) => s(t, e),
551
553
  isPreviewable: c,
552
554
  onOpenInBrowser: l,
553
- isPreviewOpen: u,
555
+ isDownloadEnabled: u,
556
+ isPreviewOpen: d,
554
557
  cardLabels: t,
555
558
  markerLabels: n
556
559
  }, `citation-${e.groupKey}`);
557
560
  }, r = (e) => {
558
561
  let r = t[e];
559
562
  return r ? n(r) : null;
560
- }, f = { cit: (t) => {
563
+ }, p = { cit: (t) => {
561
564
  let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
562
565
  return r ? n(r) : Fe(t["data-id"], t.children);
563
566
  } };
564
- return t.length === 0 && o.length === 0 ? p ? f : Me : {
565
- ...f,
566
- p: ({ children: e, ...t }) => /* @__PURE__ */ E("p", {
567
+ return t.length === 0 && o.length === 0 ? m ? p : Ne : {
568
+ ...p,
569
+ p: ({ children: e, ...t }) => /* @__PURE__ */ D("p", {
567
570
  ...t,
568
571
  className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
569
- children: $(e, r)
572
+ children: Q(e, r)
570
573
  }),
571
- li: ({ children: e, ...t }) => /* @__PURE__ */ E("li", {
574
+ li: ({ children: e, ...t }) => /* @__PURE__ */ D("li", {
572
575
  ...t,
573
576
  className: "mb-1.5 last:mb-0",
574
- children: $(e, r)
577
+ children: Q(e, r)
575
578
  })
576
579
  };
577
580
  }, [
@@ -582,8 +585,9 @@ var O = {
582
585
  l,
583
586
  u,
584
587
  d,
588
+ f,
585
589
  a,
586
- p
590
+ m
587
591
  ])
588
592
  };
589
593
  }, Le = (e) => e.url == null && e.reference_url != null, Re = /^(.*\.pdf)(?:#page=(\d+))?$/i, ze = (e) => {
@@ -607,4 +611,4 @@ var O = {
607
611
  } };
608
612
  }));
609
613
  //#endregion
610
- export { V as CitationCard, W as CitationCardProvider, q as CitationDropdown, H as CitationMarker, O as QUOTATIONS_CLASS, de as annotationHighlightId, be as annotationToOfficeHighlightLocations, ue as annotationsToPdfHighlights, z as gatherSameSourceAnnotations, fe as getAnnotationPdfPage, Be as getReferenceAttachmentGroups, R as groupAnnotations, L as groupAnnotationsByCitId, I as groupAnnotationsBySource, Te as injectCitationSentinels, Q as isDocxRangeSelector, ge as isExcelRcRangeSelector, me as isPptxRangeSelector, Le as isReferenceOnlyAttachment, ze as parsePdfPageReference, $ as replaceSentinelsInChildren, pe as resolveMessageAnnotations, je as stripCitTagsWhileStreaming, xe as useAnnotations, Ce as useCitationCard, G as useCitationCardContext, Ie as useCitationMarkdownComponents };
614
+ export { B as CitationCard, U as CitationCardProvider, K as CitationDropdown, V as CitationMarker, k as QUOTATIONS_CLASS, de as annotationHighlightId, xe as annotationToOfficeHighlightLocations, ue as annotationsToPdfHighlights, R as gatherSameSourceAnnotations, fe as getAnnotationPdfPage, Be as getReferenceAttachmentGroups, ie as groupAnnotations, L as groupAnnotationsByCitId, I as groupAnnotationsBySource, Ee as injectCitationSentinels, me as isDocxRangeSelector, _e as isExcelRcRangeSelector, he as isPptxRangeSelector, Le as isReferenceOnlyAttachment, ze as parsePdfPageReference, Q as replaceSentinelsInChildren, pe as resolveMessageAnnotations, Me as stripCitTagsWhileStreaming, Se as useAnnotations, we as useCitationCard, W as useCitationCardContext, Ie as useCitationMarkdownComponents };
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.270",
4
+ "version": "1.2.0-dev.271",
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.270",
26
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.271",
27
27
  "@epam/ai-dial-ui-kit": "^0.15.0-dev.36"
28
28
  },
29
29
  "repository": {