@recogito/text-annotator 3.3.0 → 3.3.1

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,10 +1,10 @@
1
1
  import { UAParser as ct } from "ua-parser-js";
2
2
  import { OS as lt } from "ua-parser-js/enums";
3
- import { colord as et } from "colord";
3
+ import { colord as G } from "colord";
4
4
  import { dequal as dt } from "dequal/lite";
5
5
  import { v4 as nt } from "uuid";
6
6
  import { serializeW3CBodies as ft, parseW3CBodies as ut, parseW3CUser as gt, createStore as mt, createSelectionState as pt, createHoverState as ht, createViewportState as yt, Origin as F, createAnonymousGuest as bt, createUndoStack as St, createLifecycleObserver as Ct, createBaseAnnotator as Et } from "@annotorious/core";
7
- import { Origin as Te, UserSelectAction as xe, createBody as Re } from "@annotorious/core";
7
+ import { Origin as Te, UserSelectAction as Re, createBody as Le } from "@annotorious/core";
8
8
  import wt from "rbush";
9
9
  import V from "hotkeys-js";
10
10
  import { poll as At } from "poll";
@@ -14,7 +14,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
14
14
  }, vt = (t, e) => {
15
15
  const n = e.commonAncestorContainer;
16
16
  return !Y(t, n);
17
- }, Tt = (t) => t.addEventListener("click", (e) => {
17
+ }, xt = (t) => t.addEventListener("click", (e) => {
18
18
  // Allow clicks within not-annotatable elements
19
19
  !e.target.closest(K) && !e.target.closest("a") && e.preventDefault();
20
20
  }), q = (t) => ({
@@ -59,7 +59,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
59
59
  defaultPrevented: t.defaultPrevented,
60
60
  detail: t.detail,
61
61
  timeStamp: t.timeStamp
62
- }), xt = ct(), Rt = xt.os.is(lt.MACOS), Lt = (t) => {
62
+ }), Tt = ct(), Rt = Tt.os.is(lt.MACOS), Lt = (t) => {
63
63
  !t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
64
64
  }, D = (t, e = 10) => {
65
65
  let n;
@@ -110,20 +110,20 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
110
110
  s.setStartAfter(r), s.collapsed || n.push(s);
111
111
  }
112
112
  return n.length > 0 ? n : [e];
113
- }, G = (t) => {
113
+ }, Q = (t) => {
114
114
  const e = t.cloneContents();
115
115
  return e.querySelectorAll(K).forEach((n) => n.remove()), e;
116
116
  }, It = (t, e, n = 10, r) => {
117
117
  const s = r ? t.startContainer.parentElement.closest(r) : e, o = document.createRange();
118
118
  o.setStart(s, 0), o.setEnd(t.startContainer, t.startOffset);
119
- const i = G(o).textContent, a = document.createRange();
119
+ const i = Q(o).textContent, a = document.createRange();
120
120
  a.setStart(t.endContainer, t.endOffset), s === document.body ? a.setEnd(s, s.childNodes.length) : a.setEndAfter(s);
121
- const d = G(a).textContent;
121
+ const d = Q(a).textContent;
122
122
  return {
123
123
  prefix: i.substring(i.length - n),
124
124
  suffix: d.substring(0, n)
125
125
  };
126
- }, M = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Bt = /^\s*$/, Mt = (t) => Bt.test(t.toString()), Pt = (t, e, n, r) => {
126
+ }, H = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Bt = /^\s*$/, Ht = (t) => Bt.test(t.toString()), Mt = (t, e, n, r) => {
127
127
  const s = (a) => Math.round(a * 10) / 10, o = {
128
128
  top: s(t.top),
129
129
  bottom: s(t.bottom),
@@ -147,7 +147,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
147
147
  return "block-contains";
148
148
  } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
149
149
  return "block-is-contained";
150
- }, Ht = (t, e) => {
150
+ }, Pt = (t, e) => {
151
151
  const n = Math.min(t.left, e.left), r = Math.max(t.right, e.right), s = Math.min(t.top, e.top), o = Math.max(t.bottom, e.bottom);
152
152
  return new DOMRect(n, s, r - n, o - s);
153
153
  }, Ut = (t, e = 0.5, n = 0.5) => t.reduce((r, s) => {
@@ -155,9 +155,9 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
155
155
  return r;
156
156
  let o = [...r], i = !1;
157
157
  for (const a of r) {
158
- const d = Pt(s, a, e, n);
158
+ const d = Mt(s, a, e, n);
159
159
  if (d === "inline-adjacent") {
160
- o = o.map((p) => p === a ? Ht(s, a) : p), i = !0;
160
+ o = o.map((p) => p === a ? Pt(s, a) : p), i = !0;
161
161
  break;
162
162
  } else if (d === "inline-contains") {
163
163
  o = o.map((p) => p === a ? s : p), i = !0;
@@ -171,7 +171,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
171
171
  }
172
172
  }
173
173
  return i ? o : [...o, s];
174
- }, []), Ce = (t) => ({
174
+ }, []), Ee = (t) => ({
175
175
  length: t.length,
176
176
  item: (e) => t[e],
177
177
  [Symbol.iterator]: function* () {
@@ -181,7 +181,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
181
181
  }), _t = (t, e, n) => {
182
182
  const r = document.createRange(), s = n ? t.startContainer.parentElement.closest(n) : e;
183
183
  r.setStart(s, 0), r.setEnd(t.startContainer, t.startOffset);
184
- const o = G(r).textContent, i = t.toString(), a = o.length || 0, d = a + i.length;
184
+ const o = Q(r).textContent, i = t.toString(), a = o.length || 0, d = a + i.length;
185
185
  return n ? { quote: i, start: a, end: d, range: t, offsetReference: s } : { quote: i, start: a, end: d, range: t };
186
186
  }, st = (t, e) => {
187
187
  var b, f;
@@ -221,10 +221,10 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
221
221
  ...t,
222
222
  range: a
223
223
  };
224
- }, X = (t, e) => M(t.selector) ? t : {
224
+ }, X = (t, e) => H(t.selector) ? t : {
225
225
  ...t,
226
226
  selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : st(n, e))
227
- }, j = (t, e) => M(t.target.selector) ? t : { ...t, target: X(t.target, e) }, Ft = (t, e) => {
227
+ }, j = (t, e) => H(t.target.selector) ? t : { ...t, target: X(t.target, e) }, Ft = (t, e) => {
228
228
  const n = t.cloneRange();
229
229
  return e.contains(n.startContainer) || n.setStart(e, 0), e.contains(n.endContainer) || n.setEnd(e, e.childNodes.length), n;
230
230
  }, rt = (t) => {
@@ -234,7 +234,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
234
234
  return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : rt(t.parentElement);
235
235
  }, Dt = (t, e) => (n) => {
236
236
  const r = typeof n == "string" ? n : n.id, s = (b) => {
237
- const f = o.getBoundingClientRect(), c = o.clientHeight, g = o.clientWidth, R = b.selector[0].range.getBoundingClientRect(), { width: T, height: x } = e.getAnnotationBounds(r), E = R.top - f.top, A = R.left - f.left, u = o.parentElement ? o.scrollTop : 0, m = o.parentElement ? o.scrollLeft : 0, y = E + u - (c - x) / 2, l = A + m - (g - T) / 2;
237
+ const f = o.getBoundingClientRect(), c = o.clientHeight, g = o.clientWidth, R = b.selector[0].range.getBoundingClientRect(), { width: v, height: T } = e.getAnnotationBounds(r), x = R.top - f.top, w = R.left - f.left, u = o.parentElement ? o.scrollTop : 0, m = o.parentElement ? o.scrollLeft : 0, y = x + u - (c - T) / 2, l = w + m - (g - v) / 2;
238
238
  o.scroll({ top: y, left: l, behavior: "smooth" });
239
239
  }, o = rt(t);
240
240
  if (!o)
@@ -247,7 +247,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
247
247
  return s(i.target), !0;
248
248
  const d = X(i.target, t), { range: p } = d.selector[0];
249
249
  return p && !p.collapsed ? (s(d), !0) : !1;
250
- }, U = {
250
+ }, M = {
251
251
  fill: "rgb(0, 128, 255)",
252
252
  fillOpacity: 0.18
253
253
  }, z = {
@@ -255,7 +255,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
255
255
  fillOpacity: 0.45
256
256
  }, Kt = (t, e, n, r, s) => {
257
257
  var i, a;
258
- const o = n ? typeof n == "function" ? n(t.annotation, t.state, s) || ((i = t.state) != null && i.selected ? z : U) : n : (a = t.state) != null && a.selected ? z : U;
258
+ const o = n ? typeof n == "function" ? n(t.annotation, t.state, s) || ((i = t.state) != null && i.selected ? z : M) : n : (a = t.state) != null && a.selected ? z : M;
259
259
  return r && r.paint(t, e) || o;
260
260
  }, $t = (t) => {
261
261
  const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: r, innerHeight: s } = window, o = -n, i = -e, a = r - n, d = s - e;
@@ -266,22 +266,22 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
266
266
  const s = r.map((o) => o.id);
267
267
  (e.size !== s.length || s.some((o) => !e.has(o))) && t.set(s), e = new Set(s);
268
268
  };
269
- }, Q = (t, e, n, r) => {
269
+ }, Z = (t, e, n, r) => {
270
270
  const { store: s, selection: o, hover: i } = e;
271
271
  let a, d, p;
272
272
  const b = Vt(n), f = D((C) => {
273
- const { x: N, y: S } = t.getBoundingClientRect(), v = s.getAt(C.clientX - N, C.clientY - S, !1, d);
274
- v ? i.current !== v.id && (t.classList.add("hovered"), i.set(v.id)) : i.current && (t.classList.remove("hovered"), i.set(null));
273
+ const { x: N, y: S } = t.getBoundingClientRect(), A = s.getAt(C.clientX - N, C.clientY - S, !1, d);
274
+ A ? i.current !== A.id && (t.classList.add("hovered"), i.set(A.id)) : i.current && (t.classList.remove("hovered"), i.set(null));
275
275
  }, 10);
276
276
  t.addEventListener("pointermove", f);
277
277
  const c = D((C = !1) => requestAnimationFrame(() => {
278
278
  p && p.clear();
279
- const N = $t(t), { minX: S, minY: v, maxX: O, maxY: P } = N, k = d ? s.getIntersecting(S, v, O, P).filter(({ annotation: L }) => d(L)) : s.getIntersecting(S, v, O, P), I = o.selected.map(({ id: L }) => L), B = k.map(({ annotation: L, rects: _ }) => {
280
- const H = I.includes(L.id), Z = L.id === i.current;
279
+ const N = $t(t), { minX: S, minY: A, maxX: O, maxY: P } = N, k = d ? s.getIntersecting(S, A, O, P).filter(({ annotation: L }) => d(L)) : s.getIntersecting(S, A, O, P), I = o.selected.map(({ id: L }) => L), B = k.map(({ annotation: L, rects: _ }) => {
280
+ const U = I.includes(L.id), J = L.id === i.current;
281
281
  return {
282
282
  annotation: L,
283
283
  rects: _,
284
- state: { selected: H, hovered: Z }
284
+ state: { selected: U, hovered: J }
285
285
  };
286
286
  });
287
287
  r.redraw(B, N, a, p, C), setTimeout(() => b(k.map(({ annotation: L }) => L)), 1);
@@ -289,11 +289,11 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
289
289
  p = C, c();
290
290
  }, R = (C) => {
291
291
  a = C, c();
292
- }, T = (C) => {
292
+ }, v = (C) => {
293
293
  d = C, c(!1);
294
- }, x = () => c();
295
- s.observe(x);
296
- const E = o.subscribe(() => c()), A = i.subscribe(() => c()), u = () => c(!0);
294
+ }, T = () => c();
295
+ s.observe(T);
296
+ const x = o.subscribe(() => c()), w = i.subscribe(() => c()), u = () => c(!0);
297
297
  document.addEventListener("scroll", u, { capture: !0, passive: !0 });
298
298
  const m = D(() => {
299
299
  s.recalculatePositions(), p && p.reset(), c();
@@ -306,11 +306,11 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
306
306
  }, 150));
307
307
  return h.observe(document.body, l), {
308
308
  destroy: () => {
309
- t.removeEventListener("pointermove", f), r.destroy(), s.unobserve(x), E(), A(), document.removeEventListener("scroll", u), window.removeEventListener("resize", m), y.disconnect(), h.disconnect();
309
+ t.removeEventListener("pointermove", f), r.destroy(), s.unobserve(T), x(), w(), document.removeEventListener("scroll", u), window.removeEventListener("resize", m), y.disconnect(), h.disconnect();
310
310
  },
311
311
  redraw: c,
312
312
  setStyle: R,
313
- setFilter: T,
313
+ setFilter: v,
314
314
  setPainter: g,
315
315
  setVisible: r.setVisible
316
316
  };
@@ -327,24 +327,24 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
327
327
  const { width: f, height: c } = e;
328
328
  n.clearRect(-0.5, -0.5, f + 1, c + 1), b && b.clear();
329
329
  const { top: g, left: R } = d;
330
- [...a].sort((x, E) => {
331
- const { annotation: { target: { created: A } } } = x, { annotation: { target: { created: u } } } = E;
332
- return A.getTime() - u.getTime();
333
- }).forEach((x) => {
330
+ [...a].sort((T, x) => {
331
+ const { annotation: { target: { created: w } } } = T, { annotation: { target: { created: u } } } = x;
332
+ return w.getTime() - u.getTime();
333
+ }).forEach((T) => {
334
334
  var m;
335
- const E = p ? typeof p == "function" ? p(x.annotation, x.state) : p : (m = x.state) != null && m.selected ? z : U, A = b && b.paint(x, d) || E, u = x.rects.map(({ x: y, y: l, width: h, height: w }) => ({
335
+ const x = p ? typeof p == "function" ? p(T.annotation, T.state) : p : (m = T.state) != null && m.selected ? z : M, w = b && b.paint(T, d) || x, u = T.rects.map(({ x: y, y: l, width: h, height: E }) => ({
336
336
  x: y + R,
337
337
  y: l + g,
338
338
  width: h,
339
- height: w
339
+ height: E
340
340
  }));
341
- if (n.fillStyle = A.fill, n.globalAlpha = A.fillOpacity || 1, u.forEach(
342
- ({ x: y, y: l, width: h, height: w }) => n.fillRect(y, l, h, w)
343
- ), A.underlineColor) {
344
- n.globalAlpha = 1, n.strokeStyle = A.underlineColor, n.lineWidth = A.underlineThickness ?? 1;
345
- const y = A.underlineOffset ?? 0;
346
- u.forEach(({ x: l, y: h, width: w, height: C }) => {
347
- n.beginPath(), n.moveTo(l, h + C + y), n.lineTo(l + w, h + C + y), n.stroke();
341
+ if (n.fillStyle = w.fill, n.globalAlpha = w.fillOpacity || 1, u.forEach(
342
+ ({ x: y, y: l, width: h, height: E }) => n.fillRect(y, l, h, E)
343
+ ), w.underlineColor) {
344
+ n.globalAlpha = 1, n.strokeStyle = w.underlineColor, n.lineWidth = w.underlineThickness ?? 1;
345
+ const y = w.underlineOffset ?? 0;
346
+ u.forEach(({ x: l, y: h, width: E, height: C }) => {
347
+ n.beginPath(), n.moveTo(l, h + C + y), n.lineTo(l + E, h + C + y), n.stroke();
348
348
  });
349
349
  }
350
350
  });
@@ -360,8 +360,8 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
360
360
  },
361
361
  redraw: r
362
362
  };
363
- }, zt = (t, e, n) => Q(t, e, n, Xt(t)), qt = (t) => [
364
- `background-color:${et((t == null ? void 0 : t.fill) || U.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? U.fillOpacity : t.fillOpacity).toHex()}`,
363
+ }, zt = (t, e, n) => Z(t, e, n, Xt(t)), qt = (t) => [
364
+ `background-color:${G((t == null ? void 0 : t.fill) || M.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? M.fillOpacity : t.fillOpacity).toHex()}`,
365
365
  t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
366
366
  t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
367
367
  t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
@@ -383,7 +383,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
383
383
  Array.from(e).filter((f) => !p.has(f));
384
384
  const b = o.map((f) => {
385
385
  var R;
386
- const c = a ? typeof a == "function" ? a(f.annotation, f.state) : a : (R = f.state) != null && R.selected ? z : U, g = d && d.paint(f, i) || c;
386
+ const c = a ? typeof a == "function" ? a(f.annotation, f.state) : a : (R = f.state) != null && R.selected ? z : M, g = d && d.paint(f, i) || c;
387
387
  return `::highlight(_${f.annotation.id}) { ${qt(g)} }`;
388
388
  });
389
389
  t.innerHTML = b.join(`
@@ -393,10 +393,10 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
393
393
  }), e = p;
394
394
  }
395
395
  };
396
- }, Gt = (t, e, n) => Q(t, e, n, jt()), Qt = (t, e) => {
396
+ }, Gt = (t, e, n) => Z(t, e, n, jt()), Qt = (t) => (t == null ? void 0 : t.fillOpacity) !== void 0 ? G((t == null ? void 0 : t.fill) || M.fill).alpha(t.fillOpacity).toHex() : t != null && t.fill ? t.fill : G(M.fill).alpha(M.fillOpacity).toHex(), Zt = (t, e) => {
397
397
  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, a) => i + a.width, 0), s = e.filter(({ rects: o }) => o.some((i) => n(t, i)));
398
398
  return s.sort((o, i) => r(i) - r(o)), s.findIndex((o) => o.rects.includes(t));
399
- }, Zt = (t) => {
399
+ }, Jt = (t) => {
400
400
  t.classList.add("r6o-annotatable");
401
401
  const e = document.createElement("div");
402
402
  e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
@@ -408,15 +408,15 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
408
408
  redraw: (i, a, d, p, b) => {
409
409
  const c = !(dt(n, i) && b);
410
410
  if (!p && !c) return;
411
- c && (e.innerHTML = ""), [...i].sort((R, T) => {
412
- const { annotation: { target: { created: x } } } = R, { annotation: { target: { created: E } } } = T;
413
- return x && E ? x.getTime() - E.getTime() : 0;
411
+ c && (e.innerHTML = ""), [...i].sort((R, v) => {
412
+ const { annotation: { target: { created: T } } } = R, { annotation: { target: { created: x } } } = v;
413
+ return T && x ? T.getTime() - x.getTime() : 0;
414
414
  }).forEach((R) => {
415
- R.rects.map((T) => {
416
- const x = Qt(T, i), E = Kt(R, a, d, p, x);
415
+ R.rects.map((v) => {
416
+ const T = Zt(v, i), x = Kt(R, a, d, p, T);
417
417
  if (c) {
418
- const A = document.createElement("span");
419
- A.className = "r6o-annotation", A.dataset.annotation = R.annotation.id, A.style.left = `${T.x}px`, A.style.top = `${T.y}px`, A.style.width = `${T.width}px`, A.style.height = `${T.height}px`, A.style.backgroundColor = et((E == null ? void 0 : E.fill) || U.fill).alpha((E == null ? void 0 : E.fillOpacity) === void 0 ? U.fillOpacity : E.fillOpacity).toHex(), E.underlineStyle && (A.style.borderStyle = E.underlineStyle), E.underlineColor && (A.style.borderColor = E.underlineColor), E.underlineThickness && (A.style.borderBottomWidth = `${E.underlineThickness}px`), E.underlineOffset && (A.style.paddingBottom = `${E.underlineOffset}px`), e.appendChild(A);
418
+ const w = document.createElement("span");
419
+ w.className = "r6o-annotation", w.dataset.annotation = R.annotation.id, w.style.left = `${v.x}px`, w.style.top = `${v.y}px`, w.style.width = `${v.width}px`, w.style.height = `${v.height}px`, w.style.backgroundColor = Qt(x), x.underlineStyle && (w.style.borderStyle = x.underlineStyle), x.underlineColor && (w.style.borderColor = x.underlineColor), x.underlineThickness && (w.style.borderBottomWidth = `${x.underlineThickness}px`), x.underlineOffset && (w.style.paddingBottom = `${x.underlineOffset}px`), e.appendChild(w);
420
420
  }
421
421
  });
422
422
  }), n = i;
@@ -425,10 +425,10 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
425
425
  i ? e.classList.remove("hidden") : e.classList.add("hidden");
426
426
  }
427
427
  };
428
- }, Jt = (t, e, n) => Q(t, e, n, Zt(t)), Ee = (t, e) => ({
429
- parse: (n) => ne(n),
430
- serialize: (n) => oe(n, t, e)
431
- }), te = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, ee = (t) => {
428
+ }, te = (t, e, n) => Z(t, e, n, Jt(t)), we = (t, e) => ({
429
+ parse: (n) => oe(n),
430
+ serialize: (n) => se(n, t, e)
431
+ }), ee = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, ne = (t) => {
432
432
  const {
433
433
  id: e,
434
434
  creator: n,
@@ -459,7 +459,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
459
459
  }
460
460
  return f;
461
461
  }, {});
462
- if (te(b))
462
+ if (ee(b))
463
463
  a.selector.push(
464
464
  {
465
465
  ...b,
@@ -477,14 +477,14 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
477
477
  }
478
478
  }
479
479
  return { parsed: a };
480
- }, ne = (t) => {
480
+ }, oe = (t) => {
481
481
  const e = t.id || nt(), {
482
482
  creator: n,
483
483
  created: r,
484
484
  modified: s,
485
485
  body: o,
486
486
  ...i
487
- } = t, a = ut(o, e), d = ee(t);
487
+ } = t, a = ut(o, e), d = ne(t);
488
488
  return "error" in d ? { error: d.error } : {
489
489
  parsed: {
490
490
  ...i,
@@ -493,7 +493,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
493
493
  target: d.parsed
494
494
  }
495
495
  };
496
- }, oe = (t, e, n) => {
496
+ }, se = (t, e, n) => {
497
497
  const { bodies: r, target: s, ...o } = t, {
498
498
  selector: i,
499
499
  creator: a,
@@ -501,18 +501,18 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
501
501
  updated: p,
502
502
  ...b
503
503
  } = s, f = i.map((c) => {
504
- const { id: g, quote: R, start: T, end: x, range: E } = c, A = {
504
+ const { id: g, quote: R, start: v, end: T, range: x } = c, w = {
505
505
  type: "TextQuoteSelector",
506
506
  exact: R
507
507
  };
508
508
  if (n) {
509
- const { prefix: m, suffix: y } = It(E, n);
510
- A.prefix = m, A.suffix = y;
509
+ const { prefix: m, suffix: y } = It(x, n);
510
+ w.prefix = m, w.suffix = y;
511
511
  }
512
512
  const u = {
513
513
  type: "TextPositionSelector",
514
- start: T,
515
- end: x
514
+ start: v,
515
+ end: T
516
516
  };
517
517
  return {
518
518
  ...b,
@@ -520,7 +520,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
520
520
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
521
521
  scope: "scope" in c ? c.scope : void 0,
522
522
  source: e,
523
- selector: [A, u]
523
+ selector: [w, u]
524
524
  };
525
525
  });
526
526
  return {
@@ -534,18 +534,18 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
534
534
  modified: p == null ? void 0 : p.toISOString(),
535
535
  target: f
536
536
  };
537
- }, se = (t, e, n, r) => {
537
+ }, re = (t, e, n, r) => {
538
538
  const s = new wt(), o = /* @__PURE__ */ new Map(), i = (u, m) => {
539
539
  const y = u.selector.flatMap((h) => {
540
- const w = M([h]) ? h.range : st(h, e).range;
541
- return Nt(w);
542
- }), l = Ut(y, n, r).map(({ left: h, top: w, right: C, bottom: N }) => new DOMRect(h - m.left, w - m.top, C - h, N - w));
540
+ const E = H([h]) ? h.range : st(h, e).range;
541
+ return Nt(E);
542
+ }), l = Ut(y, n, r).map(({ left: h, top: E, right: C, bottom: N }) => new DOMRect(h - m.left, E - m.top, C - h, N - E));
543
543
  return l.map((h) => {
544
- const { x: w, y: C, width: N, height: S } = h;
544
+ const { x: E, y: C, width: N, height: S } = h;
545
545
  return {
546
- minX: w,
546
+ minX: E,
547
547
  minY: C,
548
- maxX: w + N,
548
+ maxX: E + N,
549
549
  maxY: C + S,
550
550
  annotation: {
551
551
  id: u.annotation,
@@ -565,11 +565,11 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
565
565
  b(u), p(u);
566
566
  }, c = (u, m = !0) => {
567
567
  m && d();
568
- const y = e.getBoundingClientRect(), l = u.map((w) => ({ target: w, rects: i(w, y) }));
569
- l.forEach(({ target: w, rects: C }) => {
570
- C.length > 0 && o.set(w.annotation, C);
568
+ const y = e.getBoundingClientRect(), l = u.map((E) => ({ target: E, rects: i(E, y) }));
569
+ l.forEach(({ target: E, rects: C }) => {
570
+ C.length > 0 && o.set(E.annotation, C);
571
571
  });
572
- const h = l.flatMap(({ rects: w }) => w);
572
+ const h = l.flatMap(({ rects: E }) => E);
573
573
  s.load(h);
574
574
  }, g = (u, m, y = !1) => {
575
575
  const l = s.search({
@@ -577,19 +577,19 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
577
577
  minY: m,
578
578
  maxX: u,
579
579
  maxY: m
580
- }), h = (w) => w.annotation.rects.reduce((C, N) => C + N.width * N.height, 0);
581
- return l.length > 0 ? (l.sort((w, C) => h(w) - h(C)), y ? l.map((w) => w.annotation.id) : [l[0].annotation.id]) : [];
580
+ }), h = (E) => E.annotation.rects.reduce((C, N) => C + N.width * N.height, 0);
581
+ return l.length > 0 ? (l.sort((E, C) => h(E) - h(C)), y ? l.map((E) => E.annotation.id) : [l[0].annotation.id]) : [];
582
582
  }, R = (u) => {
583
- const m = T(u);
583
+ const m = v(u);
584
584
  if (m.length === 0)
585
585
  return;
586
- let y = m[0].left, l = m[0].top, h = m[0].right, w = m[0].bottom;
586
+ let y = m[0].left, l = m[0].top, h = m[0].right, E = m[0].bottom;
587
587
  for (let C = 1; C < m.length; C++) {
588
588
  const N = m[C];
589
- y = Math.min(y, N.left), l = Math.min(l, N.top), h = Math.max(h, N.right), w = Math.max(w, N.bottom);
589
+ y = Math.min(y, N.left), l = Math.min(l, N.top), h = Math.max(h, N.right), E = Math.max(E, N.bottom);
590
590
  }
591
- return new DOMRect(y, l, h - y, w - l);
592
- }, T = (u) => {
591
+ return new DOMRect(y, l, h - y, E - l);
592
+ }, v = (u) => {
593
593
  const m = o.get(u);
594
594
  return m ? m[0].annotation.rects : [];
595
595
  };
@@ -598,12 +598,12 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
598
598
  clear: d,
599
599
  getAt: g,
600
600
  getAnnotationBounds: R,
601
- getAnnotationRects: T,
601
+ getAnnotationRects: v,
602
602
  getIntersecting: (u, m, y, l) => {
603
- const h = s.search({ minX: u, minY: m, maxX: y, maxY: l }), w = new Set(h.map((C) => C.annotation.id));
604
- return Array.from(w).map((C) => ({
603
+ const h = s.search({ minX: u, minY: m, maxX: y, maxY: l }), E = new Set(h.map((C) => C.annotation.id));
604
+ return Array.from(E).map((C) => ({
605
605
  annotation: t.getAnnotation(C),
606
- rects: T(C)
606
+ rects: v(C)
607
607
  })).filter((C) => !!C.annotation);
608
608
  },
609
609
  insert: p,
@@ -613,16 +613,16 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
613
613
  size: () => s.all().length,
614
614
  update: f
615
615
  };
616
- }, re = (t, e) => {
617
- var E, A;
618
- const n = mt(), r = se(n, t, (E = e.mergeHighlights) == null ? void 0 : E.horizontalTolerance, (A = e.mergeHighlights) == null ? void 0 : A.verticalTolerance), s = pt(n, e.userSelectAction, e.adapter), o = ht(n), i = yt(), a = (u, m = F.LOCAL) => {
619
- const y = j(u, t), l = M(y.target.selector);
616
+ }, ie = (t, e) => {
617
+ var x, w;
618
+ const n = mt(), r = re(n, t, (x = e.mergeHighlights) == null ? void 0 : x.horizontalTolerance, (w = e.mergeHighlights) == null ? void 0 : w.verticalTolerance), s = pt(n, e.userSelectAction, e.adapter), o = ht(n), i = yt(), a = (u, m = F.LOCAL) => {
619
+ const y = j(u, t), l = H(y.target.selector);
620
620
  return l && n.addAnnotation(y, m), l;
621
621
  }, d = (u, m = !0, y = F.LOCAL) => {
622
- const l = u.map((w) => j(w, t)), h = l.filter((w) => !M(w.target.selector));
622
+ const l = u.map((E) => j(E, t)), h = l.filter((E) => !H(E.target.selector));
623
623
  return n.bulkAddAnnotations(l, m, y), h;
624
624
  }, p = (u, m = F.LOCAL) => {
625
- const y = u.map((h) => j(h, t)), l = y.filter((h) => !M(h.target.selector));
625
+ const y = u.map((h) => j(h, t)), l = y.filter((h) => !H(h.target.selector));
626
626
  return y.forEach((h) => {
627
627
  n.getAnnotation(h.id) ? n.updateAnnotation(h, m) : n.addAnnotation(h, m);
628
628
  }), l;
@@ -634,16 +634,16 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
634
634
  n.bulkUpdateTargets(y, m);
635
635
  };
636
636
  function c(u, m, y, l) {
637
- const h = y || !!l, w = r.getAt(u, m, h).map((N) => n.getAnnotation(N)), C = l ? w.filter(l) : w;
637
+ const h = y || !!l, E = r.getAt(u, m, h).map((N) => n.getAnnotation(N)), C = l ? E.filter(l) : E;
638
638
  if (C.length !== 0)
639
639
  return y ? C : C[0];
640
640
  }
641
641
  const g = (u) => {
642
642
  if (r.getAnnotationRects(u).length !== 0)
643
643
  return r.getAnnotationBounds(u);
644
- }, R = (u, m, y, l) => r.getIntersecting(u, m, y, l), T = (u) => r.getAnnotationRects(u), x = () => r.recalculate();
644
+ }, R = (u, m, y, l) => r.getIntersecting(u, m, y, l), v = (u) => r.getAnnotationRects(u), T = () => r.recalculate();
645
645
  return n.observe(({ changes: u }) => {
646
- const m = (u.deleted || []).filter((h) => M(h.target.selector)), y = (u.created || []).filter((h) => M(h.target.selector)), l = (u.updated || []).filter((h) => M(h.newValue.target.selector));
646
+ const m = (u.deleted || []).filter((h) => H(h.target.selector)), y = (u.created || []).filter((h) => H(h.target.selector)), l = (u.updated || []).filter((h) => H(h.newValue.target.selector));
647
647
  (m == null ? void 0 : m.length) > 0 && m.forEach((h) => r.remove(h.target)), y.length > 0 && r.set(y.map((h) => h.target), !1), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: h }) => r.update(h.target));
648
648
  }), {
649
649
  store: {
@@ -653,23 +653,23 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
653
653
  bulkUpdateTargets: f,
654
654
  bulkUpsertAnnotations: p,
655
655
  getAnnotationBounds: g,
656
- getAnnotationRects: T,
656
+ getAnnotationRects: v,
657
657
  getIntersecting: R,
658
658
  getAt: c,
659
- recalculatePositions: x,
659
+ recalculatePositions: T,
660
660
  updateTarget: b
661
661
  },
662
662
  selection: s,
663
663
  hover: o,
664
664
  viewport: i
665
665
  };
666
- }, ie = () => {
666
+ }, ae = () => {
667
667
  const t = document.createElement("canvas");
668
668
  t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
669
669
  const e = t.getContext("2d");
670
670
  return e.scale(2, 2), e.translate(0.5, 0.5), t;
671
- }, ae = (t, e = {}) => {
672
- const n = ie(), r = n.getContext("2d");
671
+ }, ce = (t, e = {}) => {
672
+ const n = ae(), r = n.getContext("2d");
673
673
  document.body.appendChild(n);
674
674
  const s = /* @__PURE__ */ new Map(), o = (b) => Array.from(s.entries()).filter(([f, c]) => c.presenceKey === b.presenceKey).map(([f, c]) => f);
675
675
  return t.on("selectionChange", (b, f) => {
@@ -686,10 +686,10 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
686
686
  e.font && (r.font = e.font);
687
687
  const g = s.get(b.annotation.id);
688
688
  if (g) {
689
- const { height: R } = b.rects[0], T = b.rects[0].x + f.left, x = b.rects[0].y + f.top;
690
- r.fillStyle = g.appearance.color, r.fillRect(T - 2, x - 2.5, 2, R + 5);
691
- const E = r.measureText(g.appearance.label), A = E.width + 6, u = E.actualBoundingBoxAscent + E.actualBoundingBoxDescent + 8, m = E.fontBoundingBoxAscent ? 8 : 6.5;
692
- return r.fillRect(T - 2, x - 2.5 - u, A, u), r.fillStyle = "#fff", r.fillText(g.appearance.label, T + 1, x - m), {
689
+ const { height: R } = b.rects[0], v = b.rects[0].x + f.left, T = b.rects[0].y + f.top;
690
+ r.fillStyle = g.appearance.color, r.fillRect(v - 2, T - 2.5, 2, R + 5);
691
+ const x = r.measureText(g.appearance.label), w = x.width + 6, u = x.actualBoundingBoxAscent + x.actualBoundingBoxDescent + 8, m = x.fontBoundingBoxAscent ? 8 : 6.5;
692
+ return r.fillRect(v - 2, T - 2.5 - u, w, u), r.fillStyle = "#fff", r.fillText(g.appearance.label, v + 1, T - m), {
693
693
  fill: g.appearance.color,
694
694
  fillOpacity: c ? 0.45 : 0.18
695
695
  };
@@ -701,10 +701,10 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
701
701
  b.scale(2, 2), b.translate(0.5, 0.5);
702
702
  }
703
703
  };
704
- }, J = 300, it = ["up", "down", "left", "right"], at = Rt ? "⌘+a" : "ctrl+a", ce = [
704
+ }, tt = 300, it = ["up", "down", "left", "right"], at = Rt ? "⌘+a" : "ctrl+a", le = [
705
705
  ...it.map((t) => `shift+${t}`),
706
706
  at
707
- ], le = (t, e, n) => {
707
+ ], de = (t, e, n) => {
708
708
  let r;
709
709
  const {
710
710
  annotatingEnabled: s,
@@ -714,100 +714,100 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
714
714
  } = n, d = (S) => r = S;
715
715
  let p;
716
716
  const b = (S) => p = S, { store: f, selection: c } = e;
717
- let g, R, T;
718
- const x = () => {
717
+ let g, R, v;
718
+ const T = () => {
719
719
  R !== !1 && (g = {
720
720
  annotation: nt(),
721
721
  selector: [],
722
722
  creator: r,
723
723
  created: /* @__PURE__ */ new Date()
724
724
  });
725
- }, E = D((S) => {
726
- const v = document.getSelection();
727
- if (!(v != null && v.anchorNode))
725
+ }, x = D((S) => {
726
+ const A = document.getSelection();
727
+ if (!(A != null && A.anchorNode))
728
728
  return;
729
- const O = Array.from(Array(v.rangeCount).keys()).map((L) => v.getRangeAt(L));
729
+ const O = Array.from(Array(A.rangeCount).keys()).map((L) => A.getRangeAt(L));
730
730
  if (!O.some((L) => L.intersectsNode(t))) {
731
731
  g = void 0;
732
732
  return;
733
733
  }
734
- const P = S.timeStamp - ((T == null ? void 0 : T.timeStamp) || S.timeStamp);
735
- if ((T == null ? void 0 : T.type) === "pointerdown" && (P < 1e3 && !g || v.isCollapsed && P < J) && x(), !g) return;
736
- if (v.isCollapsed) {
734
+ const P = S.timeStamp - ((v == null ? void 0 : v.timeStamp) || S.timeStamp);
735
+ if ((v == null ? void 0 : v.type) === "pointerdown" && (P < 1e3 && !g || A.isCollapsed && P < tt) && T(), !g) return;
736
+ if (A.isCollapsed) {
737
737
  f.getAnnotation(g.annotation) && (c.clear(), f.deleteAnnotation(g.annotation));
738
738
  return;
739
739
  }
740
740
  const k = O.map((L) => Ft(L, t));
741
- if (k.every((L) => Mt(L))) return;
741
+ if (k.every((L) => Ht(L))) return;
742
742
  const I = k.flatMap((L) => kt(t, L.cloneRange()));
743
743
  (I.length !== g.selector.length || I.some((L, _) => {
744
- var H;
745
- return L.toString() !== ((H = g.selector[_]) == null ? void 0 : H.quote);
744
+ var U;
745
+ return L.toString() !== ((U = g.selector[_]) == null ? void 0 : U.quote);
746
746
  })) && (g = {
747
747
  ...g,
748
748
  selector: I.map((L) => _t(L, t, o)),
749
749
  updated: /* @__PURE__ */ new Date()
750
750
  }, f.getAnnotation(g.annotation) ? f.updateTarget(g, F.LOCAL) : c.clear());
751
- }), A = (S) => {
752
- T = q(S), R = T.button === 0;
751
+ }), w = (S) => {
752
+ v = q(S), R = v.button === 0;
753
753
  }, u = async (S) => {
754
754
  if (!R) return;
755
- const v = q(S), O = () => {
755
+ const A = q(S), O = () => {
756
756
  const { x: k, y: I } = t.getBoundingClientRect();
757
- if (Y(t, v.target)) {
758
- (typeof a == "function" ? a(v, t) : a === "ALWAYS") && c.clear();
757
+ if (Y(t, A.target)) {
758
+ (typeof a == "function" ? a(A, t) : a === "ALWAYS") && c.clear();
759
759
  return;
760
760
  }
761
- const B = v.target instanceof Node && t.contains(v.target) && f.getAt(
762
- v.clientX - k,
763
- v.clientY - I,
761
+ const B = A.target instanceof Node && t.contains(A.target) && f.getAt(
762
+ A.clientX - k,
763
+ A.clientY - I,
764
764
  i === "all",
765
765
  p
766
766
  );
767
767
  if (B) {
768
- const { selected: L } = c, _ = new Set(L.map(($) => $.id)), H = Array.isArray(B) ? B.map(($) => $.id) : [B.id];
769
- (_.size !== H.length || !H.every(($) => _.has($))) && c.userSelect(H, v);
768
+ const { selected: L } = c, _ = new Set(L.map(($) => $.id)), U = Array.isArray(B) ? B.map(($) => $.id) : [B.id];
769
+ (_.size !== U.length || !U.every(($) => _.has($))) && c.userSelect(U, A);
770
770
  } else
771
771
  c.clear();
772
772
  };
773
- if (v.timeStamp - T.timeStamp < J) {
773
+ if (A.timeStamp - v.timeStamp < tt) {
774
774
  await m();
775
- const k = document.getSelection(), I = Y(t, T.target), B = Y(t, v.target);
775
+ const k = document.getSelection(), I = Y(t, v.target), B = Y(t, A.target);
776
776
  if (k != null && k.isCollapsed || I && B) {
777
777
  g = void 0, O();
778
778
  return;
779
779
  }
780
780
  }
781
- g && g.selector.length > 0 && (C(), c.userSelect(g.annotation, v));
781
+ g && g.selector.length > 0 && (C(), c.userSelect(g.annotation, A));
782
782
  }, m = async () => {
783
783
  const S = document.getSelection();
784
- let v = !1, O = S == null ? void 0 : S.isCollapsed;
785
- const P = () => O || v, k = 1;
786
- return setTimeout(() => v = !0, 50), At(() => O = S == null ? void 0 : S.isCollapsed, k, P);
784
+ let A = !1, O = S == null ? void 0 : S.isCollapsed;
785
+ const P = () => O || A, k = 1;
786
+ return setTimeout(() => A = !0, 50), At(() => O = S == null ? void 0 : S.isCollapsed, k, P);
787
787
  }, y = (S) => {
788
- const v = document.getSelection();
789
- v != null && v.isCollapsed || ((!g || g.selector.length === 0) && E(S), g && (C(), c.userSelect(g.annotation, q(S))));
788
+ const A = document.getSelection();
789
+ A != null && A.isCollapsed || ((!g || g.selector.length === 0) && x(S), g && (C(), c.userSelect(g.annotation, q(S))));
790
790
  }, l = (S) => {
791
791
  S.key === "Shift" && g && (document.getSelection().isCollapsed || (C(), c.userSelect(g.annotation, W(S))));
792
792
  }, h = (S) => {
793
- const v = () => setTimeout(() => {
793
+ const A = () => setTimeout(() => {
794
794
  (g == null ? void 0 : g.selector.length) > 0 && (c.clear(), f.addAnnotation({
795
795
  id: g.annotation,
796
796
  bodies: [],
797
797
  target: g
798
- }), c.userSelect(g.annotation, W(S))), document.removeEventListener("selectionchange", v);
798
+ }), c.userSelect(g.annotation, W(S))), document.removeEventListener("selectionchange", A);
799
799
  }, 100);
800
- document.addEventListener("selectionchange", v), x();
800
+ document.addEventListener("selectionchange", A), T();
801
801
  };
802
- V(ce.join(","), { element: t, keydown: !0, keyup: !1 }, (S) => {
803
- S.repeat || (T = W(S));
802
+ V(le.join(","), { element: t, keydown: !0, keyup: !1 }, (S) => {
803
+ S.repeat || (v = W(S));
804
804
  }), V(at, { keydown: !0, keyup: !1 }, (S) => {
805
- T = W(S), h(S);
805
+ v = W(S), h(S);
806
806
  });
807
- const w = (S) => {
807
+ const E = (S) => {
808
808
  S.repeat || S.target !== t && S.target !== document.body || (g = void 0, c.clear());
809
809
  };
810
- V(it.join(","), { keydown: !0, keyup: !1 }, w);
810
+ V(it.join(","), { keydown: !0, keyup: !1 }, E);
811
811
  const C = () => {
812
812
  const S = f.getAnnotation(g.annotation);
813
813
  if (!S) {
@@ -818,32 +818,32 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
818
818
  });
819
819
  return;
820
820
  }
821
- const { target: { updated: v } } = S, { updated: O } = g;
822
- (!v || !O || v < O) && f.updateTarget(g);
821
+ const { target: { updated: A } } = S, { updated: O } = g;
822
+ (!A || !O || A < O) && f.updateTarget(g);
823
823
  };
824
- return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", u), document.addEventListener("contextmenu", y), s && (t.addEventListener("keyup", l), t.addEventListener("selectstart", x), document.addEventListener("selectionchange", E)), {
824
+ return document.addEventListener("pointerdown", w), document.addEventListener("pointerup", u), document.addEventListener("contextmenu", y), s && (t.addEventListener("keyup", l), t.addEventListener("selectstart", T), document.addEventListener("selectionchange", x)), {
825
825
  destroy: () => {
826
- document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", u), document.removeEventListener("contextmenu", y), t.removeEventListener("keyup", l), t.removeEventListener("selectstart", x), document.removeEventListener("selectionchange", E), V.unbind();
826
+ document.removeEventListener("pointerdown", w), document.removeEventListener("pointerup", u), document.removeEventListener("contextmenu", y), t.removeEventListener("keyup", l), t.removeEventListener("selectstart", T), document.removeEventListener("selectionchange", x), V.unbind();
827
827
  },
828
828
  setFilter: b,
829
829
  setUser: d
830
830
  };
831
- }, de = (t, e) => ({
831
+ }, fe = (t, e) => ({
832
832
  ...t,
833
833
  annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
834
834
  user: t.user || e.user
835
- }), tt = "SPANS", we = (t, e = {}) => {
836
- Tt(t), Lt(t);
837
- const n = de(e, {
835
+ }), et = "SPANS", Ae = (t, e = {}) => {
836
+ xt(t), Lt(t);
837
+ const n = fe(e, {
838
838
  annotatingEnabled: !0,
839
839
  user: bt()
840
- }), r = re(t, n), { selection: s, viewport: o } = r, i = r.store, a = St(i), d = Ct(r, a, n.adapter);
840
+ }), r = ie(t, n), { selection: s, viewport: o } = r, i = r.store, a = St(i), d = Ct(r, a, n.adapter);
841
841
  let p = n.user;
842
- const b = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : tt : n.renderer || tt, f = b === "SPANS" ? Jt(t, r, o) : b === "CSS_HIGHLIGHTS" ? Gt(t, r, o) : b === "CANVAS" ? zt(t, r, o) : void 0;
842
+ const b = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : et : n.renderer || et, f = b === "SPANS" ? te(t, r, o) : b === "CSS_HIGHLIGHTS" ? Gt(t, r, o) : b === "CANVAS" ? zt(t, r, o) : void 0;
843
843
  if (!f)
844
844
  throw `Unknown renderer implementation: ${b}`;
845
845
  console.debug(`Using ${b} renderer`), n.style && f.setStyle(n.style);
846
- const c = le(t, r, n);
846
+ const c = de(t, r, n);
847
847
  return c.setUser(p), {
848
848
  ...Et(r, a, n.adapter),
849
849
  destroy: () => {
@@ -862,7 +862,7 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
862
862
  l ? s.setSelected(l) : s.clear();
863
863
  },
864
864
  setPresenceProvider: (l) => {
865
- l && (f.setPainter(ae(l, n.presence)), l.on("selectionChange", () => f.redraw()));
865
+ l && (f.setPainter(ce(l, n.presence)), l.on("selectionChange", () => f.redraw()));
866
866
  },
867
867
  setVisible: (l) => f.setVisible(l),
868
868
  on: d.on,
@@ -873,46 +873,46 @@ const ot = "not-annotatable", K = `.${ot}`, Y = (t, e) => {
873
873
  };
874
874
  export {
875
875
  z as DEFAULT_SELECTED_STYLE,
876
- U as DEFAULT_STYLE,
876
+ M as DEFAULT_STYLE,
877
877
  ot as NOT_ANNOTATABLE_CLASS,
878
878
  K as NOT_ANNOTATABLE_SELECTOR,
879
879
  Te as Origin,
880
- le as SelectionHandler,
881
- xe as UserSelectAction,
882
- Ee as W3CTextFormat,
883
- Tt as cancelSingleClickEvents,
880
+ de as SelectionHandler,
881
+ Re as UserSelectAction,
882
+ we as W3CTextFormat,
883
+ xt as cancelSingleClickEvents,
884
884
  W as cloneKeyboardEvent,
885
885
  q as clonePointerEvent,
886
- Re as createBody,
886
+ Le as createBody,
887
887
  zt as createCanvasRenderer,
888
888
  Gt as createHighlightsRenderer,
889
- ae as createPresencePainter,
889
+ ce as createPresencePainter,
890
890
  jt as createRenderer,
891
- Jt as createSpansRenderer,
892
- we as createTextAnnotator,
893
- re as createTextAnnotatorState,
891
+ te as createSpansRenderer,
892
+ Ae as createTextAnnotator,
893
+ ie as createTextAnnotatorState,
894
894
  D as debounce,
895
- de as fillDefaults,
895
+ fe as fillDefaults,
896
896
  Nt as getHighlightClientRects,
897
897
  It as getQuoteContext,
898
- G as getRangeAnnotatableContents,
898
+ Q as getRangeAnnotatableContents,
899
899
  Rt as isMac,
900
900
  Y as isNotAnnotatable,
901
901
  vt as isRangeAnnotatable,
902
- M as isRevived,
903
- Mt as isWhitespaceOrEmpty,
902
+ H as isRevived,
903
+ Ht as isWhitespaceOrEmpty,
904
904
  Ut as mergeClientRects,
905
905
  Kt as paint,
906
- ne as parseW3CTextAnnotation,
906
+ oe as parseW3CTextAnnotation,
907
907
  Lt as programmaticallyFocusable,
908
908
  _t as rangeToSelector,
909
909
  j as reviveAnnotation,
910
910
  st as reviveSelector,
911
911
  X as reviveTarget,
912
912
  Dt as scrollIntoView,
913
- oe as serializeW3CTextAnnotation,
913
+ se as serializeW3CTextAnnotation,
914
914
  kt as splitAnnotatableRanges,
915
- Ce as toDomRectList,
915
+ Ee as toDomRectList,
916
916
  Ft as trimRangeToContainer,
917
917
  Bt as whitespaceOrEmptyRegex
918
918
  };