@epam/ai-dial-quotations 1.2.0-dev.101 → 1.2.0-dev.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,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;
|
|
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;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,KAC1B;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAgG5D,CAAC"}
|
package/index.js
CHANGED
|
@@ -372,7 +372,7 @@ var T = {
|
|
|
372
372
|
i,
|
|
373
373
|
e
|
|
374
374
|
]);
|
|
375
|
-
}, me = /⟦C(\d+)⟧/g,
|
|
375
|
+
}, me = /⟦C(\d+)⟧/g, he = (e, t) => {
|
|
376
376
|
let n = t.map((e, t) => ({
|
|
377
377
|
g: e,
|
|
378
378
|
idx: t
|
|
@@ -385,7 +385,7 @@ var T = {
|
|
|
385
385
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
386
386
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
387
387
|
return r;
|
|
388
|
-
},
|
|
388
|
+
}, ge = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, _e = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ve = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, ye = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), W = (e) => e.replace(ve, (e) => _e.test(e) ? e : ye(e)), G = (e) => W(e).replace(ge, ""), K = (e, t) => {
|
|
389
389
|
if (typeof e == "string") {
|
|
390
390
|
let n = e.split(me);
|
|
391
391
|
if (n.length === 1) return e;
|
|
@@ -395,18 +395,18 @@ var T = {
|
|
|
395
395
|
}), r;
|
|
396
396
|
}
|
|
397
397
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
398
|
-
let n =
|
|
398
|
+
let n = K(e, t);
|
|
399
399
|
return Array.isArray(n) ? n : [n];
|
|
400
400
|
}) : e;
|
|
401
|
-
},
|
|
401
|
+
}, be = {}, xe = (e) => {
|
|
402
402
|
let t = e.primaryAnnotation.target?.selector;
|
|
403
403
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
404
|
-
},
|
|
404
|
+
}, Se = (e, t) => /* @__PURE__ */ v(g, { children: [
|
|
405
405
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
406
406
|
t,
|
|
407
407
|
"</cit>"
|
|
408
|
-
] }),
|
|
409
|
-
let { onPreview: o, isPreviewable: s, onOpenInBrowser: c, buildLabels: l } = n, u = C(() => r ?
|
|
408
|
+
] }), Ce = (e, t, n, r = !1, a = !1) => {
|
|
409
|
+
let { onPreview: o, isPreviewable: s, onOpenInBrowser: c, buildLabels: l } = n, u = C(() => r ? G(e) : W(t.length > 0 ? he(e, t) : e), [
|
|
410
410
|
e,
|
|
411
411
|
t,
|
|
412
412
|
r
|
|
@@ -416,7 +416,7 @@ var T = {
|
|
|
416
416
|
markdownComponents: C(() => {
|
|
417
417
|
let e = /* @__PURE__ */ new Map();
|
|
418
418
|
for (let n of t) {
|
|
419
|
-
let t =
|
|
419
|
+
let t = xe(n);
|
|
420
420
|
t != null && e.set(t, n);
|
|
421
421
|
}
|
|
422
422
|
let n = (e) => {
|
|
@@ -434,19 +434,19 @@ var T = {
|
|
|
434
434
|
return r ? n(r) : null;
|
|
435
435
|
}, u = { cit: (t) => {
|
|
436
436
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
437
|
-
return r ? n(r) :
|
|
437
|
+
return r ? n(r) : Se(t["data-id"], t.children);
|
|
438
438
|
} };
|
|
439
|
-
return t.length === 0 ? d ? u :
|
|
439
|
+
return t.length === 0 ? d ? u : be : {
|
|
440
440
|
...u,
|
|
441
441
|
p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
|
|
442
442
|
...t,
|
|
443
443
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
444
|
-
children:
|
|
444
|
+
children: K(e, r)
|
|
445
445
|
}),
|
|
446
446
|
li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
|
|
447
447
|
...t,
|
|
448
448
|
className: "mb-1.5 last:mb-0",
|
|
449
|
-
children:
|
|
449
|
+
children: K(e, r)
|
|
450
450
|
})
|
|
451
451
|
};
|
|
452
452
|
}, [
|
|
@@ -459,42 +459,42 @@ var T = {
|
|
|
459
459
|
d
|
|
460
460
|
])
|
|
461
461
|
};
|
|
462
|
-
},
|
|
462
|
+
}, q = (e) => {
|
|
463
463
|
try {
|
|
464
464
|
return decodeURIComponent(e);
|
|
465
465
|
} catch {
|
|
466
466
|
return e;
|
|
467
467
|
}
|
|
468
|
-
},
|
|
468
|
+
}, we = (e) => {
|
|
469
469
|
try {
|
|
470
470
|
let t = new URL(e);
|
|
471
|
-
return t.pathname.split("/").map((e) =>
|
|
471
|
+
return t.pathname.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
472
472
|
} catch {
|
|
473
|
-
return e.split("/").map((e) =>
|
|
473
|
+
return e.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? e;
|
|
474
474
|
}
|
|
475
|
-
},
|
|
475
|
+
}, J = (e, t) => e.body?.source?.attachment?.title ?? we(t), Y = (e) => {
|
|
476
476
|
let t = e.target?.selector;
|
|
477
477
|
return t?.type === "html_tag" ? t : void 0;
|
|
478
|
-
},
|
|
478
|
+
}, Te = (e) => Y(e) != null, X = (e) => {
|
|
479
479
|
let t = /* @__PURE__ */ new Map();
|
|
480
480
|
for (let n of e) {
|
|
481
|
-
if (
|
|
481
|
+
if (Te(n)) continue;
|
|
482
482
|
let e = n.body?.source?.attachment?.url;
|
|
483
483
|
if (e == null) continue;
|
|
484
484
|
let r = t.get(e);
|
|
485
485
|
r ? r.annotations.push(n) : t.set(e, {
|
|
486
486
|
groupKey: e,
|
|
487
487
|
sourceUrl: e,
|
|
488
|
-
sourceName:
|
|
488
|
+
sourceName: J(n, e),
|
|
489
489
|
annotations: [n],
|
|
490
490
|
primaryAnnotation: n
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
return Array.from(t.values());
|
|
494
|
-
},
|
|
494
|
+
}, Z = (e) => {
|
|
495
495
|
let t = /* @__PURE__ */ new Map();
|
|
496
496
|
for (let n of e) {
|
|
497
|
-
let e =
|
|
497
|
+
let e = Y(n)?.id;
|
|
498
498
|
if (e == null) continue;
|
|
499
499
|
let r = n.body?.source?.attachment?.url;
|
|
500
500
|
if (r == null) continue;
|
|
@@ -502,22 +502,22 @@ var T = {
|
|
|
502
502
|
i ? i.annotations.push(n) : t.set(e, {
|
|
503
503
|
groupKey: `cit:${e}`,
|
|
504
504
|
sourceUrl: r,
|
|
505
|
-
sourceName:
|
|
505
|
+
sourceName: J(n, r),
|
|
506
506
|
annotations: [n],
|
|
507
507
|
primaryAnnotation: n
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
return Array.from(t.values());
|
|
511
|
-
},
|
|
511
|
+
}, Ee = (e) => [...Z(e), ...X(e)], De = (e, t) => {
|
|
512
512
|
let n = e.body?.source?.attachment?.url;
|
|
513
513
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
514
|
-
},
|
|
515
|
-
let t =
|
|
514
|
+
}, Q = (e) => e.url == null && e.reference_url != null, Oe = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
|
|
515
|
+
let t = Oe.exec(e);
|
|
516
516
|
return t ? {
|
|
517
517
|
baseUrl: t[1],
|
|
518
518
|
page: t[2] == null ? null : Number(t[2])
|
|
519
519
|
} : null;
|
|
520
|
-
},
|
|
520
|
+
}, ke = (t) => X((t ?? []).filter(Q).map((t) => {
|
|
521
521
|
let n = t.reference_url, r = $(n) != null;
|
|
522
522
|
return { body: {
|
|
523
523
|
quote: t.data,
|
|
@@ -532,4 +532,4 @@ var T = {
|
|
|
532
532
|
} };
|
|
533
533
|
}));
|
|
534
534
|
//#endregion
|
|
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,
|
|
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, De as gatherSameSourceAnnotations, se as getAnnotationPdfPage, ke as getReferenceAttachmentGroups, Ee as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, he as injectCitationSentinels, z as isDocxRangeSelector, H as isExcelRcRangeSelector, B as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, K as replaceSentinelsInChildren, R as resolveMessageAnnotations, G as stripCitTagsWhileStreaming, de as useAnnotations, pe as useCitationCard, j as useCitationCardContext, Ce as useCitationMarkdownComponents };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-quotations",
|
|
3
3
|
"description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.106",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.106",
|
|
27
27
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.12"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|