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