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