@epam/ai-dial-quotations 1.1.0-rc.4 → 1.1.0

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/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*/.visible{visibility:visible}.collapse{visibility:collapse}.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}.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}.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))}
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}.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}.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.js CHANGED
@@ -224,7 +224,22 @@ var T = {
224
224
  x2: n.x2,
225
225
  y2: n.y2
226
226
  };
227
- }, re = (e) => e.flatMap((e, t) => {
227
+ }, F = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(F).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${F(t)}`).join(",")}}`, re = (e) => {
228
+ let t = 5381;
229
+ for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
230
+ return (t >>> 0).toString(36);
231
+ }, ie = (e) => {
232
+ let t = e.body?.selector;
233
+ if (t == null) return;
234
+ let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
235
+ let t = P(e);
236
+ return t == null ? [] : [t];
237
+ }), r = H(e);
238
+ if (!(n.length === 0 && r.length === 0)) return F([n, r]);
239
+ }, ae = (e) => {
240
+ let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ie(e);
241
+ if (!(r == null && i == null)) return re(`${r ?? ""}|${i ?? ""}`);
242
+ }, oe = (e) => e.flatMap((e, t) => {
228
243
  let n = e.body?.selector;
229
244
  if (n == null) return [];
230
245
  let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
@@ -233,11 +248,11 @@ var T = {
233
248
  return t == null ? [] : [t];
234
249
  });
235
250
  return i.length === 0 ? [] : [{
236
- id: String(e.index ?? t),
251
+ id: I(e, t),
237
252
  bboxes: i,
238
253
  style: te
239
254
  }];
240
- }), ie = (e, t) => String(e.index ?? t), ae = (e) => {
255
+ }), I = (e, t) => e.index == null ? ae(e) ?? String(t) : String(e.index), se = (e) => {
241
256
  let t = e.body?.selector;
242
257
  if (t == null) return;
243
258
  let n = Array.isArray(t) ? t : [t];
@@ -246,26 +261,26 @@ var T = {
246
261
  let t = P(e);
247
262
  if (t != null) return t.page;
248
263
  }
249
- }, F = (e) => {
264
+ }, L = (e) => {
250
265
  let t = e.custom_content?.annotations;
251
266
  if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
252
267
  let n = e.custom_fields;
253
268
  if (typeof n != "object" || !n) return [];
254
269
  let r = n.annotations;
255
270
  return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
256
- }, I = (e) => {
271
+ }, R = (e) => {
257
272
  if (e.type !== "docx_text_range") return !1;
258
273
  let t = e;
259
274
  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";
260
- }, L = (e) => {
275
+ }, z = (e) => {
261
276
  if (e.type !== "pptx_text_range") return !1;
262
277
  let t = e;
263
278
  return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
264
- }, R = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", z = (e) => {
279
+ }, B = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", V = (e) => {
265
280
  if (e.type !== "excel_rc_range") return !1;
266
281
  let t = e;
267
- return typeof t.sheet == "string" && R(t.start) && (t.end === void 0 || t.end === null || R(t.end));
268
- }, oe = (e) => {
282
+ return typeof t.sheet == "string" && B(t.start) && (t.end === void 0 || t.end === null || B(t.end));
283
+ }, ce = (e) => {
269
284
  let { story: t, path: n, start: r, end: i, text: a } = e;
270
285
  if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
271
286
  type: "docx_text_range",
@@ -275,7 +290,7 @@ var T = {
275
290
  endExclusive: i,
276
291
  text: a
277
292
  };
278
- }, se = (e) => {
293
+ }, le = (e) => {
279
294
  let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
280
295
  if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
281
296
  type: "pptx_text_range",
@@ -285,7 +300,7 @@ var T = {
285
300
  endExclusive: i,
286
301
  text: a
287
302
  };
288
- }, ce = (e) => {
303
+ }, ue = (e) => {
289
304
  let { sheet: t, start: n, end: r } = e;
290
305
  if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
291
306
  if (r == null) return {
@@ -300,30 +315,30 @@ var T = {
300
315
  end: r
301
316
  };
302
317
  }
303
- }, le = (e) => {
318
+ }, H = (e) => {
304
319
  let t = e.body?.selector;
305
320
  return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
306
321
  if (!r(e)) return [];
307
- if (I(e)) {
308
- let t = oe(e);
322
+ if (R(e)) {
323
+ let t = ce(e);
309
324
  return t ? [t] : [];
310
325
  }
311
- if (L(e)) {
312
- let t = se(e);
326
+ if (z(e)) {
327
+ let t = le(e);
313
328
  return t ? [t] : [];
314
329
  }
315
- if (z(e)) {
316
- let t = ce(e);
330
+ if (V(e)) {
331
+ let t = ue(e);
317
332
  return t ? [t] : [];
318
333
  }
319
334
  let t = ee(e);
320
335
  return t ? [t] : [];
321
336
  });
322
- }, ue = (e, t) => C(() => t ? [] : F(e), [t, e]), de = {
337
+ }, de = (e, t) => C(() => t ? [] : L(e), [t, e]), fe = {
323
338
  openOwnerKey: null,
324
339
  activeIndexByGroup: {}
325
- }, B = () => {
326
- let [e, t] = w(de), n = b((e) => {
340
+ }, pe = () => {
341
+ let [e, t] = w(fe), n = b((e) => {
327
342
  t((t) => ({
328
343
  ...t,
329
344
  openOwnerKey: e
@@ -354,7 +369,7 @@ var T = {
354
369
  i,
355
370
  e
356
371
  ]);
357
- }, V = /⟦C(\d+)⟧/g, H = (e, t) => {
372
+ }, me = /⟦C(\d+)⟧/g, U = (e, t) => {
358
373
  let n = t.map((e, t) => ({
359
374
  g: e,
360
375
  idx: t
@@ -367,9 +382,9 @@ var T = {
367
382
  }).sort((e, t) => t.pos - e.pos), r = e;
368
383
  for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
369
384
  return r;
370
- }, fe = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, pe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, me = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, he = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), U = (e) => e.replace(me, (e) => pe.test(e) ? e : he(e)), W = (e) => U(e).replace(fe, ""), G = (e, t) => {
385
+ }, 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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), W = (e) => e.replace(_e, (e) => ge.test(e) ? e : ve(e)), G = (e) => W(e).replace(he, ""), K = (e, t) => {
371
386
  if (typeof e == "string") {
372
- let n = e.split(V);
387
+ let n = e.split(me);
373
388
  if (n.length === 1) return e;
374
389
  let r = [];
375
390
  return n.forEach((e, n) => {
@@ -377,18 +392,18 @@ var T = {
377
392
  }), r;
378
393
  }
379
394
  return Array.isArray(e) ? e.flatMap((e) => {
380
- let n = G(e, t);
395
+ let n = K(e, t);
381
396
  return Array.isArray(n) ? n : [n];
382
397
  }) : e;
383
- }, ge = (e) => {
398
+ }, ye = (e) => {
384
399
  let t = e.primaryAnnotation.target?.selector;
385
400
  return t?.type === "html_tag" ? t.id : void 0;
386
- }, _e = (e, t) => /* @__PURE__ */ v(g, { children: [
401
+ }, be = (e, t) => /* @__PURE__ */ v(g, { children: [
387
402
  e == null ? "<cit>" : `<cit data-id="${e}">`,
388
403
  t,
389
404
  "</cit>"
390
- ] }), ve = (e, t, n, r = !1, a = !1) => {
391
- let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ? W(e) : U(t.length > 0 ? H(e, t) : e), [
405
+ ] }), xe = (e, t, n, r = !1, a = !1) => {
406
+ let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ? G(e) : W(t.length > 0 ? U(e, t) : e), [
392
407
  e,
393
408
  t,
394
409
  r
@@ -398,7 +413,7 @@ var T = {
398
413
  markdownComponents: C(() => {
399
414
  let e = /* @__PURE__ */ new Map();
400
415
  for (let n of t) {
401
- let t = ge(n);
416
+ let t = ye(n);
402
417
  t != null && e.set(t, n);
403
418
  }
404
419
  let n = (e) => {
@@ -415,19 +430,19 @@ var T = {
415
430
  return r ? n(r) : null;
416
431
  }, l = { cit: (t) => {
417
432
  let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
418
- return r ? n(r) : _e(t["data-id"], t.children);
433
+ return r ? n(r) : be(t["data-id"], t.children);
419
434
  } };
420
435
  return t.length === 0 ? u ? l : {} : {
421
436
  ...l,
422
437
  p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
423
438
  ...t,
424
439
  className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
425
- children: G(e, r)
440
+ children: K(e, r)
426
441
  }),
427
442
  li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
428
443
  ...t,
429
444
  className: "mb-1.5 last:mb-0",
430
- children: G(e, r)
445
+ children: K(e, r)
431
446
  })
432
447
  };
433
448
  }, [
@@ -439,26 +454,26 @@ var T = {
439
454
  u
440
455
  ])
441
456
  };
442
- }, K = (e) => {
457
+ }, q = (e) => {
443
458
  try {
444
459
  return decodeURIComponent(e);
445
460
  } catch {
446
461
  return e;
447
462
  }
448
- }, q = (e) => {
463
+ }, Se = (e) => {
449
464
  try {
450
465
  let t = new URL(e);
451
- return t.pathname.split("/").map((e) => K(e)).filter(Boolean).at(-1) ?? t.hostname;
466
+ return t.pathname.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? t.hostname;
452
467
  } catch {
453
- return e.split("/").map((e) => K(e)).filter(Boolean).at(-1) ?? e;
468
+ return e.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? e;
454
469
  }
455
- }, J = (e, t) => e.body?.source?.attachment?.title ?? q(t), Y = (e) => {
470
+ }, J = (e, t) => e.body?.source?.attachment?.title ?? Se(t), Y = (e) => {
456
471
  let t = e.target?.selector;
457
472
  return t?.type === "html_tag" ? t : void 0;
458
- }, ye = (e) => Y(e) != null, X = (e) => {
473
+ }, Ce = (e) => Y(e) != null, X = (e) => {
459
474
  let t = /* @__PURE__ */ new Map();
460
475
  for (let n of e) {
461
- if (ye(n)) continue;
476
+ if (Ce(n)) continue;
462
477
  let e = n.body?.source?.attachment?.url;
463
478
  if (e == null) continue;
464
479
  let r = t.get(e);
@@ -488,16 +503,16 @@ var T = {
488
503
  });
489
504
  }
490
505
  return Array.from(t.values());
491
- }, be = (e) => [...Z(e), ...X(e)], xe = (e, t) => {
506
+ }, we = (e) => [...Z(e), ...X(e)], Te = (e, t) => {
492
507
  let n = e.body?.source?.attachment?.url;
493
508
  return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
494
- }, Q = (e) => e.url == null && e.reference_url != null, Se = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
495
- let t = Se.exec(e);
509
+ }, Q = (e) => e.url == null && e.reference_url != null, Ee = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
510
+ let t = Ee.exec(e);
496
511
  return t ? {
497
512
  baseUrl: t[1],
498
513
  page: t[2] == null ? null : Number(t[2])
499
514
  } : null;
500
- }, Ce = (t) => X((t ?? []).filter(Q).map((t) => {
515
+ }, De = (t) => X((t ?? []).filter(Q).map((t) => {
501
516
  let n = t.reference_url, r = $(n) != null;
502
517
  return { body: {
503
518
  quote: t.data,
@@ -512,4 +527,4 @@ var T = {
512
527
  } };
513
528
  }));
514
529
  //#endregion
515
- export { E as CitationCard, k as CitationCardProvider, M as CitationDropdown, D as CitationMarker, ie as annotationHighlightId, le as annotationToOfficeHighlightLocations, re as annotationsToPdfHighlights, xe as gatherSameSourceAnnotations, ae as getAnnotationPdfPage, Ce as getReferenceAttachmentGroups, be as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, H as injectCitationSentinels, I as isDocxRangeSelector, z as isExcelRcRangeSelector, L as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, G as replaceSentinelsInChildren, F as resolveMessageAnnotations, W as stripCitTagsWhileStreaming, ue as useAnnotations, B as useCitationCard, A as useCitationCardContext, ve as useCitationMarkdownComponents };
530
+ export { E as CitationCard, k as CitationCardProvider, M as CitationDropdown, D as CitationMarker, I as annotationHighlightId, H as annotationToOfficeHighlightLocations, oe as annotationsToPdfHighlights, Te as gatherSameSourceAnnotations, se as getAnnotationPdfPage, De as getReferenceAttachmentGroups, we as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, U as injectCitationSentinels, R as isDocxRangeSelector, V as isExcelRcRangeSelector, z as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, K as replaceSentinelsInChildren, L as resolveMessageAnnotations, G as stripCitTagsWhileStreaming, de as useAnnotations, pe as useCitationCard, A as useCitationCardContext, xe as useCitationMarkdownComponents };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-quotations",
3
3
  "description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
4
- "version": "1.1.0-rc.4",
4
+ "version": "1.1.0",
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.1.0-rc.4",
26
+ "@epam/ai-dial-chat-shared": "1.1.0",
27
27
  "@epam/ai-dial-ui-kit": "^0.14.2"
28
28
  },
29
29
  "repository": {
@@ -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` is
9
- * `annotation.index` when present, otherwise the position in the input array.
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
- /** Returns a stable string ID for a given annotation, matching the IDs produced by `annotationsToPdfHighlights`. */
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,
@@ -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;AAsG1E;;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