@soomo/text-annotator 3.0.0-staging.32 → 3.0.0-staging.34

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.
@@ -37,17 +37,17 @@ const q = {
37
37
  }, Rt = (e) => {
38
38
  const t = e.cloneContents();
39
39
  return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
40
- }, Te = (e) => e.addEventListener("click", (t) => {
40
+ }, Ee = (e) => e.addEventListener("click", (t) => {
41
41
  // Allow clicks within not-annotatable elements
42
42
  !t.target.closest(Y) && !t.target.closest("a") && t.preventDefault();
43
- }), Ee = (e) => {
43
+ }), Te = (e) => {
44
44
  !e.hasAttribute("tabindex") && e.tabIndex < 0 && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
45
45
  }, It = (e, t = 10) => {
46
46
  let n;
47
47
  return (...o) => {
48
48
  clearTimeout(n), n = setTimeout(() => e.apply(void 0, o), t);
49
49
  };
50
- }, Ao = (e) => {
50
+ }, vo = (e) => {
51
51
  const t = e.cloneContents();
52
52
  return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
53
53
  }, Dt = (e, t) => {
@@ -71,31 +71,31 @@ const q = {
71
71
  startOffset: o,
72
72
  endContainer: i,
73
73
  endOffset: r
74
- } = e, s = Array.from(t.childNodes).map((c) => {
75
- const m = c.cloneNode(!0);
76
- return c.nodeName === "CANVAS" ? c : m;
77
- }), a = Dt(n, t), u = Dt(i, t), p = () => {
78
- const c = t;
79
- c.replaceChildren(...s);
80
- const m = yt(a, c), f = yt(u, c);
81
- return e.setStart(m, o), e.setEnd(f, r), e;
82
- }, h = (c) => {
74
+ } = e, s = Array.from(t.childNodes).map((l) => {
75
+ const m = l.cloneNode(!0);
76
+ return l.nodeName === "CANVAS" ? l : m;
77
+ }), a = Dt(n, t), d = Dt(i, t), f = () => {
78
+ const l = t;
79
+ l.replaceChildren(...s);
80
+ const m = yt(a, l), c = yt(d, l);
81
+ return e.setStart(m, o), e.setEnd(c, r), e;
82
+ }, g = (l) => {
83
83
  const m = document.createElement("SPAN");
84
- return c.surroundContents(m), m;
84
+ return l.surroundContents(m), m;
85
85
  };
86
86
  if (n === i)
87
87
  throw "Not implemented";
88
88
  {
89
- const c = document.createRange();
90
- c.selectNodeContents(n), c.setStart(n, o);
91
- const m = h(c), f = document.createRange();
92
- f.selectNode(i), f.setEnd(i, r);
93
- const v = h(f), w = Be(e).reverse().map((d) => {
94
- var g;
95
- const l = document.createElement("SPAN");
96
- return (g = d.parentNode) == null || g.insertBefore(l, d), l.appendChild(d), l;
89
+ const l = document.createRange();
90
+ l.selectNodeContents(n), l.setStart(n, o);
91
+ const m = g(l), c = document.createRange();
92
+ c.selectNode(i), c.setEnd(i, r);
93
+ const v = g(c), w = Be(e).reverse().map((p) => {
94
+ var A;
95
+ const u = document.createElement("SPAN");
96
+ return (A = p.parentNode) == null || A.insertBefore(u, p), u.appendChild(p), u;
97
97
  });
98
- return { unwrap: p, nodes: [m, ...w, v] };
98
+ return { unwrap: f, nodes: [m, ...w, v] };
99
99
  }
100
100
  }, Be = (e) => {
101
101
  const {
@@ -108,7 +108,7 @@ const q = {
108
108
  for (; r != null; )
109
109
  r === o && (s = !1), s && a.push(r), r === n && (s = !0), r = i.nextNode();
110
110
  return a;
111
- }, vo = (e) => {
111
+ }, So = (e) => {
112
112
  const { startContainer: t, endContainer: n } = e;
113
113
  if (t === n)
114
114
  return Array.from(e.getClientRects());
@@ -121,10 +121,10 @@ const q = {
121
121
  r.setStart(i, 0), r.setEnd(e.startContainer, e.startOffset);
122
122
  const s = Rt(r).textContent, a = document.createRange();
123
123
  a.setStart(e.endContainer, e.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
124
- const u = Rt(a).textContent;
124
+ const d = Rt(a).textContent;
125
125
  return {
126
126
  prefix: s.substring(s.length - n),
127
- suffix: u.substring(0, n)
127
+ suffix: d.substring(0, n)
128
128
  };
129
129
  }, Re = /^\s*$/, Ve = (e) => Re.test(e.toString()), W = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), Oe = (e, t) => {
130
130
  const n = (r) => Math.round(r * 10) / 10, o = {
@@ -174,7 +174,7 @@ const q = {
174
174
  }
175
175
  }
176
176
  return i ? o : [...o, n];
177
- }, []), So = (e) => ({
177
+ }, []), Co = (e) => ({
178
178
  length: e.length,
179
179
  item: (t) => e[t],
180
180
  [Symbol.iterator]: function* () {
@@ -184,41 +184,41 @@ const q = {
184
184
  }), Fe = (e, t, n) => {
185
185
  const o = document.createRange(), i = n ? e.startContainer.parentElement.closest(n) : t;
186
186
  o.setStart(i, 0), o.setEnd(e.startContainer, e.startOffset);
187
- const r = Rt(o).textContent, s = e.toString(), a = r.length || 0, u = a + s.length;
188
- return n ? { quote: s, start: a, end: u, range: e, offsetReference: i } : { quote: s, start: a, end: u, range: e };
187
+ const r = Rt(o).textContent, s = e.toString(), a = r.length || 0, d = a + s.length;
188
+ return n ? { quote: s, start: a, end: d, range: e, offsetReference: i } : { quote: s, start: a, end: d, range: e };
189
189
  }, oe = (e, t) => {
190
- var h, c;
190
+ var g, l;
191
191
  const { start: n, end: o } = e, i = e.offsetReference || t, r = document.createNodeIterator(
192
192
  t,
193
193
  NodeFilter.SHOW_TEXT,
194
194
  (m) => {
195
- var f;
196
- return (f = m.parentElement) != null && f.closest(Y) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
195
+ var c;
196
+ return (c = m.parentElement) != null && c.closest(Y) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
197
197
  }
198
198
  );
199
199
  let s = 0;
200
200
  const a = document.createRange();
201
- let u = r.nextNode();
202
- u === null && console.error("Could not revive annotation target. Content missing.");
203
- let p = !i;
204
- for (; u !== null; ) {
205
- if (p || (p = i == null ? void 0 : i.contains(u)), p) {
206
- const m = ((h = u.textContent) == null ? void 0 : h.length) || 0;
201
+ let d = r.nextNode();
202
+ d === null && console.error("Could not revive annotation target. Content missing.");
203
+ let f = !i;
204
+ for (; d !== null; ) {
205
+ if (f || (f = i == null ? void 0 : i.contains(d)), f) {
206
+ const m = ((g = d.textContent) == null ? void 0 : g.length) || 0;
207
207
  if (s + m > n) {
208
- a.setStart(u, n - s);
208
+ a.setStart(d, n - s);
209
209
  break;
210
210
  }
211
211
  s += m;
212
212
  }
213
- u = r.nextNode();
213
+ d = r.nextNode();
214
214
  }
215
- for (; u !== null; ) {
216
- const m = ((c = u.textContent) == null ? void 0 : c.length) || 0;
215
+ for (; d !== null; ) {
216
+ const m = ((l = d.textContent) == null ? void 0 : l.length) || 0;
217
217
  if (s + m >= o) {
218
- a.setEnd(u, o - s);
218
+ a.setEnd(d, o - s);
219
219
  break;
220
220
  }
221
- s += m, u = r.nextNode();
221
+ s += m, d = r.nextNode();
222
222
  }
223
223
  return {
224
224
  ...e,
@@ -230,7 +230,7 @@ const q = {
230
230
  }, bt = (e, t) => W(e.target.selector) ? e : { ...e, target: mt(e.target, t) }, Pe = (e, t) => {
231
231
  const { left: n, top: o, right: i, bottom: r } = e;
232
232
  return new DOMRect(n - t.left, o - t.top, i - n, r - o);
233
- }, Co = (e, t) => {
233
+ }, xo = (e, t) => {
234
234
  const { left: n, top: o, right: i, bottom: r } = e;
235
235
  return new DOMRect(n + t.left, o + t.top, i - n, r - o);
236
236
  }, De = (e) => ({
@@ -276,8 +276,8 @@ const q = {
276
276
  detail: e.detail,
277
277
  timeStamp: e.timeStamp
278
278
  }), Ue = (e) => {
279
- const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -t, a = o - n, u = i - t;
280
- return { top: t, left: n, minX: r, minY: s, maxX: a, maxY: u };
279
+ const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -t, a = o - n, d = i - t;
280
+ return { top: t, left: n, minX: r, minY: s, maxX: a, maxY: d };
281
281
  }, He = (e) => {
282
282
  let t = /* @__PURE__ */ new Set();
283
283
  return (o) => {
@@ -286,46 +286,46 @@ const q = {
286
286
  };
287
287
  }, Nt = (e, t, n, o) => {
288
288
  const { store: i, selection: r, hover: s } = t;
289
- let a, u, p;
290
- const h = He(n), c = (B) => {
291
- const { x: N, y: A } = e.getBoundingClientRect(), S = i.getAt(B.clientX - N, B.clientY - A, u);
289
+ let a, d, f;
290
+ const g = He(n), l = (T) => {
291
+ const { x: k, y: b } = e.getBoundingClientRect(), S = i.getAt(T.clientX - k, T.clientY - b, d);
292
292
  S ? s.current !== S.id && (e.classList.add("hovered"), s.set(S.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
293
293
  };
294
- e.addEventListener("pointermove", c);
295
- const m = (B = !1) => {
296
- p && p.clear();
297
- const N = Ue(e), { minX: A, minY: S, maxX: C, maxY: L } = N, k = u ? i.getIntersecting(A, S, C, L).filter(({ annotation: $ }) => u($)) : i.getIntersecting(A, S, C, L), I = r.selected.map(({ id: $ }) => $), z = k.map(({ annotation: $, rects: we }) => {
298
- const Ae = I.includes($.id), ve = $.id === s.current;
294
+ e.addEventListener("pointermove", l);
295
+ const m = (T = !1) => {
296
+ f && f.clear();
297
+ const k = Ue(e), { minX: b, minY: S, maxX: x, maxY: E } = k, B = d ? i.getIntersecting(b, S, x, E).filter(({ annotation: $ }) => d($)) : i.getIntersecting(b, S, x, E), N = r.selected.map(({ id: $ }) => $), z = B.map(({ annotation: $, rects: we }) => {
298
+ const Ae = N.includes($.id), ve = $.id === s.current;
299
299
  return { annotation: $, rects: we, state: { selected: Ae, hover: ve } };
300
300
  });
301
- o.redraw(z, N, a, p, B), setTimeout(() => h(k.map(({ annotation: $ }) => $)), 1);
302
- }, f = (B) => {
303
- p = B, m();
304
- }, v = (B) => {
305
- a = B, m();
306
- }, b = (B) => {
307
- u = B, m(!1);
301
+ o.redraw(z, k, a, f, T), setTimeout(() => g(B.map(({ annotation: $ }) => $)), 1);
302
+ }, c = (T) => {
303
+ f = T, m();
304
+ }, v = (T) => {
305
+ a = T, m();
306
+ }, C = (T) => {
307
+ d = T, m(!1);
308
308
  }, w = () => m();
309
309
  i.observe(w);
310
- const d = r.subscribe(() => m()), l = () => m(!0);
311
- document.addEventListener("scroll", l, { capture: !0, passive: !0 });
312
- const g = It(() => {
313
- i.recalculatePositions(), p && p.reset(), m();
310
+ const p = r.subscribe(() => m()), u = () => m(!0);
311
+ document.addEventListener("scroll", u, { capture: !0, passive: !0 });
312
+ const A = It(() => {
313
+ i.recalculatePositions(), f && f.reset(), m();
314
314
  });
315
- window.addEventListener("resize", g);
316
- const x = new ResizeObserver(g);
317
- x.observe(e);
318
- const T = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((B) => {
319
- B.every((A) => A.target === e || e.contains(A.target)) || m(!0);
315
+ window.addEventListener("resize", A);
316
+ const h = new ResizeObserver(A);
317
+ h.observe(e);
318
+ const L = { attributes: !0, childList: !0, subtree: !0 }, M = new MutationObserver((T) => {
319
+ T.every((b) => b.target === e || e.contains(b.target)) || m(!0);
320
320
  });
321
- return E.observe(document.body, T), {
321
+ return M.observe(document.body, L), {
322
322
  destroy: () => {
323
- e.removeEventListener("pointermove", c), o.destroy(), i.unobserve(w), d(), document.removeEventListener("scroll", l), window.removeEventListener("resize", g), x.disconnect(), E.disconnect();
323
+ e.removeEventListener("pointermove", l), o.destroy(), i.unobserve(w), p(), document.removeEventListener("scroll", u), window.removeEventListener("resize", A), h.disconnect(), M.disconnect();
324
324
  },
325
325
  redraw: m,
326
326
  setStyle: v,
327
- setFilter: b,
328
- setPainter: f,
327
+ setFilter: C,
328
+ setPainter: c,
329
329
  setVisible: o.setVisible
330
330
  };
331
331
  }, _e = () => {
@@ -337,28 +337,28 @@ const q = {
337
337
  e.classList.add("r6o-annotatable");
338
338
  const t = _e(), n = t.getContext("2d");
339
339
  document.body.appendChild(t);
340
- const o = (a, u, p, h) => requestAnimationFrame(() => {
341
- const { width: c, height: m } = t;
342
- n.clearRect(-0.5, -0.5, c + 1, m + 1), h && h.clear();
343
- const { top: f, left: v } = u;
344
- [...a].sort((w, d) => {
345
- const { annotation: { target: { created: l } } } = w, { annotation: { target: { created: g } } } = d;
346
- return l.getTime() - g.getTime();
340
+ const o = (a, d, f, g) => requestAnimationFrame(() => {
341
+ const { width: l, height: m } = t;
342
+ n.clearRect(-0.5, -0.5, l + 1, m + 1), g && g.clear();
343
+ const { top: c, left: v } = d;
344
+ [...a].sort((w, p) => {
345
+ const { annotation: { target: { created: u } } } = w, { annotation: { target: { created: A } } } = p;
346
+ return u.getTime() - A.getTime();
347
347
  }).forEach((w) => {
348
- var x;
349
- const d = p ? typeof p == "function" ? p(w.annotation, w.state) : p : (x = w.state) != null && x.selected ? gt : q, l = h && h.paint(w, u) || d, g = w.rects.map(({ x: T, y: E, width: M, height: B }) => ({
350
- x: T + v,
351
- y: E + f,
352
- width: M,
353
- height: B
348
+ var h;
349
+ const p = f ? typeof f == "function" ? f(w.annotation, w.state) : f : (h = w.state) != null && h.selected ? gt : q, u = g && g.paint(w, d) || p, A = w.rects.map(({ x: L, y: M, width: R, height: T }) => ({
350
+ x: L + v,
351
+ y: M + c,
352
+ width: R,
353
+ height: T
354
354
  }));
355
- if (n.fillStyle = l.fill, n.globalAlpha = l.fillOpacity || 1, g.forEach(
356
- ({ x: T, y: E, width: M, height: B }) => n.fillRect(T, E, M, B)
357
- ), l.underlineColor) {
358
- n.globalAlpha = 1, n.strokeStyle = l.underlineColor, n.lineWidth = l.underlineThickness ?? 1;
359
- const T = l.underlineOffset ?? 0;
360
- g.forEach(({ x: E, y: M, width: B, height: N }) => {
361
- n.beginPath(), n.moveTo(E, M + N + T), n.lineTo(E + B, M + N + T), n.stroke();
355
+ if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, A.forEach(
356
+ ({ x: L, y: M, width: R, height: T }) => n.fillRect(L, M, R, T)
357
+ ), u.underlineColor) {
358
+ n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
359
+ const L = u.underlineOffset ?? 0;
360
+ A.forEach(({ x: M, y: R, width: T, height: k }) => {
361
+ n.beginPath(), n.moveTo(M, R + k + L), n.lineTo(M + T, R + k + L), n.stroke();
362
362
  });
363
363
  }
364
364
  });
@@ -396,8 +396,8 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
396
396
  }, ae = function(e) {
397
397
  var t = e.h, n = e.s, o = e.v, i = e.a;
398
398
  t = t / 360 * 6, n /= 100, o /= 100;
399
- var r = Math.floor(t), s = o * (1 - n), a = o * (1 - (t - r) * n), u = o * (1 - (1 - t + r) * n), p = r % 6;
400
- return { r: 255 * [o, a, s, s, u, o][p], g: 255 * [u, o, o, a, s, s][p], b: 255 * [s, s, u, o, o, a][p], a: i };
399
+ var r = Math.floor(t), s = o * (1 - n), a = o * (1 - (t - r) * n), d = o * (1 - (1 - t + r) * n), f = r % 6;
400
+ return { r: 255 * [o, a, s, s, d, o][f], g: 255 * [d, o, o, a, s, s][f], b: 255 * [s, s, d, o, o, a][f], a: i };
401
401
  }, Ht = function(e) {
402
402
  return { h: ie(e.h), s: H(e.s, 0, 100), l: H(e.l, 0, 100), a: H(e.a) };
403
403
  }, _t = function(e) {
@@ -522,20 +522,20 @@ const Qe = (e) => [
522
522
  setVisible: (r) => {
523
523
  console.log("setVisible not implemented on CSS Custom Highlights renderer");
524
524
  },
525
- redraw: (r, s, a, u) => {
526
- u && u.clear();
527
- const p = new Set(r.map((c) => c.annotation.id));
528
- Array.from(t).filter((c) => !p.has(c));
529
- const h = r.map((c) => {
525
+ redraw: (r, s, a, d) => {
526
+ d && d.clear();
527
+ const f = new Set(r.map((l) => l.annotation.id));
528
+ Array.from(t).filter((l) => !f.has(l));
529
+ const g = r.map((l) => {
530
530
  var v;
531
- const m = a ? typeof a == "function" ? a(c.annotation, c.state) : a : (v = c.state) != null && v.selected ? gt : q, f = u && u.paint(c, s) || m;
532
- return `::highlight(_${c.annotation.id}) { ${Qe(f)} }`;
531
+ const m = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (v = l.state) != null && v.selected ? gt : q, c = d && d.paint(l, s) || m;
532
+ return `::highlight(_${l.annotation.id}) { ${Qe(c)} }`;
533
533
  });
534
- e.innerHTML = h.join(`
535
- `), CSS.highlights.clear(), r.forEach(({ annotation: c }) => {
536
- const m = c.target.selector.map((v) => v.range), f = new Highlight(...m);
537
- CSS.highlights.set(`_${c.id}`, f);
538
- }), t = p;
534
+ e.innerHTML = g.join(`
535
+ `), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {
536
+ const m = l.target.selector.map((v) => v.range), c = new Highlight(...m);
537
+ CSS.highlights.set(`_${l.id}`, c);
538
+ }), t = f;
539
539
  }
540
540
  };
541
541
  }, tn = (e, t, n) => Nt(e, t, n, Ke());
@@ -572,14 +572,14 @@ const en = (e, t) => {
572
572
  destroy: () => {
573
573
  t.remove();
574
574
  },
575
- redraw: (s, a, u, p, h) => {
576
- const m = !(Vt(n, s) && h);
577
- !p && !m || (m && (t.innerHTML = ""), s.forEach((f) => {
578
- f.rects.map((v) => {
579
- const b = en(v, s), w = Se(f, a, u, p, b);
575
+ redraw: (s, a, d, f, g) => {
576
+ const m = !(Vt(n, s) && g);
577
+ !f && !m || (m && (t.innerHTML = ""), s.forEach((c) => {
578
+ c.rects.map((v) => {
579
+ const C = en(v, s), w = Se(c, a, d, f, C);
580
580
  if (m) {
581
- const d = document.createElement("span");
582
- d.className = "r6o-annotation", d.dataset.annotation = f.annotation.id, d.style.left = `${v.x}px`, d.style.top = `${v.y}px`, d.style.width = `${v.width}px`, d.style.height = `${v.height}px`, d.style.backgroundColor = _((w == null ? void 0 : w.fill) || q.fill).alpha((w == null ? void 0 : w.fillOpacity) === void 0 ? q.fillOpacity : w.fillOpacity).toHex(), w.underlineStyle && (d.style.borderStyle = w.underlineStyle), w.underlineColor && (d.style.borderColor = w.underlineColor), w.underlineThickness && (d.style.borderBottomWidth = `${w.underlineThickness}px`), w.underlineOffset && (d.style.paddingBottom = `${w.underlineOffset}px`), t.appendChild(d);
581
+ const p = document.createElement("span");
582
+ p.className = "r6o-annotation", p.dataset.annotation = c.annotation.id, p.style.left = `${v.x}px`, p.style.top = `${v.y}px`, p.style.width = `${v.width}px`, p.style.height = `${v.height}px`, p.style.backgroundColor = _((w == null ? void 0 : w.fill) || q.fill).alpha((w == null ? void 0 : w.fillOpacity) === void 0 ? q.fillOpacity : w.fillOpacity).toHex(), w.underlineStyle && (p.style.borderStyle = w.underlineStyle), w.underlineColor && (p.style.borderColor = w.underlineColor), w.underlineThickness && (p.style.borderBottomWidth = `${w.underlineThickness}px`), w.underlineOffset && (p.style.paddingBottom = `${w.underlineOffset}px`), t.appendChild(p);
583
583
  }
584
584
  });
585
585
  }), n = s);
@@ -644,12 +644,12 @@ function Ft(e, t = Ct) {
644
644
  const o = /* @__PURE__ */ new Set();
645
645
  function i(a) {
646
646
  if (cn(e, a) && (e = a, n)) {
647
- const u = !Z.length;
648
- for (const p of o)
649
- p[1](), Z.push(p, e);
650
- if (u) {
651
- for (let p = 0; p < Z.length; p += 2)
652
- Z[p][0](Z[p + 1]);
647
+ const d = !Z.length;
648
+ for (const f of o)
649
+ f[1](), Z.push(f, e);
650
+ if (d) {
651
+ for (let f = 0; f < Z.length; f += 2)
652
+ Z[f][0](Z[f + 1]);
653
653
  Z.length = 0;
654
654
  }
655
655
  }
@@ -657,10 +657,10 @@ function Ft(e, t = Ct) {
657
657
  function r(a) {
658
658
  i(a(e));
659
659
  }
660
- function s(a, u = Ct) {
661
- const p = [a, u];
662
- return o.add(p), o.size === 1 && (n = t(i, r) || Ct), a(e), () => {
663
- o.delete(p), o.size === 0 && n && (n(), n = null);
660
+ function s(a, d = Ct) {
661
+ const f = [a, d];
662
+ return o.add(f), o.size === 1 && (n = t(i, r) || Ct), a(e), () => {
663
+ o.delete(f), o.size === 0 && n && (n(), n = null);
664
664
  };
665
665
  }
666
666
  return { set: i, update: r, subscribe: s };
@@ -686,47 +686,47 @@ var un = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE =
686
686
  const xt = { selected: [] }, fn = (e, t = "EDIT") => {
687
687
  const { subscribe: n, set: o } = Ft(xt);
688
688
  let i = t, r = xt;
689
- n((f) => r = f);
689
+ n((c) => r = c);
690
690
  const s = () => o(xt), a = () => {
691
- var f;
692
- return ((f = r.selected) == null ? void 0 : f.length) === 0;
693
- }, u = (f) => {
691
+ var c;
692
+ return ((c = r.selected) == null ? void 0 : c.length) === 0;
693
+ }, d = (c) => {
694
694
  if (a())
695
695
  return !1;
696
- const v = typeof f == "string" ? f : f.id;
697
- return r.selected.some((b) => b.id === v);
698
- }, p = (f, v) => {
699
- const b = e.getAnnotation(f);
700
- if (!b) {
701
- console.warn("Invalid selection: " + f);
696
+ const v = typeof c == "string" ? c : c.id;
697
+ return r.selected.some((C) => C.id === v);
698
+ }, f = (c, v) => {
699
+ const C = e.getAnnotation(c);
700
+ if (!C) {
701
+ console.warn("Invalid selection: " + c);
702
702
  return;
703
703
  }
704
- switch (Zt(b, i)) {
704
+ switch (Zt(C, i)) {
705
705
  case "EDIT":
706
- o({ selected: [{ id: f, editable: !0 }], event: v });
706
+ o({ selected: [{ id: c, editable: !0 }], event: v });
707
707
  break;
708
708
  case "SELECT":
709
- o({ selected: [{ id: f }], event: v });
709
+ o({ selected: [{ id: c }], event: v });
710
710
  break;
711
711
  default:
712
712
  o({ selected: [], event: v });
713
713
  }
714
- }, h = (f, v) => {
715
- const b = Array.isArray(f) ? f : [f], w = b.map((d) => e.getAnnotation(d)).filter((d) => !!d);
714
+ }, g = (c, v) => {
715
+ const C = Array.isArray(c) ? c : [c], w = C.map((p) => e.getAnnotation(p)).filter((p) => !!p);
716
716
  o({
717
- selected: w.map((d) => {
718
- const l = v === void 0 ? Zt(d, i) === "EDIT" : v;
719
- return { id: d.id, editable: l };
717
+ selected: w.map((p) => {
718
+ const u = v === void 0 ? Zt(p, i) === "EDIT" : v;
719
+ return { id: p.id, editable: u };
720
720
  })
721
- }), w.length !== b.length && console.warn("Invalid selection", f);
722
- }, c = (f) => {
721
+ }), w.length !== C.length && console.warn("Invalid selection", c);
722
+ }, l = (c) => {
723
723
  if (a())
724
724
  return !1;
725
725
  const { selected: v } = r;
726
- v.some(({ id: b }) => f.includes(b)) && o({ selected: v.filter(({ id: b }) => !f.includes(b)) });
727
- }, m = (f) => i = f;
726
+ v.some(({ id: C }) => c.includes(C)) && o({ selected: v.filter(({ id: C }) => !c.includes(C)) });
727
+ }, m = (c) => i = c;
728
728
  return e.observe(
729
- ({ changes: f }) => c((f.deleted || []).map((v) => v.id))
729
+ ({ changes: c }) => l((c.deleted || []).map((v) => v.id))
730
730
  ), {
731
731
  get event() {
732
732
  return r ? r.event : null;
@@ -736,11 +736,11 @@ const xt = { selected: [] }, fn = (e, t = "EDIT") => {
736
736
  },
737
737
  clear: s,
738
738
  isEmpty: a,
739
- isSelected: u,
740
- setSelected: h,
739
+ isSelected: d,
740
+ setSelected: g,
741
741
  setUserSelectAction: m,
742
742
  subscribe: n,
743
- userSelect: p
743
+ userSelect: f
744
744
  };
745
745
  }, Zt = (e, t) => typeof t == "function" ? t(e) : t || "EDIT";
746
746
  var D = [];
@@ -766,7 +766,7 @@ function bn(e, t, n) {
766
766
  var o = e.random || (e.rng || gn)();
767
767
  return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, pn(o);
768
768
  }
769
- const xo = (e, t, n, o) => ({
769
+ const Lo = (e, t, n, o) => ({
770
770
  id: bn(),
771
771
  annotation: typeof e == "string" ? e : e.id,
772
772
  created: n || /* @__PURE__ */ new Date(),
@@ -792,17 +792,17 @@ const xo = (e, t, n, o) => ({
792
792
  targetUpdated: Sn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
793
793
  };
794
794
  };
795
- var R = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(R || {});
795
+ var V = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(V || {});
796
796
  const Cn = (e, t) => {
797
797
  var n, o;
798
798
  const { changes: i, origin: r } = t;
799
799
  if (!(!e.options.origin || e.options.origin === r))
800
800
  return !1;
801
801
  if (e.options.ignore) {
802
- const { ignore: s } = e.options, a = (u) => u && u.length > 0;
802
+ const { ignore: s } = e.options, a = (d) => d && d.length > 0;
803
803
  if (!(a(i.created) || a(i.deleted))) {
804
- const u = (n = i.updated) == null ? void 0 : n.some((h) => a(h.bodiesCreated) || a(h.bodiesDeleted) || a(h.bodiesUpdated)), p = (o = i.updated) == null ? void 0 : o.some((h) => h.targetUpdated);
805
- if (s === "BODY_ONLY" && u && !p || s === "TARGET_ONLY" && p && !u)
804
+ const d = (n = i.updated) == null ? void 0 : n.some((g) => a(g.bodiesCreated) || a(g.bodiesDeleted) || a(g.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((g) => g.targetUpdated);
805
+ if (s === "BODY_ONLY" && d && !f || s === "TARGET_ONLY" && f && !d)
806
806
  return !1;
807
807
  }
808
808
  }
@@ -816,31 +816,31 @@ const Cn = (e, t) => {
816
816
  } else
817
817
  return !0;
818
818
  }, xn = (e, t) => {
819
- const n = new Set((e.created || []).map((c) => c.id)), o = new Set((e.updated || []).map(({ newValue: c }) => c.id)), i = new Set((t.created || []).map((c) => c.id)), r = new Set((t.deleted || []).map((c) => c.id)), s = new Set((t.updated || []).map(({ oldValue: c }) => c.id)), a = new Set((t.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), u = [
820
- ...(e.created || []).filter((c) => !r.has(c.id)).map((c) => s.has(c.id) ? t.updated.find(({ oldValue: m }) => m.id === c.id).newValue : c),
819
+ const n = new Set((e.created || []).map((l) => l.id)), o = new Set((e.updated || []).map(({ newValue: l }) => l.id)), i = new Set((t.created || []).map((l) => l.id)), r = new Set((t.deleted || []).map((l) => l.id)), s = new Set((t.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((t.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), d = [
820
+ ...(e.created || []).filter((l) => !r.has(l.id)).map((l) => s.has(l.id) ? t.updated.find(({ oldValue: m }) => m.id === l.id).newValue : l),
821
821
  ...t.created || []
822
- ], p = [
823
- ...(e.deleted || []).filter((c) => !i.has(c.id)),
824
- ...(t.deleted || []).filter((c) => !n.has(c.id))
825
- ], h = [
826
- ...(e.updated || []).filter(({ newValue: c }) => !r.has(c.id)).map((c) => {
827
- const { oldValue: m, newValue: f } = c;
828
- if (s.has(f.id)) {
829
- const v = t.updated.find((b) => b.oldValue.id === f.id).newValue;
822
+ ], f = [
823
+ ...(e.deleted || []).filter((l) => !i.has(l.id)),
824
+ ...(t.deleted || []).filter((l) => !n.has(l.id))
825
+ ], g = [
826
+ ...(e.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {
827
+ const { oldValue: m, newValue: c } = l;
828
+ if (s.has(c.id)) {
829
+ const v = t.updated.find((C) => C.oldValue.id === c.id).newValue;
830
830
  return le(m, v);
831
831
  } else
832
- return c;
832
+ return l;
833
833
  }),
834
- ...(t.updated || []).filter(({ oldValue: c }) => !a.has(c.id))
834
+ ...(t.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
835
835
  ];
836
- return { created: u, deleted: p, updated: h };
837
- }, Ln = (e) => e.id !== void 0, Tn = () => {
838
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (A, S = {}) => n.push({ onChange: A, options: S }), i = (A) => {
839
- const S = n.findIndex((C) => C.onChange == A);
836
+ return { created: d, deleted: f, updated: g };
837
+ }, Ln = (e) => e.id !== void 0, En = () => {
838
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (b, S = {}) => n.push({ onChange: b, options: S }), i = (b) => {
839
+ const S = n.findIndex((x) => x.onChange == b);
840
840
  S > -1 && n.splice(S, 1);
841
- }, r = (A, S) => {
842
- const C = {
843
- origin: A,
841
+ }, r = (b, S) => {
842
+ const x = {
843
+ origin: b,
844
844
  changes: {
845
845
  created: S.created || [],
846
846
  updated: S.updated || [],
@@ -848,186 +848,186 @@ const Cn = (e, t) => {
848
848
  },
849
849
  state: [...e.values()]
850
850
  };
851
- n.forEach((L) => {
852
- Cn(L, C) && L.onChange(C);
851
+ n.forEach((E) => {
852
+ Cn(E, x) && E.onChange(x);
853
853
  });
854
- }, s = (A, S = R.LOCAL) => {
855
- if (e.get(A.id))
856
- throw Error(`Cannot add annotation ${A.id} - exists already`);
857
- e.set(A.id, A), A.bodies.forEach((C) => t.set(C.id, A.id)), r(S, { created: [A] });
858
- }, a = (A, S) => {
859
- const C = typeof A == "string" ? S : A, L = typeof A == "string" ? A : A.id, k = e.get(L);
860
- if (k) {
861
- const I = le(k, C);
862
- return L === C.id ? e.set(L, C) : (e.delete(L), e.set(C.id, C)), k.bodies.forEach((z) => t.delete(z.id)), C.bodies.forEach((z) => t.set(z.id, C.id)), I;
854
+ }, s = (b, S = V.LOCAL) => {
855
+ if (e.get(b.id))
856
+ throw Error(`Cannot add annotation ${b.id} - exists already`);
857
+ e.set(b.id, b), b.bodies.forEach((x) => t.set(x.id, b.id)), r(S, { created: [b] });
858
+ }, a = (b, S) => {
859
+ const x = typeof b == "string" ? S : b, E = typeof b == "string" ? b : b.id, B = e.get(E);
860
+ if (B) {
861
+ const N = le(B, x);
862
+ return E === x.id ? e.set(E, x) : (e.delete(E), e.set(x.id, x)), B.bodies.forEach((z) => t.delete(z.id)), x.bodies.forEach((z) => t.set(z.id, x.id)), N;
863
863
  } else
864
- console.warn(`Cannot update annotation ${L} - does not exist`);
865
- }, u = (A, S = R.LOCAL, C = R.LOCAL) => {
866
- const L = Ln(S) ? C : S, k = a(A, S);
867
- k && r(L, { updated: [k] });
868
- }, p = (A, S = R.LOCAL) => {
869
- const C = A.reduce((L, k) => {
870
- const I = a(k);
871
- return I ? [...L, I] : L;
864
+ console.warn(`Cannot update annotation ${E} - does not exist`);
865
+ }, d = (b, S = V.LOCAL, x = V.LOCAL) => {
866
+ const E = Ln(S) ? x : S, B = a(b, S);
867
+ B && r(E, { updated: [B] });
868
+ }, f = (b, S = V.LOCAL) => {
869
+ const x = b.reduce((E, B) => {
870
+ const N = a(B);
871
+ return N ? [...E, N] : E;
872
872
  }, []);
873
- C.length > 0 && r(S, { updated: C });
874
- }, h = (A, S = R.LOCAL) => {
875
- const C = e.get(A.annotation);
876
- if (C) {
877
- const L = {
878
- ...C,
879
- bodies: [...C.bodies, A]
873
+ x.length > 0 && r(S, { updated: x });
874
+ }, g = (b, S = V.LOCAL) => {
875
+ const x = e.get(b.annotation);
876
+ if (x) {
877
+ const E = {
878
+ ...x,
879
+ bodies: [...x.bodies, b]
880
880
  };
881
- e.set(C.id, L), t.set(A.id, L.id), r(S, { updated: [{
882
- oldValue: C,
883
- newValue: L,
884
- bodiesCreated: [A]
881
+ e.set(x.id, E), t.set(b.id, E.id), r(S, { updated: [{
882
+ oldValue: x,
883
+ newValue: E,
884
+ bodiesCreated: [b]
885
885
  }] });
886
886
  } else
887
- console.warn(`Attempt to add body to missing annotation: ${A.annotation}`);
888
- }, c = () => [...e.values()], m = (A = R.LOCAL) => {
887
+ console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);
888
+ }, l = () => [...e.values()], m = (b = V.LOCAL) => {
889
889
  const S = [...e.values()];
890
- e.clear(), t.clear(), r(A, { deleted: S });
891
- }, f = (A, S = !0, C = R.LOCAL) => {
890
+ e.clear(), t.clear(), r(b, { deleted: S });
891
+ }, c = (b, S = !0, x = V.LOCAL) => {
892
892
  if (S) {
893
- const L = [...e.values()];
894
- e.clear(), t.clear(), A.forEach((k) => {
895
- e.set(k.id, k), k.bodies.forEach((I) => t.set(I.id, k.id));
896
- }), r(C, { created: A, deleted: L });
893
+ const E = [...e.values()];
894
+ e.clear(), t.clear(), b.forEach((B) => {
895
+ e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
896
+ }), r(x, { created: b, deleted: E });
897
897
  } else {
898
- const L = A.reduce((k, I) => {
899
- const z = e.get(I.id);
900
- return z ? [...k, z] : k;
898
+ const E = b.reduce((B, N) => {
899
+ const z = e.get(N.id);
900
+ return z ? [...B, z] : B;
901
901
  }, []);
902
- if (L.length > 0)
903
- throw Error(`Bulk insert would overwrite the following annotations: ${L.map((k) => k.id).join(", ")}`);
904
- A.forEach((k) => {
905
- e.set(k.id, k), k.bodies.forEach((I) => t.set(I.id, k.id));
906
- }), r(C, { created: A });
902
+ if (E.length > 0)
903
+ throw Error(`Bulk insert would overwrite the following annotations: ${E.map((B) => B.id).join(", ")}`);
904
+ b.forEach((B) => {
905
+ e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
906
+ }), r(x, { created: b });
907
907
  }
908
- }, v = (A) => {
909
- const S = typeof A == "string" ? A : A.id, C = e.get(S);
910
- if (C)
911
- return e.delete(S), C.bodies.forEach((L) => t.delete(L.id)), C;
908
+ }, v = (b) => {
909
+ const S = typeof b == "string" ? b : b.id, x = e.get(S);
910
+ if (x)
911
+ return e.delete(S), x.bodies.forEach((E) => t.delete(E.id)), x;
912
912
  console.warn(`Attempt to delete missing annotation: ${S}`);
913
- }, b = (A, S = R.LOCAL) => {
914
- const C = v(A);
915
- C && r(S, { deleted: [C] });
916
- }, w = (A, S = R.LOCAL) => {
917
- const C = A.reduce((L, k) => {
918
- const I = v(k);
919
- return I ? [...L, I] : L;
913
+ }, C = (b, S = V.LOCAL) => {
914
+ const x = v(b);
915
+ x && r(S, { deleted: [x] });
916
+ }, w = (b, S = V.LOCAL) => {
917
+ const x = b.reduce((E, B) => {
918
+ const N = v(B);
919
+ return N ? [...E, N] : E;
920
920
  }, []);
921
- C.length > 0 && r(S, { deleted: C });
922
- }, d = (A) => {
923
- const S = e.get(A.annotation);
921
+ x.length > 0 && r(S, { deleted: x });
922
+ }, p = (b) => {
923
+ const S = e.get(b.annotation);
924
924
  if (S) {
925
- const C = S.bodies.find((L) => L.id === A.id);
926
- if (C) {
927
- t.delete(C.id);
928
- const L = {
925
+ const x = S.bodies.find((E) => E.id === b.id);
926
+ if (x) {
927
+ t.delete(x.id);
928
+ const E = {
929
929
  ...S,
930
- bodies: S.bodies.filter((k) => k.id !== A.id)
930
+ bodies: S.bodies.filter((B) => B.id !== b.id)
931
931
  };
932
- return e.set(S.id, L), {
932
+ return e.set(S.id, E), {
933
933
  oldValue: S,
934
- newValue: L,
935
- bodiesDeleted: [C]
934
+ newValue: E,
935
+ bodiesDeleted: [x]
936
936
  };
937
937
  } else
938
- console.warn(`Attempt to delete missing body ${A.id} from annotation ${A.annotation}`);
938
+ console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);
939
939
  } else
940
- console.warn(`Attempt to delete body from missing annotation ${A.annotation}`);
941
- }, l = (A, S = R.LOCAL) => {
942
- const C = d(A);
943
- C && r(S, { updated: [C] });
944
- }, g = (A, S = R.LOCAL) => {
945
- const C = A.map((L) => d(L)).filter(Boolean);
946
- C.length > 0 && r(S, { updated: C });
947
- }, x = (A) => {
948
- const S = e.get(A);
940
+ console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);
941
+ }, u = (b, S = V.LOCAL) => {
942
+ const x = p(b);
943
+ x && r(S, { updated: [x] });
944
+ }, A = (b, S = V.LOCAL) => {
945
+ const x = b.map((E) => p(E)).filter(Boolean);
946
+ x.length > 0 && r(S, { updated: x });
947
+ }, h = (b) => {
948
+ const S = e.get(b);
949
949
  return S ? { ...S } : void 0;
950
- }, T = (A) => {
951
- const S = t.get(A);
950
+ }, L = (b) => {
951
+ const S = t.get(b);
952
952
  if (S) {
953
- const C = x(S).bodies.find((L) => L.id === A);
954
- if (C)
955
- return C;
956
- console.error(`Store integrity error: body ${A} in index, but not in annotation`);
953
+ const x = h(S).bodies.find((E) => E.id === b);
954
+ if (x)
955
+ return x;
956
+ console.error(`Store integrity error: body ${b} in index, but not in annotation`);
957
957
  } else
958
- console.warn(`Attempt to retrieve missing body: ${A}`);
959
- }, E = (A, S) => {
960
- if (A.annotation !== S.annotation)
958
+ console.warn(`Attempt to retrieve missing body: ${b}`);
959
+ }, M = (b, S) => {
960
+ if (b.annotation !== S.annotation)
961
961
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
962
- const C = e.get(A.annotation);
963
- if (C) {
964
- const L = C.bodies.find((I) => I.id === A.id), k = {
965
- ...C,
966
- bodies: C.bodies.map((I) => I.id === L.id ? S : I)
962
+ const x = e.get(b.annotation);
963
+ if (x) {
964
+ const E = x.bodies.find((N) => N.id === b.id), B = {
965
+ ...x,
966
+ bodies: x.bodies.map((N) => N.id === E.id ? S : N)
967
967
  };
968
- return e.set(C.id, k), L.id !== S.id && (t.delete(L.id), t.set(S.id, k.id)), {
969
- oldValue: C,
970
- newValue: k,
971
- bodiesUpdated: [{ oldBody: L, newBody: S }]
968
+ return e.set(x.id, B), E.id !== S.id && (t.delete(E.id), t.set(S.id, B.id)), {
969
+ oldValue: x,
970
+ newValue: B,
971
+ bodiesUpdated: [{ oldBody: E, newBody: S }]
972
972
  };
973
973
  } else
974
- console.warn(`Attempt to add body to missing annotation ${A.annotation}`);
975
- }, M = (A, S, C = R.LOCAL) => {
976
- const L = E(A, S);
977
- L && r(C, { updated: [L] });
978
- }, B = (A, S = R.LOCAL) => {
979
- const C = A.map((L) => E({ id: L.id, annotation: L.annotation }, L)).filter(Boolean);
980
- r(S, { updated: C });
981
- }, N = (A) => {
982
- const S = e.get(A.annotation);
974
+ console.warn(`Attempt to add body to missing annotation ${b.annotation}`);
975
+ }, R = (b, S, x = V.LOCAL) => {
976
+ const E = M(b, S);
977
+ E && r(x, { updated: [E] });
978
+ }, T = (b, S = V.LOCAL) => {
979
+ const x = b.map((E) => M({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
980
+ r(S, { updated: x });
981
+ }, k = (b) => {
982
+ const S = e.get(b.annotation);
983
983
  if (S) {
984
- const C = {
984
+ const x = {
985
985
  ...S,
986
986
  target: {
987
987
  ...S.target,
988
- ...A
988
+ ...b
989
989
  }
990
990
  };
991
- return e.set(S.id, C), {
991
+ return e.set(S.id, x), {
992
992
  oldValue: S,
993
- newValue: C,
993
+ newValue: x,
994
994
  targetUpdated: {
995
995
  oldTarget: S.target,
996
- newTarget: A
996
+ newTarget: b
997
997
  }
998
998
  };
999
999
  } else
1000
- console.warn(`Attempt to update target on missing annotation: ${A.annotation}`);
1000
+ console.warn(`Attempt to update target on missing annotation: ${b.annotation}`);
1001
1001
  };
1002
1002
  return {
1003
1003
  addAnnotation: s,
1004
- addBody: h,
1005
- all: c,
1006
- bulkAddAnnotation: f,
1004
+ addBody: g,
1005
+ all: l,
1006
+ bulkAddAnnotation: c,
1007
1007
  bulkDeleteAnnotation: w,
1008
- bulkDeleteBodies: g,
1009
- bulkUpdateAnnotation: p,
1010
- bulkUpdateBodies: B,
1011
- bulkUpdateTargets: (A, S = R.LOCAL) => {
1012
- const C = A.map((L) => N(L)).filter(Boolean);
1013
- C.length > 0 && r(S, { updated: C });
1008
+ bulkDeleteBodies: A,
1009
+ bulkUpdateAnnotation: f,
1010
+ bulkUpdateBodies: T,
1011
+ bulkUpdateTargets: (b, S = V.LOCAL) => {
1012
+ const x = b.map((E) => k(E)).filter(Boolean);
1013
+ x.length > 0 && r(S, { updated: x });
1014
1014
  },
1015
1015
  clear: m,
1016
- deleteAnnotation: b,
1017
- deleteBody: l,
1018
- getAnnotation: x,
1019
- getBody: T,
1016
+ deleteAnnotation: C,
1017
+ deleteBody: u,
1018
+ getAnnotation: h,
1019
+ getBody: L,
1020
1020
  observe: o,
1021
1021
  unobserve: i,
1022
- updateAnnotation: u,
1023
- updateBody: M,
1024
- updateTarget: (A, S = R.LOCAL) => {
1025
- const C = N(A);
1026
- C && r(S, { updated: [C] });
1022
+ updateAnnotation: d,
1023
+ updateBody: R,
1024
+ updateTarget: (b, S = V.LOCAL) => {
1025
+ const x = k(b);
1026
+ x && r(S, { updated: [x] });
1027
1027
  }
1028
1028
  };
1029
1029
  };
1030
- let En = () => ({
1030
+ let Tn = () => ({
1031
1031
  emit(e, ...t) {
1032
1032
  for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
1033
1033
  o[n](...t);
@@ -1042,40 +1042,40 @@ let En = () => ({
1042
1042
  }
1043
1043
  });
1044
1044
  const Mn = 250, Bn = (e) => {
1045
- const t = En(), n = [];
1045
+ const t = Tn(), n = [];
1046
1046
  let o = -1, i = !1, r = 0;
1047
- const s = (f) => {
1047
+ const s = (c) => {
1048
1048
  if (!i) {
1049
- const { changes: v } = f, b = performance.now();
1050
- if (b - r > Mn)
1049
+ const { changes: v } = c, C = performance.now();
1050
+ if (C - r > Mn)
1051
1051
  n.splice(o + 1), n.push(v), o = n.length - 1;
1052
1052
  else {
1053
1053
  const w = n.length - 1;
1054
1054
  n[w] = xn(n[w], v);
1055
1055
  }
1056
- r = b;
1056
+ r = C;
1057
1057
  }
1058
1058
  i = !1;
1059
1059
  };
1060
- e.observe(s, { origin: R.LOCAL });
1061
- const a = (f) => f && f.length > 0 && e.bulkDeleteAnnotation(f), u = (f) => f && f.length > 0 && e.bulkAddAnnotation(f, !1), p = (f) => f && f.length > 0 && e.bulkUpdateAnnotation(f.map(({ oldValue: v }) => v)), h = (f) => f && f.length > 0 && e.bulkUpdateAnnotation(f.map(({ newValue: v }) => v)), c = (f) => f && f.length > 0 && e.bulkAddAnnotation(f, !1), m = (f) => f && f.length > 0 && e.bulkDeleteAnnotation(f);
1060
+ e.observe(s, { origin: V.LOCAL });
1061
+ const a = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c), d = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), f = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ oldValue: v }) => v)), g = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ newValue: v }) => v)), l = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), m = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c);
1062
1062
  return {
1063
1063
  canRedo: () => n.length - 1 > o,
1064
1064
  canUndo: () => o > -1,
1065
1065
  destroy: () => e.unobserve(s),
1066
- on: (f, v) => t.on(f, v),
1066
+ on: (c, v) => t.on(c, v),
1067
1067
  redo: () => {
1068
1068
  if (n.length - 1 > o) {
1069
1069
  i = !0;
1070
- const { created: f, updated: v, deleted: b } = n[o + 1];
1071
- u(f), h(v), m(b), t.emit("redo", n[o + 1]), o += 1;
1070
+ const { created: c, updated: v, deleted: C } = n[o + 1];
1071
+ d(c), g(v), m(C), t.emit("redo", n[o + 1]), o += 1;
1072
1072
  }
1073
1073
  },
1074
1074
  undo: () => {
1075
1075
  if (o > -1) {
1076
1076
  i = !0;
1077
- const { created: f, updated: v, deleted: b } = n[o];
1078
- a(f), p(v), c(b), t.emit("undo", n[o]), o -= 1;
1077
+ const { created: c, updated: v, deleted: C } = n[o];
1078
+ a(c), f(v), l(C), t.emit("undo", n[o]), o -= 1;
1079
1079
  }
1080
1080
  }
1081
1081
  };
@@ -1086,73 +1086,73 @@ const Mn = 250, Bn = (e) => {
1086
1086
  set: t
1087
1087
  };
1088
1088
  }, Rn = (e, t, n, o) => {
1089
- const { store: i, selection: r, hover: s, viewport: a } = e, u = /* @__PURE__ */ new Map();
1090
- let p = [], h;
1091
- const c = (b, w) => {
1092
- u.has(b) ? u.get(b).push(w) : u.set(b, [w]);
1093
- }, m = (b, w) => {
1094
- const d = u.get(b);
1095
- if (d) {
1096
- const l = d.indexOf(w);
1097
- l !== -1 && d.splice(l, 1);
1089
+ const { store: i, selection: r, hover: s, viewport: a } = e, d = /* @__PURE__ */ new Map();
1090
+ let f = [], g;
1091
+ const l = (C, w) => {
1092
+ d.has(C) ? d.get(C).push(w) : d.set(C, [w]);
1093
+ }, m = (C, w) => {
1094
+ const p = d.get(C);
1095
+ if (p) {
1096
+ const u = p.indexOf(w);
1097
+ u !== -1 && p.splice(u, 1);
1098
1098
  }
1099
- }, f = (b, w, d) => {
1100
- u.has(b) && setTimeout(() => {
1101
- u.get(b).forEach((l) => {
1099
+ }, c = (C, w, p) => {
1100
+ d.has(C) && setTimeout(() => {
1101
+ d.get(C).forEach((u) => {
1102
1102
  if (n) {
1103
- const g = Array.isArray(w) ? w.map((T) => n.serialize(T)) : n.serialize(w), x = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
1104
- l(g, x);
1103
+ const A = Array.isArray(w) ? w.map((L) => n.serialize(L)) : n.serialize(w), h = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
1104
+ u(A, h);
1105
1105
  } else
1106
- l(w, d);
1106
+ u(w, p);
1107
1107
  });
1108
1108
  }, 1);
1109
1109
  };
1110
- r.subscribe(({ selected: b }) => {
1111
- if (!(p.length === 0 && b.length === 0)) {
1112
- if (p.length === 0 && b.length > 0)
1113
- p = b.map(({ id: w }) => i.getAnnotation(w));
1114
- else if (p.length > 0 && b.length === 0)
1115
- p.forEach((w) => {
1116
- const d = i.getAnnotation(w.id);
1117
- d && !K(d, w) && f("updateAnnotation", d, w);
1118
- }), p = [];
1110
+ r.subscribe(({ selected: C }) => {
1111
+ if (!(f.length === 0 && C.length === 0)) {
1112
+ if (f.length === 0 && C.length > 0)
1113
+ f = C.map(({ id: w }) => i.getAnnotation(w));
1114
+ else if (f.length > 0 && C.length === 0)
1115
+ f.forEach((w) => {
1116
+ const p = i.getAnnotation(w.id);
1117
+ p && !K(p, w) && c("updateAnnotation", p, w);
1118
+ }), f = [];
1119
1119
  else {
1120
- const w = new Set(p.map((l) => l.id)), d = new Set(b.map(({ id: l }) => l));
1121
- p.filter((l) => !d.has(l.id)).forEach((l) => {
1122
- const g = i.getAnnotation(l.id);
1123
- g && !K(g, l) && f("updateAnnotation", g, l);
1124
- }), p = [
1120
+ const w = new Set(f.map((u) => u.id)), p = new Set(C.map(({ id: u }) => u));
1121
+ f.filter((u) => !p.has(u.id)).forEach((u) => {
1122
+ const A = i.getAnnotation(u.id);
1123
+ A && !K(A, u) && c("updateAnnotation", A, u);
1124
+ }), f = [
1125
1125
  // Remove annotations that were deselected
1126
- ...p.filter((l) => d.has(l.id)),
1126
+ ...f.filter((u) => p.has(u.id)),
1127
1127
  // Add editable annotations that were selected
1128
- ...b.filter(({ id: l }) => !w.has(l)).map(({ id: l }) => i.getAnnotation(l))
1128
+ ...C.filter(({ id: u }) => !w.has(u)).map(({ id: u }) => i.getAnnotation(u))
1129
1129
  ];
1130
1130
  }
1131
- f("selectionChanged", p);
1131
+ c("selectionChanged", f);
1132
1132
  }
1133
- }), s.subscribe((b) => {
1134
- !h && b ? f("mouseEnterAnnotation", i.getAnnotation(b)) : h && !b ? f("mouseLeaveAnnotation", i.getAnnotation(h)) : h && b && (f("mouseLeaveAnnotation", i.getAnnotation(h)), f("mouseEnterAnnotation", i.getAnnotation(b))), h = b;
1135
- }), a == null || a.subscribe((b) => f("viewportIntersect", b.map((w) => i.getAnnotation(w)))), i.observe((b) => {
1136
- const { created: w, deleted: d } = b.changes;
1137
- (w || []).forEach((l) => f("createAnnotation", l)), (d || []).forEach((l) => f("deleteAnnotation", l)), (b.changes.updated || []).filter((l) => [
1138
- ...l.bodiesCreated || [],
1139
- ...l.bodiesDeleted || [],
1140
- ...l.bodiesUpdated || []
1141
- ].length > 0).forEach(({ oldValue: l, newValue: g }) => {
1142
- const x = p.find((T) => T.id === l.id) || l;
1143
- p = p.map((T) => T.id === l.id ? g : T), f("updateAnnotation", g, x);
1133
+ }), s.subscribe((C) => {
1134
+ !g && C ? c("mouseEnterAnnotation", i.getAnnotation(C)) : g && !C ? c("mouseLeaveAnnotation", i.getAnnotation(g)) : g && C && (c("mouseLeaveAnnotation", i.getAnnotation(g)), c("mouseEnterAnnotation", i.getAnnotation(C))), g = C;
1135
+ }), a == null || a.subscribe((C) => c("viewportIntersect", C.map((w) => i.getAnnotation(w)))), i.observe((C) => {
1136
+ const { created: w, deleted: p } = C.changes;
1137
+ (w || []).forEach((u) => c("createAnnotation", u)), (p || []).forEach((u) => c("deleteAnnotation", u)), (C.changes.updated || []).filter((u) => [
1138
+ ...u.bodiesCreated || [],
1139
+ ...u.bodiesDeleted || [],
1140
+ ...u.bodiesUpdated || []
1141
+ ].length > 0).forEach(({ oldValue: u, newValue: A }) => {
1142
+ const h = f.find((L) => L.id === u.id) || u;
1143
+ f = f.map((L) => L.id === u.id ? A : L), c("updateAnnotation", A, h);
1144
1144
  });
1145
- }, { origin: R.LOCAL }), i.observe((b) => {
1146
- if (p) {
1147
- const w = new Set(p.map((l) => l.id)), d = (b.changes.updated || []).filter(({ newValue: l }) => w.has(l.id)).map(({ newValue: l }) => l);
1148
- d.length > 0 && (p = p.map((l) => d.find((x) => x.id === l.id) || l));
1145
+ }, { origin: V.LOCAL }), i.observe((C) => {
1146
+ if (f) {
1147
+ const w = new Set(f.map((u) => u.id)), p = (C.changes.updated || []).filter(({ newValue: u }) => w.has(u.id)).map(({ newValue: u }) => u);
1148
+ p.length > 0 && (f = f.map((u) => p.find((h) => h.id === u.id) || u));
1149
1149
  }
1150
- }, { origin: R.REMOTE });
1151
- const v = (b) => (w) => {
1152
- const { updated: d } = w;
1153
- b ? (d || []).forEach((l) => f("updateAnnotation", l.oldValue, l.newValue)) : (d || []).forEach((l) => f("updateAnnotation", l.newValue, l.oldValue));
1150
+ }, { origin: V.REMOTE });
1151
+ const v = (C) => (w) => {
1152
+ const { updated: p } = w;
1153
+ C ? (p || []).forEach((u) => c("updateAnnotation", u.oldValue, u.newValue)) : (p || []).forEach((u) => c("updateAnnotation", u.newValue, u.oldValue));
1154
1154
  };
1155
- return t.on("undo", v(!0)), t.on("redo", v(!1)), { on: c, off: m, emit: f };
1155
+ return t.on("undo", v(!0)), t.on("redo", v(!1)), { on: l, off: m, emit: c };
1156
1156
  }, Vn = (e) => (t) => t.reduce((n, o) => {
1157
1157
  const { parsed: i, error: r } = e.parse(o);
1158
1158
  return r ? {
@@ -1165,46 +1165,46 @@ const Mn = 250, Bn = (e) => {
1165
1165
  ...n
1166
1166
  };
1167
1167
  }, { parsed: [], failed: [] }), On = (e, t, n) => {
1168
- const { store: o, selection: i } = e, r = (d) => {
1168
+ const { store: o, selection: i } = e, r = (p) => {
1169
1169
  if (n) {
1170
- const { parsed: l, error: g } = n.parse(d);
1171
- l ? o.addAnnotation(l, R.REMOTE) : console.error(g);
1170
+ const { parsed: u, error: A } = n.parse(p);
1171
+ u ? o.addAnnotation(u, V.REMOTE) : console.error(A);
1172
1172
  } else
1173
- o.addAnnotation(d, R.REMOTE);
1174
- }, s = () => i.clear(), a = () => o.clear(), u = (d) => {
1175
- const l = o.getAnnotation(d);
1176
- return n && l ? n.serialize(l) : l;
1177
- }, p = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
1178
- var d;
1179
- const l = (((d = i.selected) == null ? void 0 : d.map((g) => g.id)) || []).map((g) => o.getAnnotation(g)).filter(Boolean);
1180
- return n ? l.map(n.serialize) : l;
1181
- }, c = (d, l = !0) => fetch(d).then((g) => g.json()).then((g) => (f(g, l), g)), m = (d) => {
1182
- if (typeof d == "string") {
1183
- const l = o.getAnnotation(d);
1184
- if (o.deleteAnnotation(d), l)
1185
- return n ? n.serialize(l) : l;
1173
+ o.addAnnotation(p, V.REMOTE);
1174
+ }, s = () => i.clear(), a = () => o.clear(), d = (p) => {
1175
+ const u = o.getAnnotation(p);
1176
+ return n && u ? n.serialize(u) : u;
1177
+ }, f = () => n ? o.all().map(n.serialize) : o.all(), g = () => {
1178
+ var p;
1179
+ const u = (((p = i.selected) == null ? void 0 : p.map((A) => A.id)) || []).map((A) => o.getAnnotation(A)).filter(Boolean);
1180
+ return n ? u.map(n.serialize) : u;
1181
+ }, l = (p, u = !0) => fetch(p).then((A) => A.json()).then((A) => (c(A, u), A)), m = (p) => {
1182
+ if (typeof p == "string") {
1183
+ const u = o.getAnnotation(p);
1184
+ if (o.deleteAnnotation(p), u)
1185
+ return n ? n.serialize(u) : u;
1186
1186
  } else {
1187
- const l = n ? n.parse(d).parsed : d;
1188
- if (l)
1189
- return o.deleteAnnotation(l), d;
1187
+ const u = n ? n.parse(p).parsed : p;
1188
+ if (u)
1189
+ return o.deleteAnnotation(u), p;
1190
1190
  }
1191
- }, f = (d, l = !0) => {
1191
+ }, c = (p, u = !0) => {
1192
1192
  if (n) {
1193
- const { parsed: g, failed: x } = Vn(n)(d);
1194
- x.length > 0 && console.warn(`Discarded ${x.length} invalid annotations`, x), o.bulkAddAnnotation(g, l, R.REMOTE);
1193
+ const { parsed: A, failed: h } = Vn(n)(p);
1194
+ h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), o.bulkAddAnnotation(A, u, V.REMOTE);
1195
1195
  } else
1196
- o.bulkAddAnnotation(d, l, R.REMOTE);
1197
- }, v = (d, l) => {
1198
- d ? i.setSelected(d, l) : i.clear();
1199
- }, b = (d) => {
1200
- i.clear(), i.setUserSelectAction(d);
1201
- }, w = (d) => {
1196
+ o.bulkAddAnnotation(p, u, V.REMOTE);
1197
+ }, v = (p, u) => {
1198
+ p ? i.setSelected(p, u) : i.clear();
1199
+ }, C = (p) => {
1200
+ i.clear(), i.setUserSelectAction(p);
1201
+ }, w = (p) => {
1202
1202
  if (n) {
1203
- const l = n.parse(d).parsed, g = n.serialize(o.getAnnotation(l.id));
1204
- return o.updateAnnotation(l), g;
1203
+ const u = n.parse(p).parsed, A = n.serialize(o.getAnnotation(u.id));
1204
+ return o.updateAnnotation(u), A;
1205
1205
  } else {
1206
- const l = o.getAnnotation(d.id);
1207
- return o.updateAnnotation(d), l;
1206
+ const u = o.getAnnotation(p.id);
1207
+ return o.updateAnnotation(p), u;
1208
1208
  }
1209
1209
  };
1210
1210
  return {
@@ -1213,15 +1213,15 @@ const Mn = 250, Bn = (e) => {
1213
1213
  canRedo: t.canRedo,
1214
1214
  canUndo: t.canUndo,
1215
1215
  clearAnnotations: a,
1216
- getAnnotationById: u,
1217
- getAnnotations: p,
1218
- getSelected: h,
1219
- loadAnnotations: c,
1216
+ getAnnotationById: d,
1217
+ getAnnotations: f,
1218
+ getSelected: g,
1219
+ loadAnnotations: l,
1220
1220
  redo: t.redo,
1221
1221
  removeAnnotation: m,
1222
- setAnnotations: f,
1222
+ setAnnotations: c,
1223
1223
  setSelected: v,
1224
- setUserSelectAction: b,
1224
+ setUserSelectAction: C,
1225
1225
  undo: t.undo,
1226
1226
  updateAnnotation: w
1227
1227
  };
@@ -1231,9 +1231,9 @@ let Nn = (e) => crypto.getRandomValues(new Uint8Array(e)), Fn = (e, t, n) => {
1231
1231
  return (r = t) => {
1232
1232
  let s = "";
1233
1233
  for (; ; ) {
1234
- let a = n(i), u = i;
1235
- for (; u--; )
1236
- if (s += e[a[u] & o] || "", s.length === r) return s;
1234
+ let a = n(i), d = i;
1235
+ for (; d--; )
1236
+ if (s += e[a[d] & o] || "", s.length === r) return s;
1237
1237
  }
1238
1238
  };
1239
1239
  }, Pn = (e, t = 21) => Fn(e, t, Nn), Dn = (e = 21) => {
@@ -1251,17 +1251,17 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
1251
1251
  }
1252
1252
  return `${n}`;
1253
1253
  }, ce = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, Hn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1254
- const { id: o, type: i, purpose: r, value: s, created: a, modified: u, creator: p, ...h } = n;
1254
+ const { id: o, type: i, purpose: r, value: s, created: a, modified: d, creator: f, ...g } = n;
1255
1255
  return {
1256
1256
  id: o || `temp-${Un(n)}`,
1257
1257
  annotation: t,
1258
1258
  type: i,
1259
1259
  purpose: r,
1260
1260
  value: s,
1261
- creator: ce(p),
1261
+ creator: ce(f),
1262
1262
  created: a ? new Date(a) : void 0,
1263
- updated: u ? new Date(u) : void 0,
1264
- ...h
1263
+ updated: d ? new Date(d) : void 0,
1264
+ ...g
1265
1265
  };
1266
1266
  }), _n = (e) => e.map((t) => {
1267
1267
  var n;
@@ -1273,7 +1273,7 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
1273
1273
  return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
1274
1274
  });
1275
1275
  Dn();
1276
- const Lo = (e, t) => ({
1276
+ const Eo = (e, t) => ({
1277
1277
  parse: (n) => $n(n),
1278
1278
  serialize: (n) => jn(n, e, t)
1279
1279
  }), Yn = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, Xn = (e) => {
@@ -1294,26 +1294,26 @@ const Lo = (e, t) => ({
1294
1294
  selector: [],
1295
1295
  styleClass: s[0].styleClass
1296
1296
  };
1297
- for (const u of s) {
1298
- const h = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((c, m) => {
1297
+ for (const d of s) {
1298
+ const g = (Array.isArray(d.selector) ? d.selector : [d.selector]).reduce((l, m) => {
1299
1299
  switch (m.type) {
1300
1300
  case "TextQuoteSelector":
1301
- c.quote = m.exact;
1301
+ l.quote = m.exact;
1302
1302
  break;
1303
1303
  case "TextPositionSelector":
1304
- c.start = m.start, c.end = m.end;
1304
+ l.start = m.start, l.end = m.end;
1305
1305
  break;
1306
1306
  }
1307
- return c;
1307
+ return l;
1308
1308
  }, {});
1309
- if (Yn(h))
1310
- a.selector.push({ id: u.id, ...h });
1309
+ if (Yn(g))
1310
+ a.selector.push({ id: d.id, ...g });
1311
1311
  else {
1312
- const c = [
1313
- h.start ? void 0 : "TextPositionSelector",
1314
- h.quote ? void 0 : "TextQuoteSelector"
1312
+ const l = [
1313
+ g.start ? void 0 : "TextPositionSelector",
1314
+ g.quote ? void 0 : "TextQuoteSelector"
1315
1315
  ].filter(Boolean);
1316
- return { error: Error(`Missing selector types: ${c.join(" and ")} for annotation: ${e.id}`) };
1316
+ return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${e.id}`) };
1317
1317
  }
1318
1318
  }
1319
1319
  return { parsed: a };
@@ -1324,38 +1324,38 @@ const Lo = (e, t) => ({
1324
1324
  modified: i,
1325
1325
  body: r,
1326
1326
  ...s
1327
- } = e, a = Hn(r, t), u = Xn(e);
1328
- return "error" in u ? { error: u.error } : {
1327
+ } = e, a = Hn(r, t), d = Xn(e);
1328
+ return "error" in d ? { error: d.error } : {
1329
1329
  parsed: {
1330
1330
  ...s,
1331
1331
  id: t,
1332
1332
  bodies: a,
1333
- target: u.parsed
1333
+ target: d.parsed
1334
1334
  }
1335
1335
  };
1336
1336
  }, jn = (e, t, n) => {
1337
1337
  const { bodies: o, target: i, ...r } = e, {
1338
1338
  selector: s,
1339
1339
  creator: a,
1340
- created: u,
1341
- updated: p,
1342
- ...h
1343
- } = i, c = s.map((m) => {
1344
- const { quote: f, start: v, end: b, range: w } = m, { prefix: d, suffix: l } = ke(w, n), g = [{
1340
+ created: d,
1341
+ updated: f,
1342
+ ...g
1343
+ } = i, l = s.map((m) => {
1344
+ const { quote: c, start: v, end: C, range: w } = m, { prefix: p, suffix: u } = ke(w, n), A = [{
1345
1345
  type: "TextQuoteSelector",
1346
- exact: f,
1347
- prefix: d,
1348
- suffix: l
1346
+ exact: c,
1347
+ prefix: p,
1348
+ suffix: u
1349
1349
  }, {
1350
1350
  type: "TextPositionSelector",
1351
1351
  start: v,
1352
- end: b
1352
+ end: C
1353
1353
  }];
1354
1354
  return {
1355
- ...h,
1355
+ ...g,
1356
1356
  id: m.id,
1357
1357
  source: t,
1358
- selector: g
1358
+ selector: A
1359
1359
  };
1360
1360
  });
1361
1361
  return {
@@ -1365,9 +1365,9 @@ const Lo = (e, t) => ({
1365
1365
  type: "Annotation",
1366
1366
  body: _n(e.bodies),
1367
1367
  creator: a,
1368
- created: u == null ? void 0 : u.toISOString(),
1369
- modified: p == null ? void 0 : p.toISOString(),
1370
- target: c
1368
+ created: d == null ? void 0 : d.toISOString(),
1369
+ modified: f == null ? void 0 : f.toISOString(),
1370
+ target: l
1371
1371
  };
1372
1372
  };
1373
1373
  function Gn(e, t, n, o, i) {
@@ -1376,12 +1376,12 @@ function Gn(e, t, n, o, i) {
1376
1376
  function de(e, t, n, o, i) {
1377
1377
  for (; o > n; ) {
1378
1378
  if (o - n > 600) {
1379
- var r = o - n + 1, s = t - n + 1, a = Math.log(r), u = 0.5 * Math.exp(2 * a / 3), p = 0.5 * Math.sqrt(a * u * (r - u) / r) * (s - r / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(t - s * u / r + p)), c = Math.min(o, Math.floor(t + (r - s) * u / r + p));
1380
- de(e, t, h, c, i);
1379
+ var r = o - n + 1, s = t - n + 1, a = Math.log(r), d = 0.5 * Math.exp(2 * a / 3), f = 0.5 * Math.sqrt(a * d * (r - d) / r) * (s - r / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(t - s * d / r + f)), l = Math.min(o, Math.floor(t + (r - s) * d / r + f));
1380
+ de(e, t, g, l, i);
1381
1381
  }
1382
- var m = e[t], f = n, v = o;
1383
- for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o); f < v; ) {
1384
- for (tt(e, f, v), f++, v--; i(e[f], m) < 0; ) f++;
1382
+ var m = e[t], c = n, v = o;
1383
+ for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o); c < v; ) {
1384
+ for (tt(e, c, v), c++, v--; i(e[c], m) < 0; ) c++;
1385
1385
  for (; i(e[v], m) > 0; ) v--;
1386
1386
  }
1387
1387
  i(e[n], m) === 0 ? tt(e, n, v) : (v++, tt(e, v, o)), v <= t && (n = v + 1), t <= v && (o = v - 1);
@@ -1408,8 +1408,8 @@ class zn {
1408
1408
  const i = this.toBBox, r = [];
1409
1409
  for (; n; ) {
1410
1410
  for (let s = 0; s < n.children.length; s++) {
1411
- const a = n.children[s], u = n.leaf ? i(a) : a;
1412
- pt(t, u) && (n.leaf ? o.push(a) : Et(t, u) ? this._all(a, o) : r.push(a));
1411
+ const a = n.children[s], d = n.leaf ? i(a) : a;
1412
+ pt(t, d) && (n.leaf ? o.push(a) : Tt(t, d) ? this._all(a, o) : r.push(a));
1413
1413
  }
1414
1414
  n = r.pop();
1415
1415
  }
@@ -1423,7 +1423,7 @@ class zn {
1423
1423
  for (let i = 0; i < n.children.length; i++) {
1424
1424
  const r = n.children[i], s = n.leaf ? this.toBBox(r) : r;
1425
1425
  if (pt(t, s)) {
1426
- if (n.leaf || Et(t, s)) return !0;
1426
+ if (n.leaf || Tt(t, s)) return !0;
1427
1427
  o.push(r);
1428
1428
  }
1429
1429
  }
@@ -1462,14 +1462,14 @@ class zn {
1462
1462
  if (!t) return this;
1463
1463
  let o = this.data;
1464
1464
  const i = this.toBBox(t), r = [], s = [];
1465
- let a, u, p;
1465
+ let a, d, f;
1466
1466
  for (; o || r.length; ) {
1467
- if (o || (o = r.pop(), u = r[r.length - 1], a = s.pop(), p = !0), o.leaf) {
1468
- const h = qn(t, o.children, n);
1469
- if (h !== -1)
1470
- return o.children.splice(h, 1), r.push(o), this._condense(r), this;
1467
+ if (o || (o = r.pop(), d = r[r.length - 1], a = s.pop(), f = !0), o.leaf) {
1468
+ const g = qn(t, o.children, n);
1469
+ if (g !== -1)
1470
+ return o.children.splice(g, 1), r.push(o), this._condense(r), this;
1471
1471
  }
1472
- !p && !o.leaf && Et(o, i) ? (r.push(o), s.push(a), a = 0, u = o, o = o.children[0]) : u ? (a++, o = u.children[a], p = !1) : o = null;
1472
+ !f && !o.leaf && Tt(o, i) ? (r.push(o), s.push(a), a = 0, d = o, o = o.children[0]) : d ? (a++, o = d.children[a], f = !1) : o = null;
1473
1473
  }
1474
1474
  return this;
1475
1475
  }
@@ -1500,14 +1500,14 @@ class zn {
1500
1500
  if (r <= s)
1501
1501
  return a = Q(t.slice(n, o + 1)), J(a, this.toBBox), a;
1502
1502
  i || (i = Math.ceil(Math.log(r) / Math.log(s)), s = Math.ceil(r / Math.pow(s, i - 1))), a = Q([]), a.leaf = !1, a.height = i;
1503
- const u = Math.ceil(r / s), p = u * Math.ceil(Math.sqrt(s));
1504
- Qt(t, n, o, p, this.compareMinX);
1505
- for (let h = n; h <= o; h += p) {
1506
- const c = Math.min(h + p - 1, o);
1507
- Qt(t, h, c, u, this.compareMinY);
1508
- for (let m = h; m <= c; m += u) {
1509
- const f = Math.min(m + u - 1, c);
1510
- a.children.push(this._build(t, m, f, i - 1));
1503
+ const d = Math.ceil(r / s), f = d * Math.ceil(Math.sqrt(s));
1504
+ Qt(t, n, o, f, this.compareMinX);
1505
+ for (let g = n; g <= o; g += f) {
1506
+ const l = Math.min(g + f - 1, o);
1507
+ Qt(t, g, l, d, this.compareMinY);
1508
+ for (let m = g; m <= l; m += d) {
1509
+ const c = Math.min(m + d - 1, l);
1510
+ a.children.push(this._build(t, m, c, i - 1));
1511
1511
  }
1512
1512
  }
1513
1513
  return J(a, this.toBBox), a;
@@ -1515,9 +1515,9 @@ class zn {
1515
1515
  _chooseSubtree(t, n, o, i) {
1516
1516
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
1517
1517
  let r = 1 / 0, s = 1 / 0, a;
1518
- for (let u = 0; u < n.children.length; u++) {
1519
- const p = n.children[u], h = Tt(p), c = Qn(t, p) - h;
1520
- c < s ? (s = c, r = h < r ? h : r, a = p) : c === s && h < r && (r = h, a = p);
1518
+ for (let d = 0; d < n.children.length; d++) {
1519
+ const f = n.children[d], g = Et(f), l = Qn(t, f) - g;
1520
+ l < s ? (s = l, r = g < r ? g : r, a = f) : l === s && g < r && (r = g, a = f);
1521
1521
  }
1522
1522
  n = a || n.children[0];
1523
1523
  }
@@ -1542,8 +1542,8 @@ class zn {
1542
1542
  _chooseSplitIndex(t, n, o) {
1543
1543
  let i, r = 1 / 0, s = 1 / 0;
1544
1544
  for (let a = n; a <= o - n; a++) {
1545
- const u = nt(t, 0, a, this.toBBox), p = nt(t, a, o, this.toBBox), h = Kn(u, p), c = Tt(u) + Tt(p);
1546
- h < r ? (r = h, i = a, s = c < s ? c : s) : h === r && c < s && (s = c, i = a);
1545
+ const d = nt(t, 0, a, this.toBBox), f = nt(t, a, o, this.toBBox), g = Kn(d, f), l = Et(d) + Et(f);
1546
+ g < r ? (r = g, i = a, s = l < s ? l : s) : g === r && l < s && (s = l, i = a);
1547
1547
  }
1548
1548
  return i || o - n;
1549
1549
  }
@@ -1556,16 +1556,16 @@ class zn {
1556
1556
  _allDistMargin(t, n, o, i) {
1557
1557
  t.children.sort(i);
1558
1558
  const r = this.toBBox, s = nt(t, 0, n, r), a = nt(t, o - n, o, r);
1559
- let u = ft(s) + ft(a);
1560
- for (let p = n; p < o - n; p++) {
1561
- const h = t.children[p];
1562
- ot(s, t.leaf ? r(h) : h), u += ft(s);
1559
+ let d = ft(s) + ft(a);
1560
+ for (let f = n; f < o - n; f++) {
1561
+ const g = t.children[f];
1562
+ ot(s, t.leaf ? r(g) : g), d += ft(s);
1563
1563
  }
1564
- for (let p = o - n - 1; p >= n; p--) {
1565
- const h = t.children[p];
1566
- ot(a, t.leaf ? r(h) : h), u += ft(a);
1564
+ for (let f = o - n - 1; f >= n; f--) {
1565
+ const g = t.children[f];
1566
+ ot(a, t.leaf ? r(g) : g), d += ft(a);
1567
1567
  }
1568
- return u;
1568
+ return d;
1569
1569
  }
1570
1570
  _adjustParentBBoxes(t, n, o) {
1571
1571
  for (let i = o; i >= 0; i--)
@@ -1602,7 +1602,7 @@ function Zn(e, t) {
1602
1602
  function Jn(e, t) {
1603
1603
  return e.minY - t.minY;
1604
1604
  }
1605
- function Tt(e) {
1605
+ function Et(e) {
1606
1606
  return (e.maxX - e.minX) * (e.maxY - e.minY);
1607
1607
  }
1608
1608
  function ft(e) {
@@ -1615,7 +1615,7 @@ function Kn(e, t) {
1615
1615
  const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), r = Math.min(e.maxY, t.maxY);
1616
1616
  return Math.max(0, i - n) * Math.max(0, r - o);
1617
1617
  }
1618
- function Et(e, t) {
1618
+ function Tt(e, t) {
1619
1619
  return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
1620
1620
  }
1621
1621
  function pt(e, t) {
@@ -1640,171 +1640,189 @@ function Qt(e, t, n, o, i) {
1640
1640
  Gn(e, s, t, n, i), r.push(t, s, s, n);
1641
1641
  }
1642
1642
  }
1643
- const to = (e, t) => {
1644
- const n = new zn(), o = /* @__PURE__ */ new Map(), i = (d, l) => {
1645
- const g = d.selector.flatMap((T) => {
1646
- const E = W([T]) ? T.range : oe(T, t).range;
1647
- return Array.from(E.getClientRects());
1648
- }), x = Ne(g).map((T) => Pe(T, l));
1649
- return x.map((T) => {
1650
- const { x: E, y: M, width: B, height: N } = T;
1643
+ let to = () => ({
1644
+ emit(e, ...t) {
1645
+ for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
1646
+ o[n](...t);
1647
+ },
1648
+ events: {},
1649
+ on(e, t) {
1650
+ var n;
1651
+ return ((n = this.events)[e] || (n[e] = [])).push(t), () => {
1652
+ var o;
1653
+ this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
1654
+ };
1655
+ }
1656
+ });
1657
+ const eo = (e, t) => {
1658
+ const n = new zn(), o = /* @__PURE__ */ new Map(), i = to(), r = (A, h) => {
1659
+ const L = A.selector.flatMap((R) => {
1660
+ const T = W([R]) ? R.range : oe(R, t).range;
1661
+ return Array.from(T.getClientRects());
1662
+ }), M = Ne(L).map((R) => Pe(R, h));
1663
+ return M.map((R) => {
1664
+ const { x: T, y: k, width: b, height: S } = R;
1651
1665
  return {
1652
- minX: E,
1653
- minY: M,
1654
- maxX: E + B,
1655
- maxY: M + N,
1666
+ minX: T,
1667
+ minY: k,
1668
+ maxX: T + b,
1669
+ maxY: k + S,
1656
1670
  annotation: {
1657
- id: d.annotation,
1658
- rects: x
1671
+ id: A.annotation,
1672
+ rects: M
1659
1673
  }
1660
1674
  };
1661
1675
  });
1662
- }, r = () => [...o.values()], s = () => {
1676
+ }, s = () => [...o.values()], a = () => {
1663
1677
  n.clear(), o.clear();
1664
- }, a = (d) => {
1665
- const l = i(d, t.getBoundingClientRect());
1666
- l.forEach((g) => n.insert(g)), o.set(d.annotation, l);
1667
- }, u = (d) => {
1668
- const l = o.get(d.annotation);
1669
- l && (l.forEach((g) => n.remove(g)), o.delete(d.annotation));
1670
- }, p = (d) => {
1671
- u(d), a(d);
1672
- }, h = (d, l = !0) => {
1673
- l && s();
1674
- const g = t.getBoundingClientRect(), x = d.map((E) => ({ target: E, rects: i(E, g) }));
1675
- x.forEach(({ target: E, rects: M }) => o.set(E.annotation, M));
1676
- const T = x.flatMap(({ rects: E }) => E);
1677
- n.load(T);
1678
- }, c = (d, l, g = !1) => {
1679
- const x = n.search({
1680
- minX: d,
1681
- minY: l,
1682
- maxX: d,
1683
- maxY: l
1684
- }), T = (E) => E.annotation.rects.reduce((M, B) => M + B.width * B.height, 0);
1685
- return x.length > 0 ? (x.sort((E, M) => T(E) - T(M)), g ? x.map((E) => E.annotation.id) : [x[0].annotation.id]) : [];
1686
- }, m = (d) => {
1687
- const l = f(d);
1688
- if (l.length === 0)
1678
+ }, d = (A) => {
1679
+ const h = r(A, t.getBoundingClientRect());
1680
+ h.forEach((L) => n.insert(L)), o.set(A.annotation, h);
1681
+ }, f = (A) => {
1682
+ const h = o.get(A.annotation);
1683
+ h && (h.forEach((L) => n.remove(L)), o.delete(A.annotation));
1684
+ }, g = (A) => {
1685
+ f(A), d(A);
1686
+ }, l = (A, h = !0) => {
1687
+ h && a();
1688
+ const L = t.getBoundingClientRect(), M = A.map((T) => ({ target: T, rects: r(T, L) }));
1689
+ M.forEach(({ target: T, rects: k }) => o.set(T.annotation, k));
1690
+ const R = M.flatMap(({ rects: T }) => T);
1691
+ n.load(R);
1692
+ }, m = (A, h, L = !1) => {
1693
+ const M = n.search({
1694
+ minX: A,
1695
+ minY: h,
1696
+ maxX: A,
1697
+ maxY: h
1698
+ }), R = (T) => T.annotation.rects.reduce((k, b) => k + b.width * b.height, 0);
1699
+ return M.length > 0 ? (M.sort((T, k) => R(T) - R(k)), L ? M.map((T) => T.annotation.id) : [M[0].annotation.id]) : [];
1700
+ }, c = (A) => {
1701
+ const h = v(A);
1702
+ if (h.length === 0)
1689
1703
  return;
1690
- let g = l[0].left, x = l[0].top, T = l[0].right, E = l[0].bottom;
1691
- for (let M = 1; M < l.length; M++) {
1692
- const B = l[M];
1693
- g = Math.min(g, B.left), x = Math.min(x, B.top), T = Math.max(T, B.right), E = Math.max(E, B.bottom);
1704
+ let L = h[0].left, M = h[0].top, R = h[0].right, T = h[0].bottom;
1705
+ for (let k = 1; k < h.length; k++) {
1706
+ const b = h[k];
1707
+ L = Math.min(L, b.left), M = Math.min(M, b.top), R = Math.max(R, b.right), T = Math.max(T, b.bottom);
1694
1708
  }
1695
- return new DOMRect(g, x, T - g, E - x);
1696
- }, f = (d) => {
1697
- const l = o.get(d);
1698
- return l ? l[0].annotation.rects : [];
1709
+ return new DOMRect(L, M, R - L, T - M);
1710
+ }, v = (A) => {
1711
+ const h = o.get(A);
1712
+ return h ? h[0].annotation.rects : [];
1699
1713
  };
1700
1714
  return {
1701
- all: r,
1702
- clear: s,
1703
- getAt: c,
1704
- getAnnotationBounds: m,
1705
- getAnnotationRects: f,
1706
- getIntersecting: (d, l, g, x) => {
1707
- const T = n.search({ minX: d, minY: l, maxX: g, maxY: x }), E = new Set(T.map((M) => M.annotation.id));
1708
- return Array.from(E).map((M) => ({
1709
- annotation: e.getAnnotation(M),
1710
- rects: f(M)
1711
- })).filter((M) => !!M.annotation);
1715
+ all: s,
1716
+ clear: a,
1717
+ getAt: m,
1718
+ getAnnotationBounds: c,
1719
+ getAnnotationRects: v,
1720
+ getIntersecting: (A, h, L, M) => {
1721
+ const R = n.search({ minX: A, minY: h, maxX: L, maxY: M }), T = new Set(R.map((k) => k.annotation.id));
1722
+ return Array.from(T).map((k) => ({
1723
+ annotation: e.getAnnotation(k),
1724
+ rects: v(k)
1725
+ })).filter((k) => !!k.annotation);
1726
+ },
1727
+ insert: d,
1728
+ recalculate: () => {
1729
+ l(e.all().map((A) => A.target), !0), i.emit("recalculate");
1712
1730
  },
1713
- insert: a,
1714
- recalculate: () => h(e.all().map((d) => d.target), !0),
1715
- remove: u,
1716
- set: h,
1731
+ remove: f,
1732
+ set: l,
1717
1733
  size: () => n.all().length,
1718
- update: p
1734
+ update: g,
1735
+ on: (A, h) => i.on(A, h)
1719
1736
  };
1720
- }, eo = (e, t) => {
1721
- const n = Tn(), o = to(n, e), i = fn(n, t), r = dn(n), s = kn(), a = (b, w = R.LOCAL) => {
1722
- const d = bt(b, e), l = W(d.target.selector);
1723
- return l && n.addAnnotation(d, w), l;
1724
- }, u = (b, w = !0, d = R.LOCAL) => {
1725
- const l = b.map((x) => bt(x, e)), g = l.filter((x) => !W(x.target.selector));
1726
- return g.length > 0 ? (console.warn("Could not revive all targets for these annotations:", g), n.bulkAddAnnotation(l, w, d), g) : (n.bulkAddAnnotation(l, w, d), []);
1727
- }, p = (b, w = R.LOCAL) => {
1728
- const d = b.map((g) => bt(g, e)), l = d.filter((g) => !W(g.target.selector));
1729
- return l.length > 0 && console.warn("Could not revive all targets for these annotations:", l), d.forEach((g) => {
1730
- n.getAnnotation(g.id) ? n.updateAnnotation(g, w) : n.addAnnotation(g, w);
1731
- }), l;
1732
- }, h = (b, w = R.LOCAL) => {
1733
- const d = mt(b, e);
1734
- n.updateTarget(d, w);
1735
- }, c = (b, w = R.LOCAL) => {
1736
- const d = b.map((l) => mt(l, e));
1737
- n.bulkUpdateTargets(d, w);
1738
- }, m = (b, w, d) => {
1739
- const l = o.getAt(b, w, !!d).map((x) => n.getAnnotation(x)), g = d ? l.filter(d) : l;
1740
- return g.length > 0 ? g[0] : void 0;
1741
- }, f = (b, w, d, l = 5) => {
1742
- const g = o.getAnnotationRects(b);
1743
- if (g.length !== 0) {
1744
- if (w && d) {
1745
- const x = g.find(({ top: T, right: E, bottom: M, left: B }) => w >= B - l && w <= E + l && d >= T - l && d <= M + l);
1746
- if (x) return x;
1737
+ }, no = (e, t) => {
1738
+ const n = En(), o = eo(n, e), i = fn(n, t), r = dn(n), s = kn(), a = (w, p = V.LOCAL) => {
1739
+ const u = bt(w, e), A = W(u.target.selector);
1740
+ return A && n.addAnnotation(u, p), A;
1741
+ }, d = (w, p = !0, u = V.LOCAL) => {
1742
+ const A = w.map((L) => bt(L, e)), h = A.filter((L) => !W(L.target.selector));
1743
+ return h.length > 0 ? (console.warn("Could not revive all targets for these annotations:", h), n.bulkAddAnnotation(A, p, u), h) : (n.bulkAddAnnotation(A, p, u), []);
1744
+ }, f = (w, p = V.LOCAL) => {
1745
+ const u = w.map((h) => bt(h, e)), A = u.filter((h) => !W(h.target.selector));
1746
+ return A.length > 0 && console.warn("Could not revive all targets for these annotations:", A), u.forEach((h) => {
1747
+ n.getAnnotation(h.id) ? n.updateAnnotation(h, p) : n.addAnnotation(h, p);
1748
+ }), A;
1749
+ }, g = (w, p = V.LOCAL) => {
1750
+ const u = mt(w, e);
1751
+ n.updateTarget(u, p);
1752
+ }, l = (w, p = V.LOCAL) => {
1753
+ const u = w.map((A) => mt(A, e));
1754
+ n.bulkUpdateTargets(u, p);
1755
+ }, m = (w, p, u) => {
1756
+ const A = o.getAt(w, p, !!u).map((L) => n.getAnnotation(L)), h = u ? A.filter(u) : A;
1757
+ return h.length > 0 ? h[0] : void 0;
1758
+ }, c = (w, p, u, A = 5) => {
1759
+ const h = o.getAnnotationRects(w);
1760
+ if (h.length !== 0) {
1761
+ if (p && u) {
1762
+ const L = h.find(({ top: M, right: R, bottom: T, left: k }) => p >= k - A && p <= R + A && u >= M - A && u <= T + A);
1763
+ if (L) return L;
1747
1764
  }
1748
- return o.getAnnotationBounds(b);
1765
+ return o.getAnnotationBounds(w);
1749
1766
  }
1750
- }, v = () => o.recalculate();
1751
- return n.observe(({ changes: b }) => {
1752
- const w = (b.deleted || []).filter((g) => W(g.target.selector)), d = (b.created || []).filter((g) => W(g.target.selector)), l = (b.updated || []).filter((g) => W(g.newValue.target.selector));
1753
- (w == null ? void 0 : w.length) > 0 && w.forEach((g) => o.remove(g.target)), d.length > 0 && o.set(d.map((g) => g.target), !1), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: g }) => o.update(g.target));
1767
+ }, v = () => o.recalculate(), C = (w) => o.on("recalculate", w);
1768
+ return n.observe(({ changes: w }) => {
1769
+ const p = (w.deleted || []).filter((h) => W(h.target.selector)), u = (w.created || []).filter((h) => W(h.target.selector)), A = (w.updated || []).filter((h) => W(h.newValue.target.selector));
1770
+ (p == null ? void 0 : p.length) > 0 && p.forEach((h) => o.remove(h.target)), u.length > 0 && o.set(u.map((h) => h.target), !1), (A == null ? void 0 : A.length) > 0 && A.forEach(({ newValue: h }) => o.update(h.target));
1754
1771
  }), {
1755
1772
  store: {
1756
1773
  ...n,
1757
1774
  addAnnotation: a,
1758
- bulkAddAnnotation: u,
1759
- bulkUpdateTargets: c,
1760
- bulkUpsertAnnotations: p,
1761
- getAnnotationBounds: f,
1775
+ bulkAddAnnotation: d,
1776
+ bulkUpdateTargets: l,
1777
+ bulkUpsertAnnotations: f,
1778
+ getAnnotationBounds: c,
1762
1779
  getAt: m,
1763
1780
  getIntersecting: o.getIntersecting.bind(o),
1764
1781
  getAnnotationRects: o.getAnnotationRects.bind(o),
1765
1782
  recalculatePositions: v,
1766
- updateTarget: h
1783
+ onRecalculatePositions: C,
1784
+ updateTarget: g
1767
1785
  },
1768
1786
  selection: i,
1769
1787
  hover: r,
1770
1788
  viewport: s
1771
1789
  };
1772
- }, no = () => {
1790
+ }, oo = () => {
1773
1791
  const e = document.createElement("canvas");
1774
1792
  e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
1775
1793
  const t = e.getContext("2d");
1776
1794
  return t.scale(2, 2), t.translate(0.5, 0.5), e;
1777
- }, oo = (e, t, n = {}) => {
1778
- const o = no(), i = o.getContext("2d");
1795
+ }, io = (e, t, n = {}) => {
1796
+ const o = oo(), i = o.getContext("2d");
1779
1797
  document.body.appendChild(o);
1780
- const r = /* @__PURE__ */ new Map(), s = (c) => Array.from(r.entries()).filter(([m, f]) => f.presenceKey === c.presenceKey).map(([m, f]) => m);
1781
- return t.on("selectionChange", (c, m) => {
1782
- s(c).forEach((v) => r.delete(v)), m && m.forEach((v) => r.set(v, c));
1798
+ const r = /* @__PURE__ */ new Map(), s = (l) => Array.from(r.entries()).filter(([m, c]) => c.presenceKey === l.presenceKey).map(([m, c]) => m);
1799
+ return t.on("selectionChange", (l, m) => {
1800
+ s(l).forEach((v) => r.delete(v)), m && m.forEach((v) => r.set(v, l));
1783
1801
  }), {
1784
1802
  clear: () => {
1785
- const { width: c, height: m } = o;
1786
- i.clearRect(-0.5, -0.5, c + 1, m + 1);
1803
+ const { width: l, height: m } = o;
1804
+ i.clearRect(-0.5, -0.5, l + 1, m + 1);
1787
1805
  },
1788
1806
  destroy: () => {
1789
1807
  o.remove();
1790
1808
  },
1791
- paint: (c, m, f) => {
1809
+ paint: (l, m, c) => {
1792
1810
  n.font && (i.font = n.font);
1793
- const v = r.get(c.annotation.id);
1811
+ const v = r.get(l.annotation.id);
1794
1812
  if (v) {
1795
- const { height: b } = c.rects[0], w = c.rects[0].x + m.left, d = c.rects[0].y + m.top;
1796
- i.fillStyle = v.appearance.color, i.fillRect(w - 2, d - 2.5, 2, b + 5);
1797
- const l = i.measureText(v.appearance.label), g = l.width + 6, x = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, T = l.fontBoundingBoxAscent ? 8 : 6.5;
1798
- return i.fillRect(w - 2, d - 2.5 - x, g, x), i.fillStyle = "#fff", i.fillText(v.appearance.label, w + 1, d - T), {
1813
+ const { height: C } = l.rects[0], w = l.rects[0].x + m.left, p = l.rects[0].y + m.top;
1814
+ i.fillStyle = v.appearance.color, i.fillRect(w - 2, p - 2.5, 2, C + 5);
1815
+ const u = i.measureText(v.appearance.label), A = u.width + 6, h = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent + 8, L = u.fontBoundingBoxAscent ? 8 : 6.5;
1816
+ return i.fillRect(w - 2, p - 2.5 - h, A, h), i.fillStyle = "#fff", i.fillText(v.appearance.label, w + 1, p - L), {
1799
1817
  fill: v.appearance.color,
1800
- fillOpacity: f ? 0.45 : 0.18
1818
+ fillOpacity: c ? 0.45 : 0.18
1801
1819
  };
1802
1820
  }
1803
1821
  },
1804
1822
  reset: () => {
1805
1823
  o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;
1806
- const c = o.getContext("2d");
1807
- c.scale(2, 2), c.translate(0.5, 0.5);
1824
+ const l = o.getContext("2d");
1825
+ l.scale(2, 2), l.translate(0.5, 0.5);
1808
1826
  }
1809
1827
  };
1810
1828
  }, ue = (e) => {
@@ -1812,23 +1830,23 @@ const to = (e, t) => {
1812
1830
  return document.scrollingElement;
1813
1831
  const { overflowY: t } = window.getComputedStyle(e);
1814
1832
  return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : ue(e.parentElement);
1815
- }, io = (e, t) => (n) => {
1833
+ }, ro = (e, t) => (n) => {
1816
1834
  const o = typeof n == "string" ? n : n.id, i = (s) => {
1817
- const a = r.getBoundingClientRect(), u = r.clientHeight, p = r.clientWidth, h = s.selector[0].range.getBoundingClientRect(), { width: c, height: m } = t.getAnnotationBounds(o), f = h.top - a.top, v = h.left - a.left, b = r.parentElement ? r.scrollTop : 0, w = r.parentElement ? r.scrollLeft : 0, d = f + b - (u - m) / 2, l = v + w - (p - c) / 2;
1818
- r.scroll({ top: d, left: l, behavior: "smooth" });
1835
+ const a = r.getBoundingClientRect(), d = r.clientHeight, f = r.clientWidth, g = s.selector[0].range.getBoundingClientRect(), { width: l, height: m } = t.getAnnotationBounds(o), c = g.top - a.top, v = g.left - a.left, C = r.parentElement ? r.scrollTop : 0, w = r.parentElement ? r.scrollLeft : 0, p = c + C - (d - m) / 2, u = v + w - (f - l) / 2;
1836
+ r.scroll({ top: p, left: u, behavior: "smooth" });
1819
1837
  }, r = ue(e);
1820
1838
  if (r) {
1821
1839
  const s = t.getAnnotation(o), { range: a } = s.target.selector[0];
1822
1840
  if (a && !a.collapsed)
1823
1841
  return i(s.target), !0;
1824
1842
  {
1825
- const u = mt(s.target, e), { range: p } = u.selector[0];
1826
- if (p && !p.collapsed)
1827
- return i(u), !0;
1843
+ const d = mt(s.target, e), { range: f } = d.selector[0];
1844
+ if (f && !f.collapsed)
1845
+ return i(d), !0;
1828
1846
  }
1829
1847
  }
1830
1848
  return !1;
1831
- }, ro = (e, t) => ({
1849
+ }, ao = (e, t) => ({
1832
1850
  ...e,
1833
1851
  annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
1834
1852
  user: e.user || t.user
@@ -1852,7 +1870,7 @@ function pe(e) {
1852
1870
  t[n - 1] += ",", t.splice(n, 1), n = t.lastIndexOf("");
1853
1871
  return t;
1854
1872
  }
1855
- function ao(e, t) {
1873
+ function so(e, t) {
1856
1874
  const n = e.length >= t.length ? e : t, o = e.length >= t.length ? t : e;
1857
1875
  let i = !0;
1858
1876
  for (let r = 0; r < n.length; r++)
@@ -1941,27 +1959,27 @@ const at = {
1941
1959
  18: !1,
1942
1960
  17: !1,
1943
1961
  91: !1
1944
- }, O = {};
1962
+ }, I = {};
1945
1963
  for (let e = 1; e < 20; e++)
1946
1964
  at["f".concat(e)] = 111 + e;
1947
- let V = [], rt = null, he = "all";
1948
- const G = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || X[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), so = (e) => Object.keys(at).find((t) => at[t] === e), lo = (e) => Object.keys(X).find((t) => X[t] === e);
1965
+ let O = [], rt = null, he = "all";
1966
+ const G = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || X[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), lo = (e) => Object.keys(at).find((t) => at[t] === e), co = (e) => Object.keys(X).find((t) => X[t] === e);
1949
1967
  function ge(e) {
1950
1968
  he = e || "all";
1951
1969
  }
1952
1970
  function st() {
1953
1971
  return he || "all";
1954
1972
  }
1955
- function co() {
1956
- return V.slice(0);
1957
- }
1958
1973
  function uo() {
1959
- return V.map((e) => so(e) || lo(e) || String.fromCharCode(e));
1974
+ return O.slice(0);
1960
1975
  }
1961
1976
  function fo() {
1977
+ return O.map((e) => lo(e) || co(e) || String.fromCharCode(e));
1978
+ }
1979
+ function po() {
1962
1980
  const e = [];
1963
- return Object.keys(O).forEach((t) => {
1964
- O[t].forEach((n) => {
1981
+ return Object.keys(I).forEach((t) => {
1982
+ I[t].forEach((n) => {
1965
1983
  let {
1966
1984
  key: o,
1967
1985
  scope: i,
@@ -1977,7 +1995,7 @@ function fo() {
1977
1995
  });
1978
1996
  }), e;
1979
1997
  }
1980
- function po(e) {
1998
+ function ho(e) {
1981
1999
  const t = e.target || e.srcElement, {
1982
2000
  tagName: n
1983
2001
  } = t;
@@ -1985,15 +2003,15 @@ function po(e) {
1985
2003
  const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(t.type);
1986
2004
  return (t.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !t.readOnly) && (o = !1), o;
1987
2005
  }
1988
- function ho(e) {
1989
- return typeof e == "string" && (e = lt(e)), V.indexOf(e) !== -1;
2006
+ function go(e) {
2007
+ return typeof e == "string" && (e = lt(e)), O.indexOf(e) !== -1;
1990
2008
  }
1991
- function go(e, t) {
2009
+ function mo(e, t) {
1992
2010
  let n, o;
1993
2011
  e || (e = st());
1994
- for (const i in O)
1995
- if (Object.prototype.hasOwnProperty.call(O, i))
1996
- for (n = O[i], o = 0; o < n.length; )
2012
+ for (const i in I)
2013
+ if (Object.prototype.hasOwnProperty.call(I, i))
2014
+ for (n = I[i], o = 0; o < n.length; )
1997
2015
  n[o].scope === e ? n.splice(o, 1).forEach((s) => {
1998
2016
  let {
1999
2017
  element: a
@@ -2002,18 +2020,18 @@ function go(e, t) {
2002
2020
  }) : o++;
2003
2021
  st() === e && ge(t || "all");
2004
2022
  }
2005
- function mo(e) {
2023
+ function bo(e) {
2006
2024
  let t = e.keyCode || e.which || e.charCode;
2007
- const n = V.indexOf(t);
2008
- if (n >= 0 && V.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && V.splice(0, V.length), (t === 93 || t === 224) && (t = 91), t in y) {
2025
+ const n = O.indexOf(t);
2026
+ if (n >= 0 && O.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && O.splice(0, O.length), (t === 93 || t === 224) && (t = 91), t in y) {
2009
2027
  y[t] = !1;
2010
2028
  for (const o in X) X[o] === t && (U[o] = !1);
2011
2029
  }
2012
2030
  }
2013
2031
  function me(e) {
2014
2032
  if (typeof e > "u")
2015
- Object.keys(O).forEach((i) => {
2016
- Array.isArray(O[i]) && O[i].forEach((r) => ht(r)), delete O[i];
2033
+ Object.keys(I).forEach((i) => {
2034
+ Array.isArray(I[i]) && I[i].forEach((r) => ht(r)), delete I[i];
2017
2035
  }), Pt(null);
2018
2036
  else if (Array.isArray(e))
2019
2037
  e.forEach((i) => {
@@ -2041,14 +2059,14 @@ const ht = (e) => {
2041
2059
  splitKey: i = "+"
2042
2060
  } = e;
2043
2061
  pe(t).forEach((s) => {
2044
- const a = s.split(i), u = a.length, p = a[u - 1], h = p === "*" ? "*" : lt(p);
2045
- if (!O[h]) return;
2062
+ const a = s.split(i), d = a.length, f = a[d - 1], g = f === "*" ? "*" : lt(f);
2063
+ if (!I[g]) return;
2046
2064
  n || (n = st());
2047
- const c = u > 1 ? fe(X, a) : [], m = [];
2048
- O[h] = O[h].filter((f) => {
2049
- const b = (o ? f.method === o : !0) && f.scope === n && ao(f.mods, c);
2050
- return b && m.push(f.element), !b;
2051
- }), m.forEach((f) => Pt(f));
2065
+ const l = d > 1 ? fe(X, a) : [], m = [];
2066
+ I[g] = I[g].filter((c) => {
2067
+ const C = (o ? c.method === o : !0) && c.scope === n && so(c.mods, l);
2068
+ return C && m.push(c.element), !C;
2069
+ }), m.forEach((c) => Pt(c));
2052
2070
  });
2053
2071
  };
2054
2072
  function Kt(e, t, n, o) {
@@ -2059,16 +2077,16 @@ function Kt(e, t, n, o) {
2059
2077
  i = t.mods.length > 0;
2060
2078
  for (const r in y)
2061
2079
  Object.prototype.hasOwnProperty.call(y, r) && (!y[r] && t.mods.indexOf(+r) > -1 || y[r] && t.mods.indexOf(+r) === -1) && (i = !1);
2062
- (t.mods.length === 0 && !y[16] && !y[18] && !y[17] && !y[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(V), t.method(e, t) === !1 && (e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation && e.stopPropagation(), e.cancelBubble && (e.cancelBubble = !0)));
2080
+ (t.mods.length === 0 && !y[16] && !y[18] && !y[17] && !y[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(O), t.method(e, t) === !1 && (e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation && e.stopPropagation(), e.cancelBubble && (e.cancelBubble = !0)));
2063
2081
  }
2064
2082
  }
2065
2083
  function te(e, t) {
2066
- const n = O["*"];
2084
+ const n = I["*"];
2067
2085
  let o = e.keyCode || e.which || e.charCode;
2068
2086
  if (!U.filter.call(this, e)) return;
2069
- if ((o === 93 || o === 224) && (o = 91), V.indexOf(o) === -1 && o !== 229 && V.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
2070
- const u = Ot[a];
2071
- e[a] && V.indexOf(u) === -1 ? V.push(u) : !e[a] && V.indexOf(u) > -1 ? V.splice(V.indexOf(u), 1) : a === "metaKey" && e[a] && V.length === 3 && (e.ctrlKey || e.shiftKey || e.altKey || (V = V.slice(V.indexOf(u))));
2087
+ if ((o === 93 || o === 224) && (o = 91), O.indexOf(o) === -1 && o !== 229 && O.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
2088
+ const d = Ot[a];
2089
+ e[a] && O.indexOf(d) === -1 ? O.push(d) : !e[a] && O.indexOf(d) > -1 ? O.splice(O.indexOf(d), 1) : a === "metaKey" && e[a] && O.length === 3 && (e.ctrlKey || e.shiftKey || e.altKey || (O = O.slice(O.indexOf(d))));
2072
2090
  }), o in y) {
2073
2091
  y[o] = !0;
2074
2092
  for (const a in X)
@@ -2077,75 +2095,75 @@ function te(e, t) {
2077
2095
  }
2078
2096
  for (const a in y)
2079
2097
  Object.prototype.hasOwnProperty.call(y, a) && (y[a] = e[Ot[a]]);
2080
- e.getModifierState && !(e.altKey && !e.ctrlKey) && e.getModifierState("AltGraph") && (V.indexOf(17) === -1 && V.push(17), V.indexOf(18) === -1 && V.push(18), y[17] = !0, y[18] = !0);
2098
+ e.getModifierState && !(e.altKey && !e.ctrlKey) && e.getModifierState("AltGraph") && (O.indexOf(17) === -1 && O.push(17), O.indexOf(18) === -1 && O.push(18), y[17] = !0, y[18] = !0);
2081
2099
  const i = st();
2082
2100
  if (n)
2083
2101
  for (let a = 0; a < n.length; a++)
2084
2102
  n[a].scope === i && (e.type === "keydown" && n[a].keydown || e.type === "keyup" && n[a].keyup) && Kt(e, n[a], i, t);
2085
- if (!(o in O)) return;
2086
- const r = O[o], s = r.length;
2103
+ if (!(o in I)) return;
2104
+ const r = I[o], s = r.length;
2087
2105
  for (let a = 0; a < s; a++)
2088
2106
  if ((e.type === "keydown" && r[a].keydown || e.type === "keyup" && r[a].keyup) && r[a].key) {
2089
- const u = r[a], {
2090
- splitKey: p
2091
- } = u, h = u.key.split(p), c = [];
2092
- for (let m = 0; m < h.length; m++)
2093
- c.push(lt(h[m]));
2094
- c.sort().join("") === V.sort().join("") && Kt(e, u, i, t);
2107
+ const d = r[a], {
2108
+ splitKey: f
2109
+ } = d, g = d.key.split(f), l = [];
2110
+ for (let m = 0; m < g.length; m++)
2111
+ l.push(lt(g[m]));
2112
+ l.sort().join("") === O.sort().join("") && Kt(e, d, i, t);
2095
2113
  }
2096
2114
  }
2097
2115
  function U(e, t, n) {
2098
- V = [];
2116
+ O = [];
2099
2117
  const o = pe(e);
2100
- let i = [], r = "all", s = document, a = 0, u = !1, p = !0, h = "+", c = !1, m = !1;
2101
- for (n === void 0 && typeof t == "function" && (n = t), Object.prototype.toString.call(t) === "[object Object]" && (t.scope && (r = t.scope), t.element && (s = t.element), t.keyup && (u = t.keyup), t.keydown !== void 0 && (p = t.keydown), t.capture !== void 0 && (c = t.capture), typeof t.splitKey == "string" && (h = t.splitKey), t.single === !0 && (m = !0)), typeof t == "string" && (r = t), m && me(e, r); a < o.length; a++)
2102
- e = o[a].split(h), i = [], e.length > 1 && (i = fe(X, e)), e = e[e.length - 1], e = e === "*" ? "*" : lt(e), e in O || (O[e] = []), O[e].push({
2103
- keyup: u,
2104
- keydown: p,
2118
+ let i = [], r = "all", s = document, a = 0, d = !1, f = !0, g = "+", l = !1, m = !1;
2119
+ for (n === void 0 && typeof t == "function" && (n = t), Object.prototype.toString.call(t) === "[object Object]" && (t.scope && (r = t.scope), t.element && (s = t.element), t.keyup && (d = t.keyup), t.keydown !== void 0 && (f = t.keydown), t.capture !== void 0 && (l = t.capture), typeof t.splitKey == "string" && (g = t.splitKey), t.single === !0 && (m = !0)), typeof t == "string" && (r = t), m && me(e, r); a < o.length; a++)
2120
+ e = o[a].split(g), i = [], e.length > 1 && (i = fe(X, e)), e = e[e.length - 1], e = e === "*" ? "*" : lt(e), e in I || (I[e] = []), I[e].push({
2121
+ keyup: d,
2122
+ keydown: f,
2105
2123
  scope: r,
2106
2124
  mods: i,
2107
2125
  shortcut: o[a],
2108
2126
  method: n,
2109
2127
  key: o[a],
2110
- splitKey: h,
2128
+ splitKey: g,
2111
2129
  element: s
2112
2130
  });
2113
2131
  if (typeof s < "u" && window) {
2114
2132
  if (!G.has(s)) {
2115
- const f = function() {
2116
- let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2117
- return te(b, s);
2133
+ const c = function() {
2134
+ let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2135
+ return te(C, s);
2118
2136
  }, v = function() {
2119
- let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2120
- te(b, s), mo(b);
2137
+ let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2138
+ te(C, s), bo(C);
2121
2139
  };
2122
2140
  G.set(s, {
2123
- keydownListener: f,
2141
+ keydownListener: c,
2124
2142
  keyupListenr: v,
2125
- capture: c
2126
- }), Bt(s, "keydown", f, c), Bt(s, "keyup", v, c);
2143
+ capture: l
2144
+ }), Bt(s, "keydown", c, l), Bt(s, "keyup", v, l);
2127
2145
  }
2128
2146
  if (!rt) {
2129
- const f = () => {
2130
- V = [];
2147
+ const c = () => {
2148
+ O = [];
2131
2149
  };
2132
2150
  rt = {
2133
- listener: f,
2134
- capture: c
2135
- }, Bt(window, "focus", f, c);
2151
+ listener: c,
2152
+ capture: l
2153
+ }, Bt(window, "focus", c, l);
2136
2154
  }
2137
2155
  }
2138
2156
  }
2139
- function bo(e) {
2157
+ function wo(e) {
2140
2158
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
2141
- Object.keys(O).forEach((n) => {
2142
- O[n].filter((i) => i.scope === t && i.shortcut === e).forEach((i) => {
2159
+ Object.keys(I).forEach((n) => {
2160
+ I[n].filter((i) => i.scope === t && i.shortcut === e).forEach((i) => {
2143
2161
  i && i.method && i.method();
2144
2162
  });
2145
2163
  });
2146
2164
  }
2147
2165
  function Pt(e) {
2148
- const t = Object.values(O).flat();
2166
+ const t = Object.values(I).flat();
2149
2167
  if (t.findIndex((o) => {
2150
2168
  let {
2151
2169
  element: i
@@ -2166,7 +2184,7 @@ function Pt(e) {
2166
2184
  capture: a
2167
2185
  } = G.get(i) || {};
2168
2186
  r && s && (et(i, "keyup", s, a), et(i, "keydown", r, a), G.delete(i));
2169
- }), G.clear(), Object.keys(O).forEach((i) => delete O[i]), rt)) {
2187
+ }), G.clear(), Object.keys(I).forEach((i) => delete I[i]), rt)) {
2170
2188
  const {
2171
2189
  listener: i,
2172
2190
  capture: r
@@ -2175,15 +2193,15 @@ function Pt(e) {
2175
2193
  }
2176
2194
  }
2177
2195
  const kt = {
2178
- getPressedKeyString: uo,
2196
+ getPressedKeyString: fo,
2179
2197
  setScope: ge,
2180
2198
  getScope: st,
2181
- deleteScope: go,
2182
- getPressedKeyCodes: co,
2183
- getAllKeyCodes: fo,
2184
- isPressed: ho,
2185
- filter: po,
2186
- trigger: bo,
2199
+ deleteScope: mo,
2200
+ getPressedKeyCodes: uo,
2201
+ getAllKeyCodes: po,
2202
+ isPressed: go,
2203
+ filter: ho,
2204
+ trigger: wo,
2187
2205
  unbind: me,
2188
2206
  keyMap: at,
2189
2207
  modifier: X,
@@ -2201,123 +2219,130 @@ var be = {};
2201
2219
  t.Unidentified = "Unidentified", t.Alt = "Alt", t.AltGraph = "AltGraph", t.CapsLock = "CapsLock", t.Control = "Control", t.Fn = "Fn", t.FnLock = "FnLock", t.Hyper = "Hyper", t.Meta = "Meta", t.NumLock = "NumLock", t.ScrollLock = "ScrollLock", t.Shift = "Shift", t.Super = "Super", t.Symbol = "Symbol", t.SymbolLock = "SymbolLock", t.Enter = "Enter", t.Tab = "Tab", t.ArrowDown = "ArrowDown", t.ArrowLeft = "ArrowLeft", t.ArrowRight = "ArrowRight", t.ArrowUp = "ArrowUp", t.End = "End", t.Home = "Home", t.PageDown = "PageDown", t.PageUp = "PageUp", t.Backspace = "Backspace", t.Clear = "Clear", t.Copy = "Copy", t.CrSel = "CrSel", t.Cut = "Cut", t.Delete = "Delete", t.EraseEof = "EraseEof", t.ExSel = "ExSel", t.Insert = "Insert", t.Paste = "Paste", t.Redo = "Redo", t.Undo = "Undo", t.Accept = "Accept", t.Again = "Again", t.Attn = "Attn", t.Cancel = "Cancel", t.ContextMenu = "ContextMenu", t.Escape = "Escape", t.Execute = "Execute", t.Find = "Find", t.Finish = "Finish", t.Help = "Help", t.Pause = "Pause", t.Play = "Play", t.Props = "Props", t.Select = "Select", t.ZoomIn = "ZoomIn", t.ZoomOut = "ZoomOut", t.BrightnessDown = "BrightnessDown", t.BrightnessUp = "BrightnessUp", t.Eject = "Eject", t.LogOff = "LogOff", t.Power = "Power", t.PowerOff = "PowerOff", t.PrintScreen = "PrintScreen", t.Hibernate = "Hibernate", t.Standby = "Standby", t.WakeUp = "WakeUp", t.AllCandidates = "AllCandidates", t.Alphanumeric = "Alphanumeric", t.CodeInput = "CodeInput", t.Compose = "Compose", t.Convert = "Convert", t.Dead = "Dead", t.FinalMode = "FinalMode", t.GroupFirst = "GroupFirst", t.GroupLast = "GroupLast", t.GroupNext = "GroupNext", t.GroupPrevious = "GroupPrevious", t.ModeChange = "ModeChange", t.NextCandidate = "NextCandidate", t.NonConvert = "NonConvert", t.PreviousCandidate = "PreviousCandidate", t.Process = "Process", t.SingleCandidate = "SingleCandidate", t.HangulMode = "HangulMode", t.HanjaMode = "HanjaMode", t.JunjaMode = "JunjaMode", t.Eisu = "Eisu", t.Hankaku = "Hankaku", t.Hiragana = "Hiragana", t.HiraganaKatakana = "HiraganaKatakana", t.KanaMode = "KanaMode", t.KanjiMode = "KanjiMode", t.Katakana = "Katakana", t.Romaji = "Romaji", t.Zenkaku = "Zenkaku", t.ZenkakuHanaku = "ZenkakuHanaku", t.F1 = "F1", t.F2 = "F2", t.F3 = "F3", t.F4 = "F4", t.F5 = "F5", t.F6 = "F6", t.F7 = "F7", t.F8 = "F8", t.F9 = "F9", t.F10 = "F10", t.F11 = "F11", t.F12 = "F12", t.F13 = "F13", t.F14 = "F14", t.F15 = "F15", t.F16 = "F16", t.F17 = "F17", t.F18 = "F18", t.F19 = "F19", t.F20 = "F20", t.Soft1 = "Soft1", t.Soft2 = "Soft2", t.Soft3 = "Soft3", t.Soft4 = "Soft4", t.AppSwitch = "AppSwitch", t.Call = "Call", t.Camera = "Camera", t.CameraFocus = "CameraFocus", t.EndCall = "EndCall", t.GoBack = "GoBack", t.GoHome = "GoHome", t.HeadsetHook = "HeadsetHook", t.LastNumberRedial = "LastNumberRedial", t.Notification = "Notification", t.MannerMode = "MannerMode", t.VoiceDial = "VoiceDial", t.ChannelDown = "ChannelDown", t.ChannelUp = "ChannelUp", t.MediaFastForward = "MediaFastForward", t.MediaPause = "MediaPause", t.MediaPlay = "MediaPlay", t.MediaPlayPause = "MediaPlayPause", t.MediaRecord = "MediaRecord", t.MediaRewind = "MediaRewind", t.MediaStop = "MediaStop", t.MediaTrackNext = "MediaTrackNext", t.MediaTrackPrevious = "MediaTrackPrevious", t.AudioBalanceLeft = "AudioBalanceLeft", t.AudioBalanceRight = "AudioBalanceRight", t.AudioBassDown = "AudioBassDown", t.AudioBassBoostDown = "AudioBassBoostDown", t.AudioBassBoostToggle = "AudioBassBoostToggle", t.AudioBassBoostUp = "AudioBassBoostUp", t.AudioBassUp = "AudioBassUp", t.AudioFaderFront = "AudioFaderFront", t.AudioFaderRear = "AudioFaderRear", t.AudioSurroundModeNext = "AudioSurroundModeNext", t.AudioTrebleDown = "AudioTrebleDown", t.AudioTrebleUp = "AudioTrebleUp", t.AudioVolumeDown = "AudioVolumeDown", t.AudioVolumeMute = "AudioVolumeMute", t.AudioVolumeUp = "AudioVolumeUp", t.MicrophoneToggle = "MicrophoneToggle", t.MicrophoneVolumeDown = "MicrophoneVolumeDown", t.MicrophoneVolumeMute = "MicrophoneVolumeMute", t.MicrophoneVolumeUp = "MicrophoneVolumeUp", t.TV = "TV", t.TV3DMode = "TV3DMode", t.TVAntennaCable = "TVAntennaCable", t.TVAudioDescription = "TVAudioDescription", t.TVAudioDescriptionMixDown = "TVAudioDescriptionMixDown", t.TVAudioDescriptionMixUp = "TVAudioDescriptionMixUp", t.TVContentsMenu = "TVContentsMenu", t.TVDataService = "TVDataService", t.TVInput = "TVInput", t.TVInputComponent1 = "TVInputComponent1", t.TVInputComponent2 = "TVInputComponent2", t.TVInputComposite1 = "TVInputComposite1", t.TVInputComposite2 = "TVInputComposite2", t.TVInputHDMI1 = "TVInputHDMI1", t.TVInputHDMI2 = "TVInputHDMI2", t.TVInputHDMI3 = "TVInputHDMI3", t.TVInputHDMI4 = "TVInputHDMI4", t.TVInputVGA1 = "TVInputVGA1", t.TVMediaContext = "TVMediaContext", t.TVNetwork = "TVNetwork", t.TVNumberEntry = "TVNumberEntry", t.TVPower = "TVPower", t.TVRadioService = "TVRadioService", t.TVSatellite = "TVSatellite", t.TVSatelliteBS = "TVSatelliteBS", t.TVSatelliteCS = "TVSatelliteCS", t.TVSatelliteToggle = "TVSatelliteToggle", t.TVTerrestrialAnalog = "TVTerrestrialAnalog", t.TVTerrestrialDigital = "TVTerrestrialDigital", t.TVTimer = "TVTimer", t.AVRInput = "AVRInput", t.AVRPower = "AVRPower", t.ColorF0Red = "ColorF0Red", t.ColorF1Green = "ColorF1Green", t.ColorF2Yellow = "ColorF2Yellow", t.ColorF3Blue = "ColorF3Blue", t.ColorF4Grey = "ColorF4Grey", t.ColorF5Brown = "ColorF5Brown", t.ClosedCaptionToggle = "ClosedCaptionToggle", t.Dimmer = "Dimmer", t.DisplaySwap = "DisplaySwap", t.DVR = "DVR", t.Exit = "Exit", t.FavoriteClear0 = "FavoriteClear0", t.FavoriteClear1 = "FavoriteClear1", t.FavoriteClear2 = "FavoriteClear2", t.FavoriteClear3 = "FavoriteClear3", t.FavoriteRecall0 = "FavoriteRecall0", t.FavoriteRecall1 = "FavoriteRecall1", t.FavoriteRecall2 = "FavoriteRecall2", t.FavoriteRecall3 = "FavoriteRecall3", t.FavoriteStore0 = "FavoriteStore0", t.FavoriteStore1 = "FavoriteStore1", t.FavoriteStore2 = "FavoriteStore2", t.FavoriteStore3 = "FavoriteStore3", t.Guide = "Guide", t.GuideNextDay = "GuideNextDay", t.GuidePreviousDay = "GuidePreviousDay", t.Info = "Info", t.InstantReplay = "InstantReplay", t.Link = "Link", t.ListProgram = "ListProgram", t.LiveContent = "LiveContent", t.Lock = "Lock", t.MediaApps = "MediaApps", t.MediaAudioTrack = "MediaAudioTrack", t.MediaLast = "MediaLast", t.MediaSkipBackward = "MediaSkipBackward", t.MediaSkipForward = "MediaSkipForward", t.MediaStepBackward = "MediaStepBackward", t.MediaStepForward = "MediaStepForward", t.MediaTopMenu = "MediaTopMenu", t.NavigateIn = "NavigateIn", t.NavigateNext = "NavigateNext", t.NavigateOut = "NavigateOut", t.NavigatePrevious = "NavigatePrevious", t.NextFavoriteChannel = "NextFavoriteChannel", t.NextUserProfile = "NextUserProfile", t.OnDemand = "OnDemand", t.Pairing = "Pairing", t.PinPDown = "PinPDown", t.PinPMove = "PinPMove", t.PinPToggle = "PinPToggle", t.PinPUp = "PinPUp", t.PlaySpeedDown = "PlaySpeedDown", t.PlaySpeedReset = "PlaySpeedReset", t.PlaySpeedUp = "PlaySpeedUp", t.RandomToggle = "RandomToggle", t.RcLowBattery = "RcLowBattery", t.RecordSpeedNext = "RecordSpeedNext", t.RfBypass = "RfBypass", t.ScanChannelsToggle = "ScanChannelsToggle", t.ScreenModeNext = "ScreenModeNext", t.Settings = "Settings", t.SplitScreenToggle = "SplitScreenToggle", t.STBInput = "STBInput", t.STBPower = "STBPower", t.Subtitle = "Subtitle", t.Teletext = "Teletext", t.VideoModeNext = "VideoModeNext", t.Wink = "Wink", t.ZoomToggle = "ZoomToggle", t.SpeechCorrectionList = "SpeechCorrectionList", t.SpeechInputToggle = "SpeechInputToggle", t.Close = "Close", t.New = "New", t.Open = "Open", t.Print = "Print", t.Save = "Save", t.SpellCheck = "SpellCheck", t.MailForward = "MailForward", t.MailReply = "MailReply", t.MailSend = "MailSend", t.LaunchCalculator = "LaunchCalculator", t.LaunchCalendar = "LaunchCalendar", t.LaunchContacts = "LaunchContacts", t.LaunchMail = "LaunchMail", t.LaunchMediaPlayer = "LaunchMediaPlayer", t.LaunchMusicPlayer = "LaunchMusicPlayer", t.LaunchMyComputer = "LaunchMyComputer", t.LaunchPhone = "LaunchPhone", t.LaunchScreenSaver = "LaunchScreenSaver", t.LaunchSpreadsheet = "LaunchSpreadsheet", t.LaunchWebBrowser = "LaunchWebBrowser", t.LaunchWebCam = "LaunchWebCam", t.LaunchWordProcessor = "LaunchWordProcessor", t.LaunchApplication1 = "LaunchApplication1", t.LaunchApplication2 = "LaunchApplication2", t.LaunchApplication3 = "LaunchApplication3", t.LaunchApplication4 = "LaunchApplication4", t.LaunchApplication5 = "LaunchApplication5", t.LaunchApplication6 = "LaunchApplication6", t.LaunchApplication7 = "LaunchApplication7", t.LaunchApplication8 = "LaunchApplication8", t.LaunchApplication9 = "LaunchApplication9", t.LaunchApplication10 = "LaunchApplication10", t.LaunchApplication11 = "LaunchApplication11", t.LaunchApplication12 = "LaunchApplication12", t.LaunchApplication13 = "LaunchApplication13", t.LaunchApplication14 = "LaunchApplication14", t.LaunchApplication15 = "LaunchApplication15", t.LaunchApplication16 = "LaunchApplication16", t.BrowserBack = "BrowserBack", t.BrowserFavorites = "BrowserFavorites", t.BrowserForward = "BrowserForward", t.BrowserHome = "BrowserHome", t.BrowserRefresh = "BrowserRefresh", t.BrowserSearch = "BrowserSearch", t.BrowserStop = "BrowserStop", t.Decimal = "Decimal", t.Key11 = "Key11", t.Key12 = "Key12", t.Multiply = "Multiply", t.Add = "Add", t.Divide = "Divide", t.Subtract = "Subtract", t.Separator = "Separator";
2202
2220
  }(e.Key || (e.Key = {}));
2203
2221
  })(be);
2204
- const wo = (e, t, n, o) => {
2205
- let i;
2206
- const r = (g) => i = g;
2207
- let s;
2208
- const a = (g) => s = g, { store: u, selection: p } = t;
2209
- let h, c, m;
2210
- const f = (g) => {
2211
- var T;
2212
- if (c === !1)
2222
+ const Ao = (e, t, n) => {
2223
+ let o;
2224
+ const i = (h) => o = h;
2225
+ let r;
2226
+ const s = (h) => r = h;
2227
+ let a = !0;
2228
+ const d = (h) => a = h, { store: f, selection: g } = t;
2229
+ let l, m, c;
2230
+ const v = (h) => {
2231
+ var M;
2232
+ if (!a || m === !1)
2213
2233
  return;
2214
- h = !((T = g.target.parentElement) != null && T.closest(Y)) ? {
2234
+ l = !((M = h.target.parentElement) != null && M.closest(Y)) ? {
2215
2235
  annotation: se(),
2216
2236
  selector: [],
2217
- creator: i,
2237
+ creator: o,
2218
2238
  created: /* @__PURE__ */ new Date()
2219
2239
  } : void 0;
2220
2240
  };
2221
- n && e.addEventListener("selectstart", f);
2222
- const v = It((g) => {
2223
- var N, A;
2224
- const x = document.getSelection();
2225
- if (!!((A = (N = x.anchorNode) == null ? void 0 : N.parentElement) != null && A.closest(Y))) {
2226
- h = void 0;
2241
+ e.addEventListener("selectstart", v);
2242
+ const C = It((h) => {
2243
+ var b, S;
2244
+ if (!a) return;
2245
+ const L = document.getSelection();
2246
+ if (!!((S = (b = L.anchorNode) == null ? void 0 : b.parentElement) != null && S.closest(Y))) {
2247
+ l = void 0;
2227
2248
  return;
2228
2249
  }
2229
- if (g.timeStamp - ((m == null ? void 0 : m.timeStamp) || g.timeStamp) < 1e3 && !h && f(m || g), x.isCollapsed || !h || c === !1)
2250
+ if (h.timeStamp - ((c == null ? void 0 : c.timeStamp) || h.timeStamp) < 1e3 && !l && v(c || h), L.isCollapsed || !l || m === !1)
2230
2251
  return;
2231
- const E = x.getRangeAt(0);
2232
- if (Ve(E)) return;
2233
- const M = Le(E.cloneRange());
2234
- (M.length !== h.selector.length || M.some((S, C) => {
2235
- var L;
2236
- return S.toString() !== ((L = h.selector[C]) == null ? void 0 : L.quote);
2237
- })) && (h = {
2238
- ...h,
2239
- selector: M.map((S) => Fe(S, e, o)),
2252
+ const R = L.getRangeAt(0);
2253
+ if (Ve(R)) return;
2254
+ const T = Le(R.cloneRange());
2255
+ (T.length !== l.selector.length || T.some((x, E) => {
2256
+ var B;
2257
+ return x.toString() !== ((B = l.selector[E]) == null ? void 0 : B.quote);
2258
+ })) && (l = {
2259
+ ...l,
2260
+ selector: T.map((x) => Fe(x, e, n)),
2240
2261
  updated: /* @__PURE__ */ new Date()
2241
- }, u.getAnnotation(h.annotation) ? u.updateTarget(h, R.LOCAL) : (p.clear(), u.addAnnotation({
2242
- id: h.annotation,
2262
+ }, f.getAnnotation(l.annotation) ? f.updateTarget(l, V.LOCAL) : (g.clear(), f.addAnnotation({
2263
+ id: l.annotation,
2243
2264
  bodies: [],
2244
- target: h
2245
- }, R.LOCAL), p.userSelect(h.annotation, m)));
2265
+ target: l
2266
+ }, V.LOCAL), g.userSelect(l.annotation, c)));
2246
2267
  });
2247
- n && document.addEventListener("selectionchange", v);
2248
- const b = (g) => {
2249
- m = De(g), c = m.button === 0;
2268
+ document.addEventListener("selectionchange", C);
2269
+ const w = (h) => {
2270
+ c = De(h), m = c.button === 0;
2250
2271
  };
2251
- e.addEventListener("pointerdown", b);
2252
- const w = (g) => {
2253
- var M;
2254
- if (!!((M = g.target.parentElement) != null && M.closest(Y)) || !c)
2272
+ e.addEventListener("pointerdown", w);
2273
+ const p = (h) => {
2274
+ var T;
2275
+ if (!!((T = h.target.parentElement) != null && T.closest(Y)) || !m)
2255
2276
  return;
2256
- const T = () => {
2257
- const { x: B, y: N } = e.getBoundingClientRect(), A = u.getAt(g.clientX - B, g.clientY - N, s);
2258
- if (A) {
2259
- const { selected: S } = p;
2260
- (S.length !== 1 || S[0].id !== A.id) && p.userSelect(A.id, g);
2261
- } else p.isEmpty() || p.clear();
2262
- }, E = g.timeStamp - m.timeStamp;
2263
- document.getSelection().isCollapsed && E < 300 ? (h = void 0, T()) : h && p.userSelect(h.annotation, g);
2277
+ const M = () => {
2278
+ const { x: k, y: b } = e.getBoundingClientRect(), S = f.getAt(h.clientX - k, h.clientY - b, r);
2279
+ if (S) {
2280
+ const { selected: x } = g;
2281
+ (x.length !== 1 || x[0].id !== S.id) && g.userSelect(S.id, h);
2282
+ } else g.isEmpty() || g.clear();
2283
+ }, R = h.timeStamp - c.timeStamp;
2284
+ document.getSelection().isCollapsed && R < 300 ? (l = void 0, M()) : l && g.userSelect(l.annotation, h);
2264
2285
  };
2265
- document.addEventListener("pointerup", w), U("*", { element: e, keyup: !1, keydown: !0 }, (g, x) => {
2266
- g.repeat || (m = ye(g));
2267
- }), U("*", { keyup: !0, keydown: !1 }, (g) => {
2268
- U.shift && g.key === be.Key.Shift && !g.repeat && h && p.userSelect(h.annotation, g);
2286
+ document.addEventListener("pointerup", p), U("*", { element: e, keyup: !1, keydown: !0 }, (h, L) => {
2287
+ h.repeat || (c = ye(h));
2288
+ }), U("*", { keyup: !0, keydown: !1 }, (h) => {
2289
+ U.shift && h.key === be.Key.Shift && !h.repeat && l && g.userSelect(l.annotation, h);
2269
2290
  });
2270
- let d = !1;
2291
+ let u = !1;
2271
2292
  return U("ctrl+a, ⌘+a", { keyup: !1, keydown: !0 }, () => {
2272
- d = !0;
2273
- }), U("*", { keyup: !0, keydown: !1 }, (g) => {
2274
- d && !g.repeat && h && p.userSelect(h.annotation, g), d = !1;
2293
+ u = !0;
2294
+ }), U("*", { keyup: !0, keydown: !1 }, (h) => {
2295
+ u && !h.repeat && l && g.userSelect(l.annotation, h), u = !1;
2275
2296
  }), {
2276
2297
  destroy: () => {
2277
- e.removeEventListener("selectstart", f), document.removeEventListener("selectionchange", v), e.removeEventListener("pointerdown", b), document.removeEventListener("pointerup", w), U.unbind();
2298
+ e.removeEventListener("selectstart", v), document.removeEventListener("selectionchange", C), e.removeEventListener("pointerdown", w), document.removeEventListener("pointerup", p), U.unbind();
2278
2299
  },
2279
- setFilter: a,
2280
- setUser: r
2300
+ setFilter: s,
2301
+ setUser: i,
2302
+ setAnnotatingEnabled: d
2281
2303
  };
2282
2304
  }, ee = "SPANS", To = (e, t = {}) => {
2283
- Te(e), Ee(e);
2284
- const n = ro(t, {
2305
+ Ee(e), Te(e);
2306
+ const n = ao(t, {
2285
2307
  annotatingEnabled: !0,
2286
2308
  user: yn()
2287
- }), o = eo(e, n.userAction), { selection: i, viewport: r } = o, s = o.store, a = Bn(s), u = Rn(o, a, n.adapter);
2288
- let p = n.user;
2289
- const h = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ee : n.renderer || ee, c = h === "SPANS" ? on(e, o, r) : h === "CSS_HIGHLIGHTS" ? tn(e, o, r) : h === "CANVAS" ? $e(e, o, r) : void 0;
2290
- if (!c)
2291
- throw `Unknown renderer implementation: ${h}`;
2292
- console.debug(`Using ${h} renderer`), n.style && c.setStyle(n.style);
2293
- const m = wo(e, o, n.annotatingEnabled, n.offsetReferenceSelector);
2294
- m.setUser(p);
2295
- const f = On(o, a, n.adapter), v = () => p, b = (x) => {
2296
- c.setFilter(x), m.setFilter(x);
2297
- }, w = (x) => {
2298
- p = x, m.setUser(x);
2299
- }, d = (x) => {
2300
- x && (c.setPainter(oo(e, x, n.presence)), x.on("selectionChange", () => c.redraw()));
2301
- }, l = (x) => {
2302
- x ? i.setSelected(x) : i.clear();
2309
+ }), o = no(e, n.userSelectAction), { selection: i, viewport: r } = o, s = o.store, a = Bn(s), d = Rn(o, a, n.adapter);
2310
+ let f = n.user;
2311
+ const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ee : n.renderer || ee, l = g === "SPANS" ? on(e, o, r) : g === "CSS_HIGHLIGHTS" ? tn(e, o, r) : g === "CANVAS" ? $e(e, o, r) : void 0;
2312
+ if (!l)
2313
+ throw `Unknown renderer implementation: ${g}`;
2314
+ console.debug(`Using ${g} renderer`), n.style && l.setStyle(n.style);
2315
+ const m = Ao(e, o, n.offsetReferenceSelector);
2316
+ m.setUser(f), m.setAnnotatingEnabled(n.annotatingEnabled);
2317
+ const c = On(o, a, n.adapter), v = () => f, C = (L) => {
2318
+ m.setAnnotatingEnabled(L);
2319
+ }, w = (L) => {
2320
+ l.setFilter(L), m.setFilter(L);
2321
+ }, p = (L) => {
2322
+ f = L, m.setUser(L);
2323
+ }, u = (L) => {
2324
+ L && (l.setPainter(io(e, L, n.presence)), L.on("selectionChange", () => l.redraw()));
2325
+ }, A = (L) => {
2326
+ L ? i.setSelected(L) : i.clear();
2303
2327
  };
2304
2328
  return {
2305
- ...f,
2329
+ ...c,
2306
2330
  destroy: () => {
2307
- c.destroy(), m.destroy(), a.destroy();
2331
+ l.destroy(), m.destroy(), a.destroy();
2308
2332
  },
2309
2333
  element: e,
2310
2334
  getUser: v,
2311
- setFilter: b,
2312
- setStyle: c.setStyle.bind(c),
2313
- redraw: c.redraw.bind(c),
2314
- setUser: w,
2315
- setSelected: l,
2316
- setPresenceProvider: d,
2317
- setVisible: c.setVisible.bind(c),
2318
- on: u.on,
2319
- off: u.off,
2320
- scrollIntoView: io(e, s),
2335
+ setAnnotatingEnabled: C,
2336
+ setFilter: w,
2337
+ setStyle: l.setStyle.bind(l),
2338
+ redraw: l.redraw.bind(l),
2339
+ setUser: p,
2340
+ setSelected: A,
2341
+ setPresenceProvider: u,
2342
+ setVisible: l.setVisible.bind(l),
2343
+ on: d.on,
2344
+ off: d.off,
2345
+ scrollIntoView: ro(e, s),
2321
2346
  state: o
2322
2347
  };
2323
2348
  };
@@ -2326,24 +2351,24 @@ export {
2326
2351
  q as DEFAULT_STYLE,
2327
2352
  ne as NOT_ANNOTATABLE_CLASS,
2328
2353
  Y as NOT_ANNOTATABLE_SELECTOR,
2329
- R as Origin,
2354
+ V as Origin,
2330
2355
  un as UserSelectAction,
2331
- Lo as W3CTextFormat,
2332
- Te as cancelSingleClickEvents,
2356
+ Eo as W3CTextFormat,
2357
+ Ee as cancelSingleClickEvents,
2333
2358
  ye as cloneKeyboardEvent,
2334
2359
  De as clonePointerEvent,
2335
- xo as createBody,
2360
+ Lo as createBody,
2336
2361
  $e as createCanvasRenderer,
2337
2362
  tn as createHighlightsRenderer,
2338
2363
  Ke as createRenderer,
2339
2364
  on as createSpansRenderer,
2340
2365
  To as createTextAnnotator,
2341
- eo as createTextAnnotatorState,
2366
+ no as createTextAnnotatorState,
2342
2367
  It as debounce,
2343
- Co as denormalizeRectWithOffset,
2344
- ro as fillDefaults,
2345
- Ao as getAnnotatableFragment,
2346
- vo as getClientRectsPonyfill,
2368
+ xo as denormalizeRectWithOffset,
2369
+ ao as fillDefaults,
2370
+ vo as getAnnotatableFragment,
2371
+ So as getClientRectsPonyfill,
2347
2372
  ke as getQuoteContext,
2348
2373
  Rt as getRangeAnnotatableContents,
2349
2374
  W as isRevived,
@@ -2352,14 +2377,14 @@ export {
2352
2377
  Pe as normalizeRectWithOffset,
2353
2378
  Se as paint,
2354
2379
  $n as parseW3CTextAnnotation,
2355
- Ee as programmaticallyFocusable,
2380
+ Te as programmaticallyFocusable,
2356
2381
  Fe as rangeToSelector,
2357
2382
  bt as reviveAnnotation,
2358
2383
  oe as reviveSelector,
2359
2384
  mt as reviveTarget,
2360
2385
  jn as serializeW3CTextAnnotation,
2361
2386
  Le as splitAnnotatableRanges,
2362
- So as toDomRectList,
2387
+ Co as toDomRectList,
2363
2388
  Re as whitespaceOrEmptyRegex
2364
2389
  };
2365
2390
  //# sourceMappingURL=text-annotator.es.js.map