@epam/ai-dial-quotations 1.2.0-dev.1 → 1.2.0-dev.101
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/components/CitationMarker/CitationMarker.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +14 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/context/CitationCardContext.d.ts +3 -3
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts +2 -0
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +184 -132
- package/models/office-highlight.d.ts +21 -1
- package/models/office-highlight.d.ts.map +1 -1
- package/package.json +3 -3
- package/utils/annotation.d.ts +27 -4
- package/utils/annotation.d.ts.map +1 -1
- package/utils/office-table-anchor.d.ts +5 -0
- package/utils/office-table-anchor.d.ts.map +1 -0
- package/utils/useCitationCard.d.ts +14 -7
- package/utils/useCitationCard.d.ts.map +1 -1
|
@@ -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;
|
|
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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtC,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,CA6BlD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const QUOTATIONS_CLASS: {
|
|
2
|
+
/** The citation card's `role="dialog"` root, which carries the themed CSS variables. */
|
|
3
|
+
readonly citationCard: "dial-quotations-citation-card";
|
|
4
|
+
/** The floating panel a `CitationDropdown` reveals, which holds the card. */
|
|
5
|
+
readonly citationDropdown: "dial-quotations-citation-dropdown";
|
|
6
|
+
/**
|
|
7
|
+
* The marker pill that opens a citation, additive to the
|
|
8
|
+
* `dial-kit-base-button` that `@epam/ai-dial-ui-kit` draws. The pill caps its
|
|
9
|
+
* own width and ellipsises a long source name, so a host widening it should
|
|
10
|
+
* override `max-inline-size` here rather than unset the truncation.
|
|
11
|
+
*/
|
|
12
|
+
readonly citationMarker: "dial-quotations-citation-marker";
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=public-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;IAC3B,wFAAwF;;IAExF,6EAA6E;;IAE7E;;;;;OAKG;;CAEK,CAAC"}
|
|
@@ -3,10 +3,10 @@ import { useCitationCard } from '../utils/useCitationCard';
|
|
|
3
3
|
export type CitationCardHook = ReturnType<typeof useCitationCard>;
|
|
4
4
|
/** Provider that supplies `CitationCardHook` state to a citation subtree. */
|
|
5
5
|
export declare const CitationCardProvider: import('react').Provider<{
|
|
6
|
-
openPopup: (
|
|
7
|
-
closePopup: () => void;
|
|
6
|
+
openPopup: (ownerKey: string) => void;
|
|
7
|
+
closePopup: (ownerKey: string) => void;
|
|
8
8
|
setActiveIndex: (groupKey: string, index: number) => void;
|
|
9
|
-
isOpen: (
|
|
9
|
+
isOpen: (ownerKey: string) => boolean;
|
|
10
10
|
getActiveIndex: (groupKey: string) => number;
|
|
11
11
|
} | null>;
|
|
12
12
|
/** Returns the nearest `CitationCardHook` from context. Throws when used outside a `CitationCardProvider`. */
|
|
@@ -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.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))}._content_xzs0h_1>svg{fill:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc));stroke:#0000}
|
|
2
|
-
/*$vite$:1
|
|
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}.min-h-\[3lh\]{min-height:3lh}.w-\[400px\]{width:400px}.min-w-0{min-width:0}.\!max-w-none{max-width:none!important}.max-w-\[240px\]{max-width:240px}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.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}.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}.\!border-0{border-width:0!important}.\!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))}
|
package/index.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ export type { UseCitationMarkdownComponentsCallbacks } from './hooks/useCitation
|
|
|
13
13
|
export { gatherSameSourceAnnotations, groupAnnotations, groupAnnotationsByCitId, groupAnnotationsBySource, } from './utils/group-annotations-by-source';
|
|
14
14
|
export type { AnnotationGroup } from './utils/group-annotations-by-source';
|
|
15
15
|
export { annotationHighlightId, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
|
|
16
|
-
export type { DocxOfficeHighlightLocation, ExcelOfficeHighlightLocation, OfficeHighlightLocation, PptxOfficeHighlightLocation, } from './models/office-highlight';
|
|
16
|
+
export type { DocxOfficeHighlightLocation, DocxTableRowOfficeHighlightLocation, ExcelOfficeHighlightLocation, OfficeHighlightLocation, PptxOfficeHighlightLocation, PptxTableRowOfficeHighlightLocation, } from './models/office-highlight';
|
|
17
17
|
export { injectCitationSentinels, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
|
|
18
18
|
export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
|
|
19
19
|
export type { PdfPageReference } from './utils/reference-attachment';
|
|
20
|
+
export { QUOTATIONS_CLASS } from './constants/public-class-names';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;AAGlI,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACpC,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;AAGlI,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACpC,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/index.js
CHANGED
|
@@ -2,15 +2,20 @@ import { MIMEType as e, MarkdownRenderer as t, buildCssVars as n, isAnnotationSe
|
|
|
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
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,
|
|
6
|
-
|
|
5
|
+
import { createContext as y, useCallback as b, useContext as x, useId as S, useMemo as C, useState as w } from "react";
|
|
6
|
+
//#region src/constants/public-class-names.ts
|
|
7
|
+
var T = {
|
|
8
|
+
citationCard: "dial-quotations-citation-card",
|
|
9
|
+
citationDropdown: "dial-quotations-citation-dropdown",
|
|
10
|
+
citationMarker: "dial-quotations-citation-marker"
|
|
11
|
+
}, E = {
|
|
7
12
|
card: "_card_1kph1_1",
|
|
8
13
|
quote: "_quote_1kph1_5",
|
|
9
14
|
title: "_title_1kph1_9",
|
|
10
15
|
switcher: "_switcher_1kph1_13",
|
|
11
16
|
sourceName: "_sourceName_1kph1_17"
|
|
12
|
-
},
|
|
13
|
-
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation,
|
|
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 = 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({
|
|
14
19
|
"--cc-card-bg": x?.cardBackground,
|
|
15
20
|
"--cc-quote-text": x?.quoteText,
|
|
16
21
|
"--cc-title-text": x?.titleText,
|
|
@@ -21,8 +26,8 @@ var w = {
|
|
|
21
26
|
role: "dialog",
|
|
22
27
|
"aria-modal": "true",
|
|
23
28
|
"aria-label": y.ariaLabel,
|
|
24
|
-
style:
|
|
25
|
-
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
29
|
+
style: P,
|
|
30
|
+
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", E.card, T.citationCard),
|
|
26
31
|
children: [
|
|
27
32
|
/* @__PURE__ */ v("div", {
|
|
28
33
|
className: "flex items-center justify-between gap-2",
|
|
@@ -30,9 +35,9 @@ var w = {
|
|
|
30
35
|
className: "flex min-w-0 items-center gap-1",
|
|
31
36
|
children: [g, /* @__PURE__ */ _(l, {
|
|
32
37
|
text: r.sourceName,
|
|
33
|
-
className: i(
|
|
38
|
+
className: i(k, "min-w-0", E.sourceName)
|
|
34
39
|
})]
|
|
35
|
-
}),
|
|
40
|
+
}), w && /* @__PURE__ */ v("div", {
|
|
36
41
|
className: "flex shrink-0 items-center gap-1",
|
|
37
42
|
children: [
|
|
38
43
|
/* @__PURE__ */ _(u, {
|
|
@@ -46,7 +51,7 @@ var w = {
|
|
|
46
51
|
onClick: () => o((a - 1 + S) % S)
|
|
47
52
|
}),
|
|
48
53
|
/* @__PURE__ */ _("span", {
|
|
49
|
-
className: i(
|
|
54
|
+
className: i(N, E.switcher),
|
|
50
55
|
children: y.formatSwitcherText(a + 1, S)
|
|
51
56
|
}),
|
|
52
57
|
/* @__PURE__ */ _(u, {
|
|
@@ -62,20 +67,20 @@ var w = {
|
|
|
62
67
|
]
|
|
63
68
|
})]
|
|
64
69
|
}),
|
|
65
|
-
(C.body?.title || C.body?.quote ||
|
|
70
|
+
(C.body?.title || C.body?.quote || w) && /* @__PURE__ */ v("div", {
|
|
66
71
|
className: "flex flex-col gap-3",
|
|
67
72
|
children: [C.body?.title && /* @__PURE__ */ _("p", {
|
|
68
|
-
className: i(
|
|
73
|
+
className: i(A, E.title, "break-words"),
|
|
69
74
|
children: C.body.title
|
|
70
|
-
}), (C.body?.quote ||
|
|
71
|
-
className: i(
|
|
75
|
+
}), (C.body?.quote || w) && /* @__PURE__ */ _("div", {
|
|
76
|
+
className: i(j, E.quote, "line-clamp-6 break-words", w && "min-h-[3lh]"),
|
|
72
77
|
children: C.body?.quote && /* @__PURE__ */ _(t, {
|
|
73
78
|
content: C.body.quote,
|
|
74
79
|
classNames: {
|
|
75
|
-
p: i(
|
|
76
|
-
ul: i(
|
|
77
|
-
ol: i(
|
|
78
|
-
strong:
|
|
80
|
+
p: i(j, E.quote),
|
|
81
|
+
ul: i(j, "ps-3"),
|
|
82
|
+
ol: i(j, "ps-3"),
|
|
83
|
+
strong: M
|
|
79
84
|
}
|
|
80
85
|
})
|
|
81
86
|
})]
|
|
@@ -87,68 +92,97 @@ var w = {
|
|
|
87
92
|
size: c.Small,
|
|
88
93
|
onClick: () => d(C)
|
|
89
94
|
}), /* @__PURE__ */ _(f, {
|
|
90
|
-
label:
|
|
95
|
+
label: O ? y.openInBrowser : y.download,
|
|
91
96
|
size: c.Small,
|
|
92
97
|
onClick: () => p(C)
|
|
93
98
|
})]
|
|
94
99
|
})
|
|
95
100
|
]
|
|
96
101
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
}, D = y(null), O = D.Provider, k = () => {
|
|
112
|
-
let e = x(D);
|
|
102
|
+
}, O = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ _(d, {
|
|
103
|
+
size: c.Small,
|
|
104
|
+
className: i("max-w-[240px]", T.citationMarker),
|
|
105
|
+
textClassName: "min-w-0 truncate",
|
|
106
|
+
iconBefore: n,
|
|
107
|
+
label: /* @__PURE__ */ _("span", {
|
|
108
|
+
className: a,
|
|
109
|
+
children: e > 1 ? r.labelWithOverflow : r.label
|
|
110
|
+
}),
|
|
111
|
+
"aria-label": r.ariaLabel,
|
|
112
|
+
onClick: t
|
|
113
|
+
}), k = y(null), A = k.Provider, j = () => {
|
|
114
|
+
let e = x(k);
|
|
113
115
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
114
116
|
return e;
|
|
115
|
-
},
|
|
116
|
-
let
|
|
117
|
-
e ||
|
|
118
|
-
}, [
|
|
119
|
-
t(e),
|
|
120
|
-
} : void 0, [
|
|
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
|
+
} : void 0, [
|
|
123
|
+
t,
|
|
124
|
+
v,
|
|
125
|
+
d,
|
|
126
|
+
f
|
|
127
|
+
]);
|
|
121
128
|
return /* @__PURE__ */ _(p, {
|
|
122
|
-
open:
|
|
123
|
-
onOpenChange:
|
|
129
|
+
open: m,
|
|
130
|
+
onOpenChange: y,
|
|
124
131
|
triggerClassName: "ms-1 inline-flex align-middle",
|
|
125
|
-
contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none",
|
|
126
|
-
tooltip: /* @__PURE__ */ _(
|
|
132
|
+
contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none", M.content, T.citationDropdown),
|
|
133
|
+
tooltip: /* @__PURE__ */ _(D, {
|
|
127
134
|
group: e,
|
|
128
|
-
activeIndex:
|
|
129
|
-
onIndexChange: (t) =>
|
|
130
|
-
onPreview:
|
|
131
|
-
onOpenInBrowser:
|
|
132
|
-
headerIcon:
|
|
133
|
-
labels:
|
|
134
|
-
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
|
|
135
142
|
}),
|
|
136
|
-
children: /* @__PURE__ */ _(
|
|
143
|
+
children: /* @__PURE__ */ _(O, {
|
|
137
144
|
sourceName: e.sourceName,
|
|
138
145
|
annotationCount: e.annotations.length,
|
|
139
|
-
onOpen: () =>
|
|
140
|
-
icon:
|
|
141
|
-
labels:
|
|
142
|
-
labelClassName:
|
|
146
|
+
onOpen: () => d.openPopup(f),
|
|
147
|
+
icon: a,
|
|
148
|
+
labels: c,
|
|
149
|
+
labelClassName: u
|
|
143
150
|
})
|
|
144
151
|
});
|
|
145
|
-
},
|
|
152
|
+
}, P = (e) => {
|
|
153
|
+
let t = e.trim();
|
|
154
|
+
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
155
|
+
let n = [], r = "";
|
|
156
|
+
for (let e = 1; e < t.length; e += 1) {
|
|
157
|
+
let i = t[e], a = t[e + 1];
|
|
158
|
+
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
159
|
+
}
|
|
160
|
+
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
161
|
+
}, ee = (e) => {
|
|
162
|
+
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
163
|
+
let { text: t, occurrence: n, slide: r } = e;
|
|
164
|
+
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
165
|
+
let i = P(t);
|
|
166
|
+
if (i != null) {
|
|
167
|
+
if (e.type === "docx_text_anchor") return {
|
|
168
|
+
type: "docx_text_anchor",
|
|
169
|
+
cells: i,
|
|
170
|
+
occurrence: n
|
|
171
|
+
};
|
|
172
|
+
if (!(typeof r != "number" || !Number.isSafeInteger(r) || r < 1)) return {
|
|
173
|
+
type: "pptx_text_anchor",
|
|
174
|
+
cells: i,
|
|
175
|
+
occurrence: n,
|
|
176
|
+
slide: r
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}, te = {
|
|
146
180
|
backgroundColor: "transparent",
|
|
147
181
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
148
182
|
borderWidth: "2px",
|
|
149
183
|
opacity: .5,
|
|
150
184
|
hoverOpacity: .5
|
|
151
|
-
},
|
|
185
|
+
}, ne = (e) => {
|
|
152
186
|
if (typeof e != "object" || !e) return;
|
|
153
187
|
let t = e, { lt: n, wh: r } = t;
|
|
154
188
|
if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
|
|
@@ -167,7 +201,7 @@ var w = {
|
|
|
167
201
|
x2: i + o,
|
|
168
202
|
y2: a + s
|
|
169
203
|
};
|
|
170
|
-
},
|
|
204
|
+
}, F = (e) => {
|
|
171
205
|
if (!r(e)) return;
|
|
172
206
|
let t = e, n;
|
|
173
207
|
if (t.type === "pdf_bbox") {
|
|
@@ -178,7 +212,7 @@ var w = {
|
|
|
178
212
|
x2: i,
|
|
179
213
|
y2: a
|
|
180
214
|
});
|
|
181
|
-
} else t.type === "pdf_region" && (n =
|
|
215
|
+
} else t.type === "pdf_region" && (n = ne(t.bbox));
|
|
182
216
|
if (n == null) return;
|
|
183
217
|
let i = t.page;
|
|
184
218
|
if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
|
|
@@ -193,48 +227,63 @@ var w = {
|
|
|
193
227
|
x2: n.x2,
|
|
194
228
|
y2: n.y2
|
|
195
229
|
};
|
|
196
|
-
},
|
|
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) => {
|
|
231
|
+
let t = 5381;
|
|
232
|
+
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
233
|
+
return (t >>> 0).toString(36);
|
|
234
|
+
}, ie = (e) => {
|
|
235
|
+
let t = e.body?.selector;
|
|
236
|
+
if (t == null) return;
|
|
237
|
+
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
238
|
+
let t = F(e);
|
|
239
|
+
return t == null ? [] : [t];
|
|
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) => {
|
|
197
246
|
let n = e.body?.selector;
|
|
198
247
|
if (n == null) return [];
|
|
199
248
|
let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
|
|
200
249
|
if (!r(e)) return [];
|
|
201
|
-
let t =
|
|
250
|
+
let t = F(e);
|
|
202
251
|
return t == null ? [] : [t];
|
|
203
252
|
});
|
|
204
253
|
return i.length === 0 ? [] : [{
|
|
205
|
-
id:
|
|
254
|
+
id: L(e, t),
|
|
206
255
|
bboxes: i,
|
|
207
|
-
style:
|
|
256
|
+
style: te
|
|
208
257
|
}];
|
|
209
|
-
}),
|
|
258
|
+
}), L = (e, t) => e.index == null ? ae(e) ?? String(t) : String(e.index), se = (e) => {
|
|
210
259
|
let t = e.body?.selector;
|
|
211
260
|
if (t == null) return;
|
|
212
261
|
let n = Array.isArray(t) ? t : [t];
|
|
213
262
|
for (let e of n) {
|
|
214
263
|
if (!r(e)) continue;
|
|
215
|
-
let t =
|
|
264
|
+
let t = F(e);
|
|
216
265
|
if (t != null) return t.page;
|
|
217
266
|
}
|
|
218
|
-
},
|
|
267
|
+
}, R = (e) => {
|
|
219
268
|
let t = e.custom_content?.annotations;
|
|
220
269
|
if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
|
|
221
270
|
let n = e.custom_fields;
|
|
222
271
|
if (typeof n != "object" || !n) return [];
|
|
223
272
|
let r = n.annotations;
|
|
224
273
|
return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
|
|
225
|
-
},
|
|
274
|
+
}, z = (e) => {
|
|
226
275
|
if (e.type !== "docx_text_range") return !1;
|
|
227
276
|
let t = e;
|
|
228
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";
|
|
229
|
-
},
|
|
278
|
+
}, B = (e) => {
|
|
230
279
|
if (e.type !== "pptx_text_range") return !1;
|
|
231
280
|
let t = e;
|
|
232
281
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
233
|
-
},
|
|
282
|
+
}, V = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", H = (e) => {
|
|
234
283
|
if (e.type !== "excel_rc_range") return !1;
|
|
235
284
|
let t = e;
|
|
236
|
-
return typeof t.sheet == "string" &&
|
|
237
|
-
},
|
|
285
|
+
return typeof t.sheet == "string" && V(t.start) && (t.end === void 0 || t.end === null || V(t.end));
|
|
286
|
+
}, ce = (e) => {
|
|
238
287
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
239
288
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
240
289
|
type: "docx_text_range",
|
|
@@ -244,7 +293,7 @@ var w = {
|
|
|
244
293
|
endExclusive: i,
|
|
245
294
|
text: a
|
|
246
295
|
};
|
|
247
|
-
},
|
|
296
|
+
}, le = (e) => {
|
|
248
297
|
let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
|
|
249
298
|
if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
250
299
|
type: "pptx_text_range",
|
|
@@ -254,7 +303,7 @@ var w = {
|
|
|
254
303
|
endExclusive: i,
|
|
255
304
|
text: a
|
|
256
305
|
};
|
|
257
|
-
},
|
|
306
|
+
}, ue = (e) => {
|
|
258
307
|
let { sheet: t, start: n, end: r } = e;
|
|
259
308
|
if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
|
|
260
309
|
if (r == null) return {
|
|
@@ -269,38 +318,39 @@ var w = {
|
|
|
269
318
|
end: r
|
|
270
319
|
};
|
|
271
320
|
}
|
|
272
|
-
},
|
|
321
|
+
}, U = (e) => {
|
|
273
322
|
let t = e.body?.selector;
|
|
274
323
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
275
324
|
if (!r(e)) return [];
|
|
276
|
-
if (
|
|
277
|
-
let t =
|
|
325
|
+
if (z(e)) {
|
|
326
|
+
let t = ce(e);
|
|
278
327
|
return t ? [t] : [];
|
|
279
328
|
}
|
|
280
|
-
if (
|
|
281
|
-
let t =
|
|
329
|
+
if (B(e)) {
|
|
330
|
+
let t = le(e);
|
|
282
331
|
return t ? [t] : [];
|
|
283
332
|
}
|
|
284
|
-
if (
|
|
285
|
-
let t =
|
|
333
|
+
if (H(e)) {
|
|
334
|
+
let t = ue(e);
|
|
286
335
|
return t ? [t] : [];
|
|
287
336
|
}
|
|
288
|
-
|
|
337
|
+
let t = ee(e);
|
|
338
|
+
return t ? [t] : [];
|
|
289
339
|
});
|
|
290
|
-
},
|
|
291
|
-
|
|
340
|
+
}, de = (e, t) => C(() => t ? [] : R(e), [t, e]), fe = {
|
|
341
|
+
openOwnerKey: null,
|
|
292
342
|
activeIndexByGroup: {}
|
|
293
|
-
},
|
|
294
|
-
let [e, t] =
|
|
343
|
+
}, pe = () => {
|
|
344
|
+
let [e, t] = w(fe), n = b((e) => {
|
|
295
345
|
t((t) => ({
|
|
296
346
|
...t,
|
|
297
|
-
|
|
298
|
-
}));
|
|
299
|
-
}, []), r = b(() => {
|
|
300
|
-
t((e) => ({
|
|
301
|
-
...e,
|
|
302
|
-
openGroupKey: null
|
|
347
|
+
openOwnerKey: e
|
|
303
348
|
}));
|
|
349
|
+
}, []), r = b((e) => {
|
|
350
|
+
t((t) => t.openOwnerKey === e ? {
|
|
351
|
+
...t,
|
|
352
|
+
openOwnerKey: null
|
|
353
|
+
} : t);
|
|
304
354
|
}, []), i = b((e, n) => {
|
|
305
355
|
t((t) => ({
|
|
306
356
|
...t,
|
|
@@ -310,11 +360,11 @@ var w = {
|
|
|
310
360
|
}
|
|
311
361
|
}));
|
|
312
362
|
}, []);
|
|
313
|
-
return
|
|
363
|
+
return C(() => ({
|
|
314
364
|
openPopup: n,
|
|
315
365
|
closePopup: r,
|
|
316
366
|
setActiveIndex: i,
|
|
317
|
-
isOpen: (t) => e.
|
|
367
|
+
isOpen: (t) => e.openOwnerKey === t,
|
|
318
368
|
getActiveIndex: (t) => e.activeIndexByGroup[t] ?? 0
|
|
319
369
|
}), [
|
|
320
370
|
n,
|
|
@@ -322,7 +372,7 @@ var w = {
|
|
|
322
372
|
i,
|
|
323
373
|
e
|
|
324
374
|
]);
|
|
325
|
-
},
|
|
375
|
+
}, me = /⟦C(\d+)⟧/g, W = (e, t) => {
|
|
326
376
|
let n = t.map((e, t) => ({
|
|
327
377
|
g: e,
|
|
328
378
|
idx: t
|
|
@@ -335,9 +385,9 @@ var w = {
|
|
|
335
385
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
336
386
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
337
387
|
return r;
|
|
338
|
-
},
|
|
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) => {
|
|
339
389
|
if (typeof e == "string") {
|
|
340
|
-
let n = e.split(
|
|
390
|
+
let n = e.split(me);
|
|
341
391
|
if (n.length === 1) return e;
|
|
342
392
|
let r = [];
|
|
343
393
|
return n.forEach((e, n) => {
|
|
@@ -345,57 +395,58 @@ var w = {
|
|
|
345
395
|
}), r;
|
|
346
396
|
}
|
|
347
397
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
348
|
-
let n =
|
|
398
|
+
let n = q(e, t);
|
|
349
399
|
return Array.isArray(n) ? n : [n];
|
|
350
400
|
}) : e;
|
|
351
|
-
},
|
|
401
|
+
}, ye = (e) => {
|
|
352
402
|
let t = e.primaryAnnotation.target?.selector;
|
|
353
403
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
354
|
-
},
|
|
404
|
+
}, be = (e, t) => /* @__PURE__ */ v(g, { children: [
|
|
355
405
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
356
406
|
t,
|
|
357
407
|
"</cit>"
|
|
358
|
-
] }),
|
|
359
|
-
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), [
|
|
360
410
|
e,
|
|
361
411
|
t,
|
|
362
412
|
r
|
|
363
|
-
]),
|
|
413
|
+
]), d = u.includes("<cit");
|
|
364
414
|
return {
|
|
365
|
-
processedContent:
|
|
366
|
-
markdownComponents:
|
|
415
|
+
processedContent: u,
|
|
416
|
+
markdownComponents: C(() => {
|
|
367
417
|
let e = /* @__PURE__ */ new Map();
|
|
368
418
|
for (let n of t) {
|
|
369
|
-
let t =
|
|
419
|
+
let t = ye(n);
|
|
370
420
|
t != null && e.set(t, n);
|
|
371
421
|
}
|
|
372
422
|
let n = (e) => {
|
|
373
|
-
let { cardLabels: t, markerLabels: n } =
|
|
374
|
-
return /* @__PURE__ */ _(
|
|
423
|
+
let { cardLabels: t, markerLabels: n } = l(e);
|
|
424
|
+
return /* @__PURE__ */ _(N, {
|
|
375
425
|
group: e,
|
|
376
426
|
onPreview: (t) => o(t, e),
|
|
377
|
-
|
|
427
|
+
isPreviewable: s,
|
|
428
|
+
onOpenInBrowser: c,
|
|
378
429
|
cardLabels: t,
|
|
379
430
|
markerLabels: n
|
|
380
431
|
}, `citation-${e.groupKey}`);
|
|
381
432
|
}, r = (e) => {
|
|
382
433
|
let r = t[e];
|
|
383
434
|
return r ? n(r) : null;
|
|
384
|
-
},
|
|
435
|
+
}, u = { cit: (t) => {
|
|
385
436
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
386
|
-
return r ? n(r) :
|
|
437
|
+
return r ? n(r) : be(t["data-id"], t.children);
|
|
387
438
|
} };
|
|
388
|
-
return t.length === 0 ?
|
|
389
|
-
...
|
|
439
|
+
return t.length === 0 ? d ? u : {} : {
|
|
440
|
+
...u,
|
|
390
441
|
p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
|
|
391
442
|
...t,
|
|
392
443
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
393
|
-
children:
|
|
444
|
+
children: q(e, r)
|
|
394
445
|
}),
|
|
395
446
|
li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
|
|
396
447
|
...t,
|
|
397
448
|
className: "mb-1.5 last:mb-0",
|
|
398
|
-
children:
|
|
449
|
+
children: q(e, r)
|
|
399
450
|
})
|
|
400
451
|
};
|
|
401
452
|
}, [
|
|
@@ -403,46 +454,47 @@ var w = {
|
|
|
403
454
|
o,
|
|
404
455
|
s,
|
|
405
456
|
c,
|
|
457
|
+
l,
|
|
406
458
|
a,
|
|
407
|
-
|
|
459
|
+
d
|
|
408
460
|
])
|
|
409
461
|
};
|
|
410
|
-
},
|
|
462
|
+
}, J = (e) => {
|
|
411
463
|
try {
|
|
412
464
|
return decodeURIComponent(e);
|
|
413
465
|
} catch {
|
|
414
466
|
return e;
|
|
415
467
|
}
|
|
416
|
-
},
|
|
468
|
+
}, Se = (e) => {
|
|
417
469
|
try {
|
|
418
470
|
let t = new URL(e);
|
|
419
|
-
return t.pathname.split("/").map((e) =>
|
|
471
|
+
return t.pathname.split("/").map((e) => J(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
420
472
|
} catch {
|
|
421
|
-
return e.split("/").map((e) =>
|
|
473
|
+
return e.split("/").map((e) => J(e)).filter(Boolean).at(-1) ?? e;
|
|
422
474
|
}
|
|
423
|
-
},
|
|
475
|
+
}, Y = (e, t) => e.body?.source?.attachment?.title ?? Se(t), X = (e) => {
|
|
424
476
|
let t = e.target?.selector;
|
|
425
477
|
return t?.type === "html_tag" ? t : void 0;
|
|
426
|
-
},
|
|
478
|
+
}, Ce = (e) => X(e) != null, Z = (e) => {
|
|
427
479
|
let t = /* @__PURE__ */ new Map();
|
|
428
480
|
for (let n of e) {
|
|
429
|
-
if (
|
|
481
|
+
if (Ce(n)) continue;
|
|
430
482
|
let e = n.body?.source?.attachment?.url;
|
|
431
483
|
if (e == null) continue;
|
|
432
484
|
let r = t.get(e);
|
|
433
485
|
r ? r.annotations.push(n) : t.set(e, {
|
|
434
486
|
groupKey: e,
|
|
435
487
|
sourceUrl: e,
|
|
436
|
-
sourceName:
|
|
488
|
+
sourceName: Y(n, e),
|
|
437
489
|
annotations: [n],
|
|
438
490
|
primaryAnnotation: n
|
|
439
491
|
});
|
|
440
492
|
}
|
|
441
493
|
return Array.from(t.values());
|
|
442
|
-
},
|
|
494
|
+
}, Q = (e) => {
|
|
443
495
|
let t = /* @__PURE__ */ new Map();
|
|
444
496
|
for (let n of e) {
|
|
445
|
-
let e =
|
|
497
|
+
let e = X(n)?.id;
|
|
446
498
|
if (e == null) continue;
|
|
447
499
|
let r = n.body?.source?.attachment?.url;
|
|
448
500
|
if (r == null) continue;
|
|
@@ -450,22 +502,22 @@ var w = {
|
|
|
450
502
|
i ? i.annotations.push(n) : t.set(e, {
|
|
451
503
|
groupKey: `cit:${e}`,
|
|
452
504
|
sourceUrl: r,
|
|
453
|
-
sourceName:
|
|
505
|
+
sourceName: Y(n, r),
|
|
454
506
|
annotations: [n],
|
|
455
507
|
primaryAnnotation: n
|
|
456
508
|
});
|
|
457
509
|
}
|
|
458
510
|
return Array.from(t.values());
|
|
459
|
-
},
|
|
511
|
+
}, we = (e) => [...Q(e), ...Z(e)], Te = (e, t) => {
|
|
460
512
|
let n = e.body?.source?.attachment?.url;
|
|
461
513
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
462
|
-
},
|
|
463
|
-
let t =
|
|
514
|
+
}, Ee = (e) => e.url == null && e.reference_url != null, De = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
|
|
515
|
+
let t = De.exec(e);
|
|
464
516
|
return t ? {
|
|
465
517
|
baseUrl: t[1],
|
|
466
518
|
page: t[2] == null ? null : Number(t[2])
|
|
467
519
|
} : null;
|
|
468
|
-
},
|
|
520
|
+
}, Oe = (t) => Z((t ?? []).filter(Ee).map((t) => {
|
|
469
521
|
let n = t.reference_url, r = $(n) != null;
|
|
470
522
|
return { body: {
|
|
471
523
|
quote: t.data,
|
|
@@ -480,4 +532,4 @@ var w = {
|
|
|
480
532
|
} };
|
|
481
533
|
}));
|
|
482
534
|
//#endregion
|
|
483
|
-
export {
|
|
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 };
|
|
@@ -38,6 +38,26 @@ export interface PptxOfficeHighlightLocation {
|
|
|
38
38
|
/** The cited text, expected to equal the text resolved over `[start, endExclusive)`. */
|
|
39
39
|
text: string;
|
|
40
40
|
}
|
|
41
|
+
/** Temporary table-row location decoded from a DOCX text anchor. */
|
|
42
|
+
export interface DocxTableRowOfficeHighlightLocation {
|
|
43
|
+
/** Wire selector type. */
|
|
44
|
+
type: 'docx_text_anchor';
|
|
45
|
+
/** Plain text of each cell, in column order. */
|
|
46
|
+
cells: string[];
|
|
47
|
+
/** 1-based matching row in the document body. */
|
|
48
|
+
occurrence: number;
|
|
49
|
+
}
|
|
50
|
+
/** Temporary table-row location decoded from a PPTX text anchor. */
|
|
51
|
+
export interface PptxTableRowOfficeHighlightLocation {
|
|
52
|
+
/** Wire selector type. */
|
|
53
|
+
type: 'pptx_text_anchor';
|
|
54
|
+
/** Plain text of each cell, in column order. */
|
|
55
|
+
cells: string[];
|
|
56
|
+
/** 1-based matching row on the specified slide. */
|
|
57
|
+
occurrence: number;
|
|
58
|
+
/** 1-based slide number. */
|
|
59
|
+
slide: number;
|
|
60
|
+
}
|
|
41
61
|
/** A validated, normalised XLSX cell or same-row cell-range location. */
|
|
42
62
|
export interface ExcelOfficeHighlightLocation {
|
|
43
63
|
/** Discriminates this location within `OfficeHighlightLocation`. Mirrors the wire selector's `type`. */
|
|
@@ -58,5 +78,5 @@ export interface ExcelOfficeHighlightLocation {
|
|
|
58
78
|
* cycle is not permitted). `libs/chat-hooks`, which already depends on both,
|
|
59
79
|
* maps this into `OoxmlHighlight`/`OoxmlHighlightLocation`.
|
|
60
80
|
*/
|
|
61
|
-
export type OfficeHighlightLocation = DocxOfficeHighlightLocation | PptxOfficeHighlightLocation | ExcelOfficeHighlightLocation;
|
|
81
|
+
export type OfficeHighlightLocation = DocxOfficeHighlightLocation | PptxOfficeHighlightLocation | DocxTableRowOfficeHighlightLocation | PptxTableRowOfficeHighlightLocation | ExcelOfficeHighlightLocation;
|
|
62
82
|
//# sourceMappingURL=office-highlight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"office-highlight.d.ts","sourceRoot":"","sources":["../../src/models/office-highlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wGAAwG;IACxG,IAAI,EAAE,iBAAiB,CAAC;IACxB,4GAA4G;IAC5G,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wGAAwG;IACxG,IAAI,EAAE,iBAAiB,CAAC;IACxB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yEAAyE;AACzE,MAAM,WAAW,4BAA4B;IAC3C,wGAAwG;IACxG,IAAI,EAAE,gBAAgB,CAAC;IACvB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,iGAAiG;IACjG,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAC/B,2BAA2B,GAC3B,2BAA2B,GAC3B,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"office-highlight.d.ts","sourceRoot":"","sources":["../../src/models/office-highlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wGAAwG;IACxG,IAAI,EAAE,iBAAiB,CAAC;IACxB,4GAA4G;IAC5G,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wGAAwG;IACxG,IAAI,EAAE,iBAAiB,CAAC;IACxB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oEAAoE;AACpE,MAAM,WAAW,mCAAmC;IAClD,0BAA0B;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,gDAAgD;IAChD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oEAAoE;AACpE,MAAM,WAAW,mCAAmC;IAClD,0BAA0B;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,gDAAgD;IAChD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,4BAA4B;IAC3C,wGAAwG;IACxG,IAAI,EAAE,gBAAgB,CAAC;IACvB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,iGAAiG;IACjG,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAC/B,2BAA2B,GAC3B,2BAA2B,GAC3B,mCAAmC,GACnC,mCAAmC,GACnC,4BAA4B,CAAC"}
|
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.101",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
27
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.101",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.12"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
package/utils/annotation.d.ts
CHANGED
|
@@ -5,11 +5,34 @@ import { OfficeHighlightLocation } from '../models/office-highlight';
|
|
|
5
5
|
* Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
|
|
6
6
|
* Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
|
|
7
7
|
* (`lt`/`wh` and legacy `left`/`top`/`width`/`height`); annotations whose
|
|
8
|
-
* `body.selector` contains none of these are skipped. The highlight `id`
|
|
9
|
-
* `
|
|
8
|
+
* `body.selector` contains none of these are skipped. The highlight `id` comes
|
|
9
|
+
* from `annotationHighlightId`, so it identifies the annotation itself rather
|
|
10
|
+
* than its position in this particular input list.
|
|
10
11
|
*/
|
|
11
12
|
export declare const annotationsToPdfHighlights: (annotations: Annotation[]) => InputHighlightData[];
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Returns a stable string ID for a given annotation, matching the IDs
|
|
15
|
+
* `annotationsToPdfHighlights` produces (it calls this function) and the ones
|
|
16
|
+
* the Office highlight path assigns.
|
|
17
|
+
*
|
|
18
|
+
* Resolved in order:
|
|
19
|
+
* 1. `annotation.index` when the wire supplied one — already unique within the
|
|
20
|
+
* message, and short.
|
|
21
|
+
* 2. Otherwise an id derived from the annotation's own identity: its `cit` tag
|
|
22
|
+
* id plus a digest of its selectors. Two annotations differing in either
|
|
23
|
+
* part get different ids; two agreeing in both describe the same cited
|
|
24
|
+
* region and may share one.
|
|
25
|
+
* 3. Otherwise `fallbackIndex` — the annotation's position in the caller's
|
|
26
|
+
* list, for an annotation carrying neither an index, a `cit` id, nor a
|
|
27
|
+
* recognised selector.
|
|
28
|
+
*
|
|
29
|
+
* The id is opaque: compare it, never parse it. A position-derived id is not
|
|
30
|
+
* unique beyond the list it came from, which is why it is the last resort — a
|
|
31
|
+
* caller gathering one citation group at a time would otherwise give every
|
|
32
|
+
* single-annotation group the same id, and the canvas could not tell two
|
|
33
|
+
* citations of one document apart (issue #8907). Ids are never persisted and
|
|
34
|
+
* never sent over the wire.
|
|
35
|
+
*/
|
|
13
36
|
export declare const annotationHighlightId: (annotation: Annotation, fallbackIndex: number) => string;
|
|
14
37
|
/**
|
|
15
38
|
* Returns the first positive integer PDF page in the annotation's body selectors,
|
|
@@ -45,7 +68,7 @@ export declare const isExcelRcRangeSelector: (selector: AnnotationSelector) => s
|
|
|
45
68
|
/**
|
|
46
69
|
* Converts an annotation's `body.selector` (scalar or array) to validated
|
|
47
70
|
* `OfficeHighlightLocation` entries, skipping any selector that is not a
|
|
48
|
-
* recognised Office range or that fails validation
|
|
71
|
+
* recognised Office range or temporary table-row anchor, or that fails validation.
|
|
49
72
|
*/
|
|
50
73
|
export declare const annotationToOfficeHighlightLocations: (annotation: Annotation) => OfficeHighlightLocation[];
|
|
51
74
|
//# sourceMappingURL=annotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAgL1E;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,EAoBjB,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,YAAY,UAAU,EACtB,eAAe,MAAM,KACpB,MAG+D,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MAAM,GAAG,SAWX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,UAAU,EAoBtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAUd,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,oBAQd,CAAC;AA8FF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,GAC/C,YAAY,UAAU,KACrB,uBAAuB,EAuBzB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AnnotationSelector } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { DocxTableRowOfficeHighlightLocation, PptxTableRowOfficeHighlightLocation } from '../models/office-highlight';
|
|
3
|
+
/** Returns a validated table-row location for the temporary Office anchor format. */
|
|
4
|
+
export declare const normalizeOfficeTableAnchor: (selector: AnnotationSelector) => DocxTableRowOfficeHighlightLocation | PptxTableRowOfficeHighlightLocation | undefined;
|
|
5
|
+
//# sourceMappingURL=office-table-anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"office-table-anchor.d.ts","sourceRoot":"","sources":["../../src/utils/office-table-anchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EACV,mCAAmC,EACnC,mCAAmC,EACpC,MAAM,4BAA4B,CAAC;AAwCpC,qFAAqF;AACrF,eAAO,MAAM,0BAA0B,GACrC,UAAU,kBAAkB,KAE1B,mCAAmC,GACnC,mCAAmC,GACnC,SA2BH,CAAC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Manages open/close state and per-group active annotation index for citation
|
|
3
|
-
* cards within a single assistant message.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* cards within a single assistant message. The hook carries two distinct key
|
|
4
|
+
* spaces:
|
|
5
|
+
*
|
|
6
|
+
* - Openness (`openPopup`/`closePopup`/`isOpen`) is keyed by **occurrence
|
|
7
|
+
* owner key** — a stable per-instance id derived by the rendered
|
|
8
|
+
* `CitationDropdown` (see its `ownerKey`), not by `AnnotationGroup.groupKey`
|
|
9
|
+
* or `sourceUrl`. Two rendered occurrences resolving to the same group are
|
|
10
|
+
* therefore always independent popup owners.
|
|
11
|
+
* - The switcher index (`setActiveIndex`/`getActiveIndex`) is keyed by
|
|
12
|
+
* `groupKey`, because the index indexes into `group.annotations`, which is
|
|
13
|
+
* group data, not occurrence data.
|
|
7
14
|
*/
|
|
8
15
|
export declare const useCitationCard: () => {
|
|
9
|
-
openPopup: (
|
|
10
|
-
closePopup: () => void;
|
|
16
|
+
openPopup: (ownerKey: string) => void;
|
|
17
|
+
closePopup: (ownerKey: string) => void;
|
|
11
18
|
setActiveIndex: (groupKey: string, index: number) => void;
|
|
12
|
-
isOpen: (
|
|
19
|
+
isOpen: (ownerKey: string) => boolean;
|
|
13
20
|
getActiveIndex: (groupKey: string) => number;
|
|
14
21
|
};
|
|
15
22
|
//# sourceMappingURL=useCitationCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCitationCard.d.ts","sourceRoot":"","sources":["../../src/utils/useCitationCard.ts"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"useCitationCard.d.ts","sourceRoot":"","sources":["../../src/utils/useCitationCard.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe;0BAGe,MAAM;2BAIL,MAAM;+BAMF,MAAM,SAAS,MAAM;uBAY5C,MAAM;+BACE,MAAM;CAKtC,CAAC"}
|