@recogito/text-annotator 4.2.1 → 4.2.3

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