@soomo/react-text-annotator 3.0.0-staging.6 → 3.0.0-staging.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/TextAnnotator.d.ts +4 -5
  2. package/dist/TextAnnotator.d.ts.map +1 -1
  3. package/dist/TextAnnotatorPlugin.d.ts +1 -2
  4. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +14 -0
  5. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +1 -0
  6. package/dist/TextAnnotatorPopup/index.d.ts +2 -0
  7. package/dist/TextAnnotatorPopup/index.d.ts.map +1 -0
  8. package/dist/hooks/index.d.ts +2 -0
  9. package/dist/hooks/index.d.ts.map +1 -0
  10. package/dist/hooks/useAnnouncePopupNavigation.d.ts +10 -0
  11. package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -0
  12. package/dist/index.d.ts +7 -9
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/react-text-annotator.css +31 -1
  15. package/dist/react-text-annotator.es.js +11 -8
  16. package/dist/react-text-annotator.es.js.map +1 -1
  17. package/dist/react-text-annotator.es10.js +486 -34
  18. package/dist/react-text-annotator.es10.js.map +1 -1
  19. package/dist/react-text-annotator.es11.js +1387 -823
  20. package/dist/react-text-annotator.es11.js.map +1 -1
  21. package/dist/react-text-annotator.es13.js +246 -2
  22. package/dist/react-text-annotator.es13.js.map +1 -1
  23. package/dist/react-text-annotator.es14.js +576 -105
  24. package/dist/react-text-annotator.es14.js.map +1 -1
  25. package/dist/react-text-annotator.es15.js +54 -299
  26. package/dist/react-text-annotator.es15.js.map +1 -1
  27. package/dist/react-text-annotator.es16.js +38 -51
  28. package/dist/react-text-annotator.es16.js.map +1 -1
  29. package/dist/react-text-annotator.es17.js +2 -20
  30. package/dist/react-text-annotator.es17.js.map +1 -1
  31. package/dist/react-text-annotator.es18.js +34 -0
  32. package/dist/react-text-annotator.es18.js.map +1 -0
  33. package/dist/react-text-annotator.es19.js +901 -0
  34. package/dist/react-text-annotator.es19.js.map +1 -0
  35. package/dist/react-text-annotator.es2.js +2 -2
  36. package/dist/{react-text-annotator.es12.js → react-text-annotator.es20.js} +1 -1
  37. package/dist/react-text-annotator.es20.js.map +1 -0
  38. package/dist/react-text-annotator.es21.js +5 -0
  39. package/dist/react-text-annotator.es21.js.map +1 -0
  40. package/dist/react-text-annotator.es22.js +117 -0
  41. package/dist/react-text-annotator.es22.js.map +1 -0
  42. package/dist/react-text-annotator.es23.js +312 -0
  43. package/dist/react-text-annotator.es23.js.map +1 -0
  44. package/dist/react-text-annotator.es24.js +61 -0
  45. package/dist/react-text-annotator.es24.js.map +1 -0
  46. package/dist/react-text-annotator.es25.js +23 -0
  47. package/dist/react-text-annotator.es25.js.map +1 -0
  48. package/dist/react-text-annotator.es26.js +130 -0
  49. package/dist/react-text-annotator.es26.js.map +1 -0
  50. package/dist/react-text-annotator.es27.js +167 -0
  51. package/dist/react-text-annotator.es27.js.map +1 -0
  52. package/dist/react-text-annotator.es28.js +314 -0
  53. package/dist/react-text-annotator.es28.js.map +1 -0
  54. package/dist/react-text-annotator.es29.js +152 -0
  55. package/dist/react-text-annotator.es29.js.map +1 -0
  56. package/dist/react-text-annotator.es3.js +2 -2
  57. package/dist/react-text-annotator.es30.js +566 -0
  58. package/dist/react-text-annotator.es30.js.map +1 -0
  59. package/dist/react-text-annotator.es4.js +38 -28
  60. package/dist/react-text-annotator.es4.js.map +1 -1
  61. package/dist/react-text-annotator.es5.js +23 -47
  62. package/dist/react-text-annotator.es5.js.map +1 -1
  63. package/dist/react-text-annotator.es6.js +133 -10
  64. package/dist/react-text-annotator.es6.js.map +1 -1
  65. package/dist/react-text-annotator.es7.js +181 -1
  66. package/dist/react-text-annotator.es7.js.map +1 -1
  67. package/dist/react-text-annotator.es8.js +9 -487
  68. package/dist/react-text-annotator.es8.js.map +1 -1
  69. package/dist/tei/TEIAnnotator.d.ts +2 -3
  70. package/package.json +23 -16
  71. package/dist/TextAnnotatorPopup.d.ts +0 -14
  72. package/dist/TextAnnotatorPopup.d.ts.map +0 -1
  73. package/dist/react-text-annotator.es12.js.map +0 -1
  74. package/dist/react-text-annotator.es9.js +0 -5
  75. package/dist/react-text-annotator.es9.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es7.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"react-text-annotator.es7.js","sources":["../../../node_modules/@recogito/text-annotator/dist/text-annotator.es.js"],"sourcesContent":["const _t = \"not-annotatable\", X = `.${_t}`, Qt = (t) => {\n var n;\n const e = t.commonAncestorContainer;\n return e instanceof HTMLElement ? !e.closest(X) : !((n = e.parentElement) != null && n.closest(X));\n}, Jt = function* (t) {\n const e = document.createNodeIterator(\n t.commonAncestorContainer,\n NodeFilter.SHOW_ELEMENT,\n (o) => o instanceof HTMLElement && o.classList.contains(_t) && !o.parentElement.closest(X) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP\n );\n let n;\n for (; n = e.nextNode(); )\n n instanceof HTMLElement && (yield n);\n}, Zt = (t) => {\n if (!Qt(t)) return [];\n const e = [];\n let n = null;\n for (const o of Jt(t)) {\n let i;\n n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;\n }\n if (n) {\n const o = t.cloneRange();\n o.setStartAfter(n), o.collapsed || e.push(o);\n }\n return e.length > 0 ? e : [t];\n}, bt = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(X).forEach((n) => n.remove()), e;\n}, te = (t) => {\n t.addEventListener(\"click\", (e) => {\n // Allow clicks within not-annotatable elements\n !e.target.closest(X) && !e.target.closest(\"a\") && e.preventDefault();\n });\n}, yt = (t, e = 10) => {\n let n;\n return (...o) => {\n clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);\n };\n}, Mn = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(X).forEach((n) => n.remove()), e;\n}, ee = (t, e, n = 10, o) => {\n const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();\n s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);\n const r = bt(s).textContent, c = document.createRange();\n c.setStart(t.endContainer, t.endOffset), i === document.body ? c.setEnd(i, i.childNodes.length) : c.setEndAfter(i);\n const d = bt(c).textContent;\n return {\n prefix: r.substring(r.length - n),\n suffix: d.substring(0, n)\n };\n}, ne = /^\\s*$/, oe = (t) => ne.test(t.toString()), H = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), ie = (t, e) => {\n const n = (s) => Math.round(s * 10) / 10, o = {\n top: n(t.top),\n bottom: n(t.bottom),\n left: n(t.left),\n right: n(t.right)\n }, i = {\n top: n(e.top),\n bottom: n(e.bottom),\n left: n(e.left),\n right: n(e.right)\n };\n if (Math.abs(o.top - i.top) < 0.5 && Math.abs(o.bottom - i.bottom) < 0.5) {\n if (Math.abs(o.left - i.right) < 0.5 || Math.abs(o.right - i.left) < 0.5)\n return \"inline-adjacent\";\n if (o.left >= i.left && o.right <= i.right)\n return \"inline-is-contained\";\n if (o.left <= i.left && o.right >= i.right)\n return \"inline-contains\";\n } else if (o.top <= i.top && o.bottom >= i.bottom) {\n if (o.left <= i.left && o.right >= i.right)\n return \"block-contains\";\n } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)\n return \"block-is-contained\";\n}, se = (t, e) => {\n const n = Math.min(t.left, e.left), o = Math.max(t.right, e.right), i = Math.min(t.top, e.top), s = Math.max(t.bottom, e.bottom);\n return new DOMRect(n, i, o - n, s - i);\n}, re = (t) => t.reduce((e, n) => {\n if (n.width === 0 || n.height === 0)\n return e;\n let o = [...e], i = !1;\n for (const s of e) {\n const r = ie(n, s);\n if (r === \"inline-adjacent\") {\n o = o.map((c) => c === s ? se(n, s) : c), i = !0;\n break;\n } else if (r === \"inline-contains\") {\n o = o.map((c) => c === s ? n : c), i = !0;\n break;\n } else if (r === \"inline-is-contained\") {\n i = !0;\n break;\n } else if (r === \"block-contains\" || r === \"block-is-contained\") {\n n.width < s.width && (o = o.map((c) => c === s ? n : c)), i = !0;\n break;\n }\n }\n return i ? o : [...o, n];\n}, []), ae = (t, e, n) => {\n const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;\n o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);\n const s = bt(o).textContent, r = t.toString(), c = s.length || 0, d = c + r.length;\n return n ? { quote: r, start: c, end: d, range: t, offsetReference: i } : { quote: r, start: c, end: d, range: t };\n}, kt = (t, e) => {\n var f, h;\n const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(\n e,\n NodeFilter.SHOW_TEXT,\n (y) => {\n var g;\n return (g = y.parentElement) != null && g.closest(X) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;\n }\n );\n let r = 0;\n const c = document.createRange();\n let d = s.nextNode();\n d === null && console.error(\"Could not revive annotation target. Content missing.\");\n let u = !i;\n for (; d !== null; ) {\n if (u || (u = i == null ? void 0 : i.contains(d)), u) {\n const y = ((f = d.textContent) == null ? void 0 : f.length) || 0;\n if (r + y > n) {\n c.setStart(d, n - r);\n break;\n }\n r += y;\n }\n d = s.nextNode();\n }\n for (; d !== null; ) {\n const y = ((h = d.textContent) == null ? void 0 : h.length) || 0;\n if (r + y >= o) {\n c.setEnd(d, o - r);\n break;\n }\n r += y, d = s.nextNode();\n }\n return {\n ...t,\n range: c\n };\n}, it = (t, e) => H(t.selector) ? t : {\n ...t,\n selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : kt(n, e))\n}, rt = (t, e) => H(t.target.selector) ? t : { ...t, target: it(t.target, e) }, ce = (t, e) => {\n const n = t.cloneRange();\n return e.contains(n.startContainer) || n.setStart(e, 0), e.contains(n.endContainer) || n.setEnd(e, e.childNodes.length), n;\n}, Yt = (t) => {\n if (t === null)\n return document.scrollingElement;\n const { overflowY: e } = window.getComputedStyle(t);\n return e !== \"visible\" && e !== \"hidden\" && t.scrollHeight > t.clientHeight ? t : Yt(t.parentElement);\n}, le = (t, e) => (n) => {\n const o = typeof n == \"string\" ? n : n.id, i = (r) => {\n const c = s.getBoundingClientRect(), d = s.clientHeight, u = s.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: h, height: y } = e.getAnnotationBounds(o), g = f.top - c.top, x = f.left - c.left, v = s.parentElement ? s.scrollTop : 0, p = s.parentElement ? s.scrollLeft : 0, l = g + v - (d - y) / 2, a = x + p - (u - h) / 2;\n s.scroll({ top: l, left: a, behavior: \"smooth\" });\n }, s = Yt(t);\n if (s) {\n const r = e.getAnnotation(o), { range: c } = r.target.selector[0];\n if (c && !c.collapsed)\n return i(r.target), !0;\n {\n const d = it(r.target, t), { range: u } = d.selector[0];\n if (u && !u.collapsed)\n return i(d), !0;\n }\n }\n return !1;\n}, P = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.18\n}, st = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.45\n}, de = (t, e, n, o, i) => {\n var r, c;\n const s = n ? typeof n == \"function\" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? st : P) : n : (c = t.state) != null && c.selected ? st : P;\n return o && o.paint(t, e) || s;\n}, ue = (t) => {\n const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, c = o - n, d = i - e;\n return { top: e, left: n, minX: s, minY: r, maxX: c, maxY: d };\n}, he = (t) => {\n let e = /* @__PURE__ */ new Set();\n return (o) => {\n const i = o.map((s) => s.id);\n (e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);\n };\n}, wt = (t, e, n, o) => {\n const { store: i, selection: s, hover: r } = e;\n let c, d, u;\n const f = he(n), h = (R) => {\n const { x: I, y: b } = t.getBoundingClientRect(), A = i.getAt(R.clientX - I, R.clientY - b, d);\n A ? r.current !== A.id && (t.classList.add(\"hovered\"), r.set(A.id)) : r.current && (t.classList.remove(\"hovered\"), r.set(null));\n };\n t.addEventListener(\"pointermove\", h);\n const y = (R = !1) => {\n u && u.clear();\n const I = ue(t), { minX: b, minY: A, maxX: w, maxY: C } = I, O = d ? i.getIntersecting(b, A, w, C).filter(({ annotation: _ }) => d(_)) : i.getIntersecting(b, A, w, C), B = s.selected.map(({ id: _ }) => _), D = O.map(({ annotation: _, rects: qt }) => {\n const Gt = B.includes(_.id), Kt = _.id === r.current;\n return { annotation: _, rects: qt, state: { selected: Gt, hover: Kt } };\n });\n o.redraw(D, I, c, u, R), setTimeout(() => f(O.map(({ annotation: _ }) => _)), 1);\n }, g = (R) => {\n u = R, y();\n }, x = (R) => {\n c = R, y();\n }, v = (R) => {\n d = R, y(!1);\n }, p = () => y();\n i.observe(p);\n const l = s.subscribe(() => y()), a = () => y(!0);\n document.addEventListener(\"scroll\", a, { capture: !0, passive: !0 });\n const m = yt(() => {\n i.recalculatePositions(), u && u.reset(), y();\n });\n window.addEventListener(\"resize\", m);\n const S = new ResizeObserver(m);\n S.observe(t);\n const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((R) => {\n R.every((b) => b.target === t || t.contains(b.target)) || y(!0);\n });\n return E.observe(document.body, L), {\n destroy: () => {\n t.removeEventListener(\"pointermove\", h), o.destroy(), i.unobserve(p), l(), document.removeEventListener(\"scroll\", a), window.removeEventListener(\"resize\", m), S.disconnect(), E.disconnect();\n },\n redraw: y,\n setStyle: x,\n setFilter: v,\n setPainter: g,\n setVisible: o.setVisible\n };\n}, fe = () => {\n const t = document.createElement(\"canvas\");\n return t.width = window.innerWidth, t.height = window.innerHeight, t.className = \"r6o-canvas-highlight-layer bg\", t;\n}, ge = (t, e) => {\n t.width = window.innerWidth, t.height = window.innerHeight;\n}, pe = (t) => {\n t.classList.add(\"r6o-annotatable\");\n const e = fe(), n = e.getContext(\"2d\");\n document.body.appendChild(e);\n const o = (c, d, u, f) => requestAnimationFrame(() => {\n const { width: h, height: y } = e;\n n.clearRect(-0.5, -0.5, h + 1, y + 1), f && f.clear();\n const { top: g, left: x } = d;\n [...c].sort((p, l) => {\n const { annotation: { target: { created: a } } } = p, { annotation: { target: { created: m } } } = l;\n return a.getTime() - m.getTime();\n }).forEach((p) => {\n var S;\n const l = u ? typeof u == \"function\" ? u(p.annotation, p.state) : u : (S = p.state) != null && S.selected ? st : P, a = f && f.paint(p, d) || l, m = p.rects.map(({ x: L, y: E, width: T, height: R }) => ({\n x: L + x,\n y: E + g,\n width: T,\n height: R\n }));\n if (n.fillStyle = a.fill, n.globalAlpha = a.fillOpacity || 1, m.forEach(\n ({ x: L, y: E, width: T, height: R }) => n.fillRect(L, E, T, R)\n ), a.underlineColor) {\n n.globalAlpha = 1, n.strokeStyle = a.underlineColor, n.lineWidth = a.underlineThickness ?? 1;\n const L = a.underlineOffset ?? 0;\n m.forEach(({ x: E, y: T, width: R, height: I }) => {\n n.beginPath(), n.moveTo(E, T + I + L), n.lineTo(E + R, T + I + L), n.stroke();\n });\n }\n });\n }), i = yt(() => {\n ge(e);\n });\n return window.addEventListener(\"resize\", i), {\n destroy: () => {\n e.remove(), window.removeEventListener(\"resize\", i);\n },\n setVisible: (c) => {\n console.log(\"setVisible not implemented on Canvas renderer\");\n },\n redraw: o\n };\n}, me = (t, e, n) => wt(t, e, n, pe(t));\nvar be = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, $ = function(t) {\n return typeof t == \"string\" ? t.length > 0 : typeof t == \"number\";\n}, N = function(t, e, n) {\n return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;\n}, k = function(t, e, n) {\n return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;\n}, Xt = function(t) {\n return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;\n}, xt = function(t) {\n return { r: k(t.r, 0, 255), g: k(t.g, 0, 255), b: k(t.b, 0, 255), a: k(t.a) };\n}, at = function(t) {\n return { r: N(t.r), g: N(t.g), b: N(t.b), a: N(t.a, 3) };\n}, ve = /^#([0-9a-f]{3,8})$/i, J = function(t) {\n var e = t.toString(16);\n return e.length < 2 ? \"0\" + e : e;\n}, $t = function(t) {\n var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), r = s - Math.min(e, n, o), c = r ? s === e ? (n - o) / r : s === n ? 2 + (o - e) / r : 4 + (e - n) / r : 0;\n return { h: 60 * (c < 0 ? c + 6 : c), s: s ? r / s * 100 : 0, v: s / 255 * 100, a: i };\n}, Ht = function(t) {\n var e = t.h, n = t.s, o = t.v, i = t.a;\n e = e / 360 * 6, n /= 100, o /= 100;\n var s = Math.floor(e), r = o * (1 - n), c = o * (1 - (e - s) * n), d = o * (1 - (1 - e + s) * n), u = s % 6;\n return { r: 255 * [o, c, r, r, d, o][u], g: 255 * [d, o, o, c, r, r][u], b: 255 * [r, r, d, o, o, c][u], a: i };\n}, St = function(t) {\n return { h: Xt(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };\n}, Et = function(t) {\n return { h: N(t.h), s: N(t.s), l: N(t.l), a: N(t.a, 3) };\n}, Ct = function(t) {\n return Ht((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));\n var e, n, o;\n}, Q = function(t) {\n return { h: (e = $t(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };\n var e, n, o, i;\n}, ye = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, we = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Ae = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, xe = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Lt = { string: [[function(t) {\n var e = ve.exec(t);\n return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? N(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? N(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;\n}, \"hex\"], [function(t) {\n var e = Ae.exec(t) || xe.exec(t);\n return e ? e[2] !== e[4] || e[4] !== e[6] ? null : xt({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;\n}, \"rgb\"], [function(t) {\n var e = ye.exec(t) || we.exec(t);\n if (!e) return null;\n var n, o, i = St({ h: (n = e[1], o = e[2], o === void 0 && (o = \"deg\"), Number(n) * (be[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });\n return Ct(i);\n}, \"hsl\"]], object: [[function(t) {\n var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;\n return $(e) && $(n) && $(o) ? xt({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;\n}, \"rgb\"], [function(t) {\n var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;\n if (!$(e) || !$(n) || !$(o)) return null;\n var r = St({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });\n return Ct(r);\n}, \"hsl\"], [function(t) {\n var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;\n if (!$(e) || !$(n) || !$(o)) return null;\n var r = function(c) {\n return { h: Xt(c.h), s: k(c.s, 0, 100), v: k(c.v, 0, 100), a: k(c.a) };\n }({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });\n return Ht(r);\n}, \"hsv\"]] }, Tt = function(t, e) {\n for (var n = 0; n < e.length; n++) {\n var o = e[n][0](t);\n if (o) return [o, e[n][1]];\n }\n return [null, void 0];\n}, Se = function(t) {\n return typeof t == \"string\" ? Tt(t.trim(), Lt.string) : typeof t == \"object\" && t !== null ? Tt(t, Lt.object) : [null, void 0];\n}, ct = function(t, e) {\n var n = Q(t);\n return { h: n.h, s: k(n.s + 100 * e, 0, 100), l: n.l, a: n.a };\n}, lt = function(t) {\n return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;\n}, Rt = function(t, e) {\n var n = Q(t);\n return { h: n.h, s: n.s, l: k(n.l + 100 * e, 0, 100), a: n.a };\n}, Bt = function() {\n function t(e) {\n this.parsed = Se(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };\n }\n return t.prototype.isValid = function() {\n return this.parsed !== null;\n }, t.prototype.brightness = function() {\n return N(lt(this.rgba), 2);\n }, t.prototype.isDark = function() {\n return lt(this.rgba) < 0.5;\n }, t.prototype.isLight = function() {\n return lt(this.rgba) >= 0.5;\n }, t.prototype.toHex = function() {\n return e = at(this.rgba), n = e.r, o = e.g, i = e.b, r = (s = e.a) < 1 ? J(N(255 * s)) : \"\", \"#\" + J(n) + J(o) + J(i) + r;\n var e, n, o, i, s, r;\n }, t.prototype.toRgb = function() {\n return at(this.rgba);\n }, t.prototype.toRgbString = function() {\n return e = at(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? \"rgba(\" + n + \", \" + o + \", \" + i + \", \" + s + \")\" : \"rgb(\" + n + \", \" + o + \", \" + i + \")\";\n var e, n, o, i, s;\n }, t.prototype.toHsl = function() {\n return Et(Q(this.rgba));\n }, t.prototype.toHslString = function() {\n return e = Et(Q(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? \"hsla(\" + n + \", \" + o + \"%, \" + i + \"%, \" + s + \")\" : \"hsl(\" + n + \", \" + o + \"%, \" + i + \"%)\";\n var e, n, o, i, s;\n }, t.prototype.toHsv = function() {\n return e = $t(this.rgba), { h: N(e.h), s: N(e.s), v: N(e.v), a: N(e.a, 3) };\n var e;\n }, t.prototype.invert = function() {\n return Y({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });\n var e;\n }, t.prototype.saturate = function(e) {\n return e === void 0 && (e = 0.1), Y(ct(this.rgba, e));\n }, t.prototype.desaturate = function(e) {\n return e === void 0 && (e = 0.1), Y(ct(this.rgba, -e));\n }, t.prototype.grayscale = function() {\n return Y(ct(this.rgba, -1));\n }, t.prototype.lighten = function(e) {\n return e === void 0 && (e = 0.1), Y(Rt(this.rgba, e));\n }, t.prototype.darken = function(e) {\n return e === void 0 && (e = 0.1), Y(Rt(this.rgba, -e));\n }, t.prototype.rotate = function(e) {\n return e === void 0 && (e = 15), this.hue(this.hue() + e);\n }, t.prototype.alpha = function(e) {\n return typeof e == \"number\" ? Y({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : N(this.rgba.a, 3);\n var n;\n }, t.prototype.hue = function(e) {\n var n = Q(this.rgba);\n return typeof e == \"number\" ? Y({ h: e, s: n.s, l: n.l, a: n.a }) : N(n.h);\n }, t.prototype.isEqual = function(e) {\n return this.toHex() === Y(e).toHex();\n }, t;\n}(), Y = function(t) {\n return t instanceof Bt ? t : new Bt(t);\n};\nconst Ee = (t) => [\n `background-color:${Y((t == null ? void 0 : t.fill) || P.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? P.fillOpacity : t.fillOpacity).toHex()}`,\n t != null && t.underlineThickness ? \"text-decoration:underline\" : void 0,\n t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,\n t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,\n t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0\n].filter(Boolean).join(\";\"), Ce = () => {\n const t = document.createElement(\"style\");\n document.getElementsByTagName(\"head\")[0].appendChild(t);\n let e = /* @__PURE__ */ new Set();\n return {\n destroy: () => {\n CSS.highlights.clear(), t.remove();\n },\n setVisible: (s) => {\n console.log(\"setVisible not implemented on CSS Custom Highlights renderer\");\n },\n redraw: (s, r, c, d) => {\n d && d.clear();\n const u = new Set(s.map((h) => h.annotation.id));\n Array.from(e).filter((h) => !u.has(h));\n const f = s.map((h) => {\n var x;\n const y = c ? typeof c == \"function\" ? c(h.annotation, h.state) : c : (x = h.state) != null && x.selected ? st : P, g = d && d.paint(h, r) || y;\n return `::highlight(_${h.annotation.id}) { ${Ee(g)} }`;\n });\n t.innerHTML = f.join(`\n`), CSS.highlights.clear(), s.forEach(({ annotation: h }) => {\n const y = h.target.selector.map((x) => x.range), g = new Highlight(...y);\n CSS.highlights.set(`_${h.id}`, g);\n }), e = u;\n }\n };\n}, Le = (t, e, n) => wt(t, e, n, Ce());\nvar Mt = Object.prototype.hasOwnProperty;\nfunction vt(t, e) {\n var n, o;\n if (t === e) return !0;\n if (t && e && (n = t.constructor) === e.constructor) {\n if (n === Date) return t.getTime() === e.getTime();\n if (n === RegExp) return t.toString() === e.toString();\n if (n === Array) {\n if ((o = t.length) === e.length)\n for (; o-- && vt(t[o], e[o]); ) ;\n return o === -1;\n }\n if (!n || typeof t == \"object\") {\n o = 0;\n for (n in t)\n if (Mt.call(t, n) && ++o && !Mt.call(e, n) || !(n in e) || !vt(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nconst Te = (t, e) => {\n const n = (s, r) => s.x <= r.x + r.width && s.x + s.width >= r.x && s.y <= r.y + r.height && s.y + s.height >= r.y, o = (s) => s.rects.reduce((r, c) => r + c.width, 0), i = e.filter(({ rects: s }) => s.some((r) => n(t, r)));\n return i.sort((s, r) => o(r) - o(s)), i.findIndex((s) => s.rects.includes(t));\n}, Re = (t) => {\n t.classList.add(\"r6o-annotatable\");\n const e = document.createElement(\"div\");\n e.className = \"r6o-span-highlight-layer\", t.insertBefore(e, t.firstChild);\n let n = [];\n return {\n destroy: () => {\n e.remove();\n },\n redraw: (r, c, d, u, f) => {\n const y = !(vt(n, r) && f);\n if (!u && !y) return;\n y && (e.innerHTML = \"\"), [...r].sort((x, v) => {\n const { annotation: { target: { created: p } } } = x, { annotation: { target: { created: l } } } = v;\n return p && l ? p.getTime() - l.getTime() : 0;\n }).forEach((x) => {\n x.rects.map((v) => {\n const p = Te(v, r), l = de(x, c, d, u, p);\n if (y) {\n const a = document.createElement(\"span\");\n a.className = \"r6o-annotation\", a.dataset.annotation = x.annotation.id, a.style.left = `${v.x}px`, a.style.top = `${v.y}px`, a.style.width = `${v.width}px`, a.style.height = `${v.height}px`, a.style.backgroundColor = Y((l == null ? void 0 : l.fill) || P.fill).alpha((l == null ? void 0 : l.fillOpacity) === void 0 ? P.fillOpacity : l.fillOpacity).toHex(), l.underlineStyle && (a.style.borderStyle = l.underlineStyle), l.underlineColor && (a.style.borderColor = l.underlineColor), l.underlineThickness && (a.style.borderBottomWidth = `${l.underlineThickness}px`), l.underlineOffset && (a.style.paddingBottom = `${l.underlineOffset}px`), e.appendChild(a);\n }\n });\n }), n = r;\n },\n setVisible: (r) => {\n r ? e.classList.remove(\"hidden\") : e.classList.add(\"hidden\");\n }\n };\n}, Be = (t, e, n) => wt(t, e, n, Re(t));\nvar U = [];\nfor (var dt = 0; dt < 256; ++dt)\n U.push((dt + 256).toString(16).slice(1));\nfunction Me(t, e = 0) {\n return (U[t[e + 0]] + U[t[e + 1]] + U[t[e + 2]] + U[t[e + 3]] + \"-\" + U[t[e + 4]] + U[t[e + 5]] + \"-\" + U[t[e + 6]] + U[t[e + 7]] + \"-\" + U[t[e + 8]] + U[t[e + 9]] + \"-\" + U[t[e + 10]] + U[t[e + 11]] + U[t[e + 12]] + U[t[e + 13]] + U[t[e + 14]] + U[t[e + 15]]).toLowerCase();\n}\nvar Z, Oe = new Uint8Array(16);\nfunction Ie() {\n if (!Z && (Z = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return Z(Oe);\n}\nvar Ne = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst Ot = {\n randomUUID: Ne\n};\nfunction Pt(t, e, n) {\n if (Ot.randomUUID && !e && !t)\n return Ot.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || Ie)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Me(o);\n}\nvar It = Object.prototype.hasOwnProperty;\nfunction j(t, e) {\n var n, o;\n if (t === e) return !0;\n if (t && e && (n = t.constructor) === e.constructor) {\n if (n === Date) return t.getTime() === e.getTime();\n if (n === RegExp) return t.toString() === e.toString();\n if (n === Array) {\n if ((o = t.length) === e.length)\n for (; o-- && j(t[o], e[o]); ) ;\n return o === -1;\n }\n if (!n || typeof t == \"object\") {\n o = 0;\n for (n in t)\n if (It.call(t, n) && ++o && !It.call(e, n) || !(n in e) || !j(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nfunction ut() {\n}\nfunction Ue(t, e) {\n return t != t ? e == e : t !== e || t && typeof t == \"object\" || typeof t == \"function\";\n}\nconst z = [];\nfunction At(t, e = ut) {\n let n;\n const o = /* @__PURE__ */ new Set();\n function i(c) {\n if (Ue(t, c) && (t = c, n)) {\n const d = !z.length;\n for (const u of o)\n u[1](), z.push(u, t);\n if (d) {\n for (let u = 0; u < z.length; u += 2)\n z[u][0](z[u + 1]);\n z.length = 0;\n }\n }\n }\n function s(c) {\n i(c(t));\n }\n function r(c, d = ut) {\n const u = [c, d];\n return o.add(u), o.size === 1 && (n = e(i, s) || ut), c(t), () => {\n o.delete(u), o.size === 0 && n && (n(), n = null);\n };\n }\n return { set: i, update: s, subscribe: r };\n}\nconst Ve = (t) => {\n const { subscribe: e, set: n } = At();\n let o;\n return e((i) => o = i), t.observe(({ changes: i }) => {\n if (o) {\n (i.deleted || []).some((r) => r.id === o) && n(void 0);\n const s = (i.updated || []).find(({ oldValue: r }) => r.id === o);\n s && n(s.newValue.id);\n }\n }), {\n get current() {\n return o;\n },\n subscribe: e,\n set: n\n };\n};\nvar De = /* @__PURE__ */ ((t) => (t.EDIT = \"EDIT\", t.SELECT = \"SELECT\", t.NONE = \"NONE\", t))(De || {});\nconst tt = { selected: [] }, _e = (t, e, n) => {\n const { subscribe: o, set: i } = At(tt);\n let s = e, r = tt;\n o((x) => r = x);\n const c = () => {\n j(r, tt) || i(tt);\n }, d = () => {\n var x;\n return ((x = r.selected) == null ? void 0 : x.length) === 0;\n }, u = (x) => {\n if (d())\n return !1;\n const v = typeof x == \"string\" ? x : x.id;\n return r.selected.some((p) => p.id === v);\n }, f = (x, v) => {\n const p = t.getAnnotation(x);\n if (!p) {\n console.warn(\"Invalid selection: \" + x);\n return;\n }\n switch (Nt(p, s)) {\n case \"EDIT\":\n i({ selected: [{ id: x, editable: !0 }], event: v });\n break;\n case \"SELECT\":\n i({ selected: [{ id: x }], event: v });\n break;\n default:\n i({ selected: [], event: v });\n }\n }, h = (x, v) => {\n const p = Array.isArray(x) ? x : [x], l = p.map((a) => t.getAnnotation(a)).filter((a) => !!a);\n i({\n selected: l.map((a) => {\n const m = v === void 0 ? Nt(a, s) === \"EDIT\" : v;\n return { id: a.id, editable: m };\n })\n }), l.length !== p.length && console.warn(\"Invalid selection\", x);\n }, y = (x) => {\n if (d())\n return !1;\n const { selected: v } = r;\n v.some(({ id: p }) => x.includes(p)) && i({ selected: v.filter(({ id: p }) => !x.includes(p)) });\n }, g = (x) => s = x;\n return t.observe(\n ({ changes: x }) => y((x.deleted || []).map((v) => v.id))\n ), {\n get event() {\n return r ? r.event : null;\n },\n get selected() {\n return r ? [...r.selected] : null;\n },\n get userSelectAction() {\n return s;\n },\n clear: c,\n isEmpty: d,\n isSelected: u,\n setSelected: h,\n setUserSelectAction: g,\n subscribe: o,\n userSelect: f\n };\n}, Nt = (t, e, n) => typeof e == \"function\" ? e(t) : e || \"EDIT\";\nvar V = [];\nfor (var ht = 0; ht < 256; ++ht)\n V.push((ht + 256).toString(16).slice(1));\nfunction ke(t, e = 0) {\n return (V[t[e + 0]] + V[t[e + 1]] + V[t[e + 2]] + V[t[e + 3]] + \"-\" + V[t[e + 4]] + V[t[e + 5]] + \"-\" + V[t[e + 6]] + V[t[e + 7]] + \"-\" + V[t[e + 8]] + V[t[e + 9]] + \"-\" + V[t[e + 10]] + V[t[e + 11]] + V[t[e + 12]] + V[t[e + 13]] + V[t[e + 14]] + V[t[e + 15]]).toLowerCase();\n}\nvar et, Ye = new Uint8Array(16);\nfunction Xe() {\n if (!et && (et = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !et))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return et(Ye);\n}\nvar $e = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst Ut = {\n randomUUID: $e\n};\nfunction jt(t, e, n) {\n if (Ut.randomUUID && !e && !t)\n return Ut.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || Xe)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, ke(o);\n}\nconst ft = (t) => {\n const e = (n) => {\n const o = { ...n };\n return n.created && typeof n.created == \"string\" && (o.created = new Date(n.created)), n.updated && typeof n.updated == \"string\" && (o.updated = new Date(n.updated)), o;\n };\n return {\n ...t,\n bodies: (t.bodies || []).map(e),\n target: e(t.target)\n };\n}, On = (t, e, n, o) => ({\n id: jt(),\n annotation: typeof t == \"string\" ? t : t.id,\n created: n || /* @__PURE__ */ new Date(),\n creator: o,\n ...e\n}), He = (t, e) => {\n const n = new Set(t.bodies.map((o) => o.id));\n return e.bodies.filter((o) => !n.has(o.id));\n}, Pe = (t, e) => {\n const n = new Set(e.bodies.map((o) => o.id));\n return t.bodies.filter((o) => !n.has(o.id));\n}, je = (t, e) => e.bodies.map((n) => {\n const o = t.bodies.find((i) => i.id === n.id);\n return { newBody: n, oldBody: o && !j(o, n) ? o : void 0 };\n}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), ze = (t, e) => !j(t.target, e.target), zt = (t, e) => {\n const n = He(t, e), o = Pe(t, e), i = je(t, e);\n return {\n oldValue: t,\n newValue: e,\n bodiesCreated: n.length > 0 ? n : void 0,\n bodiesDeleted: o.length > 0 ? o : void 0,\n bodiesUpdated: i.length > 0 ? i : void 0,\n targetUpdated: ze(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0\n };\n};\nvar M = /* @__PURE__ */ ((t) => (t.LOCAL = \"LOCAL\", t.REMOTE = \"REMOTE\", t.SILENT = \"SILENT\", t))(M || {});\nconst Fe = (t, e) => {\n var n, o;\n const { changes: i, origin: s } = e;\n if (!(t.options.origin ? t.options.origin === s : s !== \"SILENT\"))\n return !1;\n if (t.options.ignore) {\n const { ignore: r } = t.options, c = (d) => d && d.length > 0;\n if (!(c(i.created) || c(i.deleted))) {\n const d = (n = i.updated) == null ? void 0 : n.some((f) => c(f.bodiesCreated) || c(f.bodiesDeleted) || c(f.bodiesUpdated)), u = (o = i.updated) == null ? void 0 : o.some((f) => f.targetUpdated);\n if (r === \"BODY_ONLY\" && d && !u || r === \"TARGET_ONLY\" && u && !d)\n return !1;\n }\n }\n if (t.options.annotations) {\n const r = /* @__PURE__ */ new Set([\n ...(i.created || []).map((c) => c.id),\n ...(i.deleted || []).map((c) => c.id),\n ...(i.updated || []).map(({ oldValue: c }) => c.id)\n ]);\n return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((c) => r.has(c));\n } else\n return !0;\n}, We = (t, e) => {\n const n = new Set((t.created || []).map((h) => h.id)), o = new Set((t.updated || []).map(({ newValue: h }) => h.id)), i = new Set((e.created || []).map((h) => h.id)), s = new Set((e.deleted || []).map((h) => h.id)), r = new Set((e.updated || []).map(({ oldValue: h }) => h.id)), c = new Set((e.updated || []).filter(({ oldValue: h }) => n.has(h.id) || o.has(h.id)).map(({ oldValue: h }) => h.id)), d = [\n ...(t.created || []).filter((h) => !s.has(h.id)).map((h) => r.has(h.id) ? e.updated.find(({ oldValue: y }) => y.id === h.id).newValue : h),\n ...e.created || []\n ], u = [\n ...(t.deleted || []).filter((h) => !i.has(h.id)),\n ...(e.deleted || []).filter((h) => !n.has(h.id))\n ], f = [\n ...(t.updated || []).filter(({ newValue: h }) => !s.has(h.id)).map((h) => {\n const { oldValue: y, newValue: g } = h;\n if (r.has(g.id)) {\n const x = e.updated.find((v) => v.oldValue.id === g.id).newValue;\n return zt(y, x);\n } else\n return h;\n }),\n ...(e.updated || []).filter(({ oldValue: h }) => !c.has(h.id))\n ];\n return { created: d, deleted: u, updated: f };\n}, gt = (t) => {\n const e = t.id === void 0 ? jt() : t.id;\n return {\n ...t,\n id: e,\n bodies: t.bodies === void 0 ? [] : t.bodies.map((n) => ({\n ...n,\n annotation: e\n })),\n target: {\n ...t.target,\n annotation: e\n }\n };\n}, qe = (t) => t.id !== void 0, Ge = () => {\n const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b, A = {}) => {\n n.push({ onChange: b, options: A });\n }, i = (b) => {\n const A = n.findIndex((w) => w.onChange == b);\n A > -1 && n.splice(A, 1);\n }, s = (b, A) => {\n const w = {\n origin: b,\n changes: {\n created: A.created || [],\n updated: A.updated || [],\n deleted: A.deleted || []\n },\n state: [...t.values()]\n };\n n.forEach((C) => {\n Fe(C, w) && C.onChange(w);\n });\n }, r = (b, A = M.LOCAL) => {\n if (b.id && t.get(b.id))\n throw Error(`Cannot add annotation ${b.id} - exists already`);\n {\n const w = gt(b);\n t.set(w.id, w), w.bodies.forEach((C) => e.set(C.id, w.id)), s(A, { created: [w] });\n }\n }, c = (b, A) => {\n const w = gt(typeof b == \"string\" ? A : b), C = typeof b == \"string\" ? b : b.id, O = C && t.get(C);\n if (O) {\n const B = zt(O, w);\n return C === w.id ? t.set(C, w) : (t.delete(C), t.set(w.id, w)), O.bodies.forEach((D) => e.delete(D.id)), w.bodies.forEach((D) => e.set(D.id, w.id)), B;\n } else\n console.warn(`Cannot update annotation ${C} - does not exist`);\n }, d = (b, A = M.LOCAL, w = M.LOCAL) => {\n const C = qe(A) ? w : A, O = c(b, A);\n O && s(C, { updated: [O] });\n }, u = (b, A = M.LOCAL) => {\n const w = b.reduce((C, O) => {\n const B = c(O);\n return B ? [...C, B] : C;\n }, []);\n w.length > 0 && s(A, { updated: w });\n }, f = (b, A = M.LOCAL) => {\n const w = t.get(b.annotation);\n if (w) {\n const C = {\n ...w,\n bodies: [...w.bodies, b]\n };\n t.set(w.id, C), e.set(b.id, C.id), s(A, { updated: [{\n oldValue: w,\n newValue: C,\n bodiesCreated: [b]\n }] });\n } else\n console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);\n }, h = () => [...t.values()], y = (b = M.LOCAL) => {\n const A = [...t.values()];\n t.clear(), e.clear(), s(b, { deleted: A });\n }, g = (b, A = !0, w = M.LOCAL) => {\n const C = b.map(gt);\n if (A) {\n const O = [...t.values()];\n t.clear(), e.clear(), C.forEach((B) => {\n t.set(B.id, B), B.bodies.forEach((D) => e.set(D.id, B.id));\n }), s(w, { created: C, deleted: O });\n } else {\n const O = b.reduce((B, D) => {\n const _ = D.id && t.get(D.id);\n return _ ? [...B, _] : B;\n }, []);\n if (O.length > 0)\n throw Error(`Bulk insert would overwrite the following annotations: ${O.map((B) => B.id).join(\", \")}`);\n C.forEach((B) => {\n t.set(B.id, B), B.bodies.forEach((D) => e.set(D.id, B.id));\n }), s(w, { created: C });\n }\n }, x = (b) => {\n const A = typeof b == \"string\" ? b : b.id, w = t.get(A);\n if (w)\n return t.delete(A), w.bodies.forEach((C) => e.delete(C.id)), w;\n console.warn(`Attempt to delete missing annotation: ${A}`);\n }, v = (b, A = M.LOCAL) => {\n const w = x(b);\n w && s(A, { deleted: [w] });\n }, p = (b, A = M.LOCAL) => {\n const w = b.reduce((C, O) => {\n const B = x(O);\n return B ? [...C, B] : C;\n }, []);\n w.length > 0 && s(A, { deleted: w });\n }, l = (b) => {\n const A = t.get(b.annotation);\n if (A) {\n const w = A.bodies.find((C) => C.id === b.id);\n if (w) {\n e.delete(w.id);\n const C = {\n ...A,\n bodies: A.bodies.filter((O) => O.id !== b.id)\n };\n return t.set(A.id, C), {\n oldValue: A,\n newValue: C,\n bodiesDeleted: [w]\n };\n } else\n console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);\n } else\n console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);\n }, a = (b, A = M.LOCAL) => {\n const w = l(b);\n w && s(A, { updated: [w] });\n }, m = (b, A = M.LOCAL) => {\n const w = b.map((C) => l(C)).filter(Boolean);\n w.length > 0 && s(A, { updated: w });\n }, S = (b) => {\n const A = t.get(b);\n return A ? { ...A } : void 0;\n }, L = (b) => {\n const A = e.get(b);\n if (A) {\n const w = S(A).bodies.find((C) => C.id === b);\n if (w)\n return w;\n console.error(`Store integrity error: body ${b} in index, but not in annotation`);\n } else\n console.warn(`Attempt to retrieve missing body: ${b}`);\n }, E = (b, A) => {\n if (b.annotation !== A.annotation)\n throw \"Annotation integrity violation: annotation ID must be the same when updating bodies\";\n const w = t.get(b.annotation);\n if (w) {\n const C = w.bodies.find((B) => B.id === b.id), O = {\n ...w,\n bodies: w.bodies.map((B) => B.id === C.id ? A : B)\n };\n return t.set(w.id, O), C.id !== A.id && (e.delete(C.id), e.set(A.id, O.id)), {\n oldValue: w,\n newValue: O,\n bodiesUpdated: [{ oldBody: C, newBody: A }]\n };\n } else\n console.warn(`Attempt to add body to missing annotation ${b.annotation}`);\n }, T = (b, A, w = M.LOCAL) => {\n const C = E(b, A);\n C && s(w, { updated: [C] });\n }, R = (b, A = M.LOCAL) => {\n const w = b.map((C) => E({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);\n s(A, { updated: w });\n }, I = (b) => {\n const A = t.get(b.annotation);\n if (A) {\n const w = {\n ...A,\n target: {\n ...A.target,\n ...b\n }\n };\n return t.set(A.id, w), {\n oldValue: A,\n newValue: w,\n targetUpdated: {\n oldTarget: A.target,\n newTarget: b\n }\n };\n } else\n console.warn(`Attempt to update target on missing annotation: ${b.annotation}`);\n };\n return {\n addAnnotation: r,\n addBody: f,\n all: h,\n bulkAddAnnotation: g,\n bulkDeleteAnnotation: p,\n bulkDeleteBodies: m,\n bulkUpdateAnnotation: u,\n bulkUpdateBodies: R,\n bulkUpdateTargets: (b, A = M.LOCAL) => {\n const w = b.map((C) => I(C)).filter(Boolean);\n w.length > 0 && s(A, { updated: w });\n },\n clear: y,\n deleteAnnotation: v,\n deleteBody: a,\n getAnnotation: S,\n getBody: L,\n observe: o,\n unobserve: i,\n updateAnnotation: d,\n updateBody: T,\n updateTarget: (b, A = M.LOCAL) => {\n const w = I(b);\n w && s(A, { updated: [w] });\n }\n };\n};\nlet Ke = () => ({\n emit(t, ...e) {\n for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)\n o[n](...e);\n },\n events: {},\n on(t, e) {\n var n;\n return ((n = this.events)[t] || (n[t] = [])).push(e), () => {\n var o;\n this.events[t] = (o = this.events[t]) == null ? void 0 : o.filter((i) => e !== i);\n };\n }\n});\nconst Qe = 250, Je = (t) => {\n const e = Ke(), n = [];\n let o = -1, i = !1, s = 0;\n const r = (g) => {\n if (!i) {\n const { changes: x } = g, v = performance.now();\n if (v - s > Qe)\n n.splice(o + 1), n.push(x), o = n.length - 1;\n else {\n const p = n.length - 1;\n n[p] = We(n[p], x);\n }\n s = v;\n }\n i = !1;\n };\n t.observe(r, { origin: M.LOCAL });\n const c = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), d = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), u = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: x }) => x)), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ newValue: x }) => x)), h = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), y = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g);\n return {\n canRedo: () => n.length - 1 > o,\n canUndo: () => o > -1,\n destroy: () => t.unobserve(r),\n on: (g, x) => e.on(g, x),\n redo: () => {\n if (n.length - 1 > o) {\n i = !0;\n const { created: g, updated: x, deleted: v } = n[o + 1];\n d(g), f(x), y(v), e.emit(\"redo\", n[o + 1]), o += 1;\n }\n },\n undo: () => {\n if (o > -1) {\n i = !0;\n const { created: g, updated: x, deleted: v } = n[o];\n c(g), u(x), h(v), e.emit(\"undo\", n[o]), o -= 1;\n }\n }\n };\n}, Ze = () => {\n const { subscribe: t, set: e } = At([]);\n return {\n subscribe: t,\n set: e\n };\n}, tn = (t, e, n, o) => {\n const { hover: i, selection: s, store: r, viewport: c } = t, d = /* @__PURE__ */ new Map();\n let u = [], f;\n const h = (v, p) => {\n d.has(v) ? d.get(v).push(p) : d.set(v, [p]);\n }, y = (v, p) => {\n const l = d.get(v);\n if (l) {\n const a = l.indexOf(p);\n a !== -1 && l.splice(a, 1);\n }\n }, g = (v, p, l) => {\n d.has(v) && setTimeout(() => {\n d.get(v).forEach((a) => {\n if (n) {\n const m = Array.isArray(p) ? p.map((L) => n.serialize(L)) : n.serialize(p), S = l ? l instanceof PointerEvent ? l : n.serialize(l) : void 0;\n a(m, S);\n } else\n a(p, l);\n });\n }, 1);\n };\n s.subscribe(({ selected: v }) => {\n if (!(u.length === 0 && v.length === 0)) {\n if (u.length === 0 && v.length > 0)\n u = v.map(({ id: p }) => r.getAnnotation(p));\n else if (u.length > 0 && v.length === 0)\n u.forEach((p) => {\n const l = r.getAnnotation(p.id);\n l && !j(l, p) && g(\"updateAnnotation\", l, p);\n }), u = [];\n else {\n const p = new Set(u.map((a) => a.id)), l = new Set(v.map(({ id: a }) => a));\n u.filter((a) => !l.has(a.id)).forEach((a) => {\n const m = r.getAnnotation(a.id);\n m && !j(m, a) && g(\"updateAnnotation\", m, a);\n }), u = [\n // Remove annotations that were deselected\n ...u.filter((a) => l.has(a.id)),\n // Add editable annotations that were selected\n ...v.filter(({ id: a }) => !p.has(a)).map(({ id: a }) => r.getAnnotation(a))\n ];\n }\n g(\"selectionChanged\", u);\n }\n }), i.subscribe((v) => {\n !f && v ? g(\"mouseEnterAnnotation\", r.getAnnotation(v)) : f && !v ? g(\"mouseLeaveAnnotation\", r.getAnnotation(f)) : f && v && (g(\"mouseLeaveAnnotation\", r.getAnnotation(f)), g(\"mouseEnterAnnotation\", r.getAnnotation(v))), f = v;\n }), c == null || c.subscribe((v) => g(\"viewportIntersect\", v.map((p) => r.getAnnotation(p)))), r.observe((v) => {\n const { created: p, deleted: l } = v.changes;\n (p || []).forEach((a) => g(\"createAnnotation\", a)), (l || []).forEach((a) => g(\"deleteAnnotation\", a)), (v.changes.updated || []).filter((a) => [\n ...a.bodiesCreated || [],\n ...a.bodiesDeleted || [],\n ...a.bodiesUpdated || []\n ].length > 0).forEach(({ oldValue: a, newValue: m }) => {\n const S = u.find((L) => L.id === a.id) || a;\n u = u.map((L) => L.id === a.id ? m : L), g(\"updateAnnotation\", m, S);\n });\n }, { origin: M.LOCAL }), r.observe((v) => {\n if (u) {\n const p = new Set(u.map((a) => a.id)), l = (v.changes.updated || []).filter(({ newValue: a }) => p.has(a.id)).map(({ newValue: a }) => a);\n l.length > 0 && (u = u.map((a) => l.find((S) => S.id === a.id) || a));\n }\n }, { origin: M.REMOTE });\n const x = (v) => (p) => {\n const { updated: l } = p;\n v ? (l || []).forEach((a) => g(\"updateAnnotation\", a.oldValue, a.newValue)) : (l || []).forEach((a) => g(\"updateAnnotation\", a.newValue, a.oldValue));\n };\n return e.on(\"undo\", x(!0)), e.on(\"redo\", x(!1)), { on: h, off: y, emit: g };\n}, en = (t) => (e) => e.reduce((n, o) => {\n const { parsed: i, error: s } = t.parse(o);\n return s ? {\n parsed: n.parsed,\n failed: [...n.failed, o]\n } : i ? {\n parsed: [...n.parsed, i],\n failed: n.failed\n } : {\n ...n\n };\n}, { parsed: [], failed: [] }), nn = (t, e, n) => {\n const { store: o, selection: i } = t, s = (l) => {\n if (n) {\n const { parsed: a, error: m } = n.parse(l);\n a ? o.addAnnotation(a, M.REMOTE) : console.error(m);\n } else\n o.addAnnotation(ft(l), M.REMOTE);\n }, r = () => i.clear(), c = () => o.clear(), d = (l) => {\n const a = o.getAnnotation(l);\n return n && a ? n.serialize(a) : a;\n }, u = () => n ? o.all().map(n.serialize) : o.all(), f = () => {\n var l;\n const a = (((l = i.selected) == null ? void 0 : l.map((m) => m.id)) || []).map((m) => o.getAnnotation(m)).filter(Boolean);\n return n ? a.map(n.serialize) : a;\n }, h = (l, a = !0) => fetch(l).then((m) => m.json()).then((m) => (g(m, a), m)), y = (l) => {\n if (typeof l == \"string\") {\n const a = o.getAnnotation(l);\n if (o.deleteAnnotation(l), a)\n return n ? n.serialize(a) : a;\n } else {\n const a = n ? n.parse(l).parsed : l;\n if (a)\n return o.deleteAnnotation(a), l;\n }\n }, g = (l, a = !0) => {\n if (n) {\n const m = n.parseAll || en(n), { parsed: S, failed: L } = m(l);\n L.length > 0 && console.warn(`Discarded ${L.length} invalid annotations`, L), o.bulkAddAnnotation(S, a, M.REMOTE);\n } else\n o.bulkAddAnnotation(l.map(ft), a, M.REMOTE);\n }, x = (l, a) => {\n l ? i.setSelected(l, a) : i.clear();\n }, v = (l) => {\n i.clear(), i.setUserSelectAction(l);\n }, p = (l) => {\n if (n) {\n const a = n.parse(l).parsed, m = n.serialize(o.getAnnotation(a.id));\n return o.updateAnnotation(a), m;\n } else {\n const a = o.getAnnotation(l.id);\n return o.updateAnnotation(ft(l)), a;\n }\n };\n return {\n addAnnotation: s,\n cancelSelected: r,\n canRedo: e.canRedo,\n canUndo: e.canUndo,\n clearAnnotations: c,\n getAnnotationById: d,\n getAnnotations: u,\n getSelected: f,\n loadAnnotations: h,\n redo: e.redo,\n removeAnnotation: y,\n setAnnotations: g,\n setSelected: x,\n setUserSelectAction: v,\n undo: e.undo,\n updateAnnotation: p\n };\n}, on = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nlet sn = (t) => crypto.getRandomValues(new Uint8Array(t)), rn = (t, e, n) => {\n let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);\n return (s = e) => {\n let r = \"\";\n for (; ; ) {\n let c = n(i), d = i;\n for (; d--; )\n if (r += t[c[d] & o] || \"\", r.length === s) return r;\n }\n };\n}, an = (t, e = 21) => rn(t, e, sn), cn = (t = 21) => {\n let e = \"\", n = crypto.getRandomValues(new Uint8Array(t));\n for (; t--; )\n e += on[n[t] & 63];\n return e;\n};\nconst ln = () => ({ isGuest: !0, id: an(\"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\", 20)() }), dn = (t) => {\n const e = JSON.stringify(t);\n let n = 0;\n for (let o = 0, i = e.length; o < i; o++) {\n let s = e.charCodeAt(o);\n n = (n << 5) - n + s, n |= 0;\n }\n return `${n}`;\n}, Ft = (t) => t ? typeof t == \"object\" ? { ...t } : t : void 0, un = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {\n const { id: o, type: i, purpose: s, value: r, created: c, modified: d, creator: u, ...f } = n;\n return {\n id: o || `temp-${dn(n)}`,\n annotation: e,\n type: i,\n purpose: s,\n value: r,\n creator: Ft(u),\n created: c ? new Date(c) : void 0,\n updated: d ? new Date(d) : void 0,\n ...f\n };\n}), hn = (t) => t.map((e) => {\n var n;\n const { annotation: o, created: i, updated: s, ...r } = e, c = {\n ...r,\n created: i == null ? void 0 : i.toISOString(),\n modified: s == null ? void 0 : s.toISOString()\n };\n return (n = c.id) != null && n.startsWith(\"temp-\") && delete c.id, c;\n});\ncn();\nconst In = (t, e) => ({\n parse: (n) => pn(n),\n serialize: (n) => mn(n, t, e)\n}), fn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, gn = (t) => {\n const {\n id: e,\n creator: n,\n created: o,\n modified: i,\n target: s\n } = t, r = Array.isArray(s) ? s : [s], c = {\n creator: Ft(n),\n created: o ? new Date(o) : void 0,\n updated: i ? new Date(i) : void 0,\n annotation: e,\n selector: []\n };\n for (const d of r) {\n const f = (Array.isArray(d.selector) ? d.selector : [d.selector]).reduce((h, y) => {\n switch (y.type) {\n case \"TextQuoteSelector\":\n h.quote = y.exact;\n break;\n case \"TextPositionSelector\":\n h.start = y.start, h.end = y.end;\n break;\n }\n return h;\n }, {});\n if (fn(f))\n c.selector.push({ id: d.id, ...f });\n else {\n const h = [\n f.start ? void 0 : \"TextPositionSelector\",\n f.quote ? void 0 : \"TextQuoteSelector\"\n ].filter(Boolean);\n return { error: Error(`Missing selector types: ${h.join(\" and \")} for annotation: ${t.id}`) };\n }\n }\n return { parsed: c };\n}, pn = (t) => {\n const e = t.id || Pt(), {\n creator: n,\n created: o,\n modified: i,\n body: s,\n ...r\n } = t, c = un(s, e), d = gn(t);\n return \"error\" in d ? { error: d.error } : {\n parsed: {\n ...r,\n id: e,\n bodies: c,\n target: d.parsed\n }\n };\n}, mn = (t, e, n) => {\n const { bodies: o, target: i, ...s } = t, {\n selector: r,\n creator: c,\n created: d,\n updated: u,\n ...f\n } = i, h = r.map((y) => {\n const { quote: g, start: x, end: v, range: p } = y, { prefix: l, suffix: a } = ee(p, n), m = [{\n type: \"TextQuoteSelector\",\n exact: g,\n prefix: l,\n suffix: a\n }, {\n type: \"TextPositionSelector\",\n start: x,\n end: v\n }];\n return {\n ...f,\n id: y.id,\n source: e,\n selector: m\n };\n });\n return {\n ...s,\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n id: t.id,\n type: \"Annotation\",\n body: hn(t.bodies),\n creator: c,\n created: d == null ? void 0 : d.toISOString(),\n modified: u == null ? void 0 : u.toISOString(),\n target: h\n };\n};\nfunction Wt(t, e, n = 0, o = t.length - 1, i = bn) {\n for (; o > n; ) {\n if (o - n > 600) {\n const d = o - n + 1, u = e - n + 1, f = Math.log(d), h = 0.5 * Math.exp(2 * f / 3), y = 0.5 * Math.sqrt(f * h * (d - h) / d) * (u - d / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - u * h / d + y)), x = Math.min(o, Math.floor(e + (d - u) * h / d + y));\n Wt(t, e, g, x, i);\n }\n const s = t[e];\n let r = n, c = o;\n for (q(t, n, e), i(t[o], s) > 0 && q(t, n, o); r < c; ) {\n for (q(t, r, c), r++, c--; i(t[r], s) < 0; ) r++;\n for (; i(t[c], s) > 0; ) c--;\n }\n i(t[n], s) === 0 ? q(t, n, c) : (c++, q(t, c, o)), c <= e && (n = c + 1), e <= c && (o = c - 1);\n }\n}\nfunction q(t, e, n) {\n const o = t[e];\n t[e] = t[n], t[n] = o;\n}\nfunction bn(t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n}\nclass vn {\n constructor(e = 9) {\n this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();\n }\n all() {\n return this._all(this.data, []);\n }\n search(e) {\n let n = this.data;\n const o = [];\n if (!ot(e, n)) return o;\n const i = this.toBBox, s = [];\n for (; n; ) {\n for (let r = 0; r < n.children.length; r++) {\n const c = n.children[r], d = n.leaf ? i(c) : c;\n ot(e, d) && (n.leaf ? o.push(c) : mt(e, d) ? this._all(c, o) : s.push(c));\n }\n n = s.pop();\n }\n return o;\n }\n collides(e) {\n let n = this.data;\n if (!ot(e, n)) return !1;\n const o = [];\n for (; n; ) {\n for (let i = 0; i < n.children.length; i++) {\n const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;\n if (ot(e, r)) {\n if (n.leaf || mt(e, r)) return !0;\n o.push(s);\n }\n }\n n = o.pop();\n }\n return !1;\n }\n load(e) {\n if (!(e && e.length)) return this;\n if (e.length < this._minEntries) {\n for (let o = 0; o < e.length; o++)\n this.insert(e[o]);\n return this;\n }\n let n = this._build(e.slice(), 0, e.length - 1, 0);\n if (!this.data.children.length)\n this.data = n;\n else if (this.data.height === n.height)\n this._splitRoot(this.data, n);\n else {\n if (this.data.height < n.height) {\n const o = this.data;\n this.data = n, n = o;\n }\n this._insert(n, this.data.height - n.height - 1, !0);\n }\n return this;\n }\n insert(e) {\n return e && this._insert(e, this.data.height - 1), this;\n }\n clear() {\n return this.data = W([]), this;\n }\n remove(e, n) {\n if (!e) return this;\n let o = this.data;\n const i = this.toBBox(e), s = [], r = [];\n let c, d, u;\n for (; o || s.length; ) {\n if (o || (o = s.pop(), d = s[s.length - 1], c = r.pop(), u = !0), o.leaf) {\n const f = yn(e, o.children, n);\n if (f !== -1)\n return o.children.splice(f, 1), s.push(o), this._condense(s), this;\n }\n !u && !o.leaf && mt(o, i) ? (s.push(o), r.push(c), c = 0, d = o, o = o.children[0]) : d ? (c++, o = d.children[c], u = !1) : o = null;\n }\n return this;\n }\n toBBox(e) {\n return e;\n }\n compareMinX(e, n) {\n return e.minX - n.minX;\n }\n compareMinY(e, n) {\n return e.minY - n.minY;\n }\n toJSON() {\n return this.data;\n }\n fromJSON(e) {\n return this.data = e, this;\n }\n _all(e, n) {\n const o = [];\n for (; e; )\n e.leaf ? n.push(...e.children) : o.push(...e.children), e = o.pop();\n return n;\n }\n _build(e, n, o, i) {\n const s = o - n + 1;\n let r = this._maxEntries, c;\n if (s <= r)\n return c = W(e.slice(n, o + 1)), F(c, this.toBBox), c;\n i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), c = W([]), c.leaf = !1, c.height = i;\n const d = Math.ceil(s / r), u = d * Math.ceil(Math.sqrt(r));\n Vt(e, n, o, u, this.compareMinX);\n for (let f = n; f <= o; f += u) {\n const h = Math.min(f + u - 1, o);\n Vt(e, f, h, d, this.compareMinY);\n for (let y = f; y <= h; y += d) {\n const g = Math.min(y + d - 1, h);\n c.children.push(this._build(e, y, g, i - 1));\n }\n }\n return F(c, this.toBBox), c;\n }\n _chooseSubtree(e, n, o, i) {\n for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {\n let s = 1 / 0, r = 1 / 0, c;\n for (let d = 0; d < n.children.length; d++) {\n const u = n.children[d], f = pt(u), h = xn(e, u) - f;\n h < r ? (r = h, s = f < s ? f : s, c = u) : h === r && f < s && (s = f, c = u);\n }\n n = c || n.children[0];\n }\n return n;\n }\n _insert(e, n, o) {\n const i = o ? e : this.toBBox(e), s = [], r = this._chooseSubtree(i, this.data, n, s);\n for (r.children.push(e), K(r, i); n >= 0 && s[n].children.length > this._maxEntries; )\n this._split(s, n), n--;\n this._adjustParentBBoxes(i, s, n);\n }\n // split overflowed node into two\n _split(e, n) {\n const o = e[n], i = o.children.length, s = this._minEntries;\n this._chooseSplitAxis(o, s, i);\n const r = this._chooseSplitIndex(o, s, i), c = W(o.children.splice(r, o.children.length - r));\n c.height = o.height, c.leaf = o.leaf, F(o, this.toBBox), F(c, this.toBBox), n ? e[n - 1].children.push(c) : this._splitRoot(o, c);\n }\n _splitRoot(e, n) {\n this.data = W([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, F(this.data, this.toBBox);\n }\n _chooseSplitIndex(e, n, o) {\n let i, s = 1 / 0, r = 1 / 0;\n for (let c = n; c <= o - n; c++) {\n const d = G(e, 0, c, this.toBBox), u = G(e, c, o, this.toBBox), f = Sn(d, u), h = pt(d) + pt(u);\n f < s ? (s = f, i = c, r = h < r ? h : r) : f === s && h < r && (r = h, i = c);\n }\n return i || o - n;\n }\n // sorts node children by the best axis for split\n _chooseSplitAxis(e, n, o) {\n const i = e.leaf ? this.compareMinX : wn, s = e.leaf ? this.compareMinY : An, r = this._allDistMargin(e, n, o, i), c = this._allDistMargin(e, n, o, s);\n r < c && e.children.sort(i);\n }\n // total margin of all possible split distributions where each node is at least m full\n _allDistMargin(e, n, o, i) {\n e.children.sort(i);\n const s = this.toBBox, r = G(e, 0, n, s), c = G(e, o - n, o, s);\n let d = nt(r) + nt(c);\n for (let u = n; u < o - n; u++) {\n const f = e.children[u];\n K(r, e.leaf ? s(f) : f), d += nt(r);\n }\n for (let u = o - n - 1; u >= n; u--) {\n const f = e.children[u];\n K(c, e.leaf ? s(f) : f), d += nt(c);\n }\n return d;\n }\n _adjustParentBBoxes(e, n, o) {\n for (let i = o; i >= 0; i--)\n K(n[i], e);\n }\n _condense(e) {\n for (let n = e.length - 1, o; n >= 0; n--)\n e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : F(e[n], this.toBBox);\n }\n}\nfunction yn(t, e, n) {\n if (!n) return e.indexOf(t);\n for (let o = 0; o < e.length; o++)\n if (n(t, e[o])) return o;\n return -1;\n}\nfunction F(t, e) {\n G(t, 0, t.children.length, e, t);\n}\nfunction G(t, e, n, o, i) {\n i || (i = W(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;\n for (let s = e; s < n; s++) {\n const r = t.children[s];\n K(i, t.leaf ? o(r) : r);\n }\n return i;\n}\nfunction K(t, e) {\n return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;\n}\nfunction wn(t, e) {\n return t.minX - e.minX;\n}\nfunction An(t, e) {\n return t.minY - e.minY;\n}\nfunction pt(t) {\n return (t.maxX - t.minX) * (t.maxY - t.minY);\n}\nfunction nt(t) {\n return t.maxX - t.minX + (t.maxY - t.minY);\n}\nfunction xn(t, e) {\n return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));\n}\nfunction Sn(t, e) {\n const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);\n return Math.max(0, i - n) * Math.max(0, s - o);\n}\nfunction mt(t, e) {\n return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;\n}\nfunction ot(t, e) {\n return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;\n}\nfunction W(t) {\n return {\n children: t,\n height: 1,\n leaf: !0,\n minX: 1 / 0,\n minY: 1 / 0,\n maxX: -1 / 0,\n maxY: -1 / 0\n };\n}\nfunction Vt(t, e, n, o, i) {\n const s = [e, n];\n for (; s.length; ) {\n if (n = s.pop(), e = s.pop(), n - e <= o) continue;\n const r = e + Math.ceil((n - e) / o / 2) * o;\n Wt(t, r, e, n, i), s.push(e, r, r, n);\n }\n}\nconst En = (t, e) => {\n const n = new vn(), o = /* @__PURE__ */ new Map(), i = (l, a) => {\n const m = l.selector.flatMap((L) => {\n const E = H([L]) ? L.range : kt(L, e).range;\n return Array.from(E.getClientRects());\n }), S = re(m).map(({ left: L, top: E, right: T, bottom: R }) => new DOMRect(L - a.left, E - a.top, T - L, R - E));\n return S.map((L) => {\n const { x: E, y: T, width: R, height: I } = L;\n return {\n minX: E,\n minY: T,\n maxX: E + R,\n maxY: T + I,\n annotation: {\n id: l.annotation,\n rects: S\n }\n };\n });\n }, s = () => [...o.values()], r = () => {\n n.clear(), o.clear();\n }, c = (l) => {\n const a = i(l, e.getBoundingClientRect());\n a.forEach((m) => n.insert(m)), o.set(l.annotation, a);\n }, d = (l) => {\n const a = o.get(l.annotation);\n a && (a.forEach((m) => n.remove(m)), o.delete(l.annotation));\n }, u = (l) => {\n d(l), c(l);\n }, f = (l, a = !0) => {\n a && r();\n const m = e.getBoundingClientRect(), S = l.map((E) => ({ target: E, rects: i(E, m) }));\n S.forEach(({ target: E, rects: T }) => o.set(E.annotation, T));\n const L = S.flatMap(({ rects: E }) => E);\n n.load(L);\n }, h = (l, a, m = !1) => {\n const S = n.search({\n minX: l,\n minY: a,\n maxX: l,\n maxY: a\n }), L = (E) => E.annotation.rects.reduce((T, R) => T + R.width * R.height, 0);\n return S.length > 0 ? (S.sort((E, T) => L(E) - L(T)), m ? S.map((E) => E.annotation.id) : [S[0].annotation.id]) : [];\n }, y = (l) => {\n const a = g(l);\n if (a.length === 0)\n return;\n let m = a[0].left, S = a[0].top, L = a[0].right, E = a[0].bottom;\n for (let T = 1; T < a.length; T++) {\n const R = a[T];\n m = Math.min(m, R.left), S = Math.min(S, R.top), L = Math.max(L, R.right), E = Math.max(E, R.bottom);\n }\n return new DOMRect(m, S, L - m, E - S);\n }, g = (l) => {\n const a = o.get(l);\n return a ? a[0].annotation.rects : [];\n };\n return {\n all: s,\n clear: r,\n getAt: h,\n getAnnotationBounds: y,\n getAnnotationRects: g,\n getIntersecting: (l, a, m, S) => {\n const L = n.search({ minX: l, minY: a, maxX: m, maxY: S }), E = new Set(L.map((T) => T.annotation.id));\n return Array.from(E).map((T) => ({\n annotation: t.getAnnotation(T),\n rects: g(T)\n })).filter((T) => !!T.annotation);\n },\n insert: c,\n recalculate: () => f(t.all().map((l) => l.target), !0),\n remove: d,\n set: f,\n size: () => n.all().length,\n update: u\n };\n}, Cn = (t, e) => {\n const n = Ge(), o = En(n, t), i = _e(n);\n i.setUserSelectAction(e);\n const s = Ve(n), r = Ze(), c = (p, l = M.LOCAL) => {\n const a = rt(p, t), m = H(a.target.selector);\n return m && n.addAnnotation(a, l), m;\n }, d = (p, l = !0, a = M.LOCAL) => {\n const m = p.map((L) => rt(L, t)), S = m.filter((L) => !H(L.target.selector));\n return S.length > 0 ? (console.warn(\"Could not revive all targets for these annotations:\", S), n.bulkAddAnnotation(m, l, a), S) : (n.bulkAddAnnotation(m, l, a), []);\n }, u = (p, l = M.LOCAL) => {\n const a = p.map((S) => rt(S, t)), m = a.filter((S) => !H(S.target.selector));\n return m.length > 0 && console.warn(\"Could not revive all targets for these annotations:\", m), a.forEach((S) => {\n n.getAnnotation(S.id) ? n.updateAnnotation(S, l) : n.addAnnotation(S, l);\n }), m;\n }, f = (p, l = M.LOCAL) => {\n const a = it(p, t);\n n.updateTarget(a, l);\n }, h = (p, l = M.LOCAL) => {\n const a = p.map((m) => it(m, t));\n n.bulkUpdateTargets(a, l);\n }, y = (p, l, a) => {\n const m = o.getAt(p, l, !!a).map((L) => n.getAnnotation(L)), S = a ? m.filter(a) : m;\n return S.length > 0 ? S[0] : void 0;\n }, g = (p, l, a, m = 5) => {\n const S = o.getAnnotationRects(p);\n if (S.length !== 0) {\n if (l && a) {\n const L = S.find(({ top: E, right: T, bottom: R, left: I }) => l >= I - m && l <= T + m && a >= E - m && a <= R + m);\n if (L) return L;\n }\n return o.getAnnotationBounds(p);\n }\n }, x = (p) => o.getAnnotationRects(p), v = () => o.recalculate();\n return n.observe(({ changes: p }) => {\n const l = (p.deleted || []).filter((S) => H(S.target.selector)), a = (p.created || []).filter((S) => H(S.target.selector)), m = (p.updated || []).filter((S) => H(S.newValue.target.selector));\n (l == null ? void 0 : l.length) > 0 && l.forEach((S) => o.remove(S.target)), a.length > 0 && o.set(a.map((S) => S.target), !1), (m == null ? void 0 : m.length) > 0 && m.forEach(({ newValue: S }) => o.update(S.target));\n }), {\n store: {\n ...n,\n addAnnotation: c,\n bulkAddAnnotation: d,\n bulkUpdateTargets: h,\n bulkUpsertAnnotations: u,\n getAnnotationBounds: g,\n getAnnotationRects: x,\n getAt: y,\n getIntersecting: o.getIntersecting,\n recalculatePositions: v,\n updateTarget: f\n },\n selection: i,\n hover: s,\n viewport: r\n };\n}, Ln = () => {\n const t = document.createElement(\"canvas\");\n t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = \"r6o-presence-layer\";\n const e = t.getContext(\"2d\");\n return e.scale(2, 2), e.translate(0.5, 0.5), t;\n}, Tn = (t, e = {}) => {\n const n = Ln(), o = n.getContext(\"2d\");\n document.body.appendChild(n);\n const i = /* @__PURE__ */ new Map(), s = (f) => Array.from(i.entries()).filter(([h, y]) => y.presenceKey === f.presenceKey).map(([h, y]) => h);\n return t.on(\"selectionChange\", (f, h) => {\n s(f).forEach((g) => i.delete(g)), h && h.forEach((g) => i.set(g, f));\n }), {\n clear: () => {\n const { width: f, height: h } = n;\n o.clearRect(-0.5, -0.5, f + 1, h + 1);\n },\n destroy: () => {\n n.remove();\n },\n paint: (f, h, y) => {\n e.font && (o.font = e.font);\n const g = i.get(f.annotation.id);\n if (g) {\n const { height: x } = f.rects[0], v = f.rects[0].x + h.left, p = f.rects[0].y + h.top;\n o.fillStyle = g.appearance.color, o.fillRect(v - 2, p - 2.5, 2, x + 5);\n const l = o.measureText(g.appearance.label), a = l.width + 6, m = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, S = l.fontBoundingBoxAscent ? 8 : 6.5;\n return o.fillRect(v - 2, p - 2.5 - m, a, m), o.fillStyle = \"#fff\", o.fillText(g.appearance.label, v + 1, p - S), {\n fill: g.appearance.color,\n fillOpacity: y ? 0.45 : 0.18\n };\n }\n },\n reset: () => {\n n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;\n const f = n.getContext(\"2d\");\n f.scale(2, 2), f.translate(0.5, 0.5);\n }\n };\n}, Rn = (t, e, n, o) => {\n let i;\n const s = (a) => i = a;\n let r;\n const c = (a) => r = a, { store: d, selection: u } = e;\n let f, h = !1, y;\n const g = (a) => {\n var S;\n if (!h) return;\n !((S = a.target.parentElement) != null && S.closest(X)) ? f = {\n annotation: Pt(),\n selector: [],\n creator: i,\n created: /* @__PURE__ */ new Date()\n } : f = void 0;\n }, x = yt((a) => {\n var b, A;\n const m = document.getSelection();\n if (!!((A = (b = m.anchorNode) == null ? void 0 : b.parentElement) != null && A.closest(X))) {\n f = void 0;\n return;\n }\n if (a.timeStamp - ((y == null ? void 0 : y.timeStamp) || a.timeStamp) < 1e3 && !f && g(y), m.isCollapsed || !h || !f) return;\n const E = m.getRangeAt(0), T = ce(E, t);\n if (oe(T)) return;\n const R = Zt(T.cloneRange());\n (R.length !== f.selector.length || R.some((w, C) => {\n var O;\n return w.toString() !== ((O = f.selector[C]) == null ? void 0 : O.quote);\n })) && (f = {\n ...f,\n selector: R.map((w) => ae(w, t, o)),\n updated: /* @__PURE__ */ new Date()\n }, d.getAnnotation(f.annotation) ? d.updateTarget(f, M.LOCAL) : (u.clear(), d.addAnnotation({\n id: f.annotation,\n bodies: [],\n target: f\n }), u.userSelect(f.annotation, y)));\n }), v = (a) => {\n const { target: m, timeStamp: S, offsetX: L, offsetY: E, type: T } = a;\n y = { ...a, target: m, timeStamp: S, offsetX: L, offsetY: E, type: T }, h = a.button === 0;\n }, p = (a) => {\n var E;\n if (!!((E = a.target.parentElement) != null && E.closest(X)) || !h)\n return;\n const S = () => {\n const { x: T, y: R } = t.getBoundingClientRect(), I = a.target instanceof Node && t.contains(a.target) && d.getAt(a.clientX - T, a.clientY - R, r);\n if (I) {\n const { selected: b } = u;\n (b.length !== 1 || b[0].id !== I.id) && u.userSelect(I.id, a);\n } else u.isEmpty() || u.clear();\n }, L = a.timeStamp - y.timeStamp;\n setTimeout(() => {\n const T = document.getSelection();\n T != null && T.isCollapsed && L < 300 ? (f = void 0, S()) : f && u.userSelect(f.annotation, a);\n });\n };\n return t.addEventListener(\"pointerdown\", v), document.addEventListener(\"pointerup\", p), n && (t.addEventListener(\"selectstart\", g), document.addEventListener(\"selectionchange\", x)), {\n destroy: () => {\n t.removeEventListener(\"pointerdown\", v), document.removeEventListener(\"pointerup\", p), t.removeEventListener(\"selectstart\", g), document.removeEventListener(\"selectionchange\", x);\n },\n setFilter: c,\n setUser: s\n };\n}, Bn = (t, e) => ({\n ...t,\n annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,\n user: t.user || e.user\n}), Dt = \"SPANS\", Nn = (t, e = {}) => {\n te(t);\n const n = Bn(e, {\n annotatingEnabled: !0,\n user: ln()\n }), o = Cn(t, n.userSelectAction), { selection: i, viewport: s } = o, r = o.store, c = Je(r), d = tn(o, c, n.adapter);\n let u = n.user;\n const f = n.renderer === \"CSS_HIGHLIGHTS\" ? CSS.highlights ? \"CSS_HIGHLIGHTS\" : Dt : n.renderer || Dt, h = f === \"SPANS\" ? Be(t, o, s) : f === \"CSS_HIGHLIGHTS\" ? Le(t, o, s) : f === \"CANVAS\" ? me(t, o, s) : void 0;\n if (!h)\n throw `Unknown renderer implementation: ${f}`;\n console.debug(`Using ${f} renderer`), n.style && h.setStyle(n.style);\n const y = Rn(t, o, n.annotatingEnabled, n.offsetReferenceSelector);\n return y.setUser(u), {\n ...nn(o, c, n.adapter),\n destroy: () => {\n h.destroy(), y.destroy(), c.destroy();\n },\n element: t,\n getUser: () => u,\n setFilter: (E) => {\n h.setFilter(E), y.setFilter(E);\n },\n setStyle: (E) => h.setStyle(E),\n setUser: (E) => {\n u = E, y.setUser(E);\n },\n setSelected: (E) => {\n E ? i.setSelected(E) : i.clear();\n },\n setPresenceProvider: (E) => {\n E && (h.setPainter(Tn(E, n.presence)), E.on(\"selectionChange\", () => h.redraw()));\n },\n setVisible: (E) => h.setVisible(E),\n on: d.on,\n off: d.off,\n scrollIntoView: le(t, r),\n state: o\n };\n};\nexport {\n st as DEFAULT_SELECTED_STYLE,\n P as DEFAULT_STYLE,\n _t as NOT_ANNOTATABLE_CLASS,\n X as NOT_ANNOTATABLE_SELECTOR,\n M as Origin,\n Rn as SelectionHandler,\n De as UserSelectAction,\n In as W3CTextFormat,\n te as cancelSingleClickEvents,\n On as createBody,\n me as createCanvasRenderer,\n Le as createHighlightsRenderer,\n Tn as createPresencePainter,\n Ce as createRenderer,\n Be as createSpansRenderer,\n Nn as createTextAnnotator,\n Cn as createTextAnnotatorState,\n yt as debounce,\n Bn as fillDefaults,\n Mn as getAnnotatableFragment,\n ee as getQuoteContext,\n bt as getRangeAnnotatableContents,\n H as isRevived,\n oe as isWhitespaceOrEmpty,\n re as mergeClientRects,\n de as paint,\n pn as parseW3CTextAnnotation,\n ae as rangeToSelector,\n rt as reviveAnnotation,\n kt as reviveSelector,\n it as reviveTarget,\n le as scrollIntoView,\n mn as serializeW3CTextAnnotation,\n Zt as splitAnnotatableRanges,\n ce as trimRangeToContainer,\n ne as whitespaceOrEmptyRegex\n};\n//# sourceMappingURL=text-annotator.es.js.map\n"],"names":[],"mappings":"AAAK,MAAC,KAAK,mBAAmB,IAAI,IAAI,EAAE,IA0BrC,KAAK,CAAC,MAAM;AACb,QAAM,IAAI,EAAE;AACZ,SAAO,EAAE,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG;AAC3D,GAaG,KAAK,CAAC,GAAG,GAAG,IAAI,IAAI,MAAM;AAC3B,QAAM,IAAoD,GAAG,IAAI,SAAS,YAAW;AACrF,IAAE,SAAS,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW;AAC1D,QAAM,IAAI,GAAG,CAAC,EAAE,aAAa,IAAI,SAAS;AAC1C,IAAE,SAAS,EAAE,cAAc,EAAE,SAAS,GAAG,MAAM,SAAS,OAAO,EAAE,OAAO,GAAG,EAAE,WAAW,MAAM,IAAI,EAAE,YAAY,CAAC;AACjH,QAAM,IAAI,GAAG,CAAC,EAAE;AAChB,SAAO;AAAA,IACL,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC;AA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