@soomo/text-annotator 3.1.0-staging.12 → 3.1.0-staging.13
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/src/model/core/TextAnnotation.d.ts +1 -0
- package/dist/src/model/w3c/W3CTextAnnotation.d.ts +1 -0
- package/dist/text-annotator.es.js +782 -777
- 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 +2 -3
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
2
2
|
var n;
|
|
3
3
|
return !!(t instanceof HTMLElement ? t.closest(Z) : (n = t.parentElement) == null ? void 0 : n.closest(Z));
|
|
4
|
-
},
|
|
4
|
+
}, Re = (t) => {
|
|
5
5
|
const e = t.commonAncestorContainer;
|
|
6
6
|
return !nt(e);
|
|
7
|
-
},
|
|
7
|
+
}, Me = (t) => t.addEventListener("click", (e) => {
|
|
8
8
|
// Allow clicks within not-annotatable elements
|
|
9
9
|
!e.target.closest(Z) && !e.target.closest("a") && e.preventDefault();
|
|
10
|
-
}),
|
|
10
|
+
}), Be = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), ke = (t) => {
|
|
11
11
|
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
12
|
-
},
|
|
12
|
+
}, Ie = function* (t) {
|
|
13
13
|
const e = document.createNodeIterator(
|
|
14
14
|
t.commonAncestorContainer,
|
|
15
15
|
NodeFilter.SHOW_ELEMENT,
|
|
16
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
16
|
+
(o) => o instanceof HTMLElement && o.classList.contains(ae) && !o.parentElement.closest(Z) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
17
17
|
);
|
|
18
18
|
let n;
|
|
19
19
|
for (; n = e.nextNode(); )
|
|
20
20
|
n instanceof HTMLElement && (yield n);
|
|
21
|
-
},
|
|
22
|
-
if (!
|
|
21
|
+
}, Ne = (t) => {
|
|
22
|
+
if (!Re(t)) return [];
|
|
23
23
|
const e = [];
|
|
24
24
|
let n = null;
|
|
25
|
-
for (const o of
|
|
25
|
+
for (const o of Ie(t)) {
|
|
26
26
|
let i;
|
|
27
27
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
28
28
|
}
|
|
@@ -31,20 +31,20 @@ const ce = "not-annotatable", Z = `.${ce}`, nt = (t) => {
|
|
|
31
31
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
32
32
|
}
|
|
33
33
|
return e.length > 0 ? e : [t];
|
|
34
|
-
},
|
|
34
|
+
}, _t = (t) => {
|
|
35
35
|
const e = t.cloneContents();
|
|
36
36
|
return e.querySelectorAll(Z).forEach((n) => n.remove()), e;
|
|
37
|
-
},
|
|
37
|
+
}, _e = (t, e, n = 10, o) => {
|
|
38
38
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
39
39
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
40
|
-
const r =
|
|
40
|
+
const r = _t(s).textContent, a = document.createRange();
|
|
41
41
|
a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
42
|
-
const
|
|
42
|
+
const l = _t(a).textContent;
|
|
43
43
|
return {
|
|
44
44
|
prefix: r.substring(r.length - n),
|
|
45
|
-
suffix:
|
|
45
|
+
suffix: l.substring(0, n)
|
|
46
46
|
};
|
|
47
|
-
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed),
|
|
47
|
+
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Ue = /^\s*$/, De = (t) => Ue.test(t.toString()), Ve = (t, e) => {
|
|
48
48
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
49
49
|
top: n(t.top),
|
|
50
50
|
bottom: n(t.bottom),
|
|
@@ -68,17 +68,17 @@ const ce = "not-annotatable", Z = `.${ce}`, nt = (t) => {
|
|
|
68
68
|
return "block-contains";
|
|
69
69
|
} else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
|
|
70
70
|
return "block-is-contained";
|
|
71
|
-
},
|
|
71
|
+
}, Ke = (t, e) => {
|
|
72
72
|
const n = Math.min(t.left, e.left), o = Math.max(t.right, e.right), i = Math.min(t.top, e.top), s = Math.max(t.bottom, e.bottom);
|
|
73
73
|
return new DOMRect(n, i, o - n, s - i);
|
|
74
|
-
},
|
|
74
|
+
}, Ye = (t) => t.reduce((e, n) => {
|
|
75
75
|
if (n.width === 0 || n.height === 0)
|
|
76
76
|
return e;
|
|
77
77
|
let o = [...e], i = !1;
|
|
78
78
|
for (const s of e) {
|
|
79
|
-
const r =
|
|
79
|
+
const r = Ve(n, s);
|
|
80
80
|
if (r === "inline-adjacent") {
|
|
81
|
-
o = o.map((a) => a === s ?
|
|
81
|
+
o = o.map((a) => a === s ? Ke(n, s) : a), i = !0;
|
|
82
82
|
break;
|
|
83
83
|
} else if (r === "inline-contains") {
|
|
84
84
|
o = o.map((a) => a === s ? n : a), i = !0;
|
|
@@ -92,73 +92,73 @@ const ce = "not-annotatable", Z = `.${ce}`, nt = (t) => {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return i ? o : [...o, n];
|
|
95
|
-
}, []),
|
|
95
|
+
}, []), Ro = (t) => ({
|
|
96
96
|
length: t.length,
|
|
97
97
|
item: (e) => t[e],
|
|
98
98
|
[Symbol.iterator]: function* () {
|
|
99
99
|
for (let e = 0; e < this.length; e++)
|
|
100
100
|
yield this.item(e);
|
|
101
101
|
}
|
|
102
|
-
}),
|
|
102
|
+
}), Xe = (t, e, n) => {
|
|
103
103
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
104
104
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
105
|
-
const s =
|
|
106
|
-
return n ? { quote: r, start: a, end:
|
|
107
|
-
},
|
|
108
|
-
var f,
|
|
105
|
+
const s = _t(o).textContent, r = t.toString(), a = s.length || 0, l = a + r.length;
|
|
106
|
+
return n ? { quote: r, start: a, end: l, range: t, offsetReference: i } : { quote: r, start: a, end: l, range: t };
|
|
107
|
+
}, ce = (t, e) => {
|
|
108
|
+
var f, d;
|
|
109
109
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
110
110
|
e,
|
|
111
111
|
NodeFilter.SHOW_TEXT,
|
|
112
|
-
(
|
|
112
|
+
(y) => {
|
|
113
113
|
var p;
|
|
114
|
-
return (p =
|
|
114
|
+
return (p = y.parentElement) != null && p.closest(Z) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
let r = 0;
|
|
118
118
|
const a = document.createRange();
|
|
119
|
-
let
|
|
120
|
-
|
|
119
|
+
let l = s.nextNode();
|
|
120
|
+
l === null && console.error("Could not revive annotation target. Content missing.");
|
|
121
121
|
let c = !i;
|
|
122
|
-
for (;
|
|
123
|
-
if (c || (c = i == null ? void 0 : i.contains(
|
|
124
|
-
const
|
|
125
|
-
if (r +
|
|
126
|
-
a.setStart(
|
|
122
|
+
for (; l !== null; ) {
|
|
123
|
+
if (c || (c = i == null ? void 0 : i.contains(l)), c) {
|
|
124
|
+
const y = ((f = l.textContent) == null ? void 0 : f.length) || 0;
|
|
125
|
+
if (r + y > n) {
|
|
126
|
+
a.setStart(l, n - r);
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
|
-
r +=
|
|
129
|
+
r += y;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
l = s.nextNode();
|
|
132
132
|
}
|
|
133
|
-
for (;
|
|
134
|
-
const
|
|
135
|
-
if (r +
|
|
136
|
-
a.setEnd(
|
|
133
|
+
for (; l !== null; ) {
|
|
134
|
+
const y = ((d = l.textContent) == null ? void 0 : d.length) || 0;
|
|
135
|
+
if (r + y >= o) {
|
|
136
|
+
a.setEnd(l, o - r);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
r +=
|
|
139
|
+
r += y, l = s.nextNode();
|
|
140
140
|
}
|
|
141
141
|
return {
|
|
142
142
|
...t,
|
|
143
143
|
range: a
|
|
144
144
|
};
|
|
145
|
-
},
|
|
145
|
+
}, bt = (t, e) => F(t.selector) ? t : {
|
|
146
146
|
...t,
|
|
147
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
148
|
-
},
|
|
147
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : ce(n, e))
|
|
148
|
+
}, vt = (t, e) => F(t.target.selector) ? t : { ...t, target: bt(t.target, e) }, le = (t, e) => {
|
|
149
149
|
if (t.isEqualNode(e))
|
|
150
150
|
return !0;
|
|
151
151
|
for (let n of t.childNodes)
|
|
152
|
-
if (
|
|
152
|
+
if (le(n, e))
|
|
153
153
|
return !0;
|
|
154
154
|
return !1;
|
|
155
|
-
},
|
|
155
|
+
}, Pe = (t, e) => {
|
|
156
156
|
const n = t.cloneContents();
|
|
157
|
-
return
|
|
158
|
-
},
|
|
157
|
+
return le(n, e);
|
|
158
|
+
}, $e = (t, e) => {
|
|
159
159
|
const n = t.cloneRange(), o = e.contains(n.startContainer), i = e.contains(n.endContainer);
|
|
160
|
-
return !o && !i &&
|
|
161
|
-
},
|
|
160
|
+
return !o && !i && !Pe(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
|
|
161
|
+
}, At = (t) => ({
|
|
162
162
|
...t,
|
|
163
163
|
type: t.type,
|
|
164
164
|
x: t.x,
|
|
@@ -200,169 +200,169 @@ const ce = "not-annotatable", Z = `.${ce}`, nt = (t) => {
|
|
|
200
200
|
defaultPrevented: t.defaultPrevented,
|
|
201
201
|
detail: t.detail,
|
|
202
202
|
timeStamp: t.timeStamp
|
|
203
|
-
}),
|
|
203
|
+
}), je = (t, e) => {
|
|
204
204
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
205
205
|
return new DOMRect(n - e.left, o - e.top, i - n, s - o);
|
|
206
|
-
},
|
|
206
|
+
}, Mo = (t, e) => {
|
|
207
207
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
208
208
|
return new DOMRect(n + e.left, o + e.top, i - n, s - o);
|
|
209
|
-
},
|
|
209
|
+
}, de = (t) => {
|
|
210
210
|
if (t === null)
|
|
211
211
|
return document.scrollingElement;
|
|
212
212
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
213
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
214
|
-
},
|
|
213
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : de(t.parentElement);
|
|
214
|
+
}, He = (t, e) => (n) => {
|
|
215
215
|
const o = typeof n == "string" ? n : n.id, i = (r) => {
|
|
216
|
-
const a = s.getBoundingClientRect(),
|
|
216
|
+
const a = s.getBoundingClientRect(), l = s.clientHeight, c = s.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: d, height: y } = e.getAnnotationBounds(o), p = f.top - a.top, w = f.left - a.left, b = s.parentElement ? s.scrollTop : 0, C = s.parentElement ? s.scrollLeft : 0, g = p + b - (l - y) / 2, u = w + C - (c - d) / 2;
|
|
217
217
|
s.scroll({ top: g, left: u, behavior: "smooth" });
|
|
218
|
-
}, s =
|
|
218
|
+
}, s = de(t);
|
|
219
219
|
if (s) {
|
|
220
220
|
const r = e.getAnnotation(o), { range: a } = r.target.selector[0];
|
|
221
221
|
if (a && !a.collapsed)
|
|
222
222
|
return i(r.target), !0;
|
|
223
223
|
{
|
|
224
|
-
const
|
|
224
|
+
const l = bt(r.target, t), { range: c } = l.selector[0];
|
|
225
225
|
if (c && !c.collapsed)
|
|
226
|
-
return i(
|
|
226
|
+
return i(l), !0;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
return !1;
|
|
230
230
|
}, W = {
|
|
231
231
|
fill: "rgb(0, 128, 255)",
|
|
232
232
|
fillOpacity: 0.18
|
|
233
|
-
},
|
|
233
|
+
}, wt = {
|
|
234
234
|
fill: "rgb(0, 128, 255)",
|
|
235
235
|
fillOpacity: 0.45
|
|
236
|
-
},
|
|
236
|
+
}, ze = (t, e, n, o, i) => {
|
|
237
237
|
var r, a;
|
|
238
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ?
|
|
238
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? wt : W) : n : (a = t.state) != null && a.selected ? wt : W;
|
|
239
239
|
return o && o.paint(t, e) || s;
|
|
240
240
|
};
|
|
241
|
-
function
|
|
241
|
+
function Fe(t) {
|
|
242
242
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
243
243
|
}
|
|
244
|
-
var
|
|
245
|
-
function
|
|
244
|
+
var Vt = { exports: {} };
|
|
245
|
+
function ue(t, e = 100, n = {}) {
|
|
246
246
|
if (typeof t != "function")
|
|
247
247
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);
|
|
248
248
|
if (e < 0)
|
|
249
249
|
throw new RangeError("`wait` must not be negative.");
|
|
250
250
|
const { immediate: o } = typeof n == "boolean" ? { immediate: n } : n;
|
|
251
|
-
let i, s, r, a,
|
|
251
|
+
let i, s, r, a, l;
|
|
252
252
|
function c() {
|
|
253
|
-
const
|
|
254
|
-
return i = void 0, s = void 0,
|
|
253
|
+
const y = i, p = s;
|
|
254
|
+
return i = void 0, s = void 0, l = t.apply(y, p), l;
|
|
255
255
|
}
|
|
256
256
|
function f() {
|
|
257
|
-
const
|
|
258
|
-
|
|
257
|
+
const y = Date.now() - a;
|
|
258
|
+
y < e && y >= 0 ? r = setTimeout(f, e - y) : (r = void 0, o || (l = c()));
|
|
259
259
|
}
|
|
260
|
-
const
|
|
260
|
+
const d = function(...y) {
|
|
261
261
|
if (i && this !== i && Object.getPrototypeOf(this) === Object.getPrototypeOf(i))
|
|
262
262
|
throw new Error("Debounced method called with different contexts of the same prototype.");
|
|
263
|
-
i = this, s =
|
|
263
|
+
i = this, s = y, a = Date.now();
|
|
264
264
|
const p = o && !r;
|
|
265
|
-
return r || (r = setTimeout(f, e)), p && (
|
|
265
|
+
return r || (r = setTimeout(f, e)), p && (l = c()), l;
|
|
266
266
|
};
|
|
267
|
-
return
|
|
267
|
+
return d.clear = () => {
|
|
268
268
|
r && (clearTimeout(r), r = void 0);
|
|
269
|
-
},
|
|
270
|
-
r &&
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
},
|
|
269
|
+
}, d.flush = () => {
|
|
270
|
+
r && d.trigger();
|
|
271
|
+
}, d.trigger = () => {
|
|
272
|
+
l = c(), d.clear();
|
|
273
|
+
}, d;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var
|
|
278
|
-
const
|
|
279
|
-
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, a = o - n,
|
|
280
|
-
return { top: e, left: n, minX: s, minY: r, maxX: a, maxY:
|
|
281
|
-
},
|
|
275
|
+
Vt.exports.debounce = ue;
|
|
276
|
+
Vt.exports = ue;
|
|
277
|
+
var We = Vt.exports;
|
|
278
|
+
const Kt = /* @__PURE__ */ Fe(We), qe = (t) => {
|
|
279
|
+
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, a = o - n, l = i - e;
|
|
280
|
+
return { top: e, left: n, minX: s, minY: r, maxX: a, maxY: l };
|
|
281
|
+
}, Ge = (t) => {
|
|
282
282
|
let e = /* @__PURE__ */ new Set();
|
|
283
283
|
return (o) => {
|
|
284
284
|
const i = o.map((s) => s.id);
|
|
285
285
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
286
286
|
};
|
|
287
|
-
},
|
|
287
|
+
}, Yt = (t, e, n, o) => {
|
|
288
288
|
const { store: i, selection: s, hover: r } = e;
|
|
289
|
-
let a,
|
|
290
|
-
const f =
|
|
291
|
-
const { x, y: h } = t.getBoundingClientRect(), v = i.getAt(T.clientX -
|
|
289
|
+
let a, l, c;
|
|
290
|
+
const f = Ge(n), d = (T) => {
|
|
291
|
+
const { x: E, y: h } = t.getBoundingClientRect(), v = i.getAt(T.clientX - E, T.clientY - h, l);
|
|
292
292
|
v ? r.current !== v.id && (t.classList.add("hovered"), r.set(v.id)) : r.current && (t.classList.remove("hovered"), r.set(null));
|
|
293
293
|
};
|
|
294
|
-
t.addEventListener("pointermove",
|
|
295
|
-
const
|
|
294
|
+
t.addEventListener("pointermove", d);
|
|
295
|
+
const y = (T = !1) => {
|
|
296
296
|
c && c.clear();
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
return { annotation: Y, rects: dt, state: { selected:
|
|
297
|
+
const E = qe(t), { minX: h, minY: v, maxX: A, maxY: L } = E, M = l ? i.getIntersecting(h, v, A, L).filter(({ annotation: Y }) => l(Y)) : i.getIntersecting(h, v, A, L), B = s.selected.map(({ id: Y }) => Y), K = M.map(({ annotation: Y, rects: dt }) => {
|
|
298
|
+
const Oe = B.includes(Y.id), Te = Y.id === r.current;
|
|
299
|
+
return { annotation: Y, rects: dt, state: { selected: Oe, hover: Te } };
|
|
300
300
|
});
|
|
301
|
-
o.redraw(K,
|
|
301
|
+
o.redraw(K, E, a, c, T), setTimeout(() => f(M.map(({ annotation: Y }) => Y)), 1);
|
|
302
302
|
}, p = (T) => {
|
|
303
|
-
c = T,
|
|
303
|
+
c = T, y();
|
|
304
304
|
}, w = (T) => {
|
|
305
|
-
a = T,
|
|
305
|
+
a = T, y();
|
|
306
306
|
}, b = (T) => {
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
i.observe(
|
|
310
|
-
const g = s.subscribe(() =>
|
|
307
|
+
l = T, y(!1);
|
|
308
|
+
}, C = () => y();
|
|
309
|
+
i.observe(C);
|
|
310
|
+
const g = s.subscribe(() => y()), u = () => y(!0);
|
|
311
311
|
document.addEventListener("scroll", u, { capture: !0, passive: !0 });
|
|
312
|
-
const
|
|
313
|
-
i.recalculatePositions(), c == null || c.reset(),
|
|
312
|
+
const m = Kt(() => {
|
|
313
|
+
i.recalculatePositions(), c == null || c.reset(), y();
|
|
314
314
|
}, 10);
|
|
315
|
-
window.addEventListener("resize",
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
T.every((h) => h.target === t || t.contains(h.target)) ||
|
|
315
|
+
window.addEventListener("resize", m);
|
|
316
|
+
const S = new ResizeObserver(m);
|
|
317
|
+
S.observe(t);
|
|
318
|
+
const x = { attributes: !0, childList: !0, subtree: !0 }, O = new MutationObserver((T) => {
|
|
319
|
+
T.every((h) => h.target === t || t.contains(h.target)) || y(!0);
|
|
320
320
|
});
|
|
321
|
-
return O.observe(document.body,
|
|
321
|
+
return O.observe(document.body, x), {
|
|
322
322
|
destroy: () => {
|
|
323
|
-
t.removeEventListener("pointermove",
|
|
323
|
+
t.removeEventListener("pointermove", d), o.destroy(), i.unobserve(C), g(), document.removeEventListener("scroll", u), m.clear(), window.removeEventListener("resize", m), S.disconnect(), O.disconnect();
|
|
324
324
|
},
|
|
325
|
-
redraw:
|
|
325
|
+
redraw: y,
|
|
326
326
|
setStyle: w,
|
|
327
327
|
setFilter: b,
|
|
328
328
|
setPainter: p,
|
|
329
329
|
setVisible: o.setVisible
|
|
330
330
|
};
|
|
331
|
-
},
|
|
331
|
+
}, Qe = () => {
|
|
332
332
|
const t = document.createElement("canvas");
|
|
333
333
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-canvas-highlight-layer bg", t;
|
|
334
|
-
},
|
|
334
|
+
}, Je = (t, e) => {
|
|
335
335
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
336
|
-
},
|
|
336
|
+
}, Ze = (t) => {
|
|
337
337
|
t.classList.add("r6o-annotatable");
|
|
338
|
-
const e =
|
|
338
|
+
const e = Qe(), n = e.getContext("2d");
|
|
339
339
|
document.body.appendChild(e);
|
|
340
|
-
const o = (a,
|
|
341
|
-
const { width:
|
|
342
|
-
n.clearRect(-0.5, -0.5,
|
|
343
|
-
const { top: p, left: w } =
|
|
344
|
-
[...a].sort((
|
|
345
|
-
const { annotation: { target: { created: u } } } =
|
|
346
|
-
return u.getTime() -
|
|
347
|
-
}).forEach((
|
|
348
|
-
var
|
|
349
|
-
const g = c ? typeof c == "function" ? c(
|
|
350
|
-
x:
|
|
340
|
+
const o = (a, l, c, f) => requestAnimationFrame(() => {
|
|
341
|
+
const { width: d, height: y } = e;
|
|
342
|
+
n.clearRect(-0.5, -0.5, d + 1, y + 1), f && f.clear();
|
|
343
|
+
const { top: p, left: w } = l;
|
|
344
|
+
[...a].sort((C, g) => {
|
|
345
|
+
const { annotation: { target: { created: u } } } = C, { annotation: { target: { created: m } } } = g;
|
|
346
|
+
return u.getTime() - m.getTime();
|
|
347
|
+
}).forEach((C) => {
|
|
348
|
+
var S;
|
|
349
|
+
const g = c ? typeof c == "function" ? c(C.annotation, C.state) : c : (S = C.state) != null && S.selected ? wt : W, u = f && f.paint(C, l) || g, m = C.rects.map(({ x, y: O, width: R, height: T }) => ({
|
|
350
|
+
x: x + w,
|
|
351
351
|
y: O + p,
|
|
352
352
|
width: R,
|
|
353
353
|
height: T
|
|
354
354
|
}));
|
|
355
|
-
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1,
|
|
356
|
-
({ x
|
|
355
|
+
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, m.forEach(
|
|
356
|
+
({ x, y: O, width: R, height: T }) => n.fillRect(x, O, R, T)
|
|
357
357
|
), u.underlineColor) {
|
|
358
358
|
n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
n.beginPath(), n.moveTo(O, R +
|
|
359
|
+
const x = u.underlineOffset ?? 0;
|
|
360
|
+
m.forEach(({ x: O, y: R, width: T, height: E }) => {
|
|
361
|
+
n.beginPath(), n.moveTo(O, R + E + x), n.lineTo(O + T, R + E + x), n.stroke();
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
|
-
}), i =
|
|
365
|
+
}), i = Kt(() => Je(e), 10);
|
|
366
366
|
return window.addEventListener("resize", i), {
|
|
367
367
|
destroy: () => {
|
|
368
368
|
e.remove(), i.clear(), window.removeEventListener("resize", i);
|
|
@@ -372,123 +372,123 @@ const Yt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
372
372
|
},
|
|
373
373
|
redraw: o
|
|
374
374
|
};
|
|
375
|
-
},
|
|
376
|
-
var
|
|
375
|
+
}, tn = (t, e, n) => Yt(t, e, n, Ze(t));
|
|
376
|
+
var en = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, H = function(t) {
|
|
377
377
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
378
378
|
}, _ = function(t, e, n) {
|
|
379
379
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
380
380
|
}, X = function(t, e, n) {
|
|
381
381
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
382
|
-
},
|
|
382
|
+
}, fe = function(t) {
|
|
383
383
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
384
|
-
},
|
|
384
|
+
}, $t = function(t) {
|
|
385
385
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
386
|
-
},
|
|
386
|
+
}, xt = function(t) {
|
|
387
387
|
return { r: _(t.r), g: _(t.g), b: _(t.b), a: _(t.a, 3) };
|
|
388
|
-
},
|
|
388
|
+
}, nn = /^#([0-9a-f]{3,8})$/i, ft = function(t) {
|
|
389
389
|
var e = t.toString(16);
|
|
390
390
|
return e.length < 2 ? "0" + e : e;
|
|
391
|
-
},
|
|
391
|
+
}, he = function(t) {
|
|
392
392
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), r = s - Math.min(e, n, o), a = r ? s === e ? (n - o) / r : s === n ? 2 + (o - e) / r : 4 + (e - n) / r : 0;
|
|
393
393
|
return { h: 60 * (a < 0 ? a + 6 : a), s: s ? r / s * 100 : 0, v: s / 255 * 100, a: i };
|
|
394
|
-
},
|
|
394
|
+
}, pe = function(t) {
|
|
395
395
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
396
396
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
397
|
-
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n),
|
|
398
|
-
return { r: 255 * [o, a, r, r,
|
|
397
|
+
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n), c = s % 6;
|
|
398
|
+
return { r: 255 * [o, a, r, r, l, o][c], g: 255 * [l, o, o, a, r, r][c], b: 255 * [r, r, l, o, o, a][c], a: i };
|
|
399
|
+
}, jt = function(t) {
|
|
400
|
+
return { h: fe(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
399
401
|
}, Ht = function(t) {
|
|
400
|
-
return { h: he(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
401
|
-
}, zt = function(t) {
|
|
402
402
|
return { h: _(t.h), s: _(t.s), l: _(t.l), a: _(t.a, 3) };
|
|
403
|
-
},
|
|
404
|
-
return
|
|
403
|
+
}, zt = function(t) {
|
|
404
|
+
return pe((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
405
405
|
var e, n, o;
|
|
406
406
|
}, st = function(t) {
|
|
407
|
-
return { h: (e =
|
|
407
|
+
return { h: (e = he(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
|
|
408
408
|
var e, n, o, i;
|
|
409
|
-
},
|
|
410
|
-
var e =
|
|
409
|
+
}, on = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ft = { string: [[function(t) {
|
|
410
|
+
var e = nn.exec(t);
|
|
411
411
|
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? _(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? _(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
412
412
|
}, "hex"], [function(t) {
|
|
413
|
-
var e =
|
|
414
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
413
|
+
var e = rn.exec(t) || an.exec(t);
|
|
414
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : $t({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
415
415
|
}, "rgb"], [function(t) {
|
|
416
|
-
var e =
|
|
416
|
+
var e = on.exec(t) || sn.exec(t);
|
|
417
417
|
if (!e) return null;
|
|
418
|
-
var n, o, i =
|
|
419
|
-
return
|
|
418
|
+
var n, o, i = jt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (en[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
419
|
+
return zt(i);
|
|
420
420
|
}, "hsl"]], object: [[function(t) {
|
|
421
421
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
|
|
422
|
-
return H(e) && H(n) && H(o) ?
|
|
422
|
+
return H(e) && H(n) && H(o) ? $t({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
|
|
423
423
|
}, "rgb"], [function(t) {
|
|
424
424
|
var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
|
|
425
425
|
if (!H(e) || !H(n) || !H(o)) return null;
|
|
426
|
-
var r =
|
|
427
|
-
return
|
|
426
|
+
var r = jt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
|
|
427
|
+
return zt(r);
|
|
428
428
|
}, "hsl"], [function(t) {
|
|
429
429
|
var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
|
|
430
430
|
if (!H(e) || !H(n) || !H(o)) return null;
|
|
431
431
|
var r = function(a) {
|
|
432
|
-
return { h:
|
|
432
|
+
return { h: fe(a.h), s: X(a.s, 0, 100), v: X(a.v, 0, 100), a: X(a.a) };
|
|
433
433
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
|
|
434
|
-
return
|
|
435
|
-
}, "hsv"]] },
|
|
434
|
+
return pe(r);
|
|
435
|
+
}, "hsv"]] }, Wt = function(t, e) {
|
|
436
436
|
for (var n = 0; n < e.length; n++) {
|
|
437
437
|
var o = e[n][0](t);
|
|
438
438
|
if (o) return [o, e[n][1]];
|
|
439
439
|
}
|
|
440
440
|
return [null, void 0];
|
|
441
|
-
},
|
|
442
|
-
return typeof t == "string" ?
|
|
443
|
-
},
|
|
441
|
+
}, cn = function(t) {
|
|
442
|
+
return typeof t == "string" ? Wt(t.trim(), Ft.string) : typeof t == "object" && t !== null ? Wt(t, Ft.object) : [null, void 0];
|
|
443
|
+
}, Et = function(t, e) {
|
|
444
444
|
var n = st(t);
|
|
445
445
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
446
|
-
},
|
|
446
|
+
}, St = function(t) {
|
|
447
447
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
448
|
-
},
|
|
448
|
+
}, qt = function(t, e) {
|
|
449
449
|
var n = st(t);
|
|
450
450
|
return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };
|
|
451
|
-
},
|
|
451
|
+
}, Gt = function() {
|
|
452
452
|
function t(e) {
|
|
453
|
-
this.parsed =
|
|
453
|
+
this.parsed = cn(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
454
454
|
}
|
|
455
455
|
return t.prototype.isValid = function() {
|
|
456
456
|
return this.parsed !== null;
|
|
457
457
|
}, t.prototype.brightness = function() {
|
|
458
|
-
return _(
|
|
458
|
+
return _(St(this.rgba), 2);
|
|
459
459
|
}, t.prototype.isDark = function() {
|
|
460
|
-
return
|
|
460
|
+
return St(this.rgba) < 0.5;
|
|
461
461
|
}, t.prototype.isLight = function() {
|
|
462
|
-
return
|
|
462
|
+
return St(this.rgba) >= 0.5;
|
|
463
463
|
}, t.prototype.toHex = function() {
|
|
464
|
-
return e =
|
|
464
|
+
return e = xt(this.rgba), n = e.r, o = e.g, i = e.b, r = (s = e.a) < 1 ? ft(_(255 * s)) : "", "#" + ft(n) + ft(o) + ft(i) + r;
|
|
465
465
|
var e, n, o, i, s, r;
|
|
466
466
|
}, t.prototype.toRgb = function() {
|
|
467
|
-
return
|
|
467
|
+
return xt(this.rgba);
|
|
468
468
|
}, t.prototype.toRgbString = function() {
|
|
469
|
-
return e =
|
|
469
|
+
return e = xt(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
470
470
|
var e, n, o, i, s;
|
|
471
471
|
}, t.prototype.toHsl = function() {
|
|
472
|
-
return
|
|
472
|
+
return Ht(st(this.rgba));
|
|
473
473
|
}, t.prototype.toHslString = function() {
|
|
474
|
-
return e =
|
|
474
|
+
return e = Ht(st(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
475
475
|
var e, n, o, i, s;
|
|
476
476
|
}, t.prototype.toHsv = function() {
|
|
477
|
-
return e =
|
|
477
|
+
return e = he(this.rgba), { h: _(e.h), s: _(e.s), v: _(e.v), a: _(e.a, 3) };
|
|
478
478
|
var e;
|
|
479
479
|
}, t.prototype.invert = function() {
|
|
480
480
|
return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
481
481
|
var e;
|
|
482
482
|
}, t.prototype.saturate = function(e) {
|
|
483
|
-
return e === void 0 && (e = 0.1), $(
|
|
483
|
+
return e === void 0 && (e = 0.1), $(Et(this.rgba, e));
|
|
484
484
|
}, t.prototype.desaturate = function(e) {
|
|
485
|
-
return e === void 0 && (e = 0.1), $(
|
|
485
|
+
return e === void 0 && (e = 0.1), $(Et(this.rgba, -e));
|
|
486
486
|
}, t.prototype.grayscale = function() {
|
|
487
|
-
return $(
|
|
487
|
+
return $(Et(this.rgba, -1));
|
|
488
488
|
}, t.prototype.lighten = function(e) {
|
|
489
|
-
return e === void 0 && (e = 0.1), $(
|
|
489
|
+
return e === void 0 && (e = 0.1), $(qt(this.rgba, e));
|
|
490
490
|
}, t.prototype.darken = function(e) {
|
|
491
|
-
return e === void 0 && (e = 0.1), $(
|
|
491
|
+
return e === void 0 && (e = 0.1), $(qt(this.rgba, -e));
|
|
492
492
|
}, t.prototype.rotate = function(e) {
|
|
493
493
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
494
494
|
}, t.prototype.alpha = function(e) {
|
|
@@ -501,15 +501,15 @@ var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, H = function(t) {
|
|
|
501
501
|
return this.toHex() === $(e).toHex();
|
|
502
502
|
}, t;
|
|
503
503
|
}(), $ = function(t) {
|
|
504
|
-
return t instanceof
|
|
504
|
+
return t instanceof Gt ? t : new Gt(t);
|
|
505
505
|
};
|
|
506
|
-
const
|
|
506
|
+
const ln = (t) => [
|
|
507
507
|
`background-color:${$((t == null ? void 0 : t.fill) || W.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? W.fillOpacity : t.fillOpacity).toHex()}`,
|
|
508
508
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
509
509
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
510
510
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
511
511
|
t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0
|
|
512
|
-
].filter(Boolean).join(";"),
|
|
512
|
+
].filter(Boolean).join(";"), dn = () => {
|
|
513
513
|
const t = document.createElement("style");
|
|
514
514
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
515
515
|
let e = /* @__PURE__ */ new Set();
|
|
@@ -520,25 +520,25 @@ const dn = (t) => [
|
|
|
520
520
|
setVisible: (s) => {
|
|
521
521
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
522
522
|
},
|
|
523
|
-
redraw: (s, r, a,
|
|
524
|
-
|
|
525
|
-
const c = new Set(s.map((
|
|
526
|
-
Array.from(e).filter((
|
|
527
|
-
const f = s.map((
|
|
523
|
+
redraw: (s, r, a, l) => {
|
|
524
|
+
l && l.clear();
|
|
525
|
+
const c = new Set(s.map((d) => d.annotation.id));
|
|
526
|
+
Array.from(e).filter((d) => !c.has(d));
|
|
527
|
+
const f = s.map((d) => {
|
|
528
528
|
var w;
|
|
529
|
-
const
|
|
530
|
-
return `::highlight(_${
|
|
529
|
+
const y = a ? typeof a == "function" ? a(d.annotation, d.state) : a : (w = d.state) != null && w.selected ? wt : W, p = l && l.paint(d, r) || y;
|
|
530
|
+
return `::highlight(_${d.annotation.id}) { ${ln(p)} }`;
|
|
531
531
|
});
|
|
532
532
|
t.innerHTML = f.join(`
|
|
533
|
-
`), CSS.highlights.clear(), s.forEach(({ annotation:
|
|
534
|
-
const
|
|
535
|
-
CSS.highlights.set(`_${
|
|
533
|
+
`), CSS.highlights.clear(), s.forEach(({ annotation: d }) => {
|
|
534
|
+
const y = d.target.selector.map((w) => w.range), p = new Highlight(...y);
|
|
535
|
+
CSS.highlights.set(`_${d.id}`, p);
|
|
536
536
|
}), e = c;
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
|
-
},
|
|
540
|
-
var
|
|
541
|
-
function
|
|
539
|
+
}, un = (t, e, n) => Yt(t, e, n, dn());
|
|
540
|
+
var Qt = Object.prototype.hasOwnProperty;
|
|
541
|
+
function Ut(t, e) {
|
|
542
542
|
var n, o;
|
|
543
543
|
if (t === e) return !0;
|
|
544
544
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -546,22 +546,22 @@ function Dt(t, e) {
|
|
|
546
546
|
if (n === RegExp) return t.toString() === e.toString();
|
|
547
547
|
if (n === Array) {
|
|
548
548
|
if ((o = t.length) === e.length)
|
|
549
|
-
for (; o-- &&
|
|
549
|
+
for (; o-- && Ut(t[o], e[o]); ) ;
|
|
550
550
|
return o === -1;
|
|
551
551
|
}
|
|
552
552
|
if (!n || typeof t == "object") {
|
|
553
553
|
o = 0;
|
|
554
554
|
for (n in t)
|
|
555
|
-
if (
|
|
555
|
+
if (Qt.call(t, n) && ++o && !Qt.call(e, n) || !(n in e) || !Ut(t[n], e[n])) return !1;
|
|
556
556
|
return Object.keys(e).length === o;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
return t !== t && e !== e;
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const fn = (t, e) => {
|
|
562
562
|
const n = (s, r) => s.x <= r.x + r.width && s.x + s.width >= r.x && s.y <= r.y + r.height && s.y + s.height >= r.y, o = (s) => s.rects.reduce((r, a) => r + a.width, 0), i = e.filter(({ rects: s }) => s.some((r) => n(t, r)));
|
|
563
563
|
return i.sort((s, r) => o(r) - o(s)), i.findIndex((s) => s.rects.includes(t));
|
|
564
|
-
},
|
|
564
|
+
}, hn = (t) => {
|
|
565
565
|
t.classList.add("r6o-annotatable");
|
|
566
566
|
const e = document.createElement("div");
|
|
567
567
|
e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
|
|
@@ -570,16 +570,16 @@ const hn = (t, e) => {
|
|
|
570
570
|
destroy: () => {
|
|
571
571
|
e.remove();
|
|
572
572
|
},
|
|
573
|
-
redraw: (r, a,
|
|
574
|
-
const
|
|
575
|
-
if (!c && !
|
|
576
|
-
|
|
577
|
-
const { annotation: { target: { created:
|
|
578
|
-
return
|
|
573
|
+
redraw: (r, a, l, c, f) => {
|
|
574
|
+
const y = !(Ut(n, r) && f);
|
|
575
|
+
if (!c && !y) return;
|
|
576
|
+
y && (e.innerHTML = ""), [...r].sort((w, b) => {
|
|
577
|
+
const { annotation: { target: { created: C } } } = w, { annotation: { target: { created: g } } } = b;
|
|
578
|
+
return C && g ? C.getTime() - g.getTime() : 0;
|
|
579
579
|
}).forEach((w) => {
|
|
580
580
|
w.rects.map((b) => {
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
581
|
+
const C = fn(b, r), g = ze(w, a, l, c, C);
|
|
582
|
+
if (y) {
|
|
583
583
|
const u = document.createElement("span");
|
|
584
584
|
u.className = "r6o-annotation", u.dataset.annotation = w.annotation.id, u.style.left = `${b.x}px`, u.style.top = `${b.y}px`, u.style.width = `${b.width}px`, u.style.height = `${b.height}px`, u.style.backgroundColor = $((g == null ? void 0 : g.fill) || W.fill).alpha((g == null ? void 0 : g.fillOpacity) === void 0 ? W.fillOpacity : g.fillOpacity).toHex(), g.underlineStyle && (u.style.borderStyle = g.underlineStyle), g.underlineColor && (u.style.borderColor = g.underlineColor), g.underlineThickness && (u.style.borderBottomWidth = `${g.underlineThickness}px`), g.underlineOffset && (u.style.paddingBottom = `${g.underlineOffset}px`), e.appendChild(u);
|
|
585
585
|
}
|
|
@@ -590,31 +590,31 @@ const hn = (t, e) => {
|
|
|
590
590
|
r ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
},
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
function mn(t, e = 0) {
|
|
593
|
+
}, pn = (t, e, n) => Yt(t, e, n, hn(t)), U = [];
|
|
594
|
+
for (let t = 0; t < 256; ++t)
|
|
595
|
+
U.push((t + 256).toString(16).slice(1));
|
|
596
|
+
function gn(t, e = 0) {
|
|
598
597
|
return (U[t[e + 0]] + U[t[e + 1]] + U[t[e + 2]] + U[t[e + 3]] + "-" + U[t[e + 4]] + U[t[e + 5]] + "-" + U[t[e + 6]] + U[t[e + 7]] + "-" + U[t[e + 8]] + U[t[e + 9]] + "-" + U[t[e + 10]] + U[t[e + 11]] + U[t[e + 12]] + U[t[e + 13]] + U[t[e + 14]] + U[t[e + 15]]).toLowerCase();
|
|
599
598
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
599
|
+
let Ct;
|
|
600
|
+
const mn = new Uint8Array(16);
|
|
601
|
+
function yn() {
|
|
602
|
+
if (!Ct) {
|
|
603
|
+
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
604
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
605
|
+
Ct = crypto.getRandomValues.bind(crypto);
|
|
606
|
+
}
|
|
607
|
+
return Ct(mn);
|
|
605
608
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
randomUUID
|
|
609
|
-
|
|
610
|
-
function me(t, e, n) {
|
|
611
|
-
if (Zt.randomUUID && !e && !t)
|
|
612
|
-
return Zt.randomUUID();
|
|
609
|
+
const bn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Jt = { randomUUID: bn };
|
|
610
|
+
function ge(t, e, n) {
|
|
611
|
+
if (Jt.randomUUID && !e && !t)
|
|
612
|
+
return Jt.randomUUID();
|
|
613
613
|
t = t || {};
|
|
614
|
-
|
|
615
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
614
|
+
const o = t.random || (t.rng || yn)();
|
|
615
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, gn(o);
|
|
616
616
|
}
|
|
617
|
-
var
|
|
617
|
+
var Zt = Object.prototype.hasOwnProperty;
|
|
618
618
|
function q(t, e) {
|
|
619
619
|
var n, o;
|
|
620
620
|
if (t === e) return !0;
|
|
@@ -629,27 +629,27 @@ function q(t, e) {
|
|
|
629
629
|
if (!n || typeof t == "object") {
|
|
630
630
|
o = 0;
|
|
631
631
|
for (n in t)
|
|
632
|
-
if (
|
|
632
|
+
if (Zt.call(t, n) && ++o && !Zt.call(e, n) || !(n in e) || !q(t[n], e[n])) return !1;
|
|
633
633
|
return Object.keys(e).length === o;
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
return t !== t && e !== e;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function Lt() {
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function wn(t, e) {
|
|
641
641
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
642
642
|
}
|
|
643
643
|
const G = [];
|
|
644
|
-
function
|
|
644
|
+
function Xt(t, e = Lt) {
|
|
645
645
|
let n;
|
|
646
646
|
const o = /* @__PURE__ */ new Set();
|
|
647
647
|
function i(a) {
|
|
648
|
-
if (
|
|
649
|
-
const
|
|
648
|
+
if (wn(t, a) && (t = a, n)) {
|
|
649
|
+
const l = !G.length;
|
|
650
650
|
for (const c of o)
|
|
651
651
|
c[1](), G.push(c, t);
|
|
652
|
-
if (
|
|
652
|
+
if (l) {
|
|
653
653
|
for (let c = 0; c < G.length; c += 2)
|
|
654
654
|
G[c][0](G[c + 1]);
|
|
655
655
|
G.length = 0;
|
|
@@ -659,16 +659,16 @@ function Pt(t, e = Ot) {
|
|
|
659
659
|
function s(a) {
|
|
660
660
|
i(a(t));
|
|
661
661
|
}
|
|
662
|
-
function r(a,
|
|
663
|
-
const c = [a,
|
|
664
|
-
return o.add(c), o.size === 1 && (n = e(i, s) ||
|
|
662
|
+
function r(a, l = Lt) {
|
|
663
|
+
const c = [a, l];
|
|
664
|
+
return o.add(c), o.size === 1 && (n = e(i, s) || Lt), a(t), () => {
|
|
665
665
|
o.delete(c), o.size === 0 && n && (n(), n = null);
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
return { set: i, update: s, subscribe: r };
|
|
669
669
|
}
|
|
670
|
-
const
|
|
671
|
-
const { subscribe: e, set: n } =
|
|
670
|
+
const vn = (t) => {
|
|
671
|
+
const { subscribe: e, set: n } = Xt();
|
|
672
672
|
let o;
|
|
673
673
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
674
674
|
if (o) {
|
|
@@ -684,28 +684,28 @@ const An = (t) => {
|
|
|
684
684
|
set: n
|
|
685
685
|
};
|
|
686
686
|
};
|
|
687
|
-
var
|
|
688
|
-
const
|
|
689
|
-
const { subscribe: o, set: i } =
|
|
690
|
-
let s = e, r =
|
|
687
|
+
var An = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(An || {});
|
|
688
|
+
const ht = { selected: [] }, xn = (t, e, n) => {
|
|
689
|
+
const { subscribe: o, set: i } = Xt(ht);
|
|
690
|
+
let s = e, r = ht;
|
|
691
691
|
o((w) => r = w);
|
|
692
692
|
const a = () => {
|
|
693
|
-
q(r,
|
|
694
|
-
},
|
|
693
|
+
q(r, ht) || i(ht);
|
|
694
|
+
}, l = () => {
|
|
695
695
|
var w;
|
|
696
696
|
return ((w = r.selected) == null ? void 0 : w.length) === 0;
|
|
697
697
|
}, c = (w) => {
|
|
698
|
-
if (
|
|
698
|
+
if (l())
|
|
699
699
|
return !1;
|
|
700
700
|
const b = typeof w == "string" ? w : w.id;
|
|
701
|
-
return r.selected.some((
|
|
701
|
+
return r.selected.some((C) => C.id === b);
|
|
702
702
|
}, f = (w, b) => {
|
|
703
|
-
const
|
|
704
|
-
if (!
|
|
703
|
+
const C = t.getAnnotation(w);
|
|
704
|
+
if (!C) {
|
|
705
705
|
console.warn("Invalid selection: " + w);
|
|
706
706
|
return;
|
|
707
707
|
}
|
|
708
|
-
switch (
|
|
708
|
+
switch (te(C, s)) {
|
|
709
709
|
case "EDIT":
|
|
710
710
|
i({ selected: [{ id: w, editable: !0 }], event: b });
|
|
711
711
|
break;
|
|
@@ -715,22 +715,22 @@ const pt = { selected: [] }, En = (t, e, n) => {
|
|
|
715
715
|
default:
|
|
716
716
|
i({ selected: [], event: b });
|
|
717
717
|
}
|
|
718
|
-
},
|
|
719
|
-
const
|
|
718
|
+
}, d = (w, b) => {
|
|
719
|
+
const C = Array.isArray(w) ? w : [w], g = C.map((u) => t.getAnnotation(u)).filter((u) => !!u);
|
|
720
720
|
i({
|
|
721
721
|
selected: g.map((u) => {
|
|
722
|
-
const
|
|
723
|
-
return { id: u.id, editable:
|
|
722
|
+
const m = b === void 0 ? te(u, s) === "EDIT" : b;
|
|
723
|
+
return { id: u.id, editable: m };
|
|
724
724
|
})
|
|
725
|
-
}), g.length !==
|
|
726
|
-
},
|
|
727
|
-
if (
|
|
725
|
+
}), g.length !== C.length && console.warn("Invalid selection", w);
|
|
726
|
+
}, y = (w) => {
|
|
727
|
+
if (l())
|
|
728
728
|
return !1;
|
|
729
729
|
const { selected: b } = r;
|
|
730
|
-
b.some(({ id:
|
|
730
|
+
b.some(({ id: C }) => w.includes(C)) && i({ selected: b.filter(({ id: C }) => !w.includes(C)) });
|
|
731
731
|
}, p = (w) => s = w;
|
|
732
732
|
return t.observe(
|
|
733
|
-
({ changes: w }) =>
|
|
733
|
+
({ changes: w }) => y((w.deleted || []).map((b) => b.id))
|
|
734
734
|
), {
|
|
735
735
|
get event() {
|
|
736
736
|
return r ? r.event : null;
|
|
@@ -742,38 +742,38 @@ const pt = { selected: [] }, En = (t, e, n) => {
|
|
|
742
742
|
return s;
|
|
743
743
|
},
|
|
744
744
|
clear: a,
|
|
745
|
-
isEmpty:
|
|
745
|
+
isEmpty: l,
|
|
746
746
|
isSelected: c,
|
|
747
|
-
setSelected:
|
|
747
|
+
setSelected: d,
|
|
748
748
|
setUserSelectAction: p,
|
|
749
749
|
subscribe: o,
|
|
750
750
|
userSelect: f
|
|
751
751
|
};
|
|
752
|
-
},
|
|
752
|
+
}, te = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT";
|
|
753
753
|
var D = [];
|
|
754
|
-
for (var
|
|
755
|
-
D.push((
|
|
756
|
-
function
|
|
754
|
+
for (var Ot = 0; Ot < 256; ++Ot)
|
|
755
|
+
D.push((Ot + 256).toString(16).slice(1));
|
|
756
|
+
function En(t, e = 0) {
|
|
757
757
|
return (D[t[e + 0]] + D[t[e + 1]] + D[t[e + 2]] + D[t[e + 3]] + "-" + D[t[e + 4]] + D[t[e + 5]] + "-" + D[t[e + 6]] + D[t[e + 7]] + "-" + D[t[e + 8]] + D[t[e + 9]] + "-" + D[t[e + 10]] + D[t[e + 11]] + D[t[e + 12]] + D[t[e + 13]] + D[t[e + 14]] + D[t[e + 15]]).toLowerCase();
|
|
758
758
|
}
|
|
759
|
-
var
|
|
760
|
-
function
|
|
761
|
-
if (!
|
|
759
|
+
var pt, Sn = new Uint8Array(16);
|
|
760
|
+
function Cn() {
|
|
761
|
+
if (!pt && (pt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !pt))
|
|
762
762
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
763
|
-
return
|
|
763
|
+
return pt(Sn);
|
|
764
764
|
}
|
|
765
|
-
var
|
|
766
|
-
const
|
|
767
|
-
randomUUID:
|
|
765
|
+
var Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
766
|
+
const ee = {
|
|
767
|
+
randomUUID: Ln
|
|
768
768
|
};
|
|
769
|
-
function
|
|
770
|
-
if (
|
|
771
|
-
return
|
|
769
|
+
function me(t, e, n) {
|
|
770
|
+
if (ee.randomUUID && !e && !t)
|
|
771
|
+
return ee.randomUUID();
|
|
772
772
|
t = t || {};
|
|
773
|
-
var o = t.random || (t.rng ||
|
|
774
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
773
|
+
var o = t.random || (t.rng || Cn)();
|
|
774
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, En(o);
|
|
775
775
|
}
|
|
776
|
-
const
|
|
776
|
+
const Tt = (t) => {
|
|
777
777
|
const e = (n) => {
|
|
778
778
|
const o = { ...n };
|
|
779
779
|
return n.created && typeof n.created == "string" && (o.created = new Date(n.created)), n.updated && typeof n.updated == "string" && (o.updated = new Date(n.updated)), o;
|
|
@@ -783,43 +783,43 @@ const Rt = (t) => {
|
|
|
783
783
|
bodies: (t.bodies || []).map(e),
|
|
784
784
|
target: e(t.target)
|
|
785
785
|
};
|
|
786
|
-
},
|
|
787
|
-
id:
|
|
786
|
+
}, Bo = (t, e, n, o) => ({
|
|
787
|
+
id: me(),
|
|
788
788
|
annotation: typeof t == "string" ? t : t.id,
|
|
789
789
|
created: n || /* @__PURE__ */ new Date(),
|
|
790
790
|
creator: o,
|
|
791
791
|
...e
|
|
792
|
-
}),
|
|
792
|
+
}), On = (t, e) => {
|
|
793
793
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
794
794
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
795
|
-
},
|
|
795
|
+
}, Tn = (t, e) => {
|
|
796
796
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
797
797
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
798
|
-
},
|
|
798
|
+
}, Rn = (t, e) => e.bodies.map((n) => {
|
|
799
799
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
800
800
|
return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };
|
|
801
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })),
|
|
802
|
-
const n =
|
|
801
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Mn = (t, e) => !q(t.target, e.target), ye = (t, e) => {
|
|
802
|
+
const n = On(t, e), o = Tn(t, e), i = Rn(t, e);
|
|
803
803
|
return {
|
|
804
804
|
oldValue: t,
|
|
805
805
|
newValue: e,
|
|
806
806
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
807
807
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
808
808
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
809
|
-
targetUpdated:
|
|
809
|
+
targetUpdated: Mn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
810
810
|
};
|
|
811
811
|
};
|
|
812
812
|
var k = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t.SILENT = "SILENT", t))(k || {});
|
|
813
|
-
const
|
|
813
|
+
const Bn = (t, e) => {
|
|
814
814
|
var n, o;
|
|
815
815
|
const { changes: i, origin: s } = e;
|
|
816
816
|
if (!(t.options.origin ? t.options.origin === s : s !== "SILENT"))
|
|
817
817
|
return !1;
|
|
818
818
|
if (t.options.ignore) {
|
|
819
|
-
const { ignore: r } = t.options, a = (
|
|
819
|
+
const { ignore: r } = t.options, a = (l) => l && l.length > 0;
|
|
820
820
|
if (!(a(i.created) || a(i.deleted))) {
|
|
821
|
-
const
|
|
822
|
-
if (r === "BODY_ONLY" &&
|
|
821
|
+
const l = (n = i.updated) == null ? void 0 : n.some((f) => a(f.bodiesCreated) || a(f.bodiesDeleted) || a(f.bodiesUpdated)), c = (o = i.updated) == null ? void 0 : o.some((f) => f.targetUpdated);
|
|
822
|
+
if (r === "BODY_ONLY" && l && !c || r === "TARGET_ONLY" && c && !l)
|
|
823
823
|
return !1;
|
|
824
824
|
}
|
|
825
825
|
}
|
|
@@ -832,27 +832,27 @@ const kn = (t, e) => {
|
|
|
832
832
|
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((a) => r.has(a));
|
|
833
833
|
} else
|
|
834
834
|
return !0;
|
|
835
|
-
},
|
|
836
|
-
const n = new Set((t.created || []).map((
|
|
837
|
-
...(t.created || []).filter((
|
|
835
|
+
}, kn = (t, e) => {
|
|
836
|
+
const n = new Set((t.created || []).map((d) => d.id)), o = new Set((t.updated || []).map(({ newValue: d }) => d.id)), i = new Set((e.created || []).map((d) => d.id)), s = new Set((e.deleted || []).map((d) => d.id)), r = new Set((e.updated || []).map(({ oldValue: d }) => d.id)), a = new Set((e.updated || []).filter(({ oldValue: d }) => n.has(d.id) || o.has(d.id)).map(({ oldValue: d }) => d.id)), l = [
|
|
837
|
+
...(t.created || []).filter((d) => !s.has(d.id)).map((d) => r.has(d.id) ? e.updated.find(({ oldValue: y }) => y.id === d.id).newValue : d),
|
|
838
838
|
...e.created || []
|
|
839
839
|
], c = [
|
|
840
|
-
...(t.deleted || []).filter((
|
|
841
|
-
...(e.deleted || []).filter((
|
|
840
|
+
...(t.deleted || []).filter((d) => !i.has(d.id)),
|
|
841
|
+
...(e.deleted || []).filter((d) => !n.has(d.id))
|
|
842
842
|
], f = [
|
|
843
|
-
...(t.updated || []).filter(({ newValue:
|
|
844
|
-
const { oldValue:
|
|
843
|
+
...(t.updated || []).filter(({ newValue: d }) => !s.has(d.id)).map((d) => {
|
|
844
|
+
const { oldValue: y, newValue: p } = d;
|
|
845
845
|
if (r.has(p.id)) {
|
|
846
846
|
const w = e.updated.find((b) => b.oldValue.id === p.id).newValue;
|
|
847
|
-
return
|
|
847
|
+
return ye(y, w);
|
|
848
848
|
} else
|
|
849
|
-
return
|
|
849
|
+
return d;
|
|
850
850
|
}),
|
|
851
|
-
...(e.updated || []).filter(({ oldValue:
|
|
851
|
+
...(e.updated || []).filter(({ oldValue: d }) => !a.has(d.id))
|
|
852
852
|
];
|
|
853
|
-
return { created:
|
|
854
|
-
},
|
|
855
|
-
const e = t.id === void 0 ?
|
|
853
|
+
return { created: l, deleted: c, updated: f };
|
|
854
|
+
}, Rt = (t) => {
|
|
855
|
+
const e = t.id === void 0 ? me() : t.id;
|
|
856
856
|
return {
|
|
857
857
|
...t,
|
|
858
858
|
id: e,
|
|
@@ -865,7 +865,7 @@ const kn = (t, e) => {
|
|
|
865
865
|
annotation: e
|
|
866
866
|
}
|
|
867
867
|
};
|
|
868
|
-
},
|
|
868
|
+
}, In = (t) => t.id !== void 0, Nn = () => {
|
|
869
869
|
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (h, v = {}) => {
|
|
870
870
|
n.push({ onChange: h, options: v });
|
|
871
871
|
}, i = (h) => {
|
|
@@ -882,24 +882,24 @@ const kn = (t, e) => {
|
|
|
882
882
|
state: [...t.values()]
|
|
883
883
|
};
|
|
884
884
|
n.forEach((L) => {
|
|
885
|
-
|
|
885
|
+
Bn(L, A) && L.onChange(A);
|
|
886
886
|
});
|
|
887
887
|
}, r = (h, v = k.LOCAL) => {
|
|
888
888
|
if (h.id && t.get(h.id))
|
|
889
889
|
throw Error(`Cannot add annotation ${h.id} - exists already`);
|
|
890
890
|
{
|
|
891
|
-
const A =
|
|
891
|
+
const A = Rt(h);
|
|
892
892
|
t.set(A.id, A), A.bodies.forEach((L) => e.set(L.id, A.id)), s(v, { created: [A] });
|
|
893
893
|
}
|
|
894
894
|
}, a = (h, v) => {
|
|
895
|
-
const A =
|
|
895
|
+
const A = Rt(typeof h == "string" ? v : h), L = typeof h == "string" ? h : h.id, M = L && t.get(L);
|
|
896
896
|
if (M) {
|
|
897
|
-
const B =
|
|
897
|
+
const B = ye(M, A);
|
|
898
898
|
return L === A.id ? t.set(L, A) : (t.delete(L), t.set(A.id, A)), M.bodies.forEach((K) => e.delete(K.id)), A.bodies.forEach((K) => e.set(K.id, A.id)), B;
|
|
899
899
|
} else
|
|
900
900
|
console.warn(`Cannot update annotation ${L} - does not exist`);
|
|
901
|
-
},
|
|
902
|
-
const L =
|
|
901
|
+
}, l = (h, v = k.LOCAL, A = k.LOCAL) => {
|
|
902
|
+
const L = In(v) ? A : v, M = a(h, v);
|
|
903
903
|
M && s(L, { updated: [M] });
|
|
904
904
|
}, c = (h, v = k.LOCAL) => {
|
|
905
905
|
const A = h.reduce((L, M) => {
|
|
@@ -921,11 +921,11 @@ const kn = (t, e) => {
|
|
|
921
921
|
}] });
|
|
922
922
|
} else
|
|
923
923
|
console.warn(`Attempt to add body to missing annotation: ${h.annotation}`);
|
|
924
|
-
},
|
|
924
|
+
}, d = () => [...t.values()], y = (h = k.LOCAL) => {
|
|
925
925
|
const v = [...t.values()];
|
|
926
926
|
t.clear(), e.clear(), s(h, { deleted: v });
|
|
927
927
|
}, p = (h, v = !0, A = k.LOCAL) => {
|
|
928
|
-
const L = h.map(
|
|
928
|
+
const L = h.map(Rt);
|
|
929
929
|
if (v) {
|
|
930
930
|
const M = [...t.values()];
|
|
931
931
|
t.clear(), e.clear(), L.forEach((B) => {
|
|
@@ -950,7 +950,7 @@ const kn = (t, e) => {
|
|
|
950
950
|
}, b = (h, v = k.LOCAL) => {
|
|
951
951
|
const A = w(h);
|
|
952
952
|
A && s(v, { deleted: [A] });
|
|
953
|
-
},
|
|
953
|
+
}, C = (h, v = k.LOCAL) => {
|
|
954
954
|
const A = h.reduce((L, M) => {
|
|
955
955
|
const B = w(M);
|
|
956
956
|
return B ? [...L, B] : L;
|
|
@@ -978,16 +978,16 @@ const kn = (t, e) => {
|
|
|
978
978
|
}, u = (h, v = k.LOCAL) => {
|
|
979
979
|
const A = g(h);
|
|
980
980
|
A && s(v, { updated: [A] });
|
|
981
|
-
},
|
|
981
|
+
}, m = (h, v = k.LOCAL) => {
|
|
982
982
|
const A = h.map((L) => g(L)).filter(Boolean);
|
|
983
983
|
A.length > 0 && s(v, { updated: A });
|
|
984
|
-
},
|
|
984
|
+
}, S = (h) => {
|
|
985
985
|
const v = t.get(h);
|
|
986
986
|
return v ? { ...v } : void 0;
|
|
987
|
-
},
|
|
987
|
+
}, x = (h) => {
|
|
988
988
|
const v = e.get(h);
|
|
989
989
|
if (v) {
|
|
990
|
-
const A =
|
|
990
|
+
const A = S(v).bodies.find((L) => L.id === h);
|
|
991
991
|
if (A)
|
|
992
992
|
return A;
|
|
993
993
|
console.error(`Store integrity error: body ${h} in index, but not in annotation`);
|
|
@@ -1015,7 +1015,7 @@ const kn = (t, e) => {
|
|
|
1015
1015
|
}, T = (h, v = k.LOCAL) => {
|
|
1016
1016
|
const A = h.map((L) => O({ id: L.id, annotation: L.annotation }, L)).filter(Boolean);
|
|
1017
1017
|
s(v, { updated: A });
|
|
1018
|
-
},
|
|
1018
|
+
}, E = (h) => {
|
|
1019
1019
|
const v = t.get(h.annotation);
|
|
1020
1020
|
if (v) {
|
|
1021
1021
|
const A = {
|
|
@@ -1039,32 +1039,32 @@ const kn = (t, e) => {
|
|
|
1039
1039
|
return {
|
|
1040
1040
|
addAnnotation: r,
|
|
1041
1041
|
addBody: f,
|
|
1042
|
-
all:
|
|
1042
|
+
all: d,
|
|
1043
1043
|
bulkAddAnnotation: p,
|
|
1044
|
-
bulkDeleteAnnotation:
|
|
1045
|
-
bulkDeleteBodies:
|
|
1044
|
+
bulkDeleteAnnotation: C,
|
|
1045
|
+
bulkDeleteBodies: m,
|
|
1046
1046
|
bulkUpdateAnnotation: c,
|
|
1047
1047
|
bulkUpdateBodies: T,
|
|
1048
1048
|
bulkUpdateTargets: (h, v = k.LOCAL) => {
|
|
1049
|
-
const A = h.map((L) =>
|
|
1049
|
+
const A = h.map((L) => E(L)).filter(Boolean);
|
|
1050
1050
|
A.length > 0 && s(v, { updated: A });
|
|
1051
1051
|
},
|
|
1052
|
-
clear:
|
|
1052
|
+
clear: y,
|
|
1053
1053
|
deleteAnnotation: b,
|
|
1054
1054
|
deleteBody: u,
|
|
1055
|
-
getAnnotation:
|
|
1056
|
-
getBody:
|
|
1055
|
+
getAnnotation: S,
|
|
1056
|
+
getBody: x,
|
|
1057
1057
|
observe: o,
|
|
1058
1058
|
unobserve: i,
|
|
1059
|
-
updateAnnotation:
|
|
1059
|
+
updateAnnotation: l,
|
|
1060
1060
|
updateBody: R,
|
|
1061
1061
|
updateTarget: (h, v = k.LOCAL) => {
|
|
1062
|
-
const A =
|
|
1062
|
+
const A = E(h);
|
|
1063
1063
|
A && s(v, { updated: [A] });
|
|
1064
1064
|
}
|
|
1065
1065
|
};
|
|
1066
1066
|
};
|
|
1067
|
-
let
|
|
1067
|
+
let _n = () => ({
|
|
1068
1068
|
emit(t, ...e) {
|
|
1069
1069
|
for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)
|
|
1070
1070
|
o[n](...e);
|
|
@@ -1078,24 +1078,24 @@ let Un = () => ({
|
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
1080
|
});
|
|
1081
|
-
const
|
|
1082
|
-
const e =
|
|
1081
|
+
const Un = 250, Dn = (t) => {
|
|
1082
|
+
const e = _n(), n = [];
|
|
1083
1083
|
let o = -1, i = !1, s = 0;
|
|
1084
1084
|
const r = (p) => {
|
|
1085
1085
|
if (!i) {
|
|
1086
1086
|
const { changes: w } = p, b = performance.now();
|
|
1087
|
-
if (b - s >
|
|
1087
|
+
if (b - s > Un)
|
|
1088
1088
|
n.splice(o + 1), n.push(w), o = n.length - 1;
|
|
1089
1089
|
else {
|
|
1090
|
-
const
|
|
1091
|
-
n[
|
|
1090
|
+
const C = n.length - 1;
|
|
1091
|
+
n[C] = kn(n[C], w);
|
|
1092
1092
|
}
|
|
1093
1093
|
s = b;
|
|
1094
1094
|
}
|
|
1095
1095
|
i = !1;
|
|
1096
1096
|
};
|
|
1097
1097
|
t.observe(r, { origin: k.LOCAL });
|
|
1098
|
-
const a = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p),
|
|
1098
|
+
const a = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), l = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), c = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: w }) => w)), f = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: w }) => w)), d = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), y = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
|
|
1099
1099
|
return {
|
|
1100
1100
|
canRedo: () => n.length - 1 > o,
|
|
1101
1101
|
canUndo: () => o > -1,
|
|
@@ -1105,92 +1105,92 @@ const Dn = 250, Vn = (t) => {
|
|
|
1105
1105
|
if (n.length - 1 > o) {
|
|
1106
1106
|
i = !0;
|
|
1107
1107
|
const { created: p, updated: w, deleted: b } = n[o + 1];
|
|
1108
|
-
|
|
1108
|
+
l(p), f(w), y(b), e.emit("redo", n[o + 1]), o += 1;
|
|
1109
1109
|
}
|
|
1110
1110
|
},
|
|
1111
1111
|
undo: () => {
|
|
1112
1112
|
if (o > -1) {
|
|
1113
1113
|
i = !0;
|
|
1114
1114
|
const { created: p, updated: w, deleted: b } = n[o];
|
|
1115
|
-
a(p), c(w),
|
|
1115
|
+
a(p), c(w), d(b), e.emit("undo", n[o]), o -= 1;
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
1118
|
};
|
|
1119
|
-
},
|
|
1120
|
-
const { subscribe: t, set: e } =
|
|
1119
|
+
}, Vn = () => {
|
|
1120
|
+
const { subscribe: t, set: e } = Xt([]);
|
|
1121
1121
|
return {
|
|
1122
1122
|
subscribe: t,
|
|
1123
1123
|
set: e
|
|
1124
1124
|
};
|
|
1125
|
-
},
|
|
1126
|
-
const { hover: i, selection: s, store: r, viewport: a } = t,
|
|
1125
|
+
}, Kn = (t, e, n, o) => {
|
|
1126
|
+
const { hover: i, selection: s, store: r, viewport: a } = t, l = /* @__PURE__ */ new Map();
|
|
1127
1127
|
let c = [], f;
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
},
|
|
1131
|
-
const g =
|
|
1128
|
+
const d = (b, C) => {
|
|
1129
|
+
l.has(b) ? l.get(b).push(C) : l.set(b, [C]);
|
|
1130
|
+
}, y = (b, C) => {
|
|
1131
|
+
const g = l.get(b);
|
|
1132
1132
|
if (g) {
|
|
1133
|
-
const u = g.indexOf(
|
|
1133
|
+
const u = g.indexOf(C);
|
|
1134
1134
|
u !== -1 && g.splice(u, 1);
|
|
1135
1135
|
}
|
|
1136
|
-
}, p = (b,
|
|
1137
|
-
|
|
1138
|
-
|
|
1136
|
+
}, p = (b, C, g) => {
|
|
1137
|
+
l.has(b) && setTimeout(() => {
|
|
1138
|
+
l.get(b).forEach((u) => {
|
|
1139
1139
|
if (n) {
|
|
1140
|
-
const
|
|
1141
|
-
u(
|
|
1140
|
+
const m = Array.isArray(C) ? C.map((x) => n.serialize(x)) : n.serialize(C), S = g ? g instanceof PointerEvent ? g : n.serialize(g) : void 0;
|
|
1141
|
+
u(m, S);
|
|
1142
1142
|
} else
|
|
1143
|
-
u(
|
|
1143
|
+
u(C, g);
|
|
1144
1144
|
});
|
|
1145
1145
|
}, 1);
|
|
1146
1146
|
};
|
|
1147
1147
|
s.subscribe(({ selected: b }) => {
|
|
1148
1148
|
if (!(c.length === 0 && b.length === 0)) {
|
|
1149
1149
|
if (c.length === 0 && b.length > 0)
|
|
1150
|
-
c = b.map(({ id:
|
|
1150
|
+
c = b.map(({ id: C }) => r.getAnnotation(C));
|
|
1151
1151
|
else if (c.length > 0 && b.length === 0)
|
|
1152
|
-
c.forEach((
|
|
1153
|
-
const g = r.getAnnotation(
|
|
1154
|
-
g && !q(g,
|
|
1152
|
+
c.forEach((C) => {
|
|
1153
|
+
const g = r.getAnnotation(C.id);
|
|
1154
|
+
g && !q(g, C) && p("updateAnnotation", g, C);
|
|
1155
1155
|
}), c = [];
|
|
1156
1156
|
else {
|
|
1157
|
-
const
|
|
1157
|
+
const C = new Set(c.map((u) => u.id)), g = new Set(b.map(({ id: u }) => u));
|
|
1158
1158
|
c.filter((u) => !g.has(u.id)).forEach((u) => {
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1159
|
+
const m = r.getAnnotation(u.id);
|
|
1160
|
+
m && !q(m, u) && p("updateAnnotation", m, u);
|
|
1161
1161
|
}), c = [
|
|
1162
1162
|
// Remove annotations that were deselected
|
|
1163
1163
|
...c.filter((u) => g.has(u.id)),
|
|
1164
1164
|
// Add editable annotations that were selected
|
|
1165
|
-
...b.filter(({ id: u }) => !
|
|
1165
|
+
...b.filter(({ id: u }) => !C.has(u)).map(({ id: u }) => r.getAnnotation(u))
|
|
1166
1166
|
];
|
|
1167
1167
|
}
|
|
1168
1168
|
p("selectionChanged", c);
|
|
1169
1169
|
}
|
|
1170
1170
|
}), i.subscribe((b) => {
|
|
1171
1171
|
!f && b ? p("mouseEnterAnnotation", r.getAnnotation(b)) : f && !b ? p("mouseLeaveAnnotation", r.getAnnotation(f)) : f && b && (p("mouseLeaveAnnotation", r.getAnnotation(f)), p("mouseEnterAnnotation", r.getAnnotation(b))), f = b;
|
|
1172
|
-
}), a == null || a.subscribe((b) => p("viewportIntersect", b.map((
|
|
1173
|
-
const { created:
|
|
1174
|
-
(
|
|
1172
|
+
}), a == null || a.subscribe((b) => p("viewportIntersect", b.map((C) => r.getAnnotation(C)))), r.observe((b) => {
|
|
1173
|
+
const { created: C, deleted: g } = b.changes;
|
|
1174
|
+
(C || []).forEach((u) => p("createAnnotation", u)), (g || []).forEach((u) => p("deleteAnnotation", u)), (b.changes.updated || []).filter((u) => [
|
|
1175
1175
|
...u.bodiesCreated || [],
|
|
1176
1176
|
...u.bodiesDeleted || [],
|
|
1177
1177
|
...u.bodiesUpdated || []
|
|
1178
|
-
].length > 0).forEach(({ oldValue: u, newValue:
|
|
1179
|
-
const
|
|
1180
|
-
c = c.map((
|
|
1178
|
+
].length > 0).forEach(({ oldValue: u, newValue: m }) => {
|
|
1179
|
+
const S = c.find((x) => x.id === u.id) || u;
|
|
1180
|
+
c = c.map((x) => x.id === u.id ? m : x), p("updateAnnotation", m, S);
|
|
1181
1181
|
});
|
|
1182
1182
|
}, { origin: k.LOCAL }), r.observe((b) => {
|
|
1183
1183
|
if (c) {
|
|
1184
|
-
const
|
|
1185
|
-
g.length > 0 && (c = c.map((u) => g.find((
|
|
1184
|
+
const C = new Set(c.map((u) => u.id)), g = (b.changes.updated || []).filter(({ newValue: u }) => C.has(u.id)).map(({ newValue: u }) => u);
|
|
1185
|
+
g.length > 0 && (c = c.map((u) => g.find((S) => S.id === u.id) || u));
|
|
1186
1186
|
}
|
|
1187
1187
|
}, { origin: k.REMOTE });
|
|
1188
|
-
const w = (b) => (
|
|
1189
|
-
const { updated: g } =
|
|
1188
|
+
const w = (b) => (C) => {
|
|
1189
|
+
const { updated: g } = C;
|
|
1190
1190
|
b ? (g || []).forEach((u) => p("updateAnnotation", u.oldValue, u.newValue)) : (g || []).forEach((u) => p("updateAnnotation", u.newValue, u.oldValue));
|
|
1191
1191
|
};
|
|
1192
|
-
return e.on("undo", w(!0)), e.on("redo", w(!1)), { on:
|
|
1193
|
-
},
|
|
1192
|
+
return e.on("undo", w(!0)), e.on("redo", w(!1)), { on: d, off: y, emit: p };
|
|
1193
|
+
}, Yn = (t) => (e) => e.reduce((n, o) => {
|
|
1194
1194
|
const { parsed: i, error: s } = t.parse(o);
|
|
1195
1195
|
return s ? {
|
|
1196
1196
|
parsed: n.parsed,
|
|
@@ -1201,21 +1201,21 @@ const Dn = 250, Vn = (t) => {
|
|
|
1201
1201
|
} : {
|
|
1202
1202
|
...n
|
|
1203
1203
|
};
|
|
1204
|
-
}, { parsed: [], failed: [] }),
|
|
1204
|
+
}, { parsed: [], failed: [] }), Xn = (t, e, n) => {
|
|
1205
1205
|
const { store: o, selection: i } = t, s = (g) => {
|
|
1206
1206
|
if (n) {
|
|
1207
|
-
const { parsed: u, error:
|
|
1208
|
-
u ? o.addAnnotation(u, k.REMOTE) : console.error(
|
|
1207
|
+
const { parsed: u, error: m } = n.parse(g);
|
|
1208
|
+
u ? o.addAnnotation(u, k.REMOTE) : console.error(m);
|
|
1209
1209
|
} else
|
|
1210
|
-
o.addAnnotation(
|
|
1211
|
-
}, r = () => i.clear(), a = () => o.clear(),
|
|
1210
|
+
o.addAnnotation(Tt(g), k.REMOTE);
|
|
1211
|
+
}, r = () => i.clear(), a = () => o.clear(), l = (g) => {
|
|
1212
1212
|
const u = o.getAnnotation(g);
|
|
1213
1213
|
return n && u ? n.serialize(u) : u;
|
|
1214
1214
|
}, c = () => n ? o.all().map(n.serialize) : o.all(), f = () => {
|
|
1215
1215
|
var g;
|
|
1216
|
-
const u = (((g = i.selected) == null ? void 0 : g.map((
|
|
1216
|
+
const u = (((g = i.selected) == null ? void 0 : g.map((m) => m.id)) || []).map((m) => o.getAnnotation(m)).filter(Boolean);
|
|
1217
1217
|
return n ? u.map(n.serialize) : u;
|
|
1218
|
-
},
|
|
1218
|
+
}, d = (g, u = !0) => fetch(g).then((m) => m.json()).then((m) => (p(m, u), m)), y = (g) => {
|
|
1219
1219
|
if (typeof g == "string") {
|
|
1220
1220
|
const u = o.getAnnotation(g);
|
|
1221
1221
|
if (o.deleteAnnotation(g), u)
|
|
@@ -1227,21 +1227,21 @@ const Dn = 250, Vn = (t) => {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
}, p = (g, u = !0) => {
|
|
1229
1229
|
if (n) {
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1230
|
+
const m = n.parseAll || Yn(n), { parsed: S, failed: x } = m(g);
|
|
1231
|
+
x.length > 0 && console.warn(`Discarded ${x.length} invalid annotations`, x), o.bulkAddAnnotation(S, u, k.REMOTE);
|
|
1232
1232
|
} else
|
|
1233
|
-
o.bulkAddAnnotation(g.map(
|
|
1233
|
+
o.bulkAddAnnotation(g.map(Tt), u, k.REMOTE);
|
|
1234
1234
|
}, w = (g, u) => {
|
|
1235
1235
|
g ? i.setSelected(g, u) : i.clear();
|
|
1236
1236
|
}, b = (g) => {
|
|
1237
1237
|
i.clear(), i.setUserSelectAction(g);
|
|
1238
|
-
},
|
|
1238
|
+
}, C = (g) => {
|
|
1239
1239
|
if (n) {
|
|
1240
|
-
const u = n.parse(g).parsed,
|
|
1241
|
-
return o.updateAnnotation(u),
|
|
1240
|
+
const u = n.parse(g).parsed, m = n.serialize(o.getAnnotation(u.id));
|
|
1241
|
+
return o.updateAnnotation(u), m;
|
|
1242
1242
|
} else {
|
|
1243
1243
|
const u = o.getAnnotation(g.id);
|
|
1244
|
-
return o.updateAnnotation(
|
|
1244
|
+
return o.updateAnnotation(Tt(g)), u;
|
|
1245
1245
|
}
|
|
1246
1246
|
};
|
|
1247
1247
|
return {
|
|
@@ -1250,36 +1250,36 @@ const Dn = 250, Vn = (t) => {
|
|
|
1250
1250
|
canRedo: e.canRedo,
|
|
1251
1251
|
canUndo: e.canUndo,
|
|
1252
1252
|
clearAnnotations: a,
|
|
1253
|
-
getAnnotationById:
|
|
1253
|
+
getAnnotationById: l,
|
|
1254
1254
|
getAnnotations: c,
|
|
1255
1255
|
getSelected: f,
|
|
1256
|
-
loadAnnotations:
|
|
1256
|
+
loadAnnotations: d,
|
|
1257
1257
|
redo: e.redo,
|
|
1258
|
-
removeAnnotation:
|
|
1258
|
+
removeAnnotation: y,
|
|
1259
1259
|
setAnnotations: p,
|
|
1260
1260
|
setSelected: w,
|
|
1261
1261
|
setUserSelectAction: b,
|
|
1262
1262
|
undo: e.undo,
|
|
1263
|
-
updateAnnotation:
|
|
1263
|
+
updateAnnotation: C
|
|
1264
1264
|
};
|
|
1265
|
-
},
|
|
1266
|
-
let
|
|
1265
|
+
}, Pn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1266
|
+
let $n = (t) => crypto.getRandomValues(new Uint8Array(t)), jn = (t, e, n) => {
|
|
1267
1267
|
let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);
|
|
1268
1268
|
return (s = e) => {
|
|
1269
1269
|
let r = "";
|
|
1270
1270
|
for (; ; ) {
|
|
1271
|
-
let a = n(i),
|
|
1272
|
-
for (;
|
|
1273
|
-
if (r += t[a[
|
|
1271
|
+
let a = n(i), l = i;
|
|
1272
|
+
for (; l--; )
|
|
1273
|
+
if (r += t[a[l] & o] || "", r.length === s) return r;
|
|
1274
1274
|
}
|
|
1275
1275
|
};
|
|
1276
|
-
},
|
|
1276
|
+
}, Hn = (t, e = 21) => jn(t, e, $n), zn = (t = 21) => {
|
|
1277
1277
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
1278
1278
|
for (; t--; )
|
|
1279
|
-
e +=
|
|
1279
|
+
e += Pn[n[t] & 63];
|
|
1280
1280
|
return e;
|
|
1281
1281
|
};
|
|
1282
|
-
const
|
|
1282
|
+
const Fn = () => ({ isGuest: !0, id: Hn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Wn = (t) => {
|
|
1283
1283
|
const e = JSON.stringify(t);
|
|
1284
1284
|
let n = 0;
|
|
1285
1285
|
for (let o = 0, i = e.length; o < i; o++) {
|
|
@@ -1287,20 +1287,20 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1287
1287
|
n = (n << 5) - n + s, n |= 0;
|
|
1288
1288
|
}
|
|
1289
1289
|
return `${n}`;
|
|
1290
|
-
},
|
|
1291
|
-
const { id: o, type: i, purpose: s, value: r, created: a, modified:
|
|
1290
|
+
}, be = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, qn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1291
|
+
const { id: o, type: i, purpose: s, value: r, created: a, modified: l, creator: c, ...f } = n;
|
|
1292
1292
|
return {
|
|
1293
|
-
id: o || `temp-${
|
|
1293
|
+
id: o || `temp-${Wn(n)}`,
|
|
1294
1294
|
annotation: e,
|
|
1295
1295
|
type: i,
|
|
1296
1296
|
purpose: s,
|
|
1297
1297
|
value: r,
|
|
1298
|
-
creator:
|
|
1298
|
+
creator: be(c),
|
|
1299
1299
|
created: a ? new Date(a) : void 0,
|
|
1300
|
-
updated:
|
|
1300
|
+
updated: l ? new Date(l) : void 0,
|
|
1301
1301
|
...f
|
|
1302
1302
|
};
|
|
1303
|
-
}),
|
|
1303
|
+
}), Gn = (t) => t.map((e) => {
|
|
1304
1304
|
var n;
|
|
1305
1305
|
const { annotation: o, created: i, updated: s, ...r } = e, a = {
|
|
1306
1306
|
...r,
|
|
@@ -1309,11 +1309,11 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1309
1309
|
};
|
|
1310
1310
|
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
1311
1311
|
});
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
parse: (n) =>
|
|
1315
|
-
serialize: (n) =>
|
|
1316
|
-
}),
|
|
1312
|
+
zn();
|
|
1313
|
+
const ko = (t, e) => ({
|
|
1314
|
+
parse: (n) => Zn(n),
|
|
1315
|
+
serialize: (n) => to(n, t, e)
|
|
1316
|
+
}), Qn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, Jn = (t) => {
|
|
1317
1317
|
const {
|
|
1318
1318
|
id: e,
|
|
1319
1319
|
creator: n,
|
|
@@ -1324,75 +1324,80 @@ const Io = (t, e) => ({
|
|
|
1324
1324
|
if (r.length === 0)
|
|
1325
1325
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1326
1326
|
const a = {
|
|
1327
|
-
creator:
|
|
1327
|
+
creator: be(n),
|
|
1328
1328
|
created: o ? new Date(o) : void 0,
|
|
1329
1329
|
updated: i ? new Date(i) : void 0,
|
|
1330
1330
|
annotation: e,
|
|
1331
1331
|
selector: [],
|
|
1332
1332
|
styleClass: r[0].styleClass
|
|
1333
1333
|
};
|
|
1334
|
-
for (const
|
|
1335
|
-
const f = (Array.isArray(
|
|
1336
|
-
switch (
|
|
1334
|
+
for (const l of r) {
|
|
1335
|
+
const f = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((d, y) => {
|
|
1336
|
+
switch (y.type) {
|
|
1337
1337
|
case "TextQuoteSelector":
|
|
1338
|
-
|
|
1338
|
+
d.quote = y.exact;
|
|
1339
1339
|
break;
|
|
1340
1340
|
case "TextPositionSelector":
|
|
1341
|
-
|
|
1341
|
+
d.start = y.start, d.end = y.end;
|
|
1342
1342
|
break;
|
|
1343
1343
|
}
|
|
1344
|
-
return
|
|
1344
|
+
return d;
|
|
1345
1345
|
}, {});
|
|
1346
|
-
if (
|
|
1347
|
-
a.selector.push({
|
|
1346
|
+
if (Qn(f))
|
|
1347
|
+
a.selector.push({
|
|
1348
|
+
...f,
|
|
1349
|
+
id: l.id,
|
|
1350
|
+
scope: l.scope
|
|
1351
|
+
});
|
|
1348
1352
|
else {
|
|
1349
|
-
const
|
|
1353
|
+
const d = [
|
|
1350
1354
|
f.start ? void 0 : "TextPositionSelector",
|
|
1351
1355
|
f.quote ? void 0 : "TextQuoteSelector"
|
|
1352
1356
|
].filter(Boolean);
|
|
1353
|
-
return { error: Error(`Missing selector types: ${
|
|
1357
|
+
return { error: Error(`Missing selector types: ${d.join(" and ")} for annotation: ${t.id}`) };
|
|
1354
1358
|
}
|
|
1355
1359
|
}
|
|
1356
1360
|
return { parsed: a };
|
|
1357
|
-
},
|
|
1358
|
-
const e = t.id ||
|
|
1361
|
+
}, Zn = (t) => {
|
|
1362
|
+
const e = t.id || ge(), {
|
|
1359
1363
|
creator: n,
|
|
1360
1364
|
created: o,
|
|
1361
1365
|
modified: i,
|
|
1362
1366
|
body: s,
|
|
1363
1367
|
...r
|
|
1364
|
-
} = t, a =
|
|
1365
|
-
return "error" in
|
|
1368
|
+
} = t, a = qn(s, e), l = Jn(t);
|
|
1369
|
+
return "error" in l ? { error: l.error } : {
|
|
1366
1370
|
parsed: {
|
|
1367
1371
|
...r,
|
|
1368
1372
|
id: e,
|
|
1369
1373
|
bodies: a,
|
|
1370
|
-
target:
|
|
1374
|
+
target: l.parsed
|
|
1371
1375
|
}
|
|
1372
1376
|
};
|
|
1373
|
-
},
|
|
1377
|
+
}, to = (t, e, n) => {
|
|
1374
1378
|
const { bodies: o, target: i, ...s } = t, {
|
|
1375
1379
|
selector: r,
|
|
1376
1380
|
creator: a,
|
|
1377
|
-
created:
|
|
1381
|
+
created: l,
|
|
1378
1382
|
updated: c,
|
|
1379
1383
|
...f
|
|
1380
|
-
} = i,
|
|
1381
|
-
const {
|
|
1382
|
-
type: "TextQuoteSelector",
|
|
1383
|
-
exact: p,
|
|
1384
|
-
prefix: g,
|
|
1385
|
-
suffix: u
|
|
1386
|
-
}, {
|
|
1387
|
-
type: "TextPositionSelector",
|
|
1388
|
-
start: w,
|
|
1389
|
-
end: b
|
|
1390
|
-
}];
|
|
1384
|
+
} = i, d = r.map((y) => {
|
|
1385
|
+
const { id: p, scope: w, quote: b, start: C, end: g, range: u } = y, { prefix: m, suffix: S } = _e(u, n);
|
|
1391
1386
|
return {
|
|
1392
1387
|
...f,
|
|
1393
|
-
id:
|
|
1388
|
+
id: p,
|
|
1389
|
+
scope: w,
|
|
1394
1390
|
source: e,
|
|
1395
|
-
selector:
|
|
1391
|
+
selector: [{
|
|
1392
|
+
type: "TextQuoteSelector",
|
|
1393
|
+
exact: b,
|
|
1394
|
+
prefix: m,
|
|
1395
|
+
suffix: S
|
|
1396
|
+
}, {
|
|
1397
|
+
type: "TextPositionSelector",
|
|
1398
|
+
start: C,
|
|
1399
|
+
end: g
|
|
1400
|
+
}]
|
|
1396
1401
|
};
|
|
1397
1402
|
});
|
|
1398
1403
|
return {
|
|
@@ -1400,18 +1405,18 @@ const Io = (t, e) => ({
|
|
|
1400
1405
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1401
1406
|
id: t.id,
|
|
1402
1407
|
type: "Annotation",
|
|
1403
|
-
body:
|
|
1408
|
+
body: Gn(t.bodies),
|
|
1404
1409
|
creator: a,
|
|
1405
|
-
created:
|
|
1410
|
+
created: l == null ? void 0 : l.toISOString(),
|
|
1406
1411
|
modified: c == null ? void 0 : c.toISOString(),
|
|
1407
|
-
target:
|
|
1412
|
+
target: d
|
|
1408
1413
|
};
|
|
1409
1414
|
};
|
|
1410
|
-
function
|
|
1415
|
+
function we(t, e, n = 0, o = t.length - 1, i = eo) {
|
|
1411
1416
|
for (; o > n; ) {
|
|
1412
1417
|
if (o - n > 600) {
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1418
|
+
const l = o - n + 1, c = e - n + 1, f = Math.log(l), d = 0.5 * Math.exp(2 * f / 3), y = 0.5 * Math.sqrt(f * d * (l - d) / l) * (c - l / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - c * d / l + y)), w = Math.min(o, Math.floor(e + (l - c) * d / l + y));
|
|
1419
|
+
we(t, e, p, w, i);
|
|
1415
1420
|
}
|
|
1416
1421
|
const s = t[e];
|
|
1417
1422
|
let r = n, a = o;
|
|
@@ -1426,10 +1431,10 @@ function tt(t, e, n) {
|
|
|
1426
1431
|
const o = t[e];
|
|
1427
1432
|
t[e] = t[n], t[n] = o;
|
|
1428
1433
|
}
|
|
1429
|
-
function
|
|
1434
|
+
function eo(t, e) {
|
|
1430
1435
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1431
1436
|
}
|
|
1432
|
-
class
|
|
1437
|
+
class no {
|
|
1433
1438
|
constructor(e = 9) {
|
|
1434
1439
|
this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
1435
1440
|
}
|
|
@@ -1439,12 +1444,12 @@ class oo {
|
|
|
1439
1444
|
search(e) {
|
|
1440
1445
|
let n = this.data;
|
|
1441
1446
|
const o = [];
|
|
1442
|
-
if (!
|
|
1447
|
+
if (!mt(e, n)) return o;
|
|
1443
1448
|
const i = this.toBBox, s = [];
|
|
1444
1449
|
for (; n; ) {
|
|
1445
1450
|
for (let r = 0; r < n.children.length; r++) {
|
|
1446
|
-
const a = n.children[r],
|
|
1447
|
-
|
|
1451
|
+
const a = n.children[r], l = n.leaf ? i(a) : a;
|
|
1452
|
+
mt(e, l) && (n.leaf ? o.push(a) : Bt(e, l) ? this._all(a, o) : s.push(a));
|
|
1448
1453
|
}
|
|
1449
1454
|
n = s.pop();
|
|
1450
1455
|
}
|
|
@@ -1452,13 +1457,13 @@ class oo {
|
|
|
1452
1457
|
}
|
|
1453
1458
|
collides(e) {
|
|
1454
1459
|
let n = this.data;
|
|
1455
|
-
if (!
|
|
1460
|
+
if (!mt(e, n)) return !1;
|
|
1456
1461
|
const o = [];
|
|
1457
1462
|
for (; n; ) {
|
|
1458
1463
|
for (let i = 0; i < n.children.length; i++) {
|
|
1459
1464
|
const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
|
|
1460
|
-
if (
|
|
1461
|
-
if (n.leaf ||
|
|
1465
|
+
if (mt(e, r)) {
|
|
1466
|
+
if (n.leaf || Bt(e, r)) return !0;
|
|
1462
1467
|
o.push(s);
|
|
1463
1468
|
}
|
|
1464
1469
|
}
|
|
@@ -1497,14 +1502,14 @@ class oo {
|
|
|
1497
1502
|
if (!e) return this;
|
|
1498
1503
|
let o = this.data;
|
|
1499
1504
|
const i = this.toBBox(e), s = [], r = [];
|
|
1500
|
-
let a,
|
|
1505
|
+
let a, l, c;
|
|
1501
1506
|
for (; o || s.length; ) {
|
|
1502
|
-
if (o || (o = s.pop(),
|
|
1503
|
-
const f =
|
|
1507
|
+
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), c = !0), o.leaf) {
|
|
1508
|
+
const f = oo(e, o.children, n);
|
|
1504
1509
|
if (f !== -1)
|
|
1505
1510
|
return o.children.splice(f, 1), s.push(o), this._condense(s), this;
|
|
1506
1511
|
}
|
|
1507
|
-
!c && !o.leaf &&
|
|
1512
|
+
!c && !o.leaf && Bt(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], c = !1) : o = null;
|
|
1508
1513
|
}
|
|
1509
1514
|
return this;
|
|
1510
1515
|
}
|
|
@@ -1535,14 +1540,14 @@ class oo {
|
|
|
1535
1540
|
if (s <= r)
|
|
1536
1541
|
return a = J(e.slice(n, o + 1)), Q(a, this.toBBox), a;
|
|
1537
1542
|
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = J([]), a.leaf = !1, a.height = i;
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1543
|
+
const l = Math.ceil(s / r), c = l * Math.ceil(Math.sqrt(r));
|
|
1544
|
+
ne(e, n, o, c, this.compareMinX);
|
|
1540
1545
|
for (let f = n; f <= o; f += c) {
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
for (let
|
|
1544
|
-
const p = Math.min(
|
|
1545
|
-
a.children.push(this._build(e,
|
|
1546
|
+
const d = Math.min(f + c - 1, o);
|
|
1547
|
+
ne(e, f, d, l, this.compareMinY);
|
|
1548
|
+
for (let y = f; y <= d; y += l) {
|
|
1549
|
+
const p = Math.min(y + l - 1, d);
|
|
1550
|
+
a.children.push(this._build(e, y, p, i - 1));
|
|
1546
1551
|
}
|
|
1547
1552
|
}
|
|
1548
1553
|
return Q(a, this.toBBox), a;
|
|
@@ -1550,9 +1555,9 @@ class oo {
|
|
|
1550
1555
|
_chooseSubtree(e, n, o, i) {
|
|
1551
1556
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1552
1557
|
let s = 1 / 0, r = 1 / 0, a;
|
|
1553
|
-
for (let
|
|
1554
|
-
const c = n.children[
|
|
1555
|
-
|
|
1558
|
+
for (let l = 0; l < n.children.length; l++) {
|
|
1559
|
+
const c = n.children[l], f = Mt(c), d = ro(e, c) - f;
|
|
1560
|
+
d < r ? (r = d, s = f < s ? f : s, a = c) : d === r && f < s && (s = f, a = c);
|
|
1556
1561
|
}
|
|
1557
1562
|
n = a || n.children[0];
|
|
1558
1563
|
}
|
|
@@ -1577,30 +1582,30 @@ class oo {
|
|
|
1577
1582
|
_chooseSplitIndex(e, n, o) {
|
|
1578
1583
|
let i, s = 1 / 0, r = 1 / 0;
|
|
1579
1584
|
for (let a = n; a <= o - n; a++) {
|
|
1580
|
-
const
|
|
1581
|
-
f < s ? (s = f, i = a, r =
|
|
1585
|
+
const l = ot(e, 0, a, this.toBBox), c = ot(e, a, o, this.toBBox), f = ao(l, c), d = Mt(l) + Mt(c);
|
|
1586
|
+
f < s ? (s = f, i = a, r = d < r ? d : r) : f === s && d < r && (r = d, i = a);
|
|
1582
1587
|
}
|
|
1583
1588
|
return i || o - n;
|
|
1584
1589
|
}
|
|
1585
1590
|
// sorts node children by the best axis for split
|
|
1586
1591
|
_chooseSplitAxis(e, n, o) {
|
|
1587
|
-
const i = e.leaf ? this.compareMinX :
|
|
1592
|
+
const i = e.leaf ? this.compareMinX : io, s = e.leaf ? this.compareMinY : so, r = this._allDistMargin(e, n, o, i), a = this._allDistMargin(e, n, o, s);
|
|
1588
1593
|
r < a && e.children.sort(i);
|
|
1589
1594
|
}
|
|
1590
1595
|
// total margin of all possible split distributions where each node is at least m full
|
|
1591
1596
|
_allDistMargin(e, n, o, i) {
|
|
1592
1597
|
e.children.sort(i);
|
|
1593
1598
|
const s = this.toBBox, r = ot(e, 0, n, s), a = ot(e, o - n, o, s);
|
|
1594
|
-
let
|
|
1599
|
+
let l = gt(r) + gt(a);
|
|
1595
1600
|
for (let c = n; c < o - n; c++) {
|
|
1596
1601
|
const f = e.children[c];
|
|
1597
|
-
it(r, e.leaf ? s(f) : f),
|
|
1602
|
+
it(r, e.leaf ? s(f) : f), l += gt(r);
|
|
1598
1603
|
}
|
|
1599
1604
|
for (let c = o - n - 1; c >= n; c--) {
|
|
1600
1605
|
const f = e.children[c];
|
|
1601
|
-
it(a, e.leaf ? s(f) : f),
|
|
1606
|
+
it(a, e.leaf ? s(f) : f), l += gt(a);
|
|
1602
1607
|
}
|
|
1603
|
-
return
|
|
1608
|
+
return l;
|
|
1604
1609
|
}
|
|
1605
1610
|
_adjustParentBBoxes(e, n, o) {
|
|
1606
1611
|
for (let i = o; i >= 0; i--)
|
|
@@ -1611,7 +1616,7 @@ class oo {
|
|
|
1611
1616
|
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : Q(e[n], this.toBBox);
|
|
1612
1617
|
}
|
|
1613
1618
|
}
|
|
1614
|
-
function
|
|
1619
|
+
function oo(t, e, n) {
|
|
1615
1620
|
if (!n) return e.indexOf(t);
|
|
1616
1621
|
for (let o = 0; o < e.length; o++)
|
|
1617
1622
|
if (n(t, e[o])) return o;
|
|
@@ -1631,29 +1636,29 @@ function ot(t, e, n, o, i) {
|
|
|
1631
1636
|
function it(t, e) {
|
|
1632
1637
|
return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
|
|
1633
1638
|
}
|
|
1634
|
-
function
|
|
1639
|
+
function io(t, e) {
|
|
1635
1640
|
return t.minX - e.minX;
|
|
1636
1641
|
}
|
|
1637
|
-
function
|
|
1642
|
+
function so(t, e) {
|
|
1638
1643
|
return t.minY - e.minY;
|
|
1639
1644
|
}
|
|
1640
|
-
function
|
|
1645
|
+
function Mt(t) {
|
|
1641
1646
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1642
1647
|
}
|
|
1643
|
-
function
|
|
1648
|
+
function gt(t) {
|
|
1644
1649
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1645
1650
|
}
|
|
1646
|
-
function
|
|
1651
|
+
function ro(t, e) {
|
|
1647
1652
|
return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
|
|
1648
1653
|
}
|
|
1649
|
-
function
|
|
1654
|
+
function ao(t, e) {
|
|
1650
1655
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);
|
|
1651
1656
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
1652
1657
|
}
|
|
1653
|
-
function
|
|
1658
|
+
function Bt(t, e) {
|
|
1654
1659
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1655
1660
|
}
|
|
1656
|
-
function
|
|
1661
|
+
function mt(t, e) {
|
|
1657
1662
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1658
1663
|
}
|
|
1659
1664
|
function J(t) {
|
|
@@ -1667,15 +1672,15 @@ function J(t) {
|
|
|
1667
1672
|
maxY: -1 / 0
|
|
1668
1673
|
};
|
|
1669
1674
|
}
|
|
1670
|
-
function
|
|
1675
|
+
function ne(t, e, n, o, i) {
|
|
1671
1676
|
const s = [e, n];
|
|
1672
1677
|
for (; s.length; ) {
|
|
1673
1678
|
if (n = s.pop(), e = s.pop(), n - e <= o) continue;
|
|
1674
1679
|
const r = e + Math.ceil((n - e) / o / 2) * o;
|
|
1675
|
-
|
|
1680
|
+
we(t, r, e, n, i), s.push(e, r, r, n);
|
|
1676
1681
|
}
|
|
1677
1682
|
}
|
|
1678
|
-
let
|
|
1683
|
+
let co = () => ({
|
|
1679
1684
|
emit(t, ...e) {
|
|
1680
1685
|
for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)
|
|
1681
1686
|
o[n](...e);
|
|
@@ -1689,134 +1694,134 @@ let lo = () => ({
|
|
|
1689
1694
|
};
|
|
1690
1695
|
}
|
|
1691
1696
|
});
|
|
1692
|
-
const
|
|
1693
|
-
const n = new
|
|
1694
|
-
const
|
|
1695
|
-
const T = F([R]) ? R.range :
|
|
1697
|
+
const lo = (t, e) => {
|
|
1698
|
+
const n = new no(), o = /* @__PURE__ */ new Map(), i = co(), s = (m, S) => {
|
|
1699
|
+
const x = m.selector.flatMap((R) => {
|
|
1700
|
+
const T = F([R]) ? R.range : ce(R, e).range;
|
|
1696
1701
|
return Array.from(T.getClientRects());
|
|
1697
|
-
}), O =
|
|
1702
|
+
}), O = Ye(x).map((R) => je(R, S));
|
|
1698
1703
|
return O.map((R) => {
|
|
1699
|
-
const { x: T, y:
|
|
1704
|
+
const { x: T, y: E, width: h, height: v } = R;
|
|
1700
1705
|
return {
|
|
1701
1706
|
minX: T,
|
|
1702
|
-
minY:
|
|
1707
|
+
minY: E,
|
|
1703
1708
|
maxX: T + h,
|
|
1704
|
-
maxY:
|
|
1709
|
+
maxY: E + v,
|
|
1705
1710
|
annotation: {
|
|
1706
|
-
id:
|
|
1711
|
+
id: m.annotation,
|
|
1707
1712
|
rects: O
|
|
1708
1713
|
}
|
|
1709
1714
|
};
|
|
1710
1715
|
});
|
|
1711
1716
|
}, r = () => [...o.values()], a = () => {
|
|
1712
1717
|
n.clear(), o.clear();
|
|
1713
|
-
},
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
}, c = (
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1719
|
-
}, f = (
|
|
1720
|
-
c(
|
|
1721
|
-
},
|
|
1722
|
-
|
|
1723
|
-
const
|
|
1724
|
-
O.forEach(({ target: T, rects:
|
|
1718
|
+
}, l = (m) => {
|
|
1719
|
+
const S = s(m, e.getBoundingClientRect());
|
|
1720
|
+
S.forEach((x) => n.insert(x)), o.set(m.annotation, S);
|
|
1721
|
+
}, c = (m) => {
|
|
1722
|
+
const S = o.get(m.annotation);
|
|
1723
|
+
S && (S.forEach((x) => n.remove(x)), o.delete(m.annotation));
|
|
1724
|
+
}, f = (m) => {
|
|
1725
|
+
c(m), l(m);
|
|
1726
|
+
}, d = (m, S = !0) => {
|
|
1727
|
+
S && a();
|
|
1728
|
+
const x = e.getBoundingClientRect(), O = m.map((T) => ({ target: T, rects: s(T, x) }));
|
|
1729
|
+
O.forEach(({ target: T, rects: E }) => o.set(T.annotation, E));
|
|
1725
1730
|
const R = O.flatMap(({ rects: T }) => T);
|
|
1726
1731
|
n.load(R);
|
|
1727
|
-
},
|
|
1732
|
+
}, y = (m, S, x = !1) => {
|
|
1728
1733
|
const O = n.search({
|
|
1729
|
-
minX:
|
|
1730
|
-
minY:
|
|
1731
|
-
maxX:
|
|
1732
|
-
maxY:
|
|
1733
|
-
}), R = (T) => T.annotation.rects.reduce((
|
|
1734
|
-
return O.length > 0 ? (O.sort((T,
|
|
1735
|
-
}, p = (
|
|
1736
|
-
const
|
|
1737
|
-
if (
|
|
1734
|
+
minX: m,
|
|
1735
|
+
minY: S,
|
|
1736
|
+
maxX: m,
|
|
1737
|
+
maxY: S
|
|
1738
|
+
}), R = (T) => T.annotation.rects.reduce((E, h) => E + h.width * h.height, 0);
|
|
1739
|
+
return O.length > 0 ? (O.sort((T, E) => R(T) - R(E)), x ? O.map((T) => T.annotation.id) : [O[0].annotation.id]) : [];
|
|
1740
|
+
}, p = (m) => {
|
|
1741
|
+
const S = w(m);
|
|
1742
|
+
if (S.length === 0)
|
|
1738
1743
|
return;
|
|
1739
|
-
let
|
|
1740
|
-
for (let
|
|
1741
|
-
const h =
|
|
1742
|
-
|
|
1744
|
+
let x = S[0].left, O = S[0].top, R = S[0].right, T = S[0].bottom;
|
|
1745
|
+
for (let E = 1; E < S.length; E++) {
|
|
1746
|
+
const h = S[E];
|
|
1747
|
+
x = Math.min(x, h.left), O = Math.min(O, h.top), R = Math.max(R, h.right), T = Math.max(T, h.bottom);
|
|
1743
1748
|
}
|
|
1744
|
-
return new DOMRect(
|
|
1745
|
-
}, w = (
|
|
1746
|
-
const
|
|
1747
|
-
return
|
|
1749
|
+
return new DOMRect(x, O, R - x, T - O);
|
|
1750
|
+
}, w = (m) => {
|
|
1751
|
+
const S = o.get(m);
|
|
1752
|
+
return S[0] ? S[0].annotation.rects : [];
|
|
1748
1753
|
};
|
|
1749
1754
|
return {
|
|
1750
1755
|
all: r,
|
|
1751
1756
|
clear: a,
|
|
1752
|
-
getAt:
|
|
1757
|
+
getAt: y,
|
|
1753
1758
|
getAnnotationBounds: p,
|
|
1754
1759
|
getAnnotationRects: w,
|
|
1755
|
-
getIntersecting: (
|
|
1756
|
-
const R = n.search({ minX:
|
|
1757
|
-
return Array.from(T).map((
|
|
1758
|
-
annotation: t.getAnnotation(
|
|
1759
|
-
rects: w(
|
|
1760
|
-
})).filter((
|
|
1760
|
+
getIntersecting: (m, S, x, O) => {
|
|
1761
|
+
const R = n.search({ minX: m, minY: S, maxX: x, maxY: O }), T = new Set(R.map((E) => E.annotation.id));
|
|
1762
|
+
return Array.from(T).map((E) => ({
|
|
1763
|
+
annotation: t.getAnnotation(E),
|
|
1764
|
+
rects: w(E)
|
|
1765
|
+
})).filter((E) => !!E.annotation);
|
|
1761
1766
|
},
|
|
1762
|
-
insert:
|
|
1767
|
+
insert: l,
|
|
1763
1768
|
recalculate: () => {
|
|
1764
|
-
|
|
1769
|
+
d(t.all().map((m) => m.target), !0), i.emit("recalculate");
|
|
1765
1770
|
},
|
|
1766
1771
|
remove: c,
|
|
1767
|
-
set:
|
|
1772
|
+
set: d,
|
|
1768
1773
|
size: () => n.all().length,
|
|
1769
1774
|
update: f,
|
|
1770
|
-
on: (
|
|
1775
|
+
on: (m, S) => i.on(m, S)
|
|
1771
1776
|
};
|
|
1772
|
-
},
|
|
1773
|
-
const n =
|
|
1777
|
+
}, uo = (t, e) => {
|
|
1778
|
+
const n = Nn(), o = lo(n, t), i = xn(n);
|
|
1774
1779
|
i.setUserSelectAction(e);
|
|
1775
|
-
const s =
|
|
1776
|
-
const
|
|
1777
|
-
return
|
|
1778
|
-
},
|
|
1779
|
-
const
|
|
1780
|
-
return O.length > 0 ? (console.warn("Could not revive all targets for these annotations:", O), n.bulkAddAnnotation(
|
|
1781
|
-
}, c = (u,
|
|
1782
|
-
const
|
|
1783
|
-
return
|
|
1784
|
-
n.getAnnotation(O.id) ? n.updateAnnotation(O,
|
|
1785
|
-
}),
|
|
1786
|
-
}, f = (u,
|
|
1787
|
-
const
|
|
1788
|
-
n.updateTarget(
|
|
1789
|
-
},
|
|
1790
|
-
const
|
|
1791
|
-
n.bulkUpdateTargets(
|
|
1792
|
-
},
|
|
1793
|
-
const
|
|
1780
|
+
const s = vn(n), r = Vn(), a = (u, m = k.LOCAL) => {
|
|
1781
|
+
const S = vt(u, t), x = F(S.target.selector);
|
|
1782
|
+
return x && n.addAnnotation(S, m), x;
|
|
1783
|
+
}, l = (u, m = !0, S = k.LOCAL) => {
|
|
1784
|
+
const x = u.map((R) => vt(R, t)), O = x.filter((R) => !F(R.target.selector));
|
|
1785
|
+
return O.length > 0 ? (console.warn("Could not revive all targets for these annotations:", O), n.bulkAddAnnotation(x, m, S), O) : (n.bulkAddAnnotation(x, m, S), []);
|
|
1786
|
+
}, c = (u, m = k.LOCAL) => {
|
|
1787
|
+
const S = u.map((O) => vt(O, t)), x = S.filter((O) => !F(O.target.selector));
|
|
1788
|
+
return x.length > 0 && console.warn("Could not revive all targets for these annotations:", x), S.forEach((O) => {
|
|
1789
|
+
n.getAnnotation(O.id) ? n.updateAnnotation(O, m) : n.addAnnotation(O, m);
|
|
1790
|
+
}), x;
|
|
1791
|
+
}, f = (u, m = k.LOCAL) => {
|
|
1792
|
+
const S = bt(u, t);
|
|
1793
|
+
n.updateTarget(S, m);
|
|
1794
|
+
}, d = (u, m = k.LOCAL) => {
|
|
1795
|
+
const S = u.map((x) => bt(x, t));
|
|
1796
|
+
n.bulkUpdateTargets(S, m);
|
|
1797
|
+
}, y = (u, m, S) => {
|
|
1798
|
+
const x = o.getAt(u, m, !!S).map((R) => n.getAnnotation(R)), O = S ? x.filter(S) : x;
|
|
1794
1799
|
return O.length > 0 ? O[0] : void 0;
|
|
1795
|
-
}, p = (u,
|
|
1800
|
+
}, p = (u, m, S, x = 5) => {
|
|
1796
1801
|
const O = o.getAnnotationRects(u);
|
|
1797
1802
|
if (O.length !== 0) {
|
|
1798
|
-
if (
|
|
1799
|
-
const R = O.find(({ top: T, right:
|
|
1803
|
+
if (m && S) {
|
|
1804
|
+
const R = O.find(({ top: T, right: E, bottom: h, left: v }) => m >= v - x && m <= E + x && S >= T - x && S <= h + x);
|
|
1800
1805
|
if (R) return R;
|
|
1801
1806
|
}
|
|
1802
1807
|
return o.getAnnotationBounds(u);
|
|
1803
1808
|
}
|
|
1804
|
-
}, w = (u,
|
|
1809
|
+
}, w = (u, m, S, x) => o.getIntersecting(u, m, S, x), b = (u) => o.getAnnotationRects(u), C = () => o.recalculate(), g = (u) => o.on("recalculate", u);
|
|
1805
1810
|
return n.observe(({ changes: u }) => {
|
|
1806
|
-
const
|
|
1807
|
-
(
|
|
1811
|
+
const m = (u.deleted || []).filter((O) => F(O.target.selector)), S = (u.created || []).filter((O) => F(O.target.selector)), x = (u.updated || []).filter((O) => F(O.newValue.target.selector));
|
|
1812
|
+
(m == null ? void 0 : m.length) > 0 && m.forEach((O) => o.remove(O.target)), S.length > 0 && o.set(S.map((O) => O.target), !1), (x == null ? void 0 : x.length) > 0 && x.forEach(({ newValue: O }) => o.update(O.target));
|
|
1808
1813
|
}), {
|
|
1809
1814
|
store: {
|
|
1810
1815
|
...n,
|
|
1811
1816
|
addAnnotation: a,
|
|
1812
|
-
bulkAddAnnotation:
|
|
1813
|
-
bulkUpdateTargets:
|
|
1817
|
+
bulkAddAnnotation: l,
|
|
1818
|
+
bulkUpdateTargets: d,
|
|
1814
1819
|
bulkUpsertAnnotations: c,
|
|
1815
1820
|
getAnnotationBounds: p,
|
|
1816
1821
|
getAnnotationRects: b,
|
|
1817
1822
|
getIntersecting: w,
|
|
1818
|
-
getAt:
|
|
1819
|
-
recalculatePositions:
|
|
1823
|
+
getAt: y,
|
|
1824
|
+
recalculatePositions: C,
|
|
1820
1825
|
onRecalculatePositions: g,
|
|
1821
1826
|
updateTarget: f
|
|
1822
1827
|
},
|
|
@@ -1824,35 +1829,35 @@ const uo = (t, e) => {
|
|
|
1824
1829
|
hover: s,
|
|
1825
1830
|
viewport: r
|
|
1826
1831
|
};
|
|
1827
|
-
},
|
|
1832
|
+
}, fo = () => {
|
|
1828
1833
|
const t = document.createElement("canvas");
|
|
1829
1834
|
t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
|
|
1830
1835
|
const e = t.getContext("2d");
|
|
1831
1836
|
return e.scale(2, 2), e.translate(0.5, 0.5), t;
|
|
1832
|
-
},
|
|
1833
|
-
const n =
|
|
1837
|
+
}, ho = (t, e = {}) => {
|
|
1838
|
+
const n = fo(), o = n.getContext("2d");
|
|
1834
1839
|
document.body.appendChild(n);
|
|
1835
|
-
const i = /* @__PURE__ */ new Map(), s = (f) => Array.from(i.entries()).filter(([
|
|
1836
|
-
return t.on("selectionChange", (f,
|
|
1837
|
-
s(f).forEach((p) => i.delete(p)),
|
|
1840
|
+
const i = /* @__PURE__ */ new Map(), s = (f) => Array.from(i.entries()).filter(([d, y]) => y.presenceKey === f.presenceKey).map(([d, y]) => d);
|
|
1841
|
+
return t.on("selectionChange", (f, d) => {
|
|
1842
|
+
s(f).forEach((p) => i.delete(p)), d && d.forEach((p) => i.set(p, f));
|
|
1838
1843
|
}), {
|
|
1839
1844
|
clear: () => {
|
|
1840
|
-
const { width: f, height:
|
|
1841
|
-
o.clearRect(-0.5, -0.5, f + 1,
|
|
1845
|
+
const { width: f, height: d } = n;
|
|
1846
|
+
o.clearRect(-0.5, -0.5, f + 1, d + 1);
|
|
1842
1847
|
},
|
|
1843
1848
|
destroy: () => {
|
|
1844
1849
|
n.remove();
|
|
1845
1850
|
},
|
|
1846
|
-
paint: (f,
|
|
1851
|
+
paint: (f, d, y) => {
|
|
1847
1852
|
e.font && (o.font = e.font);
|
|
1848
1853
|
const p = i.get(f.annotation.id);
|
|
1849
1854
|
if (p) {
|
|
1850
|
-
const { height: w } = f.rects[0], b = f.rects[0].x +
|
|
1851
|
-
o.fillStyle = p.appearance.color, o.fillRect(b - 2,
|
|
1852
|
-
const g = o.measureText(p.appearance.label), u = g.width + 6,
|
|
1853
|
-
return o.fillRect(b - 2,
|
|
1855
|
+
const { height: w } = f.rects[0], b = f.rects[0].x + d.left, C = f.rects[0].y + d.top;
|
|
1856
|
+
o.fillStyle = p.appearance.color, o.fillRect(b - 2, C - 2.5, 2, w + 5);
|
|
1857
|
+
const g = o.measureText(p.appearance.label), u = g.width + 6, m = g.actualBoundingBoxAscent + g.actualBoundingBoxDescent + 8, S = g.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1858
|
+
return o.fillRect(b - 2, C - 2.5 - m, u, m), o.fillStyle = "#fff", o.fillText(p.appearance.label, b + 1, C - S), {
|
|
1854
1859
|
fill: p.appearance.color,
|
|
1855
|
-
fillOpacity:
|
|
1860
|
+
fillOpacity: y ? 0.45 : 0.18
|
|
1856
1861
|
};
|
|
1857
1862
|
}
|
|
1858
1863
|
},
|
|
@@ -1862,19 +1867,19 @@ const uo = (t, e) => {
|
|
|
1862
1867
|
f.scale(2, 2), f.translate(0.5, 0.5);
|
|
1863
1868
|
}
|
|
1864
1869
|
};
|
|
1865
|
-
},
|
|
1866
|
-
function
|
|
1870
|
+
}, kt = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1871
|
+
function It(t, e, n, o) {
|
|
1867
1872
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1868
1873
|
}
|
|
1869
1874
|
function et(t, e, n, o) {
|
|
1870
1875
|
t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
|
|
1871
1876
|
}
|
|
1872
|
-
function
|
|
1877
|
+
function ve(t, e) {
|
|
1873
1878
|
const n = e.slice(0, e.length - 1);
|
|
1874
1879
|
for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
|
|
1875
1880
|
return n;
|
|
1876
1881
|
}
|
|
1877
|
-
function
|
|
1882
|
+
function Ae(t) {
|
|
1878
1883
|
typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
|
|
1879
1884
|
const e = t.split(",");
|
|
1880
1885
|
let n = e.lastIndexOf("");
|
|
@@ -1882,7 +1887,7 @@ function xe(t) {
|
|
|
1882
1887
|
e[n - 1] += ",", e.splice(n, 1), n = e.lastIndexOf("");
|
|
1883
1888
|
return e;
|
|
1884
1889
|
}
|
|
1885
|
-
function
|
|
1890
|
+
function po(t, e) {
|
|
1886
1891
|
const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;
|
|
1887
1892
|
let i = !0;
|
|
1888
1893
|
for (let s = 0; s < n.length; s++)
|
|
@@ -1934,9 +1939,9 @@ const at = {
|
|
|
1934
1939
|
".": 190,
|
|
1935
1940
|
"/": 191,
|
|
1936
1941
|
"`": 192,
|
|
1937
|
-
"-":
|
|
1938
|
-
"=":
|
|
1939
|
-
";":
|
|
1942
|
+
"-": kt ? 173 : 189,
|
|
1943
|
+
"=": kt ? 61 : 187,
|
|
1944
|
+
";": kt ? 59 : 186,
|
|
1940
1945
|
"'": 222,
|
|
1941
1946
|
"[": 219,
|
|
1942
1947
|
"]": 221,
|
|
@@ -1957,7 +1962,7 @@ const at = {
|
|
|
1957
1962
|
"⌘": 91,
|
|
1958
1963
|
cmd: 91,
|
|
1959
1964
|
command: 91
|
|
1960
|
-
},
|
|
1965
|
+
}, Dt = {
|
|
1961
1966
|
16: "shiftKey",
|
|
1962
1967
|
18: "altKey",
|
|
1963
1968
|
17: "ctrlKey",
|
|
@@ -1974,21 +1979,21 @@ const at = {
|
|
|
1974
1979
|
}, N = {};
|
|
1975
1980
|
for (let t = 1; t < 20; t++)
|
|
1976
1981
|
at["f".concat(t)] = 111 + t;
|
|
1977
|
-
let I = [], rt = null,
|
|
1978
|
-
const z = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0),
|
|
1979
|
-
function
|
|
1980
|
-
|
|
1982
|
+
let I = [], rt = null, xe = "all";
|
|
1983
|
+
const z = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), go = (t) => Object.keys(at).find((e) => at[e] === t), mo = (t) => Object.keys(j).find((e) => j[e] === t);
|
|
1984
|
+
function Ee(t) {
|
|
1985
|
+
xe = t || "all";
|
|
1981
1986
|
}
|
|
1982
1987
|
function ct() {
|
|
1983
|
-
return
|
|
1988
|
+
return xe || "all";
|
|
1984
1989
|
}
|
|
1985
|
-
function
|
|
1990
|
+
function yo() {
|
|
1986
1991
|
return I.slice(0);
|
|
1987
1992
|
}
|
|
1988
|
-
function
|
|
1989
|
-
return I.map((t) =>
|
|
1993
|
+
function bo() {
|
|
1994
|
+
return I.map((t) => go(t) || mo(t) || String.fromCharCode(t));
|
|
1990
1995
|
}
|
|
1991
|
-
function
|
|
1996
|
+
function wo() {
|
|
1992
1997
|
const t = [];
|
|
1993
1998
|
return Object.keys(N).forEach((e) => {
|
|
1994
1999
|
N[e].forEach((n) => {
|
|
@@ -2007,7 +2012,7 @@ function vo() {
|
|
|
2007
2012
|
});
|
|
2008
2013
|
}), t;
|
|
2009
2014
|
}
|
|
2010
|
-
function
|
|
2015
|
+
function vo(t) {
|
|
2011
2016
|
const e = t.target || t.srcElement, {
|
|
2012
2017
|
tagName: n
|
|
2013
2018
|
} = e;
|
|
@@ -2015,10 +2020,10 @@ function Ao(t) {
|
|
|
2015
2020
|
const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(e.type);
|
|
2016
2021
|
return (e.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !e.readOnly) && (o = !1), o;
|
|
2017
2022
|
}
|
|
2018
|
-
function
|
|
2023
|
+
function Ao(t) {
|
|
2019
2024
|
return typeof t == "string" && (t = lt(t)), I.indexOf(t) !== -1;
|
|
2020
2025
|
}
|
|
2021
|
-
function
|
|
2026
|
+
function xo(t, e) {
|
|
2022
2027
|
let n, o;
|
|
2023
2028
|
t || (t = ct());
|
|
2024
2029
|
for (const i in N)
|
|
@@ -2028,11 +2033,11 @@ function Eo(t, e) {
|
|
|
2028
2033
|
let {
|
|
2029
2034
|
element: a
|
|
2030
2035
|
} = r;
|
|
2031
|
-
return
|
|
2036
|
+
return Pt(a);
|
|
2032
2037
|
}) : o++;
|
|
2033
|
-
ct() === t &&
|
|
2038
|
+
ct() === t && Ee(e || "all");
|
|
2034
2039
|
}
|
|
2035
|
-
function
|
|
2040
|
+
function Eo(t) {
|
|
2036
2041
|
let e = t.keyCode || t.which || t.charCode;
|
|
2037
2042
|
const n = I.indexOf(e);
|
|
2038
2043
|
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in V) {
|
|
@@ -2040,22 +2045,22 @@ function So(t) {
|
|
|
2040
2045
|
for (const o in j) j[o] === e && (P[o] = !1);
|
|
2041
2046
|
}
|
|
2042
2047
|
}
|
|
2043
|
-
function
|
|
2048
|
+
function Se(t) {
|
|
2044
2049
|
if (typeof t > "u")
|
|
2045
2050
|
Object.keys(N).forEach((i) => {
|
|
2046
|
-
Array.isArray(N[i]) && N[i].forEach((s) =>
|
|
2047
|
-
}),
|
|
2051
|
+
Array.isArray(N[i]) && N[i].forEach((s) => yt(s)), delete N[i];
|
|
2052
|
+
}), Pt(null);
|
|
2048
2053
|
else if (Array.isArray(t))
|
|
2049
2054
|
t.forEach((i) => {
|
|
2050
|
-
i.key &&
|
|
2055
|
+
i.key && yt(i);
|
|
2051
2056
|
});
|
|
2052
2057
|
else if (typeof t == "object")
|
|
2053
|
-
t.key &&
|
|
2058
|
+
t.key && yt(t);
|
|
2054
2059
|
else if (typeof t == "string") {
|
|
2055
2060
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++)
|
|
2056
2061
|
n[o - 1] = arguments[o];
|
|
2057
2062
|
let [i, s] = n;
|
|
2058
|
-
typeof i == "function" && (s = i, i = ""),
|
|
2063
|
+
typeof i == "function" && (s = i, i = ""), yt({
|
|
2059
2064
|
key: t,
|
|
2060
2065
|
scope: i,
|
|
2061
2066
|
method: s,
|
|
@@ -2063,25 +2068,25 @@ function Ce(t) {
|
|
|
2063
2068
|
});
|
|
2064
2069
|
}
|
|
2065
2070
|
}
|
|
2066
|
-
const
|
|
2071
|
+
const yt = (t) => {
|
|
2067
2072
|
let {
|
|
2068
2073
|
key: e,
|
|
2069
2074
|
scope: n,
|
|
2070
2075
|
method: o,
|
|
2071
2076
|
splitKey: i = "+"
|
|
2072
2077
|
} = t;
|
|
2073
|
-
|
|
2074
|
-
const a = r.split(i),
|
|
2078
|
+
Ae(e).forEach((r) => {
|
|
2079
|
+
const a = r.split(i), l = a.length, c = a[l - 1], f = c === "*" ? "*" : lt(c);
|
|
2075
2080
|
if (!N[f]) return;
|
|
2076
2081
|
n || (n = ct());
|
|
2077
|
-
const
|
|
2082
|
+
const d = l > 1 ? ve(j, a) : [], y = [];
|
|
2078
2083
|
N[f] = N[f].filter((p) => {
|
|
2079
|
-
const b = (o ? p.method === o : !0) && p.scope === n &&
|
|
2080
|
-
return b &&
|
|
2081
|
-
}),
|
|
2084
|
+
const b = (o ? p.method === o : !0) && p.scope === n && po(p.mods, d);
|
|
2085
|
+
return b && y.push(p.element), !b;
|
|
2086
|
+
}), y.forEach((p) => Pt(p));
|
|
2082
2087
|
});
|
|
2083
2088
|
};
|
|
2084
|
-
function
|
|
2089
|
+
function oe(t, e, n, o) {
|
|
2085
2090
|
if (e.element !== o)
|
|
2086
2091
|
return;
|
|
2087
2092
|
let i;
|
|
@@ -2092,13 +2097,13 @@ function ie(t, e, n, o) {
|
|
|
2092
2097
|
(e.mods.length === 0 && !V[16] && !V[18] && !V[17] && !V[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
|
|
2093
2098
|
}
|
|
2094
2099
|
}
|
|
2095
|
-
function
|
|
2100
|
+
function ie(t, e) {
|
|
2096
2101
|
const n = N["*"];
|
|
2097
2102
|
let o = t.keyCode || t.which || t.charCode;
|
|
2098
2103
|
if (!P.filter.call(this, t)) return;
|
|
2099
2104
|
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
|
|
2100
|
-
const
|
|
2101
|
-
t[a] && I.indexOf(
|
|
2105
|
+
const l = Dt[a];
|
|
2106
|
+
t[a] && I.indexOf(l) === -1 ? I.push(l) : !t[a] && I.indexOf(l) > -1 ? I.splice(I.indexOf(l), 1) : a === "metaKey" && t[a] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(l))));
|
|
2102
2107
|
}), o in V) {
|
|
2103
2108
|
V[o] = !0;
|
|
2104
2109
|
for (const a in j)
|
|
@@ -2106,31 +2111,31 @@ function se(t, e) {
|
|
|
2106
2111
|
if (!n) return;
|
|
2107
2112
|
}
|
|
2108
2113
|
for (const a in V)
|
|
2109
|
-
Object.prototype.hasOwnProperty.call(V, a) && (V[a] = t[
|
|
2114
|
+
Object.prototype.hasOwnProperty.call(V, a) && (V[a] = t[Dt[a]]);
|
|
2110
2115
|
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), V[17] = !0, V[18] = !0);
|
|
2111
2116
|
const i = ct();
|
|
2112
2117
|
if (n)
|
|
2113
2118
|
for (let a = 0; a < n.length; a++)
|
|
2114
|
-
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) &&
|
|
2119
|
+
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) && oe(t, n[a], i, e);
|
|
2115
2120
|
if (!(o in N)) return;
|
|
2116
2121
|
const s = N[o], r = s.length;
|
|
2117
2122
|
for (let a = 0; a < r; a++)
|
|
2118
2123
|
if ((t.type === "keydown" && s[a].keydown || t.type === "keyup" && s[a].keyup) && s[a].key) {
|
|
2119
|
-
const
|
|
2124
|
+
const l = s[a], {
|
|
2120
2125
|
splitKey: c
|
|
2121
|
-
} =
|
|
2122
|
-
for (let
|
|
2123
|
-
|
|
2124
|
-
|
|
2126
|
+
} = l, f = l.key.split(c), d = [];
|
|
2127
|
+
for (let y = 0; y < f.length; y++)
|
|
2128
|
+
d.push(lt(f[y]));
|
|
2129
|
+
d.sort().join("") === I.sort().join("") && oe(t, l, i, e);
|
|
2125
2130
|
}
|
|
2126
2131
|
}
|
|
2127
2132
|
function P(t, e, n) {
|
|
2128
2133
|
I = [];
|
|
2129
|
-
const o =
|
|
2130
|
-
let i = [], s = "all", r = document, a = 0,
|
|
2131
|
-
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (
|
|
2132
|
-
t = o[a].split(f), i = [], t.length > 1 && (i =
|
|
2133
|
-
keyup:
|
|
2134
|
+
const o = Ae(t);
|
|
2135
|
+
let i = [], s = "all", r = document, a = 0, l = !1, c = !0, f = "+", d = !1, y = !1;
|
|
2136
|
+
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (c = e.keydown), e.capture !== void 0 && (d = e.capture), typeof e.splitKey == "string" && (f = e.splitKey), e.single === !0 && (y = !0)), typeof e == "string" && (s = e), y && Se(t, s); a < o.length; a++)
|
|
2137
|
+
t = o[a].split(f), i = [], t.length > 1 && (i = ve(j, t)), t = t[t.length - 1], t = t === "*" ? "*" : lt(t), t in N || (N[t] = []), N[t].push({
|
|
2138
|
+
keyup: l,
|
|
2134
2139
|
keydown: c,
|
|
2135
2140
|
scope: s,
|
|
2136
2141
|
mods: i,
|
|
@@ -2144,16 +2149,16 @@ function P(t, e, n) {
|
|
|
2144
2149
|
if (!z.has(r)) {
|
|
2145
2150
|
const p = function() {
|
|
2146
2151
|
let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2147
|
-
return
|
|
2152
|
+
return ie(b, r);
|
|
2148
2153
|
}, w = function() {
|
|
2149
2154
|
let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2150
|
-
|
|
2155
|
+
ie(b, r), Eo(b);
|
|
2151
2156
|
};
|
|
2152
2157
|
z.set(r, {
|
|
2153
2158
|
keydownListener: p,
|
|
2154
2159
|
keyupListenr: w,
|
|
2155
|
-
capture:
|
|
2156
|
-
}),
|
|
2160
|
+
capture: d
|
|
2161
|
+
}), It(r, "keydown", p, d), It(r, "keyup", w, d);
|
|
2157
2162
|
}
|
|
2158
2163
|
if (!rt) {
|
|
2159
2164
|
const p = () => {
|
|
@@ -2161,12 +2166,12 @@ function P(t, e, n) {
|
|
|
2161
2166
|
};
|
|
2162
2167
|
rt = {
|
|
2163
2168
|
listener: p,
|
|
2164
|
-
capture:
|
|
2165
|
-
},
|
|
2169
|
+
capture: d
|
|
2170
|
+
}, It(window, "focus", p, d);
|
|
2166
2171
|
}
|
|
2167
2172
|
}
|
|
2168
2173
|
}
|
|
2169
|
-
function
|
|
2174
|
+
function So(t) {
|
|
2170
2175
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2171
2176
|
Object.keys(N).forEach((n) => {
|
|
2172
2177
|
N[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
|
|
@@ -2174,7 +2179,7 @@ function Co(t) {
|
|
|
2174
2179
|
});
|
|
2175
2180
|
});
|
|
2176
2181
|
}
|
|
2177
|
-
function
|
|
2182
|
+
function Pt(t) {
|
|
2178
2183
|
const e = Object.values(N).flat();
|
|
2179
2184
|
if (e.findIndex((o) => {
|
|
2180
2185
|
let {
|
|
@@ -2204,55 +2209,55 @@ function $t(t) {
|
|
|
2204
2209
|
et(window, "focus", i, s), rt = null;
|
|
2205
2210
|
}
|
|
2206
2211
|
}
|
|
2207
|
-
const
|
|
2208
|
-
getPressedKeyString:
|
|
2209
|
-
setScope:
|
|
2212
|
+
const Nt = {
|
|
2213
|
+
getPressedKeyString: bo,
|
|
2214
|
+
setScope: Ee,
|
|
2210
2215
|
getScope: ct,
|
|
2211
|
-
deleteScope:
|
|
2212
|
-
getPressedKeyCodes:
|
|
2213
|
-
getAllKeyCodes:
|
|
2214
|
-
isPressed:
|
|
2215
|
-
filter:
|
|
2216
|
-
trigger:
|
|
2217
|
-
unbind:
|
|
2216
|
+
deleteScope: xo,
|
|
2217
|
+
getPressedKeyCodes: yo,
|
|
2218
|
+
getAllKeyCodes: wo,
|
|
2219
|
+
isPressed: Ao,
|
|
2220
|
+
filter: vo,
|
|
2221
|
+
trigger: So,
|
|
2222
|
+
unbind: Se,
|
|
2218
2223
|
keyMap: at,
|
|
2219
2224
|
modifier: j,
|
|
2220
|
-
modifierMap:
|
|
2225
|
+
modifierMap: Dt
|
|
2221
2226
|
};
|
|
2222
|
-
for (const t in
|
|
2223
|
-
Object.prototype.hasOwnProperty.call(
|
|
2227
|
+
for (const t in Nt)
|
|
2228
|
+
Object.prototype.hasOwnProperty.call(Nt, t) && (P[t] = Nt[t]);
|
|
2224
2229
|
if (typeof window < "u") {
|
|
2225
2230
|
const t = window.hotkeys;
|
|
2226
2231
|
P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
|
|
2227
2232
|
}
|
|
2228
|
-
async function
|
|
2233
|
+
async function Co(t, e, n = () => !1) {
|
|
2229
2234
|
do {
|
|
2230
2235
|
if (await t(), await n()) break;
|
|
2231
2236
|
const o = e;
|
|
2232
2237
|
await new Promise((i) => setTimeout(i, Math.max(0, o)));
|
|
2233
2238
|
} while (!await n());
|
|
2234
2239
|
}
|
|
2235
|
-
const
|
|
2236
|
-
...
|
|
2237
|
-
|
|
2238
|
-
],
|
|
2240
|
+
const se = 300, Ce = ["up", "down", "left", "right"], Le = Be ? "⌘+a" : "ctrl+a", Lo = [
|
|
2241
|
+
...Ce.map((t) => `shift+${t}`),
|
|
2242
|
+
Le
|
|
2243
|
+
], Oo = (t, e, n) => {
|
|
2239
2244
|
const { store: o, selection: i } = e;
|
|
2240
2245
|
let s;
|
|
2241
|
-
const r = (
|
|
2246
|
+
const r = (E) => s = E;
|
|
2242
2247
|
let a;
|
|
2243
|
-
const
|
|
2244
|
-
let c, f,
|
|
2245
|
-
const p = (
|
|
2246
|
-
|
|
2247
|
-
}, w = (
|
|
2248
|
-
f !== !1 && (c = nt(
|
|
2249
|
-
annotation:
|
|
2248
|
+
const l = (E) => a = E;
|
|
2249
|
+
let c, f, d, y = !0;
|
|
2250
|
+
const p = (E) => {
|
|
2251
|
+
y = E, b.clear(), E || (c = void 0, d = void 0);
|
|
2252
|
+
}, w = (E) => {
|
|
2253
|
+
f !== !1 && (c = nt(E.target) ? void 0 : {
|
|
2254
|
+
annotation: ge(),
|
|
2250
2255
|
selector: [],
|
|
2251
2256
|
creator: s,
|
|
2252
2257
|
created: /* @__PURE__ */ new Date()
|
|
2253
2258
|
});
|
|
2254
|
-
}, b =
|
|
2255
|
-
if (!
|
|
2259
|
+
}, b = Kt((E) => {
|
|
2260
|
+
if (!y) return;
|
|
2256
2261
|
const h = document.getSelection();
|
|
2257
2262
|
if (!(h != null && h.anchorNode))
|
|
2258
2263
|
return;
|
|
@@ -2260,181 +2265,181 @@ const re = 300, Le = ["up", "down", "left", "right"], Oe = ke ? "⌘+a" : "ctrl+
|
|
|
2260
2265
|
c = void 0;
|
|
2261
2266
|
return;
|
|
2262
2267
|
}
|
|
2263
|
-
const v =
|
|
2264
|
-
if ((
|
|
2268
|
+
const v = E.timeStamp - ((d == null ? void 0 : d.timeStamp) || E.timeStamp);
|
|
2269
|
+
if ((d == null ? void 0 : d.type) === "pointerdown" && (v < 1e3 && !c || h.isCollapsed && v < se) && w(d || E), !c) return;
|
|
2265
2270
|
if (h.isCollapsed) {
|
|
2266
2271
|
o.getAnnotation(c.annotation) && (i.clear(), o.deleteAnnotation(c.annotation));
|
|
2267
2272
|
return;
|
|
2268
2273
|
}
|
|
2269
|
-
const A = h.getRangeAt(0), L =
|
|
2270
|
-
if (
|
|
2271
|
-
const M =
|
|
2274
|
+
const A = h.getRangeAt(0), L = $e(A, t);
|
|
2275
|
+
if (De(L)) return;
|
|
2276
|
+
const M = Ne(L.cloneRange());
|
|
2272
2277
|
(M.length !== c.selector.length || M.some((K, Y) => {
|
|
2273
2278
|
var dt;
|
|
2274
2279
|
return K.toString() !== ((dt = c.selector[Y]) == null ? void 0 : dt.quote);
|
|
2275
2280
|
})) && (c = {
|
|
2276
2281
|
...c,
|
|
2277
|
-
selector: M.map((K) =>
|
|
2282
|
+
selector: M.map((K) => Xe(K, t, n)),
|
|
2278
2283
|
updated: /* @__PURE__ */ new Date()
|
|
2279
2284
|
}, o.getAnnotation(c.annotation) ? o.updateTarget(c, k.LOCAL) : i.clear());
|
|
2280
|
-
}, 10),
|
|
2281
|
-
nt(
|
|
2285
|
+
}, 10), C = (E) => {
|
|
2286
|
+
nt(E.target) || (d = At(E), f = d.button === 0);
|
|
2282
2287
|
}, g = () => {
|
|
2283
2288
|
o.getAnnotation(c.annotation) ? o.updateTarget(c) : o.addAnnotation({
|
|
2284
2289
|
id: c.annotation,
|
|
2285
2290
|
bodies: [],
|
|
2286
2291
|
target: c
|
|
2287
2292
|
});
|
|
2288
|
-
}, u = async (
|
|
2289
|
-
if (nt(
|
|
2293
|
+
}, u = async (E) => {
|
|
2294
|
+
if (nt(E.target) || !f) return;
|
|
2290
2295
|
const h = () => {
|
|
2291
|
-
const { x: A, y: L } = t.getBoundingClientRect(), M =
|
|
2296
|
+
const { x: A, y: L } = t.getBoundingClientRect(), M = E.target instanceof Node && t.contains(E.target) && o.getAt(E.clientX - A, E.clientY - L, a);
|
|
2292
2297
|
if (M) {
|
|
2293
2298
|
const { selected: B } = i;
|
|
2294
|
-
(B.length !== 1 || B[0].id !== M.id) && i.userSelect(M.id,
|
|
2299
|
+
(B.length !== 1 || B[0].id !== M.id) && i.userSelect(M.id, E);
|
|
2295
2300
|
} else
|
|
2296
2301
|
i.clear();
|
|
2297
2302
|
};
|
|
2298
|
-
if (
|
|
2299
|
-
await
|
|
2303
|
+
if (E.timeStamp - d.timeStamp < se) {
|
|
2304
|
+
await m();
|
|
2300
2305
|
const A = document.getSelection();
|
|
2301
2306
|
if (A != null && A.isCollapsed) {
|
|
2302
2307
|
c = void 0, h();
|
|
2303
2308
|
return;
|
|
2304
2309
|
}
|
|
2305
2310
|
}
|
|
2306
|
-
c && c.selector.length > 0 && (i.clear(), g(), i.userSelect(c.annotation,
|
|
2307
|
-
},
|
|
2308
|
-
const
|
|
2309
|
-
let h = !1, v =
|
|
2311
|
+
c && c.selector.length > 0 && (i.clear(), g(), i.userSelect(c.annotation, At(E)));
|
|
2312
|
+
}, m = async () => {
|
|
2313
|
+
const E = document.getSelection();
|
|
2314
|
+
let h = !1, v = E == null ? void 0 : E.isCollapsed;
|
|
2310
2315
|
const A = () => v || h, L = 1;
|
|
2311
|
-
return setTimeout(() => h = !0, 50),
|
|
2312
|
-
},
|
|
2316
|
+
return setTimeout(() => h = !0, 50), Co(() => v = E == null ? void 0 : E.isCollapsed, L, A);
|
|
2317
|
+
}, S = (E) => {
|
|
2313
2318
|
const h = document.getSelection();
|
|
2314
|
-
h != null && h.isCollapsed || ((!c || c.selector.length === 0) && b(
|
|
2315
|
-
},
|
|
2316
|
-
|
|
2317
|
-
}, O = (
|
|
2319
|
+
h != null && h.isCollapsed || ((!c || c.selector.length === 0) && b(E), g(), i.userSelect(c.annotation, At(E)));
|
|
2320
|
+
}, x = (E) => {
|
|
2321
|
+
y && E.key === "Shift" && c && (document.getSelection().isCollapsed || (i.clear(), g(), i.userSelect(c.annotation, ut(E))));
|
|
2322
|
+
}, O = (E) => {
|
|
2318
2323
|
const h = () => setTimeout(() => {
|
|
2319
2324
|
(c == null ? void 0 : c.selector.length) > 0 && (i.clear(), o.addAnnotation({
|
|
2320
2325
|
id: c.annotation,
|
|
2321
2326
|
bodies: [],
|
|
2322
2327
|
target: c
|
|
2323
|
-
}), i.userSelect(c.annotation, ut(
|
|
2328
|
+
}), i.userSelect(c.annotation, ut(E))), document.removeEventListener("selectionchange", h);
|
|
2324
2329
|
}, 100);
|
|
2325
|
-
document.addEventListener("selectionchange", h), w(
|
|
2330
|
+
document.addEventListener("selectionchange", h), w(E);
|
|
2326
2331
|
};
|
|
2327
|
-
P(
|
|
2328
|
-
|
|
2329
|
-
}), P(
|
|
2330
|
-
|
|
2332
|
+
P(Lo.join(","), { element: t, keydown: !0, keyup: !1 }, (E) => {
|
|
2333
|
+
E.repeat || (d = ut(E));
|
|
2334
|
+
}), P(Le, { keydown: !0, keyup: !1 }, (E) => {
|
|
2335
|
+
d = ut(E), O(E);
|
|
2331
2336
|
});
|
|
2332
|
-
const R = (
|
|
2333
|
-
|
|
2337
|
+
const R = (E) => {
|
|
2338
|
+
E.repeat || E.target !== t && E.target !== document.body || (c = void 0, i.clear());
|
|
2334
2339
|
};
|
|
2335
|
-
return P(
|
|
2340
|
+
return P(Ce.join(","), { keydown: !0, keyup: !1 }, R), document.addEventListener("pointerdown", C), document.addEventListener("pointerup", u), document.addEventListener("contextmenu", S), t.addEventListener("keyup", x), t.addEventListener("selectstart", w), document.addEventListener("selectionchange", b), {
|
|
2336
2341
|
destroy: () => {
|
|
2337
|
-
c = void 0, f = void 0,
|
|
2342
|
+
c = void 0, f = void 0, d = void 0, b.clear(), document.removeEventListener("pointerdown", C), document.removeEventListener("pointerup", u), document.removeEventListener("contextmenu", S), t.removeEventListener("keyup", x), t.removeEventListener("selectstart", w), document.removeEventListener("selectionchange", b), P.unbind();
|
|
2338
2343
|
},
|
|
2339
|
-
setFilter:
|
|
2344
|
+
setFilter: l,
|
|
2340
2345
|
setUser: r,
|
|
2341
2346
|
setAnnotatingEnabled: p
|
|
2342
2347
|
};
|
|
2343
|
-
},
|
|
2348
|
+
}, To = (t, e) => ({
|
|
2344
2349
|
...t,
|
|
2345
2350
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2346
2351
|
user: t.user || e.user
|
|
2347
|
-
}),
|
|
2348
|
-
|
|
2349
|
-
const n =
|
|
2352
|
+
}), re = "SPANS", Io = (t, e = {}) => {
|
|
2353
|
+
Me(t), ke(t);
|
|
2354
|
+
const n = To(e, {
|
|
2350
2355
|
annotatingEnabled: !0,
|
|
2351
|
-
user:
|
|
2352
|
-
}), o =
|
|
2356
|
+
user: Fn()
|
|
2357
|
+
}), o = uo(t, n.userSelectAction), { selection: i, viewport: s } = o, r = o.store, a = Dn(r), l = Kn(o, a, n.adapter);
|
|
2353
2358
|
let c = n.user;
|
|
2354
|
-
const f = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" :
|
|
2355
|
-
if (!
|
|
2359
|
+
const f = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : re : n.renderer || re, d = f === "SPANS" ? pn(t, o, s) : f === "CSS_HIGHLIGHTS" ? un(t, o, s) : f === "CANVAS" ? tn(t, o, s) : void 0;
|
|
2360
|
+
if (!d)
|
|
2356
2361
|
throw `Unknown renderer implementation: ${f}`;
|
|
2357
|
-
console.debug(`Using ${f} renderer`), n.style &&
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
const p =
|
|
2361
|
-
|
|
2362
|
-
|
|
2362
|
+
console.debug(`Using ${f} renderer`), n.style && d.setStyle(n.style);
|
|
2363
|
+
const y = Oo(t, o, n.offsetReferenceSelector);
|
|
2364
|
+
y.setUser(c), y.setAnnotatingEnabled(n.annotatingEnabled);
|
|
2365
|
+
const p = Xn(o, a, n.adapter), w = () => c, b = (x) => {
|
|
2366
|
+
y.setAnnotatingEnabled(
|
|
2367
|
+
x === void 0 ? !0 : x
|
|
2363
2368
|
);
|
|
2364
|
-
},
|
|
2365
|
-
|
|
2366
|
-
}, g = (
|
|
2367
|
-
c =
|
|
2368
|
-
}, u = (
|
|
2369
|
-
|
|
2370
|
-
},
|
|
2371
|
-
|
|
2369
|
+
}, C = (x) => {
|
|
2370
|
+
d.setFilter(x), y.setFilter(x);
|
|
2371
|
+
}, g = (x) => {
|
|
2372
|
+
c = x, y.setUser(x);
|
|
2373
|
+
}, u = (x) => {
|
|
2374
|
+
x && (d.setPainter(ho(x, n.presence)), x.on("selectionChange", () => d.redraw()));
|
|
2375
|
+
}, m = (x) => {
|
|
2376
|
+
x ? i.setSelected(x) : i.clear();
|
|
2372
2377
|
};
|
|
2373
2378
|
return {
|
|
2374
2379
|
...p,
|
|
2375
2380
|
destroy: () => {
|
|
2376
|
-
|
|
2381
|
+
d.destroy(), y.destroy(), a.destroy();
|
|
2377
2382
|
},
|
|
2378
2383
|
element: t,
|
|
2379
2384
|
getUser: w,
|
|
2380
2385
|
setAnnotatingEnabled: b,
|
|
2381
|
-
setFilter:
|
|
2382
|
-
setStyle:
|
|
2383
|
-
redraw:
|
|
2386
|
+
setFilter: C,
|
|
2387
|
+
setStyle: d.setStyle.bind(d),
|
|
2388
|
+
redraw: d.redraw.bind(d),
|
|
2384
2389
|
setUser: g,
|
|
2385
|
-
setSelected:
|
|
2390
|
+
setSelected: m,
|
|
2386
2391
|
setPresenceProvider: u,
|
|
2387
|
-
setVisible:
|
|
2388
|
-
on:
|
|
2389
|
-
off:
|
|
2390
|
-
scrollIntoView:
|
|
2392
|
+
setVisible: d.setVisible.bind(d),
|
|
2393
|
+
on: l.on,
|
|
2394
|
+
off: l.off,
|
|
2395
|
+
scrollIntoView: He(t, r),
|
|
2391
2396
|
state: o
|
|
2392
2397
|
};
|
|
2393
2398
|
};
|
|
2394
2399
|
export {
|
|
2395
|
-
|
|
2400
|
+
wt as DEFAULT_SELECTED_STYLE,
|
|
2396
2401
|
W as DEFAULT_STYLE,
|
|
2397
|
-
|
|
2402
|
+
ae as NOT_ANNOTATABLE_CLASS,
|
|
2398
2403
|
Z as NOT_ANNOTATABLE_SELECTOR,
|
|
2399
2404
|
k as Origin,
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2405
|
+
An as UserSelectAction,
|
|
2406
|
+
ko as W3CTextFormat,
|
|
2407
|
+
Me as cancelSingleClickEvents,
|
|
2403
2408
|
ut as cloneKeyboardEvent,
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2409
|
+
At as clonePointerEvent,
|
|
2410
|
+
Bo as createBody,
|
|
2411
|
+
tn as createCanvasRenderer,
|
|
2412
|
+
un as createHighlightsRenderer,
|
|
2413
|
+
ho as createPresencePainter,
|
|
2414
|
+
dn as createRenderer,
|
|
2415
|
+
Oo as createSelectionHandler,
|
|
2416
|
+
pn as createSpansRenderer,
|
|
2417
|
+
Io as createTextAnnotator,
|
|
2418
|
+
uo as createTextAnnotatorState,
|
|
2419
|
+
Mo as denormalizeRectWithOffset,
|
|
2420
|
+
To as fillDefaults,
|
|
2421
|
+
_e as getQuoteContext,
|
|
2422
|
+
_t as getRangeAnnotatableContents,
|
|
2423
|
+
Be as isMac,
|
|
2419
2424
|
nt as isNotAnnotatable,
|
|
2420
|
-
|
|
2425
|
+
Re as isRangeAnnotatable,
|
|
2421
2426
|
F as isRevived,
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2427
|
+
De as isWhitespaceOrEmpty,
|
|
2428
|
+
Ye as mergeClientRects,
|
|
2429
|
+
je as normalizeRectWithOffset,
|
|
2430
|
+
ze as paint,
|
|
2431
|
+
Zn as parseW3CTextAnnotation,
|
|
2432
|
+
ke as programmaticallyFocusable,
|
|
2433
|
+
Pe as rangeContains,
|
|
2434
|
+
Xe as rangeToSelector,
|
|
2435
|
+
vt as reviveAnnotation,
|
|
2436
|
+
ce as reviveSelector,
|
|
2437
|
+
bt as reviveTarget,
|
|
2438
|
+
He as scrollIntoView,
|
|
2439
|
+
to as serializeW3CTextAnnotation,
|
|
2440
|
+
Ne as splitAnnotatableRanges,
|
|
2441
|
+
Ro as toDomRectList,
|
|
2442
|
+
$e as trimRangeToContainer,
|
|
2443
|
+
Ue as whitespaceOrEmptyRegex
|
|
2439
2444
|
};
|
|
2440
2445
|
//# sourceMappingURL=text-annotator.es.js.map
|