@recogito/text-annotator 3.4.8 → 3.4.10

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.
Files changed (62) hide show
  1. package/dist/text-annotator.css +1 -1
  2. package/dist/text-annotator.es.js +308 -302
  3. package/dist/text-annotator.es.js.map +1 -1
  4. package/dist/text-annotator.umd.js +2 -2
  5. package/dist/text-annotator.umd.js.map +1 -1
  6. package/dist/utils/index.d.ts +1 -0
  7. package/package.json +8 -9
  8. package/dist/highlight/RendererImplementation.d.ts +0 -9
  9. package/dist/highlight/baseRenderer.d.ts +0 -22
  10. package/dist/highlight/color.d.ts +0 -2
  11. package/dist/src/SelectionHandler.d.ts +0 -9
  12. package/dist/src/TextAnnotator.d.ts +0 -12
  13. package/dist/src/TextAnnotatorOptions.d.ts +0 -34
  14. package/dist/src/api/index.d.ts +0 -1
  15. package/dist/src/api/scrollIntoView.d.ts +0 -3
  16. package/dist/src/highlight/Highlight.d.ts +0 -5
  17. package/dist/src/highlight/HighlightPainter.d.ts +0 -11
  18. package/dist/src/highlight/HighlightStyle.d.ts +0 -11
  19. package/dist/src/highlight/baseRenderer.d.ts +0 -20
  20. package/dist/src/highlight/canvas/canvasRenderer.d.ts +0 -4
  21. package/dist/src/highlight/canvas/index.d.ts +0 -1
  22. package/dist/src/highlight/highlights/highlightsRenderer.d.ts +0 -6
  23. package/dist/src/highlight/highlights/index.d.ts +0 -1
  24. package/dist/src/highlight/index.d.ts +0 -6
  25. package/dist/src/highlight/span/color.d.ts +0 -2
  26. package/dist/src/highlight/span/index.d.ts +0 -1
  27. package/dist/src/highlight/span/spansRenderer.d.ts +0 -4
  28. package/dist/src/highlight/viewport.d.ts +0 -12
  29. package/dist/src/index.d.ts +0 -11
  30. package/dist/src/model/core/TextAnnotation.d.ts +0 -15
  31. package/dist/src/model/core/index.d.ts +0 -1
  32. package/dist/src/model/index.d.ts +0 -2
  33. package/dist/src/model/w3c/W3CTextAnnotation.d.ts +0 -34
  34. package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +0 -12
  35. package/dist/src/model/w3c/index.d.ts +0 -2
  36. package/dist/src/presence/PresencePainter.d.ts +0 -4
  37. package/dist/src/presence/PresencePainterOptions.d.ts +0 -3
  38. package/dist/src/presence/index.d.ts +0 -2
  39. package/dist/src/state/TextAnnotationStore.d.ts +0 -25
  40. package/dist/src/state/TextAnnotatorState.d.ts +0 -11
  41. package/dist/src/state/index.d.ts +0 -2
  42. package/dist/src/state/spatialTree.d.ts +0 -28
  43. package/dist/src/utils/cancelSingleClickEvents.d.ts +0 -6
  44. package/dist/src/utils/cloneEvents.d.ts +0 -11
  45. package/dist/src/utils/device.d.ts +0 -1
  46. package/dist/src/utils/getHighlightClientRects.d.ts +0 -1
  47. package/dist/src/utils/getQuoteContext.d.ts +0 -4
  48. package/dist/src/utils/index.d.ts +0 -17
  49. package/dist/src/utils/isNotAnnotatable.d.ts +0 -4
  50. package/dist/src/utils/isRevived.d.ts +0 -2
  51. package/dist/src/utils/isWhitespaceOrEmpty.d.ts +0 -2
  52. package/dist/src/utils/mergeClientRects.d.ts +0 -2
  53. package/dist/src/utils/programmaticallyFocusable.d.ts +0 -6
  54. package/dist/src/utils/rangeToSelector.d.ts +0 -2
  55. package/dist/src/utils/reviveAnnotation.d.ts +0 -2
  56. package/dist/src/utils/reviveSelector.d.ts +0 -11
  57. package/dist/src/utils/reviveTarget.d.ts +0 -2
  58. package/dist/src/utils/splitAnnotatableRanges.d.ts +0 -5
  59. package/dist/src/utils/trimRangeToContainer.d.ts +0 -1
  60. package/dist/test/model/w3c/W3CTextFormatAdapter.test.d.ts +0 -1
  61. package/dist/test/model/w3c/fixtures.d.ts +0 -3
  62. /package/dist/{src/utils → utils}/debounce.d.ts +0 -0
@@ -1,22 +1,20 @@
1
- import { UAParser as ye } from "ua-parser-js";
2
- import { OS as be } from "ua-parser-js/enums";
3
- import Y from "debounce";
4
- import { UserSelectAction as Ee, serializeW3CBodies as Ce, parseW3CBodies as Se, parseW3CUser as Ae, createStore as we, createSelectionState as Re, createHoverState as Te, createViewportState as ve, Origin as K, createAnonymousGuest as xe, createUndoStack as Le, createLifecycleObserver as Ne, createBaseAnnotator as Oe } from "@annotorious/core";
5
- import { Origin as Ft, UserSelectAction as $t, createBody as Vt } from "@annotorious/core";
1
+ import de from "debounce";
2
+ import { UserSelectAction as Ce, parseW3CBodies as Se, serializeW3CBodies as Ae, parseW3CUser as we, createStore as Re, createSelectionState as Te, createHoverState as ve, createViewportState as xe, Origin as K, createAnonymousGuest as Le, createUndoStack as Ne, createLifecycleObserver as Oe, createBaseAnnotator as Be } from "@annotorious/core";
3
+ import { Origin as Ut, UserSelectAction as Kt, createBody as Wt } from "@annotorious/core";
6
4
  import { colord as ne } from "colord";
7
- import { dequal as Be } from "dequal/lite";
8
- import { v4 as le } from "uuid";
9
- import ke from "rbush";
10
- import { createNanoEvents as Me } from "nanoevents";
11
- import j from "hotkeys-js";
12
- import { poll as Ie } from "poll";
13
- const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t instanceof HTMLElement ? t.closest(W) : t.parentElement?.closest(W)) : !0, _e = (e, t) => {
5
+ import { dequal as ke } from "dequal/lite";
6
+ import { v4 as ue } from "uuid";
7
+ import Me from "rbush";
8
+ import { createNanoEvents as Ie } from "nanoevents";
9
+ import q from "hotkeys-js";
10
+ import { poll as _e } from "poll";
11
+ const fe = "not-annotatable", $ = `.${fe}`, W = (e, t) => e.contains(t) ? !!(t instanceof HTMLElement ? t.closest($) : t.parentElement?.closest($)) : !0, ge = (e, t) => {
14
12
  const n = t.commonAncestorContainer;
15
- return !Q(e, n);
13
+ return !W(e, n);
16
14
  }, He = (e) => e.addEventListener("click", (t) => {
17
15
  // Allow clicks within not-annotatable elements
18
- !t.target.closest(W) && !t.target.closest("a") && t.preventDefault();
19
- }), ee = (e) => ({
16
+ !t.target.closest($) && !t.target.closest("a") && t.preventDefault();
17
+ }), J = (e) => ({
20
18
  ...e,
21
19
  type: e.type,
22
20
  x: e.x,
@@ -58,9 +56,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
58
56
  defaultPrevented: e.defaultPrevented,
59
57
  detail: e.detail,
60
58
  timeStamp: e.timeStamp
61
- }), Pe = ye(), ue = Pe.os.is(be.MACOS), De = (e) => {
62
- !e.hasAttribute("tabindex") && e.tabIndex < 0 && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
63
- }, Ue = (e) => {
59
+ }), ee = (e, t = 10) => {
60
+ let n;
61
+ return ((...r) => {
62
+ clearTimeout(n), n = setTimeout(() => e.apply(void 0, r), t);
63
+ });
64
+ }, me = typeof navigator < "u" && navigator.platform.startsWith("Mac"), De = (e) => {
65
+ (!e.hasAttribute("tabindex") || e.tabIndex < -1) && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
66
+ }, Pe = (e) => {
64
67
  const t = [], n = document.createNodeIterator(
65
68
  e.commonAncestorContainer,
66
69
  NodeFilter.SHOW_TEXT
@@ -86,8 +89,8 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
86
89
  f ? c.setEndBefore(f) : c.setEndAfter(e.endContainer);
87
90
  }
88
91
  const l = (f) => {
89
- const d = document.createRange();
90
- return d.selectNode(f), Array.from(d.getClientRects());
92
+ const u = document.createRange();
93
+ return u.selectNode(f), Array.from(u.getClientRects());
91
94
  };
92
95
  return [
93
96
  ...Array.from(i.getClientRects()),
@@ -95,20 +98,20 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
95
98
  ...Array.from(c.getClientRects())
96
99
  ];
97
100
  }
98
- }, Ke = function* (e) {
101
+ }, Ue = function* (e) {
99
102
  const t = document.createNodeIterator(
100
103
  e.commonAncestorContainer,
101
104
  NodeFilter.SHOW_ELEMENT,
102
- (r) => r instanceof HTMLElement && r.classList.contains(de) && !r.parentElement.closest(W) && e.intersectsNode(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
105
+ (r) => r instanceof HTMLElement && r.classList.contains(fe) && !r.parentElement.closest($) && e.intersectsNode(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
103
106
  );
104
107
  let n;
105
108
  for (; n = t.nextNode(); )
106
109
  n instanceof HTMLElement && (yield n);
107
- }, We = (e, t) => {
108
- if (!_e(e, t)) return [];
110
+ }, Ke = (e, t) => {
111
+ if (!ge(e, t)) return [];
109
112
  const n = [];
110
113
  let r = null;
111
- for (const s of Ke(t)) {
114
+ for (const s of Ue(t)) {
112
115
  let o;
113
116
  r ? (o = document.createRange(), o.setStartAfter(r), o.setEndBefore(s)) : (o = t.cloneRange(), o.setEndBefore(s)), o.collapsed || n.push(o), r = s;
114
117
  }
@@ -119,18 +122,18 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
119
122
  return n.length > 0 ? n : [t];
120
123
  }, oe = (e) => {
121
124
  const t = e.cloneContents();
122
- return t.querySelectorAll(W).forEach((n) => n.remove()), t;
123
- }, Fe = (e, t, n = 10, r) => {
125
+ return t.querySelectorAll($).forEach((n) => n.remove()), t;
126
+ }, ie = new Intl.Segmenter(void 0, { granularity: "grapheme" }), We = (e, t, n = 10, r) => {
124
127
  const s = r ? e.startContainer.parentElement.closest(r) : t, o = document.createRange();
125
128
  o.setStart(s, 0), o.setEnd(e.startContainer, e.startOffset);
126
129
  const i = oe(o).textContent, c = document.createRange();
127
130
  c.setStart(e.endContainer, e.endOffset), s === document.body ? c.setEnd(s, s.childNodes.length) : c.setEndAfter(s);
128
- const l = oe(c).textContent;
131
+ const l = oe(c).textContent, f = [...ie.segment(i)], u = [...ie.segment(l)];
129
132
  return {
130
- prefix: i.substring(i.length - n),
131
- suffix: l.substring(0, n)
133
+ prefix: f.slice(-n).map((d) => d.segment).join(""),
134
+ suffix: u.slice(0, n).map((d) => d.segment).join("")
132
135
  };
133
- }, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), fe = /^\s*$/, $e = (e) => fe.test(e.toString()), _t = (e) => fe.test(e.textContent || ""), Ve = (e, t, n, r) => {
136
+ }, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), pe = /^\s*$/, $e = (e) => pe.test(e.toString()), kt = (e) => pe.test(e.textContent || ""), Fe = (e, t, n, r) => {
134
137
  const s = (c) => Math.round(c * 10) / 10, o = {
135
138
  top: s(e.top),
136
139
  bottom: s(e.bottom),
@@ -154,17 +157,17 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
154
157
  return "block-contains";
155
158
  } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
156
159
  return "block-is-contained";
157
- }, Ye = (e, t) => {
160
+ }, Ve = (e, t) => {
158
161
  const n = Math.min(e.left, t.left), r = Math.max(e.right, t.right), s = Math.min(e.top, t.top), o = Math.max(e.bottom, t.bottom);
159
162
  return new DOMRect(n, s, r - n, o - s);
160
- }, Xe = (e, t = 0.5, n = 0.5) => e.reduce((r, s) => {
163
+ }, Ye = (e, t = 0.5, n = 0.5) => e.reduce((r, s) => {
161
164
  if (s.width === 0 || s.height === 0)
162
165
  return r;
163
166
  let o = [...r], i = !1;
164
167
  for (const c of r) {
165
- const l = Ve(s, c, t, n);
168
+ const l = Fe(s, c, t, n);
166
169
  if (l === "inline-adjacent") {
167
- o = o.map((f) => f === c ? Ye(s, c) : f), i = !0;
170
+ o = o.map((f) => f === c ? Ve(s, c) : f), i = !0;
168
171
  break;
169
172
  } else if (l === "inline-contains") {
170
173
  o = o.map((f) => f === c ? s : f), i = !0;
@@ -178,14 +181,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
178
181
  }
179
182
  }
180
183
  return i ? o : [...o, s];
181
- }, []), Ht = (e) => ({
184
+ }, []), Mt = (e) => ({
182
185
  length: e.length,
183
186
  item: (t) => e[t],
184
187
  [Symbol.iterator]: function* () {
185
188
  for (let t = 0; t < this.length; t++)
186
189
  yield this.item(t);
187
190
  }
188
- }), ze = (e) => {
191
+ }), Xe = (e) => {
189
192
  if (e.length === 0) return [];
190
193
  if (e.length === 1) return [e[0]];
191
194
  e.sort((s, o) => {
@@ -194,7 +197,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
194
197
  });
195
198
  const [t, ...n] = e, r = n.reduce((s, o) => s.current.compareBoundaryPoints(Range.START_TO_END, o) >= 0 ? (s.current.compareBoundaryPoints(Range.END_TO_END, o) < 0 && s.current.setEnd(o.endContainer, o.endOffset), s) : (s.merged.push(s.current), s.current = o.cloneRange(), s), { merged: [], current: t.cloneRange() });
196
199
  return [...r.merged, r.current];
197
- }, qe = (e, t, n) => {
200
+ }, ze = (e, t, n) => {
198
201
  const r = document.createRange(), s = n ? e.startContainer.parentElement.closest(n) : t;
199
202
  r.setStart(s, 0), r.setEnd(e.startContainer, e.startOffset);
200
203
  const o = oe(r).textContent, i = e.toString(), c = o.length || 0, l = c + i.length;
@@ -202,14 +205,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
202
205
  }, je = (e, t) => {
203
206
  const { left: n, top: r, right: s, bottom: o } = e;
204
207
  return new DOMRect(n - t.left, r - t.top, s - n, o - r);
205
- }, Pt = (e, t) => {
208
+ }, It = (e, t) => {
206
209
  const { left: n, top: r, right: s, bottom: o } = e;
207
210
  return new DOMRect(n + t.left, r + t.top, s - n, o - r);
208
- }, ge = (e, t) => {
211
+ }, he = (e, t) => {
209
212
  const { start: n, end: r } = e, s = e.offsetReference || t, o = document.createNodeIterator(
210
213
  t,
211
214
  NodeFilter.SHOW_TEXT,
212
- (d) => d.parentElement?.closest(W) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT
215
+ (u) => u.parentElement?.closest($) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT
213
216
  );
214
217
  let i = 0;
215
218
  const c = document.createRange();
@@ -218,43 +221,43 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
218
221
  let f = !s;
219
222
  for (; l !== null; ) {
220
223
  if (f ||= typeof s?.contains == "function" ? s.contains(l) : !1, f) {
221
- const d = l.textContent?.length || 0;
222
- if (i + d > n) {
224
+ const u = l.textContent?.length || 0;
225
+ if (i + u > n) {
223
226
  c.setStart(l, n - i);
224
227
  break;
225
228
  }
226
- i += d;
229
+ i += u;
227
230
  }
228
231
  l = o.nextNode();
229
232
  }
230
233
  for (; l !== null; ) {
231
- const d = l.textContent?.length || 0;
232
- if (i + d >= r) {
234
+ const u = l.textContent?.length || 0;
235
+ if (i + u >= r) {
233
236
  c.setEnd(l, r - i);
234
237
  break;
235
238
  }
236
- i += d, l = o.nextNode();
239
+ i += u, l = o.nextNode();
237
240
  }
238
241
  return {
239
242
  ...e,
240
243
  range: c
241
244
  };
242
- }, Z = (e, t) => I(e.selector) ? e : {
245
+ }, Q = (e, t) => I(e.selector) ? e : {
243
246
  ...e,
244
- selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : ge(n, t))
245
- }, te = (e, t) => I(e.target.selector) ? e : { ...e, target: Z(e.target, t) }, Ge = (e, t) => {
247
+ selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : he(n, t))
248
+ }, te = (e, t) => I(e.target.selector) ? e : { ...e, target: Q(e.target, t) }, qe = (e, t) => {
246
249
  const n = e.cloneRange();
247
250
  return t.contains(n.startContainer) || n.setStart(t, 0), t.contains(n.endContainer) || n.setEnd(t, t.childNodes.length), n;
248
- }, me = (e) => {
251
+ }, ye = (e) => {
249
252
  if (!e)
250
253
  return document.scrollingElement;
251
254
  const { overflowY: t } = window.getComputedStyle(e);
252
- return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : me(e.parentElement);
253
- }, ie = (e, t, n) => {
254
- const r = n.getBoundingClientRect(), s = n.clientHeight, o = n.clientWidth, i = t.selector[0].range.getBoundingClientRect(), { width: c, height: l } = e.getAnnotationBounds(t.annotation), f = i.top - r.top, d = i.left - r.left, u = n.parentElement ? n.scrollTop : 0, y = n.parentElement ? n.scrollLeft : 0, w = f + u - (s - l) / 2, g = d + y - (o - c) / 2;
255
+ return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : ye(e.parentElement);
256
+ }, ae = (e, t, n) => {
257
+ const r = n.getBoundingClientRect(), s = n.clientHeight, o = n.clientWidth, i = t.selector[0].range.getBoundingClientRect(), { width: c, height: l } = e.getAnnotationBounds(t.annotation), f = i.top - r.top, u = i.left - r.left, d = n.parentElement ? n.scrollTop : 0, y = n.parentElement ? n.scrollLeft : 0, w = f + d - (s - l) / 2, g = u + y - (o - c) / 2;
255
258
  n.scroll({ top: w, left: g, behavior: "smooth" });
256
- }, Qe = (e, t) => (n, r) => {
257
- const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r : me(e);
259
+ }, Ge = (e, t) => (n, r) => {
260
+ const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r : ye(e);
258
261
  if (!o)
259
262
  return console.warn(`The scroll parent is missing for the annotation: ${s}`, { container: e }), !1;
260
263
  const i = t.getAnnotation(s);
@@ -262,19 +265,19 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
262
265
  return console.warn(`The annotation is missing in the store: ${s}`), !1;
263
266
  const { range: c } = i.target.selector[0];
264
267
  if (c && !c.collapsed)
265
- return ie(t, i.target, o), !0;
266
- const l = Z(i.target, e), { range: f } = l.selector[0];
267
- return f && !f.collapsed ? (ie(t, l, o), !0) : !1;
268
+ return ae(t, i.target, o), !0;
269
+ const l = Q(i.target, e), { range: f } = l.selector[0];
270
+ return f && !f.collapsed ? (ae(t, l, o), !0) : !1;
268
271
  }, _ = {
269
272
  fill: "rgb(0, 128, 255)",
270
273
  fillOpacity: 0.18
271
- }, J = {
274
+ }, Z = {
272
275
  fill: "rgb(0, 128, 255)",
273
276
  fillOpacity: 0.45
274
- }, Ze = (e) => {
277
+ }, Qe = (e) => {
275
278
  const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: r, innerHeight: s } = window, o = -n, i = -t, c = r - n, l = s - t;
276
279
  return { top: t, left: n, minX: o, minY: i, maxX: c, maxY: l };
277
- }, Je = (e) => {
280
+ }, Ze = (e) => {
278
281
  let t = /* @__PURE__ */ new Set();
279
282
  return (r) => {
280
283
  const s = r.map((o) => o.id);
@@ -283,22 +286,22 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
283
286
  }, se = (e, t, n, r) => {
284
287
  const { store: s, selection: o, hover: i } = t;
285
288
  let c, l, f;
286
- const d = Je(n), u = (A) => {
289
+ const u = Ze(n), d = (A) => {
287
290
  const { x: v, y: N } = e.getBoundingClientRect(), O = s.getAt(A.clientX - v, A.clientY - N, !1, l);
288
- O && t.selection.evalSelectAction(O) !== Ee.NONE ? i.current !== O.id && (e.classList.add("hovered"), i.set(O.id)) : i.current && (e.classList.remove("hovered"), i.set(null));
291
+ O && t.selection.evalSelectAction(O) !== Ce.NONE ? i.current !== O.id && (e.classList.add("hovered"), i.set(O.id)) : i.current && (e.classList.remove("hovered"), i.set(null));
289
292
  };
290
- e.addEventListener("pointermove", u);
291
- const y = Y((A = !1) => requestAnimationFrame(() => {
293
+ e.addEventListener("pointermove", d);
294
+ const y = ee((A = !1) => requestAnimationFrame(() => {
292
295
  f && f.clear();
293
- const v = Ze(e), { minX: N, minY: O, maxX: D, maxY: X } = v, z = l ? s.getIntersecting(N, O, D, X).filter(({ annotation: h }) => l(h)) : s.getIntersecting(N, O, D, X), F = o.selected.map(({ id: h }) => h), re = z.map(({ annotation: h, rects: T }) => {
294
- const k = F.includes(h.id), U = h.id === i.current;
296
+ const v = Qe(e), { minX: N, minY: O, maxX: P, maxY: X } = v, z = l ? s.getIntersecting(N, O, P, X).filter(({ annotation: p }) => l(p)) : s.getIntersecting(N, O, P, X), F = o.selected.map(({ id: p }) => p), re = z.map(({ annotation: p, rects: T }) => {
297
+ const k = F.includes(p.id), U = p.id === i.current;
295
298
  return {
296
- annotation: h,
299
+ annotation: p,
297
300
  rects: T,
298
301
  state: { selected: k, hovered: U }
299
302
  };
300
303
  });
301
- r.redraw(re, v, c, f, A), setTimeout(() => d(z.map(({ annotation: h }) => h)), 1);
304
+ r.redraw(re, v, c, f, A), setTimeout(() => u(z.map(({ annotation: p }) => p)), 1);
302
305
  }), 10), w = (A) => {
303
306
  f = A, y();
304
307
  }, g = (A) => {
@@ -307,20 +310,20 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
307
310
  l = A, y(!1);
308
311
  }, R = () => y();
309
312
  s.observe(R);
310
- const b = o.subscribe(() => y()), p = i.subscribe(() => y()), S = () => y(!0);
313
+ const b = o.subscribe(() => y()), h = i.subscribe(() => y()), S = () => y(!0);
311
314
  document.addEventListener("scroll", S, { capture: !0, passive: !0 });
312
- const E = Y(() => {
315
+ const E = ee(() => {
313
316
  s.recalculatePositions(), f?.reset(), y();
314
317
  }, 10);
315
318
  window.addEventListener("resize", E);
316
319
  const m = new ResizeObserver(E);
317
320
  m.observe(e);
318
- const a = { attributes: !0, childList: !0, subtree: !0 }, C = new MutationObserver(Y((A) => {
321
+ const a = { attributes: !0, childList: !0, subtree: !0 }, C = new MutationObserver(ee((A) => {
319
322
  A.every((N) => N.target === e || e.contains(N.target)) || y(!0);
320
323
  }, 150));
321
324
  return C.observe(document.body, a), {
322
325
  destroy: () => {
323
- e.removeEventListener("pointermove", u), r.destroy(), s.unobserve(R), b(), p(), document.removeEventListener("scroll", S), E.clear(), window.removeEventListener("resize", E), m.disconnect(), C.disconnect();
326
+ e.removeEventListener("pointermove", d), r.destroy(), s.unobserve(R), b(), h(), document.removeEventListener("scroll", S), window.removeEventListener("resize", E), m.disconnect(), C.disconnect();
324
327
  },
325
328
  redraw: y,
326
329
  setStyle: g,
@@ -328,40 +331,40 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
328
331
  setPainter: w,
329
332
  setVisible: r.setVisible
330
333
  };
331
- }, et = () => {
334
+ }, Je = () => {
332
335
  const e = document.createElement("canvas");
333
336
  return e.width = window.innerWidth, e.height = window.innerHeight, e.className = "r6o-canvas-highlight-layer bg", e;
334
- }, tt = (e, t) => {
337
+ }, et = (e, t) => {
335
338
  e.width = window.innerWidth, e.height = window.innerHeight;
336
- }, nt = (e) => {
339
+ }, tt = (e) => {
337
340
  console.warn('WARNING! Canvas renderer is deprecated and will be removed in the next major release. Please use the default "SPANS" renderer instead.'), e.classList.add("r6o-annotatable");
338
- const t = et(), n = t.getContext("2d");
341
+ const t = Je(), n = t.getContext("2d");
339
342
  document.body.appendChild(t);
340
- const r = (c, l, f, d) => requestAnimationFrame(() => {
341
- const { width: u, height: y } = t;
342
- n.clearRect(-0.5, -0.5, u + 1, y + 1), d && d.clear();
343
+ const r = (c, l, f, u) => requestAnimationFrame(() => {
344
+ const { width: d, height: y } = t;
345
+ n.clearRect(-0.5, -0.5, d + 1, y + 1), u && u.clear();
343
346
  const { top: w, left: g } = l;
344
347
  [...c].sort((R, b) => {
345
- const { annotation: { target: { created: p } } } = R, { annotation: { target: { created: S } } } = b;
346
- return p.getTime() - S.getTime();
348
+ const { annotation: { target: { created: h } } } = R, { annotation: { target: { created: S } } } = b;
349
+ return h.getTime() - S.getTime();
347
350
  }).forEach((R) => {
348
- const b = f ? typeof f == "function" ? f(R.annotation, R.state) : f : R.state?.selected ? J : _, p = d && d.paint(R, l) || b, S = R.rects.map(({ x: E, y: m, width: a, height: C }) => ({
351
+ const b = f ? typeof f == "function" ? f(R.annotation, R.state) : f : R.state?.selected ? Z : _, h = u && u.paint(R, l) || b, S = R.rects.map(({ x: E, y: m, width: a, height: C }) => ({
349
352
  x: E + g,
350
353
  y: m + w,
351
354
  width: a,
352
355
  height: C
353
356
  }));
354
- if (n.fillStyle = p.fill, n.globalAlpha = p.fillOpacity || 1, S.forEach(
357
+ if (n.fillStyle = h.fill, n.globalAlpha = h.fillOpacity || 1, S.forEach(
355
358
  ({ x: E, y: m, width: a, height: C }) => n.fillRect(E, m, a, C)
356
- ), p.underlineColor) {
357
- n.globalAlpha = 1, n.strokeStyle = p.underlineColor, n.lineWidth = p.underlineThickness ?? 1;
358
- const E = p.underlineOffset ?? 0;
359
+ ), h.underlineColor) {
360
+ n.globalAlpha = 1, n.strokeStyle = h.underlineColor, n.lineWidth = h.underlineThickness ?? 1;
361
+ const E = h.underlineOffset ?? 0;
359
362
  S.forEach(({ x: m, y: a, width: C, height: L }) => {
360
363
  n.beginPath(), n.moveTo(m, a + L + E), n.lineTo(m + C, a + L + E), n.stroke();
361
364
  });
362
365
  }
363
366
  });
364
- }), s = Y(() => tt(t), 10);
367
+ }), s = de(() => et(t), 10);
365
368
  return window.addEventListener("resize", s), {
366
369
  destroy: () => {
367
370
  t.remove(), s.clear(), window.removeEventListener("resize", s);
@@ -371,13 +374,13 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
371
374
  },
372
375
  redraw: r
373
376
  };
374
- }, ot = (e, t, n) => se(e, t, n, nt(e)), st = (e) => [
377
+ }, nt = (e, t, n) => se(e, t, n, tt(e)), ot = (e) => [
375
378
  `background-color:${ne(e?.fill || _.fill).alpha(e?.fillOpacity === void 0 ? _.fillOpacity : e.fillOpacity).toHex()}`,
376
379
  e?.underlineThickness ? "text-decoration:underline" : void 0,
377
380
  e?.underlineColor ? `text-decoration-color:${e.underlineColor}` : void 0,
378
381
  e?.underlineOffset ? `text-underline-offset:${e.underlineOffset}px` : void 0,
379
382
  e?.underlineThickness ? `text-decoration-thickness:${e.underlineThickness}px` : void 0
380
- ].filter(Boolean).join(";"), rt = () => {
383
+ ].filter(Boolean).join(";"), st = () => {
381
384
  const e = document.createElement("style");
382
385
  document.getElementsByTagName("head")[0].appendChild(e);
383
386
  let t = /* @__PURE__ */ new Set();
@@ -390,46 +393,46 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
390
393
  },
391
394
  redraw: (o, i, c, l) => {
392
395
  l && l.clear();
393
- const f = new Set(o.map((u) => u.annotation.id));
394
- Array.from(t).filter((u) => !f.has(u));
395
- const d = o.map((u) => {
396
- const y = c ? typeof c == "function" ? c(u.annotation, u.state) : c : u.state?.selected ? J : _, w = l && l.paint(u, i) || y;
397
- return `::highlight(_${u.annotation.id}) { ${st(w)} }`;
396
+ const f = new Set(o.map((d) => d.annotation.id));
397
+ Array.from(t).filter((d) => !f.has(d));
398
+ const u = o.map((d) => {
399
+ const y = c ? typeof c == "function" ? c(d.annotation, d.state) : c : d.state?.selected ? Z : _, w = l && l.paint(d, i) || y;
400
+ return `::highlight(_${d.annotation.id}) { ${ot(w)} }`;
398
401
  });
399
- e.innerHTML = d.join(`
400
- `), CSS.highlights.clear(), o.forEach(({ annotation: u }) => {
401
- const y = u.target.selector.map((g) => g.range), w = new Highlight(...y);
402
- CSS.highlights.set(`_${u.id}`, w);
402
+ e.innerHTML = u.join(`
403
+ `), CSS.highlights.clear(), o.forEach(({ annotation: d }) => {
404
+ const y = d.target.selector.map((g) => g.range), w = new Highlight(...y);
405
+ CSS.highlights.set(`_${d.id}`, w);
403
406
  }), t = f;
404
407
  }
405
408
  };
406
- }, it = (e, t, n) => se(e, t, n, rt()), at = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), ct = (e, t, n, r, s) => {
407
- const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ? J : _) : n : e.state?.selected ? J : _;
409
+ }, rt = (e, t, n) => se(e, t, n, st()), it = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), at = (e, t, n, r, s) => {
410
+ const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ? Z : _) : n : e.state?.selected ? Z : _;
408
411
  return r && r.paint(e, t) || o;
409
- }, lt = (e, t) => {
412
+ }, ct = (e, t) => {
410
413
  const n = (o, i) => o.x <= i.x + i.width && o.x + o.width >= i.x && o.y <= i.y + i.height && o.y + o.height >= i.y, r = (o) => o.rects.reduce((i, c) => i + c.width, 0), s = t.filter(({ rects: o }) => o.some((i) => n(e, i)));
411
414
  return s.sort((o, i) => r(i) - r(o)), s.findIndex((o) => o.rects.includes(e));
412
- }, dt = (e) => {
415
+ }, lt = (e) => {
413
416
  e.classList.add("r6o-annotatable");
414
417
  const t = document.createElement("div");
415
- t.className = "r6o-span-highlight-layer", e.insertBefore(t, e.firstChild);
418
+ t.className = "r6o-span-highlight-layer", e.appendChild(t);
416
419
  let n = [];
417
420
  return {
418
421
  destroy: () => {
419
422
  t.remove();
420
423
  },
421
- redraw: (i, c, l, f, d) => {
422
- const y = !(Be(n, i) && d);
424
+ redraw: (i, c, l, f, u) => {
425
+ const y = !(ke(n, i) && u);
423
426
  if (!f && !y) return;
424
427
  y && (t.innerHTML = ""), [...i].sort((g, x) => {
425
428
  const { annotation: { target: { created: R } } } = g, { annotation: { target: { created: b } } } = x;
426
429
  return R && b ? R.getTime() - b.getTime() : 0;
427
430
  }).forEach((g) => {
428
431
  g.rects.map((x) => {
429
- const R = lt(x, i), b = ct(g, c, l, f, R);
432
+ const R = ct(x, i), b = at(g, c, l, f, R);
430
433
  if (y) {
431
- const p = document.createElement("span");
432
- p.className = "r6o-annotation", p.dataset.annotation = g.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor = at(b), b.underlineStyle && (p.style.borderStyle = b.underlineStyle), b.underlineColor && (p.style.borderColor = b.underlineColor), b.underlineThickness && (p.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (p.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(p);
434
+ const h = document.createElement("span");
435
+ h.className = "r6o-annotation", h.dataset.annotation = g.annotation.id, h.style.left = `${x.x}px`, h.style.top = `${x.y}px`, h.style.width = `${x.width}px`, h.style.height = `${x.height}px`, h.style.backgroundColor = it(b), b.underlineStyle && (h.style.borderStyle = b.underlineStyle), b.underlineColor && (h.style.borderColor = b.underlineColor), b.underlineThickness && (h.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (h.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(h);
433
436
  }
434
437
  });
435
438
  }), n = i;
@@ -438,10 +441,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
438
441
  i ? t.classList.remove("hidden") : t.classList.add("hidden");
439
442
  }
440
443
  };
441
- }, ut = (e, t, n) => se(e, t, n, dt(e)), Dt = (e, t) => ({
442
- parse: (n) => mt(n),
443
- serialize: (n) => pt(n, e, t)
444
- }), ft = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, gt = (e) => {
444
+ }, dt = (e, t, n) => se(e, t, n, lt(e)), _t = (e, t) => ({
445
+ parse: (n) => gt(n),
446
+ serialize: (n) => mt(n, e, t)
447
+ }), ut = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, ft = (e) => {
445
448
  const {
446
449
  id: t,
447
450
  creator: n,
@@ -452,7 +455,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
452
455
  if (i.length === 0)
453
456
  return { error: Error(`No targets found for annotation: ${e.id}`) };
454
457
  const c = {
455
- creator: Ae(n),
458
+ creator: we(n),
456
459
  created: r ? new Date(r) : void 0,
457
460
  updated: s ? new Date(s) : void 0,
458
461
  annotation: t,
@@ -461,43 +464,43 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
461
464
  styleClass: "styleClass" in i[0] ? i[0].styleClass : void 0
462
465
  };
463
466
  for (const l of i) {
464
- const d = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((u, y) => {
467
+ const u = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((d, y) => {
465
468
  switch (y.type) {
466
469
  case "TextQuoteSelector":
467
- u.quote = y.exact;
470
+ d.quote = y.exact;
468
471
  break;
469
472
  case "TextPositionSelector":
470
- u.start = y.start, u.end = y.end;
473
+ d.start = y.start, d.end = y.end;
471
474
  break;
472
475
  }
473
- return u;
476
+ return d;
474
477
  }, {});
475
- if (ft(d))
478
+ if (ut(u))
476
479
  c.selector.push(
477
480
  {
478
- ...d,
481
+ ...u,
479
482
  id: l.id,
480
483
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
481
484
  scope: l.scope
482
485
  }
483
486
  );
484
487
  else {
485
- const u = [
486
- d.start ? void 0 : "TextPositionSelector",
487
- d.quote ? void 0 : "TextQuoteSelector"
488
+ const d = [
489
+ u.start ? void 0 : "TextPositionSelector",
490
+ u.quote ? void 0 : "TextQuoteSelector"
488
491
  ].filter(Boolean);
489
- return { error: Error(`Missing selector types: ${u.join(" and ")} for annotation: ${e.id}`) };
492
+ return { error: Error(`Missing selector types: ${d.join(" and ")} for annotation: ${e.id}`) };
490
493
  }
491
494
  }
492
495
  return { parsed: c };
493
- }, mt = (e) => {
494
- const t = e.id || le(), {
496
+ }, gt = (e) => {
497
+ const t = e.id || ue(), {
495
498
  creator: n,
496
499
  created: r,
497
500
  modified: s,
498
501
  body: o,
499
502
  ...i
500
- } = e, c = Se(o, t), l = gt(e);
503
+ } = e, c = Se(o, t), l = ft(e);
501
504
  return "error" in l ? { error: l.error } : {
502
505
  parsed: {
503
506
  ...i,
@@ -506,21 +509,21 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
506
509
  target: l.parsed
507
510
  }
508
511
  };
509
- }, pt = (e, t, n) => {
512
+ }, mt = (e, t, n) => {
510
513
  const { bodies: r, target: s, ...o } = e, {
511
514
  selector: i,
512
515
  creator: c,
513
516
  created: l,
514
517
  updated: f,
515
- ...d
516
- } = s, u = i.map((y) => {
517
- const { id: w, quote: g, start: x, end: R, range: b } = y, p = {
518
+ ...u
519
+ } = s, d = i.map((y) => {
520
+ const { id: w, quote: g, start: x, end: R, range: b } = y, h = {
518
521
  type: "TextQuoteSelector",
519
522
  exact: g
520
523
  };
521
524
  if (n) {
522
- const { prefix: E, suffix: m } = Fe(b, n);
523
- p.prefix = E, p.suffix = m;
525
+ const { prefix: E, suffix: m } = We(b, n);
526
+ h.prefix = E, h.suffix = m;
524
527
  }
525
528
  const S = {
526
529
  type: "TextPositionSelector",
@@ -528,12 +531,12 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
528
531
  end: R
529
532
  };
530
533
  return {
531
- ...d,
534
+ ...u,
532
535
  id: w,
533
536
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
534
537
  scope: "scope" in y ? y.scope : void 0,
535
538
  source: t,
536
- selector: [p, S]
539
+ selector: [h, S]
537
540
  };
538
541
  });
539
542
  return {
@@ -541,39 +544,39 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
541
544
  "@context": "http://www.w3.org/ns/anno.jsonld",
542
545
  id: e.id,
543
546
  type: "Annotation",
544
- body: Ce(e.bodies),
547
+ body: Ae(e.bodies),
545
548
  creator: c,
546
549
  created: l?.toISOString(),
547
550
  modified: f?.toISOString(),
548
- target: u
551
+ target: d
549
552
  };
550
- }, ht = () => {
553
+ }, pt = () => {
551
554
  const e = document.createElement("canvas");
552
555
  e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
553
556
  const t = e.getContext("2d");
554
557
  return t.scale(2, 2), t.translate(0.5, 0.5), e;
555
- }, yt = (e, t = {}) => {
556
- const n = ht(), r = n.getContext("2d");
558
+ }, ht = (e, t = {}) => {
559
+ const n = pt(), r = n.getContext("2d");
557
560
  document.body.appendChild(n);
558
- const s = /* @__PURE__ */ new Map(), o = (d) => Array.from(s.entries()).filter(([u, y]) => y.presenceKey === d.presenceKey).map(([u, y]) => u);
559
- return e.on("selectionChange", (d, u) => {
560
- o(d).forEach((w) => s.delete(w)), u && u.forEach((w) => s.set(w, d));
561
+ const s = /* @__PURE__ */ new Map(), o = (u) => Array.from(s.entries()).filter(([d, y]) => y.presenceKey === u.presenceKey).map(([d, y]) => d);
562
+ return e.on("selectionChange", (u, d) => {
563
+ o(u).forEach((w) => s.delete(w)), d && d.forEach((w) => s.set(w, u));
561
564
  }), {
562
565
  clear: () => {
563
- const { width: d, height: u } = n;
564
- r.clearRect(-0.5, -0.5, d + 1, u + 1);
566
+ const { width: u, height: d } = n;
567
+ r.clearRect(-0.5, -0.5, u + 1, d + 1);
565
568
  },
566
569
  destroy: () => {
567
570
  n.remove();
568
571
  },
569
- paint: (d, u, y) => {
572
+ paint: (u, d, y) => {
570
573
  t.font && (r.font = t.font);
571
- const w = s.get(d.annotation.id);
574
+ const w = s.get(u.annotation.id);
572
575
  if (w) {
573
- const { height: g } = d.rects[0], x = d.rects[0].x + u.left, R = d.rects[0].y + u.top;
576
+ const { height: g } = u.rects[0], x = u.rects[0].x + d.left, R = u.rects[0].y + d.top;
574
577
  r.fillStyle = w.appearance.color, r.fillRect(x - 2, R - 2.5, 2, g + 5);
575
- const b = r.measureText(w.appearance.label), p = b.width + 6, S = b.actualBoundingBoxAscent + b.actualBoundingBoxDescent + 8, E = b.fontBoundingBoxAscent ? 8 : 6.5;
576
- return r.fillRect(x - 2, R - 2.5 - S, p, S), r.fillStyle = "#fff", r.fillText(w.appearance.label, x + 1, R - E), {
578
+ const b = r.measureText(w.appearance.label), h = b.width + 6, S = b.actualBoundingBoxAscent + b.actualBoundingBoxDescent + 8, E = b.fontBoundingBoxAscent ? 8 : 6.5;
579
+ return r.fillRect(x - 2, R - 2.5 - S, h, S), r.fillStyle = "#fff", r.fillText(w.appearance.label, x + 1, R - E), {
577
580
  fill: w.appearance.color,
578
581
  fillOpacity: y ? 0.45 : 0.18
579
582
  };
@@ -581,23 +584,23 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
581
584
  },
582
585
  reset: () => {
583
586
  n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;
584
- const d = n.getContext("2d");
585
- d.scale(2, 2), d.translate(0.5, 0.5);
587
+ const u = n.getContext("2d");
588
+ u.scale(2, 2), u.translate(0.5, 0.5);
586
589
  }
587
590
  };
588
- }, bt = (e, t, n, r) => {
589
- const s = new ke(), o = /* @__PURE__ */ new Map(), i = Me(), c = (m, a) => {
591
+ }, yt = (e, t, n, r) => {
592
+ const s = new Me(), o = /* @__PURE__ */ new Map(), i = Ie(), c = (m, a) => {
590
593
  const C = m.selector.flatMap((A) => {
591
- const v = I([A]) ? A.range : ge(A, t).range;
592
- return Ue(v);
593
- }), L = Xe(C, n, r).map((A) => je(A, a));
594
+ const v = I([A]) ? A.range : he(A, t).range;
595
+ return Pe(v);
596
+ }), L = Ye(C, n, r).map((A) => je(A, a));
594
597
  return L.map((A) => {
595
- const { x: v, y: N, width: O, height: D } = A;
598
+ const { x: v, y: N, width: O, height: P } = A;
596
599
  return {
597
600
  minX: v,
598
601
  minY: N,
599
602
  maxX: v + O,
600
- maxY: N + D,
603
+ maxY: N + P,
601
604
  annotation: {
602
605
  id: m.annotation,
603
606
  rects: L
@@ -606,14 +609,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
606
609
  });
607
610
  }, l = () => [...o.values()], f = () => {
608
611
  s.clear(), o.clear();
609
- }, d = (m) => {
612
+ }, u = (m) => {
610
613
  const a = c(m, t.getBoundingClientRect());
611
614
  a.length !== 0 && (a.forEach((C) => s.insert(C)), o.set(m.annotation, a));
612
- }, u = (m) => {
615
+ }, d = (m) => {
613
616
  const a = o.get(m.annotation);
614
617
  a && (a.forEach((C) => s.remove(C)), o.delete(m.annotation));
615
618
  }, y = (m) => {
616
- u(m), d(m);
619
+ d(m), u(m);
617
620
  }, w = (m, a = !0) => {
618
621
  a && f();
619
622
  const C = t.getBoundingClientRect(), L = m.map((v) => ({ target: v, rects: c(v, C) }));
@@ -657,50 +660,50 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
657
660
  rects: R(N)
658
661
  })).filter((N) => !!N.annotation);
659
662
  },
660
- insert: d,
663
+ insert: u,
661
664
  recalculate: () => {
662
665
  w(e.all().map((m) => m.target), !0), i.emit("recalculate");
663
666
  },
664
- remove: u,
667
+ remove: d,
665
668
  set: w,
666
669
  size: () => s.all().length,
667
670
  update: y,
668
671
  on: (m, a) => i.on(m, a)
669
672
  };
670
- }, Et = (e, t) => {
671
- const n = we(), r = bt(n, e, t.mergeHighlights?.horizontalTolerance, t.mergeHighlights?.verticalTolerance), s = Re(n, t.userSelectAction, t.adapter), o = Te(n), i = ve(), c = (p, S = K.LOCAL) => {
672
- const E = te(p, e), m = I(E.target.selector);
673
+ }, bt = (e, t) => {
674
+ const n = Re(), r = yt(n, e, t.mergeHighlights?.horizontalTolerance, t.mergeHighlights?.verticalTolerance), s = Te(n, t.userSelectAction, t.adapter), o = ve(n), i = xe(), c = (h, S = K.LOCAL) => {
675
+ const E = te(h, e), m = I(E.target.selector);
673
676
  return m && n.addAnnotation(E, S), m;
674
- }, l = (p, S = !0, E = K.LOCAL) => {
675
- const m = p.map((C) => te(C, e)), a = m.filter((C) => !I(C.target.selector));
677
+ }, l = (h, S = !0, E = K.LOCAL) => {
678
+ const m = h.map((C) => te(C, e)), a = m.filter((C) => !I(C.target.selector));
676
679
  return n.bulkAddAnnotations(m, S, E), a;
677
- }, f = (p, S = K.LOCAL) => {
678
- const E = p.map((a) => te(a, e)), m = E.filter((a) => !I(a.target.selector));
680
+ }, f = (h, S = K.LOCAL) => {
681
+ const E = h.map((a) => te(a, e)), m = E.filter((a) => !I(a.target.selector));
679
682
  return E.forEach((a) => {
680
683
  n.getAnnotation(a.id) ? n.updateAnnotation(a, S) : n.addAnnotation(a, S);
681
684
  }), m;
682
- }, d = (p, S = K.LOCAL) => {
683
- const E = Z(p, e);
685
+ }, u = (h, S = K.LOCAL) => {
686
+ const E = Q(h, e);
684
687
  n.updateTarget(E, S);
685
- }, u = (p, S = K.LOCAL) => {
686
- const E = p.map((m) => Z(m, e));
688
+ }, d = (h, S = K.LOCAL) => {
689
+ const E = h.map((m) => Q(m, e));
687
690
  n.bulkUpdateTargets(E, S);
688
691
  };
689
- function y(p, S, E, m) {
690
- const a = E || !!m, C = r.getAt(p, S, a).map((A) => n.getAnnotation(A)), L = m ? C.filter(m) : C;
692
+ function y(h, S, E, m) {
693
+ const a = E || !!m, C = r.getAt(h, S, a).map((A) => n.getAnnotation(A)), L = m ? C.filter(m) : C;
691
694
  if (L.length !== 0)
692
695
  return E ? L : L[0];
693
696
  }
694
- const w = (p) => r.getAnnotationRects(p).length > 0 ? r.getAnnotationBounds(p) : void 0, g = (p, S, E, m) => r.getIntersecting(p, S, E, m), x = (p) => r.getAnnotationRects(p), R = () => r.recalculate(), b = (p) => r.on("recalculate", p);
695
- return n.observe(({ changes: p }) => {
696
- const S = (p.deleted || []).filter((a) => I(a.target.selector)), E = (p.created || []).filter((a) => I(a.target.selector)), m = (p.updated || []).filter((a) => I(a.newValue.target.selector));
697
+ const w = (h) => r.getAnnotationRects(h).length > 0 ? r.getAnnotationBounds(h) : void 0, g = (h, S, E, m) => r.getIntersecting(h, S, E, m), x = (h) => r.getAnnotationRects(h), R = () => r.recalculate(), b = (h) => r.on("recalculate", h);
698
+ return n.observe(({ changes: h }) => {
699
+ const S = (h.deleted || []).filter((a) => I(a.target.selector)), E = (h.created || []).filter((a) => I(a.target.selector)), m = (h.updated || []).filter((a) => I(a.newValue.target.selector));
697
700
  S?.length > 0 && S.forEach((a) => r.remove(a.target)), E.length > 0 && r.set(E.map((a) => a.target), !1), m?.length > 0 && m.forEach(({ newValue: a }) => r.update(a.target));
698
701
  }), {
699
702
  store: {
700
703
  ...n,
701
704
  addAnnotation: c,
702
705
  bulkAddAnnotations: l,
703
- bulkUpdateTargets: u,
706
+ bulkUpdateTargets: d,
704
707
  bulkUpsertAnnotations: f,
705
708
  getAnnotationBounds: w,
706
709
  getAnnotationRects: x,
@@ -708,40 +711,40 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
708
711
  getAt: y,
709
712
  recalculatePositions: R,
710
713
  onRecalculatePositions: b,
711
- updateTarget: d
714
+ updateTarget: u
712
715
  },
713
716
  selection: s,
714
717
  hover: o,
715
718
  viewport: i
716
719
  };
717
- }, ae = 300, pe = ["up", "down", "left", "right"], he = ue ? "⌘+a" : "ctrl+a", Ct = [
718
- ...pe.map((e) => `shift+${e}`),
719
- he
720
- ], St = (e, t, n, r) => {
720
+ }, ce = 300, be = ["up", "down", "left", "right"], Ee = me ? "⌘+a" : "ctrl+a", Et = [
721
+ ...be.map((e) => `shift+${e}`),
722
+ Ee
723
+ ], Ct = (e, t, n, r) => {
721
724
  const { store: s, selection: o } = t;
722
725
  let i;
723
726
  const {
724
727
  annotatingEnabled: c,
725
728
  offsetReferenceSelector: l,
726
729
  selectionMode: f,
727
- dismissOnNotAnnotatable: d = "NEVER"
730
+ dismissOnNotAnnotatable: u = "NEVER"
728
731
  } = r;
729
- let u, y = c, w = "CREATE_NEW", g, x, R, b;
730
- const p = (h) => {
731
- y = h, L.clear(), h || (x = void 0, g = void 0, R = void 0, b = void 0);
732
- }, S = (h) => w = h || "CREATE_NEW", E = (h) => u = h, m = (h) => i = h, a = (h) => {
732
+ let d, y = c, w = "CREATE_NEW", g, x, R, b;
733
+ const h = (p) => {
734
+ y = p, L.clear(), p || (x = void 0, g = void 0, R = void 0, b = void 0);
735
+ }, S = (p) => w = p || "CREATE_NEW", E = (p) => d = p, m = (p) => i = p, a = (p) => {
733
736
  if (w === "ADD_TO_CURRENT")
734
737
  return !0;
735
738
  if (r.allowModifierSelect) {
736
- const T = h;
737
- return ue ? T.metaKey : T.ctrlKey;
739
+ const T = p;
740
+ return me ? T.metaKey : T.ctrlKey;
738
741
  } else
739
742
  return !1;
740
743
  }, C = () => {
741
744
  if (!y || R === !1) return;
742
- const { selected: h } = o;
743
- if ((a(b) || w === "REPLACE_CURRENT") && h.length === 1 && h[0].editable) {
744
- const k = s.getAnnotation(h[0].id);
745
+ const { selected: p } = o;
746
+ if ((a(b) || w === "REPLACE_CURRENT") && p.length === 1 && p[0].editable) {
747
+ const k = s.getAnnotation(p[0].id);
745
748
  if (k?.target) {
746
749
  x = k.target, g = {
747
750
  annotation: k.id,
@@ -755,223 +758,226 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
755
758
  }
756
759
  }
757
760
  x = void 0, g = {
758
- annotation: le(),
761
+ annotation: ue(),
759
762
  selector: [],
760
763
  created: /* @__PURE__ */ new Date(),
761
764
  creator: i
762
765
  };
763
- }, L = Y((h) => {
766
+ }, L = de((p) => {
764
767
  if (!y) return;
765
768
  const T = document.getSelection();
766
769
  if (!T?.anchorNode) return;
767
770
  const k = Array.from(Array(T.rangeCount).keys()).map((B) => T.getRangeAt(B));
768
- if (!k.some((B) => B.intersectsNode(e))) {
771
+ if (k.every((B) => !ge(e, B))) {
769
772
  g = void 0;
770
773
  return;
771
774
  }
772
- const U = h.timeStamp - (b?.timeStamp || h.timeStamp);
773
- if (b?.type === "pointerdown" && (U < 1e3 && !g || T.isCollapsed && U < ae) && C(), g || C(), T.isCollapsed) {
775
+ const U = p.timeStamp - (b?.timeStamp || p.timeStamp);
776
+ if (b?.type === "pointerdown" && (U < 1e3 && !g || T.isCollapsed && U < ce) && C(), !g && (C(), !g))
777
+ return;
778
+ if (T.isCollapsed) {
774
779
  s.getAnnotation(g.annotation) && !(a(b) || w === "REPLACE_CURRENT") && (o.clear(), s.deleteAnnotation(g.annotation));
775
780
  return;
776
781
  }
777
- const H = k.map((B) => Ge(B, e));
782
+ const H = k.map((B) => qe(B, e));
778
783
  if (H.every((B) => $e(B))) return;
779
- const M = H.flatMap((B) => We(e, B.cloneRange()));
780
- if (!(M.length > 0 && !g || M.length !== g.selector.length || M.some((B, $) => B.toString() !== g.selector[$]?.quote))) return;
781
- const q = a(b) && x ? ze([
784
+ const M = H.flatMap((B) => Ke(e, B.cloneRange()));
785
+ if (!(M.length > 0 && !g || M.length !== g.selector.length || M.some((B, V) => B.toString() !== g.selector[V]?.quote))) return;
786
+ const j = a(b) && x ? Xe([
782
787
  ...x.selector.map((B) => B.range),
783
788
  ...M
784
789
  ]) : M;
785
790
  g = {
786
791
  ...g,
787
- selector: q.map((B) => qe(B, e, l)),
792
+ selector: j.map((B) => ze(B, e, l)),
788
793
  updated: /* @__PURE__ */ new Date()
789
794
  }, !(a(b) || w === "REPLACE_CURRENT") && (s.getAnnotation(g.annotation) ? s.updateTarget(g, K.LOCAL) : o.clear());
790
- }, 10), A = (h) => {
791
- b = ee(h), R = b.button === 0;
792
- }, v = async (h) => {
795
+ }, 10), A = (p) => {
796
+ b = J(p), R = b.button === 0;
797
+ }, v = async (p) => {
793
798
  if (!R) return;
794
- const T = ee(h), k = () => {
799
+ const T = J(p), k = () => {
795
800
  const { x: H, y: M } = e.getBoundingClientRect();
796
- if (Q(e, T.target)) {
797
- (typeof d == "function" ? d(T, e) : d === "ALWAYS") && o.clear();
801
+ if (W(e, T.target)) {
802
+ (typeof u == "function" ? u(T, e) : u === "ALWAYS") && o.clear();
798
803
  return;
799
804
  }
800
- const P = T.target instanceof Node && e.contains(T.target) && s.getAt(
805
+ const D = T.target instanceof Node && e.contains(T.target) && s.getAt(
801
806
  T.clientX - H,
802
807
  T.clientY - M,
803
808
  f === "all",
804
- u
809
+ d
805
810
  );
806
- if (P) {
807
- const { selected: q } = o, B = new Set(q.map((V) => V.id)), $ = Array.isArray(P) ? P.map((V) => V.id) : [P.id];
808
- (B.size !== $.length || !$.every((V) => B.has(V))) && (n.emit("clickAnnotation", P), o.userSelect($, T));
811
+ if (D) {
812
+ const { selected: j } = o, B = new Set(j.map((Y) => Y.id)), V = Array.isArray(D) ? D.map((Y) => Y.id) : [D.id];
813
+ (B.size !== V.length || !V.every((Y) => B.has(Y))) && (n.emit("clickAnnotation", D), o.userSelect(V, T));
809
814
  } else
810
815
  o.clear();
811
816
  };
812
- if (T.timeStamp - b.timeStamp < ae) {
817
+ if (T.timeStamp - b.timeStamp < ce) {
813
818
  await N();
814
- const H = document.getSelection(), M = Q(e, b.target), P = Q(e, T.target);
815
- if (H?.isCollapsed || M && P) {
819
+ const H = document.getSelection(), M = W(e, b.target), D = W(e, T.target);
820
+ if (H?.isCollapsed || M && D) {
816
821
  g = void 0, k();
817
822
  return;
818
823
  }
819
824
  }
820
825
  g && g.selector.length > 0 && (F(), o.userSelect(g.annotation, T));
821
826
  }, N = async () => {
822
- const h = document.getSelection();
823
- let T = !1, k = h?.isCollapsed;
827
+ const p = document.getSelection();
828
+ let T = !1, k = p?.isCollapsed;
824
829
  const U = () => k || T, H = 1;
825
- return setTimeout(() => T = !0, 50), Ie(() => k = h?.isCollapsed, H, U);
826
- }, O = (h) => {
827
- document.getSelection()?.isCollapsed || ((!g || g.selector.length === 0) && L(h), g && (F(), o.userSelect(g.annotation, ee(h))));
828
- }, D = (h) => {
829
- y && h.key === "Shift" && g && (document.getSelection().isCollapsed || (F(), o.userSelect(g.annotation, G(h))));
830
- }, X = (h) => {
830
+ return setTimeout(() => T = !0, 50), _e(() => k = p?.isCollapsed, H, U);
831
+ }, O = (p) => {
832
+ document.getSelection()?.isCollapsed || ((!g || g.selector.length === 0) && L(p), g && (F(), o.userSelect(g.annotation, J(p))));
833
+ }, P = (p) => {
834
+ y && (p.repeat || p.target instanceof Node && W(e, p.target) && p.target !== document.body || p.key === "Shift" && g && (document.getSelection().isCollapsed || (F(), o.userSelect(g.annotation, G(p)))));
835
+ }, X = (p) => {
831
836
  const T = () => setTimeout(() => {
832
837
  g?.selector.length > 0 && (o.clear(), s.addAnnotation({
833
838
  id: g.annotation,
834
839
  bodies: [],
835
840
  target: g
836
- }), o.userSelect(g.annotation, G(h))), document.removeEventListener("selectionchange", T);
841
+ }), o.userSelect(g.annotation, G(p))), document.removeEventListener("selectionchange", T);
837
842
  }, 100);
838
843
  document.addEventListener("selectionchange", T), C();
839
844
  };
840
- j(Ct.join(","), { element: e, keydown: !0, keyup: !1 }, (h) => {
841
- h.repeat || (b = G(h));
842
- }), j(he, { keydown: !0, keyup: !1 }, (h) => {
843
- b = G(h), X(h);
845
+ q(Et.join(","), { element: e, keydown: !0, keyup: !1 }, (p) => {
846
+ p.repeat || (b = G(p));
847
+ }), q(Ee, { keydown: !0, keyup: !1 }, (p) => {
848
+ b = G(p), X(p);
844
849
  });
845
- const z = (h) => {
846
- h.repeat || h.target !== e && h.target !== document.body || (g = void 0, o.clear());
850
+ const z = (p) => {
851
+ p.repeat || p.target instanceof Node && W(e, p.target) && p.target !== document.body || (g = void 0, o.clear());
847
852
  };
848
- j(pe.join(","), { keydown: !0, keyup: !1 }, z);
853
+ q(be.join(","), { keydown: !0, keyup: !1 }, z);
849
854
  const F = () => {
850
- const h = s.getAnnotation(g.annotation);
851
- if (!h)
855
+ const p = s.getAnnotation(g.annotation);
856
+ if (!p)
852
857
  s.addAnnotation({
853
858
  id: g.annotation,
854
859
  bodies: [],
855
860
  target: g
856
861
  });
857
862
  else {
858
- const { target: { updated: T } } = h, { updated: k } = g;
863
+ const { target: { updated: T } } = p, { updated: k } = g;
859
864
  (!T || !k || T < k) && s.updateTarget(g);
860
865
  }
861
866
  };
862
- return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", v), document.addEventListener("contextmenu", O), e.addEventListener("keyup", D), e.addEventListener("selectstart", C), document.addEventListener("selectionchange", L), {
867
+ return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", v), document.addEventListener("contextmenu", O), document.addEventListener("keyup", P), e.addEventListener("selectstart", C), document.addEventListener("selectionchange", L), {
863
868
  destroy: () => {
864
- g = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", v), document.removeEventListener("contextmenu", O), e.removeEventListener("keyup", D), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L), j.unbind();
869
+ g = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", v), document.removeEventListener("contextmenu", O), document.removeEventListener("keyup", P), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L), q.unbind();
865
870
  },
866
871
  setFilter: E,
867
872
  setUser: m,
868
- setAnnotatingEnabled: p,
873
+ setAnnotatingEnabled: h,
869
874
  setAnnotatingMode: S
870
875
  };
871
- }, At = (e, t) => ({
876
+ }, St = (e, t) => ({
872
877
  ...e,
873
878
  annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
874
879
  user: e.user || t.user
875
- }), ce = "SPANS", Ut = (e, t = {}) => {
880
+ }), le = "SPANS", Ht = (e, t = {}) => {
876
881
  He(e), De(e);
877
- const n = At(t, {
882
+ const n = St(t, {
878
883
  annotatingEnabled: !0,
879
- user: xe()
880
- }), r = Et(e, n), { selection: s, viewport: o } = r, i = r.store, c = Le(i), l = Ne(r, c, n.adapter);
884
+ user: Le()
885
+ }), r = bt(e, n), { selection: s, viewport: o } = r, i = r.store, c = Ne(i), l = Oe(r, c, n.adapter);
881
886
  let f = n.user;
882
- const d = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ce : n.renderer || ce : null, u = d === null ? n.renderer(e, r, o) : d === "SPANS" ? ut(e, r, o) : d === "CSS_HIGHLIGHTS" ? it(e, r, o) : d === "CANVAS" ? ot(e, r, o) : void 0;
883
- if (!u)
887
+ const u = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : le : n.renderer || le : null, d = u === null ? n.renderer(e, r, o) : u === "SPANS" ? dt(e, r, o) : u === "CSS_HIGHLIGHTS" ? rt(e, r, o) : u === "CANVAS" ? nt(e, r, o) : void 0;
888
+ if (!d)
884
889
  throw `Unknown renderer implementation: ${n.renderer}`;
885
- console.debug(d ? `Using ${d} renderer` : "Using custom renderer implementation"), n.style && u.setStyle(n.style);
886
- const y = St(e, r, l, n);
890
+ console.debug(u ? `Using ${u} renderer` : "Using custom renderer implementation"), n.style && d.setStyle(n.style);
891
+ const y = Ct(e, r, l, n);
887
892
  y.setUser(f);
888
- const w = Oe(r, c, n.adapter), g = () => f, x = (a) => {
893
+ const w = Be(r, c, n.adapter), g = () => f, x = (a) => {
889
894
  y.setAnnotatingEnabled(
890
895
  a === void 0 ? !0 : a
891
896
  );
892
897
  }, R = (a) => {
893
898
  y.setAnnotatingMode(a);
894
899
  }, b = (a) => {
895
- u.setFilter(a), y.setFilter(a);
896
- }, p = (a) => {
900
+ d.setFilter(a), y.setFilter(a);
901
+ }, h = (a) => {
897
902
  f = a, y.setUser(a);
898
903
  }, S = (a) => {
899
- a && (u.setPainter(yt(a, n.presence)), a.on("selectionChange", () => u.redraw()));
904
+ a && (d.setPainter(ht(a, n.presence)), a.on("selectionChange", () => d.redraw()));
900
905
  }, E = (a) => {
901
906
  a ? s.setSelected(a) : s.clear();
902
907
  };
903
908
  return {
904
909
  ...w,
905
910
  destroy: () => {
906
- u.destroy(), y.destroy(), c.destroy();
911
+ d.destroy(), y.destroy(), c.destroy();
907
912
  },
908
913
  element: e,
909
914
  getUser: g,
910
915
  setAnnotatingEnabled: x,
911
916
  setAnnotatingMode: R,
912
917
  setFilter: b,
913
- setStyle: u.setStyle.bind(u),
914
- redraw: u.redraw.bind(u),
915
- setUser: p,
918
+ setStyle: d.setStyle.bind(d),
919
+ redraw: d.redraw.bind(d),
920
+ setUser: h,
916
921
  setSelected: E,
917
922
  setPresenceProvider: S,
918
- setVisible: u.setVisible.bind(u),
923
+ setVisible: d.setVisible.bind(d),
919
924
  on: l.on,
920
925
  off: l.off,
921
- scrollIntoView: Qe(e, i),
926
+ scrollIntoView: Ge(e, i),
922
927
  state: r
923
928
  };
924
929
  };
925
930
  export {
926
- J as DEFAULT_SELECTED_STYLE,
931
+ Z as DEFAULT_SELECTED_STYLE,
927
932
  _ as DEFAULT_STYLE,
928
- de as NOT_ANNOTATABLE_CLASS,
929
- W as NOT_ANNOTATABLE_SELECTOR,
930
- Ft as Origin,
931
- $t as UserSelectAction,
932
- Dt as W3CTextFormat,
933
+ fe as NOT_ANNOTATABLE_CLASS,
934
+ $ as NOT_ANNOTATABLE_SELECTOR,
935
+ Ut as Origin,
936
+ Kt as UserSelectAction,
937
+ _t as W3CTextFormat,
933
938
  He as cancelSingleClickEvents,
934
939
  G as cloneKeyboardEvent,
935
- ee as clonePointerEvent,
940
+ J as clonePointerEvent,
936
941
  se as createBaseRenderer,
937
- Vt as createBody,
938
- ot as createCanvasRenderer,
939
- it as createHighlightsRenderer,
940
- yt as createPresencePainter,
941
- rt as createRenderer,
942
- St as createSelectionHandler,
943
- ut as createSpansRenderer,
944
- Ut as createTextAnnotator,
945
- Et as createTextAnnotatorState,
946
- At as fillDefaults,
947
- at as getBackgroundColor,
948
- Ue as getHighlightClientRects,
949
- Fe as getQuoteContext,
942
+ Wt as createBody,
943
+ nt as createCanvasRenderer,
944
+ rt as createHighlightsRenderer,
945
+ ht as createPresencePainter,
946
+ st as createRenderer,
947
+ Ct as createSelectionHandler,
948
+ dt as createSpansRenderer,
949
+ Ht as createTextAnnotator,
950
+ bt as createTextAnnotatorState,
951
+ ee as debounce,
952
+ St as fillDefaults,
953
+ it as getBackgroundColor,
954
+ Pe as getHighlightClientRects,
955
+ We as getQuoteContext,
950
956
  oe as getRangeAnnotatableContents,
951
- Ze as getViewportBounds,
952
- ue as isMac,
953
- _t as isNodeWhitespaceOrEmpty,
954
- Q as isNotAnnotatable,
955
- _e as isRangeAnnotatable,
957
+ Qe as getViewportBounds,
958
+ me as isMac,
959
+ kt as isNodeWhitespaceOrEmpty,
960
+ W as isNotAnnotatable,
961
+ ge as isRangeAnnotatable,
956
962
  $e as isRangeWhitespaceOrEmpty,
957
963
  I as isRevived,
958
- Xe as mergeClientRects,
959
- ze as mergeRanges,
960
- ct as paint,
961
- mt as parseW3CTextAnnotation,
964
+ Ye as mergeClientRects,
965
+ Xe as mergeRanges,
966
+ at as paint,
967
+ gt as parseW3CTextAnnotation,
962
968
  De as programmaticallyFocusable,
963
- qe as rangeToSelector,
969
+ ze as rangeToSelector,
964
970
  te as reviveAnnotation,
965
- ge as reviveSelector,
966
- Z as reviveTarget,
967
- Qe as scrollIntoView,
968
- pt as serializeW3CTextAnnotation,
969
- We as splitAnnotatableRanges,
970
- Ht as toDomRectList,
971
+ he as reviveSelector,
972
+ Q as reviveTarget,
973
+ Ge as scrollIntoView,
974
+ mt as serializeW3CTextAnnotation,
975
+ Ke as splitAnnotatableRanges,
976
+ Mt as toDomRectList,
971
977
  je as toParentBounds,
972
- Pt as toViewportBounds,
973
- Je as trackViewport,
974
- Ge as trimRangeToContainer,
975
- fe as whitespaceOrEmptyRegex
978
+ It as toViewportBounds,
979
+ Ze as trackViewport,
980
+ qe as trimRangeToContainer,
981
+ pe as whitespaceOrEmptyRegex
976
982
  };
977
983
  //# sourceMappingURL=text-annotator.es.js.map