@soomo/text-annotator 3.1.0-staging.2 → 3.1.0-staging.4
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/utils/index.d.ts +0 -1
- package/dist/src/utils/splitAnnotatableRanges.d.ts +2 -0
- package/dist/text-annotator.es.js +491 -496
- 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 +1 -1
- package/dist/src/utils/getAnnotatableFragment.d.ts +0 -5
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ce = "not-annotatable", Z = `.${ce}`, nt = (t) => {
|
|
2
2
|
var n;
|
|
3
|
+
return !!(t instanceof HTMLElement ? t.closest(Z) : (n = t.parentElement) == null ? void 0 : n.closest(Z));
|
|
4
|
+
}, Me = (t) => {
|
|
3
5
|
const e = t.commonAncestorContainer;
|
|
4
|
-
return
|
|
6
|
+
return !nt(e);
|
|
5
7
|
}, Be = function* (t) {
|
|
6
8
|
const e = document.createNodeIterator(
|
|
7
9
|
t.commonAncestorContainer,
|
|
8
10
|
NodeFilter.SHOW_ELEMENT,
|
|
9
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
11
|
+
(o) => o instanceof HTMLElement && o.classList.contains(ce) && !o.parentElement.closest(Z) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
10
12
|
);
|
|
11
13
|
let n;
|
|
12
14
|
for (; n = e.nextNode(); )
|
|
@@ -24,28 +26,25 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
24
26
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
25
27
|
}
|
|
26
28
|
return e.length > 0 ? e : [t];
|
|
27
|
-
},
|
|
29
|
+
}, Ut = (t) => {
|
|
28
30
|
const e = t.cloneContents();
|
|
29
|
-
return e.querySelectorAll(
|
|
31
|
+
return e.querySelectorAll(Z).forEach((n) => n.remove()), e;
|
|
30
32
|
}, Ie = (t) => t.addEventListener("click", (e) => {
|
|
31
33
|
// Allow clicks within not-annotatable elements
|
|
32
|
-
!e.target.closest(
|
|
33
|
-
}),
|
|
34
|
+
!e.target.closest(Z) && !e.target.closest("a") && e.preventDefault();
|
|
35
|
+
}), Ne = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), _e = (t) => {
|
|
34
36
|
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
35
|
-
}, Ro = (t) => {
|
|
36
|
-
const e = t.cloneContents();
|
|
37
|
-
return e.querySelectorAll(j).forEach((n) => n.remove()), e;
|
|
38
37
|
}, Ue = (t, e, n = 10, o) => {
|
|
39
38
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
40
39
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
41
|
-
const r =
|
|
40
|
+
const r = Ut(s).textContent, a = document.createRange();
|
|
42
41
|
a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
43
|
-
const d =
|
|
42
|
+
const d = Ut(a).textContent;
|
|
44
43
|
return {
|
|
45
44
|
prefix: r.substring(r.length - n),
|
|
46
45
|
suffix: d.substring(0, n)
|
|
47
46
|
};
|
|
48
|
-
}, De = /^\s*$/, Ve = (t) => De.test(t.toString()),
|
|
47
|
+
}, De = /^\s*$/, Ve = (t) => De.test(t.toString()), F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Ke = (t, e) => {
|
|
49
48
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
50
49
|
top: n(t.top),
|
|
51
50
|
bottom: n(t.bottom),
|
|
@@ -93,7 +92,7 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
return i ? o : [...o, n];
|
|
96
|
-
}, []),
|
|
95
|
+
}, []), Ro = (t) => ({
|
|
97
96
|
length: t.length,
|
|
98
97
|
item: (e) => t[e],
|
|
99
98
|
[Symbol.iterator]: function* () {
|
|
@@ -103,16 +102,16 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
103
102
|
}), $e = (t, e, n) => {
|
|
104
103
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
105
104
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
106
|
-
const s =
|
|
105
|
+
const s = Ut(o).textContent, r = t.toString(), a = s.length || 0, d = a + r.length;
|
|
107
106
|
return n ? { quote: r, start: a, end: d, range: t, offsetReference: i } : { quote: r, start: a, end: d, range: t };
|
|
108
|
-
},
|
|
107
|
+
}, le = (t, e) => {
|
|
109
108
|
var f, l;
|
|
110
109
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
111
110
|
e,
|
|
112
111
|
NodeFilter.SHOW_TEXT,
|
|
113
112
|
(p) => {
|
|
114
113
|
var h;
|
|
115
|
-
return (h = p.parentElement) != null && h.closest(
|
|
114
|
+
return (h = p.parentElement) != null && h.closest(Z) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
116
115
|
}
|
|
117
116
|
);
|
|
118
117
|
let r = 0;
|
|
@@ -143,23 +142,23 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
143
142
|
...t,
|
|
144
143
|
range: a
|
|
145
144
|
};
|
|
146
|
-
}, wt = (t, e) =>
|
|
145
|
+
}, wt = (t, e) => F(t.selector) ? t : {
|
|
147
146
|
...t,
|
|
148
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
149
|
-
},
|
|
147
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : le(n, e))
|
|
148
|
+
}, At = (t, e) => F(t.target.selector) ? t : { ...t, target: wt(t.target, e) }, de = (t, e) => {
|
|
150
149
|
if (t.isEqualNode(e))
|
|
151
150
|
return !0;
|
|
152
151
|
for (let n of t.childNodes)
|
|
153
|
-
if (
|
|
152
|
+
if (de(n, e))
|
|
154
153
|
return !0;
|
|
155
154
|
return !1;
|
|
156
155
|
}, Pe = (t, e) => {
|
|
157
156
|
const n = t.cloneContents();
|
|
158
|
-
return
|
|
157
|
+
return de(n, e);
|
|
159
158
|
}, je = (t, e) => {
|
|
160
159
|
const n = t.cloneRange(), o = e.contains(n.startContainer), i = e.contains(n.endContainer);
|
|
161
160
|
return !o && !i && !Pe(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
|
|
162
|
-
},
|
|
161
|
+
}, xt = (t) => ({
|
|
163
162
|
...t,
|
|
164
163
|
type: t.type,
|
|
165
164
|
x: t.x,
|
|
@@ -204,19 +203,19 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
204
203
|
}), He = (t, e) => {
|
|
205
204
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
206
205
|
return new DOMRect(n - e.left, o - e.top, i - n, s - o);
|
|
207
|
-
},
|
|
206
|
+
}, Mo = (t, e) => {
|
|
208
207
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
209
208
|
return new DOMRect(n + e.left, o + e.top, i - n, s - o);
|
|
210
|
-
},
|
|
209
|
+
}, ue = (t) => {
|
|
211
210
|
if (t === null)
|
|
212
211
|
return document.scrollingElement;
|
|
213
212
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
214
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
213
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : ue(t.parentElement);
|
|
215
214
|
}, ze = (t, e) => (n) => {
|
|
216
215
|
const o = typeof n == "string" ? n : n.id, i = (r) => {
|
|
217
|
-
const a = s.getBoundingClientRect(), d = s.clientHeight, c = s.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: l, height: p } = e.getAnnotationBounds(o), h = f.top - a.top,
|
|
216
|
+
const a = s.getBoundingClientRect(), d = s.clientHeight, c = s.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: l, height: p } = e.getAnnotationBounds(o), h = f.top - a.top, A = f.left - a.left, b = s.parentElement ? s.scrollTop : 0, E = s.parentElement ? s.scrollLeft : 0, m = h + b - (d - p) / 2, u = A + E - (c - l) / 2;
|
|
218
217
|
s.scroll({ top: m, left: u, behavior: "smooth" });
|
|
219
|
-
}, s =
|
|
218
|
+
}, s = ue(t);
|
|
220
219
|
if (s) {
|
|
221
220
|
const r = e.getAnnotation(o), { range: a } = r.target.selector[0];
|
|
222
221
|
if (a && !a.collapsed)
|
|
@@ -228,7 +227,7 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
229
|
return !1;
|
|
231
|
-
},
|
|
230
|
+
}, W = {
|
|
232
231
|
fill: "rgb(0, 128, 255)",
|
|
233
232
|
fillOpacity: 0.18
|
|
234
233
|
}, vt = {
|
|
@@ -236,14 +235,14 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
236
235
|
fillOpacity: 0.45
|
|
237
236
|
}, Fe = (t, e, n, o, i) => {
|
|
238
237
|
var r, a;
|
|
239
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? vt :
|
|
238
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? vt : W) : n : (a = t.state) != null && a.selected ? vt : W;
|
|
240
239
|
return o && o.paint(t, e) || s;
|
|
241
240
|
};
|
|
242
241
|
function We(t) {
|
|
243
242
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
244
243
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
244
|
+
var Kt = { exports: {} };
|
|
245
|
+
function fe(t, e = 100, n = {}) {
|
|
247
246
|
if (typeof t != "function")
|
|
248
247
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);
|
|
249
248
|
if (e < 0)
|
|
@@ -273,10 +272,10 @@ function ge(t, e = 100, n = {}) {
|
|
|
273
272
|
d = c(), l.clear();
|
|
274
273
|
}, l;
|
|
275
274
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
var qe =
|
|
279
|
-
const
|
|
275
|
+
Kt.exports.debounce = fe;
|
|
276
|
+
Kt.exports = fe;
|
|
277
|
+
var qe = Kt.exports;
|
|
278
|
+
const Yt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
280
279
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, a = o - n, d = i - e;
|
|
281
280
|
return { top: e, left: n, minX: s, minY: r, maxX: a, maxY: d };
|
|
282
281
|
}, Qe = (t) => {
|
|
@@ -285,7 +284,7 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
285
284
|
const i = o.map((s) => s.id);
|
|
286
285
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
287
286
|
};
|
|
288
|
-
},
|
|
287
|
+
}, Xt = (t, e, n, o) => {
|
|
289
288
|
const { store: i, selection: s, hover: r } = e;
|
|
290
289
|
let a, d, c;
|
|
291
290
|
const f = Qe(n), l = (T) => {
|
|
@@ -295,14 +294,14 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
295
294
|
t.addEventListener("pointermove", l);
|
|
296
295
|
const p = (T = !1) => {
|
|
297
296
|
c && c.clear();
|
|
298
|
-
const S = Ge(t), { minX: g, minY: w, maxX:
|
|
299
|
-
const
|
|
300
|
-
return { annotation:
|
|
297
|
+
const S = Ge(t), { minX: g, minY: w, maxX: v, maxY: O } = S, B = d ? i.getIntersecting(g, w, v, O).filter(({ annotation: Y }) => d(Y)) : i.getIntersecting(g, w, v, O), M = s.selected.map(({ id: Y }) => Y), K = B.map(({ annotation: Y, rects: dt }) => {
|
|
298
|
+
const Te = M.includes(Y.id), Re = Y.id === r.current;
|
|
299
|
+
return { annotation: Y, rects: dt, state: { selected: Te, hover: Re } };
|
|
301
300
|
});
|
|
302
|
-
o.redraw(
|
|
301
|
+
o.redraw(K, S, a, c, T), setTimeout(() => f(B.map(({ annotation: Y }) => Y)), 1);
|
|
303
302
|
}, h = (T) => {
|
|
304
303
|
c = T, p();
|
|
305
|
-
},
|
|
304
|
+
}, A = (T) => {
|
|
306
305
|
a = T, p();
|
|
307
306
|
}, b = (T) => {
|
|
308
307
|
d = T, p(!1);
|
|
@@ -310,21 +309,21 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
310
309
|
i.observe(E);
|
|
311
310
|
const m = s.subscribe(() => p()), u = () => p(!0);
|
|
312
311
|
document.addEventListener("scroll", u, { capture: !0, passive: !0 });
|
|
313
|
-
const y =
|
|
312
|
+
const y = Yt(() => {
|
|
314
313
|
i.recalculatePositions(), c == null || c.reset(), p();
|
|
315
314
|
}, 10);
|
|
316
315
|
window.addEventListener("resize", y);
|
|
317
316
|
const C = new ResizeObserver(y);
|
|
318
317
|
C.observe(t);
|
|
319
|
-
const
|
|
318
|
+
const x = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((T) => {
|
|
320
319
|
T.every((g) => g.target === t || t.contains(g.target)) || p(!0);
|
|
321
320
|
});
|
|
322
|
-
return L.observe(document.body,
|
|
321
|
+
return L.observe(document.body, x), {
|
|
323
322
|
destroy: () => {
|
|
324
323
|
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(E), m(), document.removeEventListener("scroll", u), y.clear(), window.removeEventListener("resize", y), C.disconnect(), L.disconnect();
|
|
325
324
|
},
|
|
326
325
|
redraw: p,
|
|
327
|
-
setStyle:
|
|
326
|
+
setStyle: A,
|
|
328
327
|
setFilter: b,
|
|
329
328
|
setPainter: h,
|
|
330
329
|
setVisible: o.setVisible
|
|
@@ -341,29 +340,29 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
341
340
|
const o = (a, d, c, f) => requestAnimationFrame(() => {
|
|
342
341
|
const { width: l, height: p } = e;
|
|
343
342
|
n.clearRect(-0.5, -0.5, l + 1, p + 1), f && f.clear();
|
|
344
|
-
const { top: h, left:
|
|
343
|
+
const { top: h, left: A } = d;
|
|
345
344
|
[...a].sort((E, m) => {
|
|
346
345
|
const { annotation: { target: { created: u } } } = E, { annotation: { target: { created: y } } } = m;
|
|
347
346
|
return u.getTime() - y.getTime();
|
|
348
347
|
}).forEach((E) => {
|
|
349
348
|
var C;
|
|
350
|
-
const m = c ? typeof c == "function" ? c(E.annotation, E.state) : c : (C = E.state) != null && C.selected ? vt :
|
|
351
|
-
x:
|
|
349
|
+
const m = c ? typeof c == "function" ? c(E.annotation, E.state) : c : (C = E.state) != null && C.selected ? vt : W, u = f && f.paint(E, d) || m, y = E.rects.map(({ x, y: L, width: R, height: T }) => ({
|
|
350
|
+
x: x + A,
|
|
352
351
|
y: L + h,
|
|
353
352
|
width: R,
|
|
354
353
|
height: T
|
|
355
354
|
}));
|
|
356
355
|
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, y.forEach(
|
|
357
|
-
({ x
|
|
356
|
+
({ x, y: L, width: R, height: T }) => n.fillRect(x, L, R, T)
|
|
358
357
|
), u.underlineColor) {
|
|
359
358
|
n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
|
|
360
|
-
const
|
|
359
|
+
const x = u.underlineOffset ?? 0;
|
|
361
360
|
y.forEach(({ x: L, y: R, width: T, height: S }) => {
|
|
362
|
-
n.beginPath(), n.moveTo(L, R + S +
|
|
361
|
+
n.beginPath(), n.moveTo(L, R + S + x), n.lineTo(L + T, R + S + x), n.stroke();
|
|
363
362
|
});
|
|
364
363
|
}
|
|
365
364
|
});
|
|
366
|
-
}), i =
|
|
365
|
+
}), i = Yt(() => Ze(e), 10);
|
|
367
366
|
return window.addEventListener("resize", i), {
|
|
368
367
|
destroy: () => {
|
|
369
368
|
e.remove(), i.clear(), window.removeEventListener("resize", i);
|
|
@@ -373,139 +372,139 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
373
372
|
},
|
|
374
373
|
redraw: o
|
|
375
374
|
};
|
|
376
|
-
}, en = (t, e, n) =>
|
|
377
|
-
var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
375
|
+
}, en = (t, e, n) => Xt(t, e, n, tn(t));
|
|
376
|
+
var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, H = function(t) {
|
|
378
377
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
379
|
-
},
|
|
378
|
+
}, _ = function(t, e, n) {
|
|
380
379
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
381
380
|
}, X = function(t, e, n) {
|
|
382
381
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
383
|
-
},
|
|
382
|
+
}, he = function(t) {
|
|
384
383
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
385
|
-
},
|
|
384
|
+
}, jt = function(t) {
|
|
386
385
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
387
|
-
},
|
|
388
|
-
return { r:
|
|
386
|
+
}, Et = function(t) {
|
|
387
|
+
return { r: _(t.r), g: _(t.g), b: _(t.b), a: _(t.a, 3) };
|
|
389
388
|
}, on = /^#([0-9a-f]{3,8})$/i, ft = function(t) {
|
|
390
389
|
var e = t.toString(16);
|
|
391
390
|
return e.length < 2 ? "0" + e : e;
|
|
392
|
-
},
|
|
391
|
+
}, ge = function(t) {
|
|
393
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;
|
|
394
393
|
return { h: 60 * (a < 0 ? a + 6 : a), s: s ? r / s * 100 : 0, v: s / 255 * 100, a: i };
|
|
395
|
-
},
|
|
394
|
+
}, pe = function(t) {
|
|
396
395
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
397
396
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
398
397
|
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n), d = o * (1 - (1 - e + s) * n), c = s % 6;
|
|
399
398
|
return { r: 255 * [o, a, r, r, d, o][c], g: 255 * [d, o, o, a, r, r][c], b: 255 * [r, r, d, o, o, a][c], a: i };
|
|
399
|
+
}, 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
|
+
return { h: _(t.h), s: _(t.s), l: _(t.l), a: _(t.a, 3) };
|
|
400
403
|
}, Ft = function(t) {
|
|
401
|
-
return { h:
|
|
402
|
-
}, Wt = function(t) {
|
|
403
|
-
return { h: U(t.h), s: U(t.s), l: U(t.l), a: U(t.a, 3) };
|
|
404
|
-
}, qt = function(t) {
|
|
405
|
-
return ye((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 }));
|
|
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 }));
|
|
406
405
|
var e, n, o;
|
|
407
406
|
}, st = function(t) {
|
|
408
|
-
return { h: (e =
|
|
407
|
+
return { h: (e = ge(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 };
|
|
409
408
|
var e, n, o, i;
|
|
410
|
-
}, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,
|
|
409
|
+
}, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Wt = { string: [[function(t) {
|
|
411
410
|
var e = on.exec(t);
|
|
412
|
-
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 ?
|
|
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;
|
|
413
412
|
}, "hex"], [function(t) {
|
|
414
413
|
var e = an.exec(t) || cn.exec(t);
|
|
415
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
414
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : jt({ 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;
|
|
416
415
|
}, "rgb"], [function(t) {
|
|
417
416
|
var e = sn.exec(t) || rn.exec(t);
|
|
418
417
|
if (!e) return null;
|
|
419
|
-
var n, o, i =
|
|
420
|
-
return
|
|
418
|
+
var n, o, i = Ht({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (nn[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 Ft(i);
|
|
421
420
|
}, "hsl"]], object: [[function(t) {
|
|
422
421
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
|
|
423
|
-
return
|
|
422
|
+
return H(e) && H(n) && H(o) ? jt({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
|
|
424
423
|
}, "rgb"], [function(t) {
|
|
425
424
|
var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
|
|
426
|
-
if (!
|
|
427
|
-
var r =
|
|
428
|
-
return
|
|
425
|
+
if (!H(e) || !H(n) || !H(o)) return null;
|
|
426
|
+
var r = Ht({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
|
|
427
|
+
return Ft(r);
|
|
429
428
|
}, "hsl"], [function(t) {
|
|
430
429
|
var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
|
|
431
|
-
if (!
|
|
430
|
+
if (!H(e) || !H(n) || !H(o)) return null;
|
|
432
431
|
var r = function(a) {
|
|
433
|
-
return { h:
|
|
432
|
+
return { h: he(a.h), s: X(a.s, 0, 100), v: X(a.v, 0, 100), a: X(a.a) };
|
|
434
433
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
|
|
435
|
-
return
|
|
436
|
-
}, "hsv"]] },
|
|
434
|
+
return pe(r);
|
|
435
|
+
}, "hsv"]] }, qt = function(t, e) {
|
|
437
436
|
for (var n = 0; n < e.length; n++) {
|
|
438
437
|
var o = e[n][0](t);
|
|
439
438
|
if (o) return [o, e[n][1]];
|
|
440
439
|
}
|
|
441
440
|
return [null, void 0];
|
|
442
441
|
}, ln = function(t) {
|
|
443
|
-
return typeof t == "string" ?
|
|
444
|
-
},
|
|
442
|
+
return typeof t == "string" ? qt(t.trim(), Wt.string) : typeof t == "object" && t !== null ? qt(t, Wt.object) : [null, void 0];
|
|
443
|
+
}, St = function(t, e) {
|
|
445
444
|
var n = st(t);
|
|
446
445
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
447
|
-
},
|
|
446
|
+
}, Ct = function(t) {
|
|
448
447
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
449
|
-
},
|
|
448
|
+
}, Gt = function(t, e) {
|
|
450
449
|
var n = st(t);
|
|
451
450
|
return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };
|
|
452
|
-
},
|
|
451
|
+
}, Qt = function() {
|
|
453
452
|
function t(e) {
|
|
454
453
|
this.parsed = ln(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
455
454
|
}
|
|
456
455
|
return t.prototype.isValid = function() {
|
|
457
456
|
return this.parsed !== null;
|
|
458
457
|
}, t.prototype.brightness = function() {
|
|
459
|
-
return
|
|
458
|
+
return _(Ct(this.rgba), 2);
|
|
460
459
|
}, t.prototype.isDark = function() {
|
|
461
|
-
return
|
|
460
|
+
return Ct(this.rgba) < 0.5;
|
|
462
461
|
}, t.prototype.isLight = function() {
|
|
463
|
-
return
|
|
462
|
+
return Ct(this.rgba) >= 0.5;
|
|
464
463
|
}, t.prototype.toHex = function() {
|
|
465
|
-
return e =
|
|
464
|
+
return e = Et(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;
|
|
466
465
|
var e, n, o, i, s, r;
|
|
467
466
|
}, t.prototype.toRgb = function() {
|
|
468
|
-
return
|
|
467
|
+
return Et(this.rgba);
|
|
469
468
|
}, t.prototype.toRgbString = function() {
|
|
470
|
-
return e =
|
|
469
|
+
return e = Et(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
471
470
|
var e, n, o, i, s;
|
|
472
471
|
}, t.prototype.toHsl = function() {
|
|
473
|
-
return
|
|
472
|
+
return zt(st(this.rgba));
|
|
474
473
|
}, t.prototype.toHslString = function() {
|
|
475
|
-
return e =
|
|
474
|
+
return e = zt(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 + "%)";
|
|
476
475
|
var e, n, o, i, s;
|
|
477
476
|
}, t.prototype.toHsv = function() {
|
|
478
|
-
return e =
|
|
477
|
+
return e = ge(this.rgba), { h: _(e.h), s: _(e.s), v: _(e.v), a: _(e.a, 3) };
|
|
479
478
|
var e;
|
|
480
479
|
}, t.prototype.invert = function() {
|
|
481
480
|
return P({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
482
481
|
var e;
|
|
483
482
|
}, t.prototype.saturate = function(e) {
|
|
484
|
-
return e === void 0 && (e = 0.1), P(
|
|
483
|
+
return e === void 0 && (e = 0.1), P(St(this.rgba, e));
|
|
485
484
|
}, t.prototype.desaturate = function(e) {
|
|
486
|
-
return e === void 0 && (e = 0.1), P(
|
|
485
|
+
return e === void 0 && (e = 0.1), P(St(this.rgba, -e));
|
|
487
486
|
}, t.prototype.grayscale = function() {
|
|
488
|
-
return P(
|
|
487
|
+
return P(St(this.rgba, -1));
|
|
489
488
|
}, t.prototype.lighten = function(e) {
|
|
490
|
-
return e === void 0 && (e = 0.1), P(
|
|
489
|
+
return e === void 0 && (e = 0.1), P(Gt(this.rgba, e));
|
|
491
490
|
}, t.prototype.darken = function(e) {
|
|
492
|
-
return e === void 0 && (e = 0.1), P(
|
|
491
|
+
return e === void 0 && (e = 0.1), P(Gt(this.rgba, -e));
|
|
493
492
|
}, t.prototype.rotate = function(e) {
|
|
494
493
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
495
494
|
}, t.prototype.alpha = function(e) {
|
|
496
|
-
return typeof e == "number" ? P({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) :
|
|
495
|
+
return typeof e == "number" ? P({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : _(this.rgba.a, 3);
|
|
497
496
|
var n;
|
|
498
497
|
}, t.prototype.hue = function(e) {
|
|
499
498
|
var n = st(this.rgba);
|
|
500
|
-
return typeof e == "number" ? P({ h: e, s: n.s, l: n.l, a: n.a }) :
|
|
499
|
+
return typeof e == "number" ? P({ h: e, s: n.s, l: n.l, a: n.a }) : _(n.h);
|
|
501
500
|
}, t.prototype.isEqual = function(e) {
|
|
502
501
|
return this.toHex() === P(e).toHex();
|
|
503
502
|
}, t;
|
|
504
503
|
}(), P = function(t) {
|
|
505
|
-
return t instanceof
|
|
504
|
+
return t instanceof Qt ? t : new Qt(t);
|
|
506
505
|
};
|
|
507
506
|
const dn = (t) => [
|
|
508
|
-
`background-color:${P((t == null ? void 0 : t.fill) ||
|
|
507
|
+
`background-color:${P((t == null ? void 0 : t.fill) || W.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? W.fillOpacity : t.fillOpacity).toHex()}`,
|
|
509
508
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
510
509
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
511
510
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
@@ -526,20 +525,20 @@ const dn = (t) => [
|
|
|
526
525
|
const c = new Set(s.map((l) => l.annotation.id));
|
|
527
526
|
Array.from(e).filter((l) => !c.has(l));
|
|
528
527
|
const f = s.map((l) => {
|
|
529
|
-
var
|
|
530
|
-
const p = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (
|
|
528
|
+
var A;
|
|
529
|
+
const p = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (A = l.state) != null && A.selected ? vt : W, h = d && d.paint(l, r) || p;
|
|
531
530
|
return `::highlight(_${l.annotation.id}) { ${dn(h)} }`;
|
|
532
531
|
});
|
|
533
532
|
t.innerHTML = f.join(`
|
|
534
533
|
`), CSS.highlights.clear(), s.forEach(({ annotation: l }) => {
|
|
535
|
-
const p = l.target.selector.map((
|
|
534
|
+
const p = l.target.selector.map((A) => A.range), h = new Highlight(...p);
|
|
536
535
|
CSS.highlights.set(`_${l.id}`, h);
|
|
537
536
|
}), e = c;
|
|
538
537
|
}
|
|
539
538
|
};
|
|
540
|
-
}, fn = (t, e, n) =>
|
|
541
|
-
var
|
|
542
|
-
function
|
|
539
|
+
}, fn = (t, e, n) => Xt(t, e, n, un());
|
|
540
|
+
var Jt = Object.prototype.hasOwnProperty;
|
|
541
|
+
function Dt(t, e) {
|
|
543
542
|
var n, o;
|
|
544
543
|
if (t === e) return !0;
|
|
545
544
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -547,13 +546,13 @@ function Vt(t, e) {
|
|
|
547
546
|
if (n === RegExp) return t.toString() === e.toString();
|
|
548
547
|
if (n === Array) {
|
|
549
548
|
if ((o = t.length) === e.length)
|
|
550
|
-
for (; o-- &&
|
|
549
|
+
for (; o-- && Dt(t[o], e[o]); ) ;
|
|
551
550
|
return o === -1;
|
|
552
551
|
}
|
|
553
552
|
if (!n || typeof t == "object") {
|
|
554
553
|
o = 0;
|
|
555
554
|
for (n in t)
|
|
556
|
-
if (
|
|
555
|
+
if (Jt.call(t, n) && ++o && !Jt.call(e, n) || !(n in e) || !Dt(t[n], e[n])) return !1;
|
|
557
556
|
return Object.keys(e).length === o;
|
|
558
557
|
}
|
|
559
558
|
}
|
|
@@ -572,17 +571,17 @@ const hn = (t, e) => {
|
|
|
572
571
|
e.remove();
|
|
573
572
|
},
|
|
574
573
|
redraw: (r, a, d, c, f) => {
|
|
575
|
-
const p = !(
|
|
574
|
+
const p = !(Dt(n, r) && f);
|
|
576
575
|
if (!c && !p) return;
|
|
577
|
-
p && (e.innerHTML = ""), [...r].sort((
|
|
578
|
-
const { annotation: { target: { created: E } } } =
|
|
576
|
+
p && (e.innerHTML = ""), [...r].sort((A, b) => {
|
|
577
|
+
const { annotation: { target: { created: E } } } = A, { annotation: { target: { created: m } } } = b;
|
|
579
578
|
return E && m ? E.getTime() - m.getTime() : 0;
|
|
580
|
-
}).forEach((
|
|
581
|
-
|
|
582
|
-
const E = hn(b, r), m = Fe(
|
|
579
|
+
}).forEach((A) => {
|
|
580
|
+
A.rects.map((b) => {
|
|
581
|
+
const E = hn(b, r), m = Fe(A, a, d, c, E);
|
|
583
582
|
if (p) {
|
|
584
583
|
const u = document.createElement("span");
|
|
585
|
-
u.className = "r6o-annotation", u.dataset.annotation =
|
|
584
|
+
u.className = "r6o-annotation", u.dataset.annotation = A.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 = P((m == null ? void 0 : m.fill) || W.fill).alpha((m == null ? void 0 : m.fillOpacity) === void 0 ? W.fillOpacity : m.fillOpacity).toHex(), m.underlineStyle && (u.style.borderStyle = m.underlineStyle), m.underlineColor && (u.style.borderColor = m.underlineColor), m.underlineThickness && (u.style.borderBottomWidth = `${m.underlineThickness}px`), m.underlineOffset && (u.style.paddingBottom = `${m.underlineOffset}px`), e.appendChild(u);
|
|
586
585
|
}
|
|
587
586
|
});
|
|
588
587
|
}), n = r;
|
|
@@ -591,12 +590,12 @@ const hn = (t, e) => {
|
|
|
591
590
|
r ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
592
591
|
}
|
|
593
592
|
};
|
|
594
|
-
}, pn = (t, e, n) =>
|
|
595
|
-
var
|
|
596
|
-
for (var
|
|
597
|
-
|
|
593
|
+
}, pn = (t, e, n) => Xt(t, e, n, gn(t));
|
|
594
|
+
var U = [];
|
|
595
|
+
for (var Lt = 0; Lt < 256; ++Lt)
|
|
596
|
+
U.push((Lt + 256).toString(16).slice(1));
|
|
598
597
|
function mn(t, e = 0) {
|
|
599
|
-
return (
|
|
598
|
+
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();
|
|
600
599
|
}
|
|
601
600
|
var ht, yn = new Uint8Array(16);
|
|
602
601
|
function bn() {
|
|
@@ -605,18 +604,18 @@ function bn() {
|
|
|
605
604
|
return ht(yn);
|
|
606
605
|
}
|
|
607
606
|
var wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
608
|
-
const
|
|
607
|
+
const Zt = {
|
|
609
608
|
randomUUID: wn
|
|
610
609
|
};
|
|
611
|
-
function
|
|
612
|
-
if (
|
|
613
|
-
return
|
|
610
|
+
function me(t, e, n) {
|
|
611
|
+
if (Zt.randomUUID && !e && !t)
|
|
612
|
+
return Zt.randomUUID();
|
|
614
613
|
t = t || {};
|
|
615
614
|
var o = t.random || (t.rng || bn)();
|
|
616
615
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, mn(o);
|
|
617
616
|
}
|
|
618
|
-
var
|
|
619
|
-
function
|
|
617
|
+
var te = Object.prototype.hasOwnProperty;
|
|
618
|
+
function q(t, e) {
|
|
620
619
|
var n, o;
|
|
621
620
|
if (t === e) return !0;
|
|
622
621
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -624,52 +623,52 @@ function G(t, e) {
|
|
|
624
623
|
if (n === RegExp) return t.toString() === e.toString();
|
|
625
624
|
if (n === Array) {
|
|
626
625
|
if ((o = t.length) === e.length)
|
|
627
|
-
for (; o-- &&
|
|
626
|
+
for (; o-- && q(t[o], e[o]); ) ;
|
|
628
627
|
return o === -1;
|
|
629
628
|
}
|
|
630
629
|
if (!n || typeof t == "object") {
|
|
631
630
|
o = 0;
|
|
632
631
|
for (n in t)
|
|
633
|
-
if (
|
|
632
|
+
if (te.call(t, n) && ++o && !te.call(e, n) || !(n in e) || !q(t[n], e[n])) return !1;
|
|
634
633
|
return Object.keys(e).length === o;
|
|
635
634
|
}
|
|
636
635
|
}
|
|
637
636
|
return t !== t && e !== e;
|
|
638
637
|
}
|
|
639
|
-
function
|
|
638
|
+
function Ot() {
|
|
640
639
|
}
|
|
641
640
|
function vn(t, e) {
|
|
642
641
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
643
642
|
}
|
|
644
|
-
const
|
|
645
|
-
function
|
|
643
|
+
const G = [];
|
|
644
|
+
function $t(t, e = Ot) {
|
|
646
645
|
let n;
|
|
647
646
|
const o = /* @__PURE__ */ new Set();
|
|
648
647
|
function i(a) {
|
|
649
648
|
if (vn(t, a) && (t = a, n)) {
|
|
650
|
-
const d = !
|
|
649
|
+
const d = !G.length;
|
|
651
650
|
for (const c of o)
|
|
652
|
-
c[1](),
|
|
651
|
+
c[1](), G.push(c, t);
|
|
653
652
|
if (d) {
|
|
654
|
-
for (let c = 0; c <
|
|
655
|
-
|
|
656
|
-
|
|
653
|
+
for (let c = 0; c < G.length; c += 2)
|
|
654
|
+
G[c][0](G[c + 1]);
|
|
655
|
+
G.length = 0;
|
|
657
656
|
}
|
|
658
657
|
}
|
|
659
658
|
}
|
|
660
659
|
function s(a) {
|
|
661
660
|
i(a(t));
|
|
662
661
|
}
|
|
663
|
-
function r(a, d =
|
|
662
|
+
function r(a, d = Ot) {
|
|
664
663
|
const c = [a, d];
|
|
665
|
-
return o.add(c), o.size === 1 && (n = e(i, s) ||
|
|
664
|
+
return o.add(c), o.size === 1 && (n = e(i, s) || Ot), a(t), () => {
|
|
666
665
|
o.delete(c), o.size === 0 && n && (n(), n = null);
|
|
667
666
|
};
|
|
668
667
|
}
|
|
669
668
|
return { set: i, update: s, subscribe: r };
|
|
670
669
|
}
|
|
671
670
|
const An = (t) => {
|
|
672
|
-
const { subscribe: e, set: n } =
|
|
671
|
+
const { subscribe: e, set: n } = $t();
|
|
673
672
|
let o;
|
|
674
673
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
675
674
|
if (o) {
|
|
@@ -687,51 +686,51 @@ const An = (t) => {
|
|
|
687
686
|
};
|
|
688
687
|
var xn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(xn || {});
|
|
689
688
|
const gt = { selected: [] }, En = (t, e, n) => {
|
|
690
|
-
const { subscribe: o, set: i } =
|
|
689
|
+
const { subscribe: o, set: i } = $t(gt);
|
|
691
690
|
let s = e, r = gt;
|
|
692
|
-
o((
|
|
691
|
+
o((A) => r = A);
|
|
693
692
|
const a = () => {
|
|
694
|
-
|
|
693
|
+
q(r, gt) || i(gt);
|
|
695
694
|
}, d = () => {
|
|
696
|
-
var
|
|
697
|
-
return ((
|
|
698
|
-
}, c = (
|
|
695
|
+
var A;
|
|
696
|
+
return ((A = r.selected) == null ? void 0 : A.length) === 0;
|
|
697
|
+
}, c = (A) => {
|
|
699
698
|
if (d())
|
|
700
699
|
return !1;
|
|
701
|
-
const b = typeof
|
|
700
|
+
const b = typeof A == "string" ? A : A.id;
|
|
702
701
|
return r.selected.some((E) => E.id === b);
|
|
703
|
-
}, f = (
|
|
704
|
-
const E = t.getAnnotation(
|
|
702
|
+
}, f = (A, b) => {
|
|
703
|
+
const E = t.getAnnotation(A);
|
|
705
704
|
if (!E) {
|
|
706
|
-
console.warn("Invalid selection: " +
|
|
705
|
+
console.warn("Invalid selection: " + A);
|
|
707
706
|
return;
|
|
708
707
|
}
|
|
709
|
-
switch (
|
|
708
|
+
switch (ee(E, s)) {
|
|
710
709
|
case "EDIT":
|
|
711
|
-
i({ selected: [{ id:
|
|
710
|
+
i({ selected: [{ id: A, editable: !0 }], event: b });
|
|
712
711
|
break;
|
|
713
712
|
case "SELECT":
|
|
714
|
-
i({ selected: [{ id:
|
|
713
|
+
i({ selected: [{ id: A }], event: b });
|
|
715
714
|
break;
|
|
716
715
|
default:
|
|
717
716
|
i({ selected: [], event: b });
|
|
718
717
|
}
|
|
719
|
-
}, l = (
|
|
720
|
-
const E = Array.isArray(
|
|
718
|
+
}, l = (A, b) => {
|
|
719
|
+
const E = Array.isArray(A) ? A : [A], m = E.map((u) => t.getAnnotation(u)).filter((u) => !!u);
|
|
721
720
|
i({
|
|
722
721
|
selected: m.map((u) => {
|
|
723
|
-
const y = b === void 0 ?
|
|
722
|
+
const y = b === void 0 ? ee(u, s) === "EDIT" : b;
|
|
724
723
|
return { id: u.id, editable: y };
|
|
725
724
|
})
|
|
726
|
-
}), m.length !== E.length && console.warn("Invalid selection",
|
|
727
|
-
}, p = (
|
|
725
|
+
}), m.length !== E.length && console.warn("Invalid selection", A);
|
|
726
|
+
}, p = (A) => {
|
|
728
727
|
if (d())
|
|
729
728
|
return !1;
|
|
730
729
|
const { selected: b } = r;
|
|
731
|
-
b.some(({ id: E }) =>
|
|
732
|
-
}, h = (
|
|
730
|
+
b.some(({ id: E }) => A.includes(E)) && i({ selected: b.filter(({ id: E }) => !A.includes(E)) });
|
|
731
|
+
}, h = (A) => s = A;
|
|
733
732
|
return t.observe(
|
|
734
|
-
({ changes:
|
|
733
|
+
({ changes: A }) => p((A.deleted || []).map((b) => b.id))
|
|
735
734
|
), {
|
|
736
735
|
get event() {
|
|
737
736
|
return r ? r.event : null;
|
|
@@ -750,12 +749,12 @@ const gt = { selected: [] }, En = (t, e, n) => {
|
|
|
750
749
|
subscribe: o,
|
|
751
750
|
userSelect: f
|
|
752
751
|
};
|
|
753
|
-
},
|
|
754
|
-
var
|
|
755
|
-
for (var
|
|
756
|
-
|
|
752
|
+
}, ee = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT";
|
|
753
|
+
var D = [];
|
|
754
|
+
for (var Tt = 0; Tt < 256; ++Tt)
|
|
755
|
+
D.push((Tt + 256).toString(16).slice(1));
|
|
757
756
|
function Sn(t, e = 0) {
|
|
758
|
-
return (
|
|
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();
|
|
759
758
|
}
|
|
760
759
|
var pt, Cn = new Uint8Array(16);
|
|
761
760
|
function Ln() {
|
|
@@ -764,17 +763,17 @@ function Ln() {
|
|
|
764
763
|
return pt(Cn);
|
|
765
764
|
}
|
|
766
765
|
var On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
767
|
-
const
|
|
766
|
+
const ne = {
|
|
768
767
|
randomUUID: On
|
|
769
768
|
};
|
|
770
|
-
function
|
|
771
|
-
if (
|
|
772
|
-
return
|
|
769
|
+
function ye(t, e, n) {
|
|
770
|
+
if (ne.randomUUID && !e && !t)
|
|
771
|
+
return ne.randomUUID();
|
|
773
772
|
t = t || {};
|
|
774
773
|
var o = t.random || (t.rng || Ln)();
|
|
775
774
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Sn(o);
|
|
776
775
|
}
|
|
777
|
-
const
|
|
776
|
+
const Rt = (t) => {
|
|
778
777
|
const e = (n) => {
|
|
779
778
|
const o = { ...n };
|
|
780
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;
|
|
@@ -784,8 +783,8 @@ const Mt = (t) => {
|
|
|
784
783
|
bodies: (t.bodies || []).map(e),
|
|
785
784
|
target: e(t.target)
|
|
786
785
|
};
|
|
787
|
-
},
|
|
788
|
-
id:
|
|
786
|
+
}, Bo = (t, e, n, o) => ({
|
|
787
|
+
id: ye(),
|
|
789
788
|
annotation: typeof t == "string" ? t : t.id,
|
|
790
789
|
created: n || /* @__PURE__ */ new Date(),
|
|
791
790
|
creator: o,
|
|
@@ -798,8 +797,8 @@ const Mt = (t) => {
|
|
|
798
797
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
799
798
|
}, Mn = (t, e) => e.bodies.map((n) => {
|
|
800
799
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
801
|
-
return { newBody: n, oldBody: o && !
|
|
802
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Bn = (t, e) => !
|
|
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 })), Bn = (t, e) => !q(t.target, e.target), be = (t, e) => {
|
|
803
802
|
const n = Tn(t, e), o = Rn(t, e), i = Mn(t, e);
|
|
804
803
|
return {
|
|
805
804
|
oldValue: t,
|
|
@@ -844,16 +843,16 @@ const kn = (t, e) => {
|
|
|
844
843
|
...(t.updated || []).filter(({ newValue: l }) => !s.has(l.id)).map((l) => {
|
|
845
844
|
const { oldValue: p, newValue: h } = l;
|
|
846
845
|
if (r.has(h.id)) {
|
|
847
|
-
const
|
|
848
|
-
return
|
|
846
|
+
const A = e.updated.find((b) => b.oldValue.id === h.id).newValue;
|
|
847
|
+
return be(p, A);
|
|
849
848
|
} else
|
|
850
849
|
return l;
|
|
851
850
|
}),
|
|
852
851
|
...(e.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
|
|
853
852
|
];
|
|
854
853
|
return { created: d, deleted: c, updated: f };
|
|
855
|
-
},
|
|
856
|
-
const e = t.id === void 0 ?
|
|
854
|
+
}, Mt = (t) => {
|
|
855
|
+
const e = t.id === void 0 ? ye() : t.id;
|
|
857
856
|
return {
|
|
858
857
|
...t,
|
|
859
858
|
id: e,
|
|
@@ -866,14 +865,14 @@ const kn = (t, e) => {
|
|
|
866
865
|
annotation: e
|
|
867
866
|
}
|
|
868
867
|
};
|
|
869
|
-
},
|
|
868
|
+
}, Nn = (t) => t.id !== void 0, _n = () => {
|
|
870
869
|
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (g, w = {}) => {
|
|
871
870
|
n.push({ onChange: g, options: w });
|
|
872
871
|
}, i = (g) => {
|
|
873
|
-
const w = n.findIndex((
|
|
872
|
+
const w = n.findIndex((v) => v.onChange == g);
|
|
874
873
|
w > -1 && n.splice(w, 1);
|
|
875
874
|
}, s = (g, w) => {
|
|
876
|
-
const
|
|
875
|
+
const v = {
|
|
877
876
|
origin: g,
|
|
878
877
|
changes: {
|
|
879
878
|
created: w.created || [],
|
|
@@ -883,40 +882,40 @@ const kn = (t, e) => {
|
|
|
883
882
|
state: [...t.values()]
|
|
884
883
|
};
|
|
885
884
|
n.forEach((O) => {
|
|
886
|
-
kn(O,
|
|
885
|
+
kn(O, v) && O.onChange(v);
|
|
887
886
|
});
|
|
888
887
|
}, r = (g, w = k.LOCAL) => {
|
|
889
888
|
if (g.id && t.get(g.id))
|
|
890
889
|
throw Error(`Cannot add annotation ${g.id} - exists already`);
|
|
891
890
|
{
|
|
892
|
-
const
|
|
893
|
-
t.set(
|
|
891
|
+
const v = Mt(g);
|
|
892
|
+
t.set(v.id, v), v.bodies.forEach((O) => e.set(O.id, v.id)), s(w, { created: [v] });
|
|
894
893
|
}
|
|
895
894
|
}, a = (g, w) => {
|
|
896
|
-
const
|
|
895
|
+
const v = Mt(typeof g == "string" ? w : g), O = typeof g == "string" ? g : g.id, B = O && t.get(O);
|
|
897
896
|
if (B) {
|
|
898
|
-
const M =
|
|
899
|
-
return O ===
|
|
897
|
+
const M = be(B, v);
|
|
898
|
+
return O === v.id ? t.set(O, v) : (t.delete(O), t.set(v.id, v)), B.bodies.forEach((K) => e.delete(K.id)), v.bodies.forEach((K) => e.set(K.id, v.id)), M;
|
|
900
899
|
} else
|
|
901
900
|
console.warn(`Cannot update annotation ${O} - does not exist`);
|
|
902
|
-
}, d = (g, w = k.LOCAL,
|
|
903
|
-
const O =
|
|
901
|
+
}, d = (g, w = k.LOCAL, v = k.LOCAL) => {
|
|
902
|
+
const O = Nn(w) ? v : w, B = a(g, w);
|
|
904
903
|
B && s(O, { updated: [B] });
|
|
905
904
|
}, c = (g, w = k.LOCAL) => {
|
|
906
|
-
const
|
|
905
|
+
const v = g.reduce((O, B) => {
|
|
907
906
|
const M = a(B);
|
|
908
907
|
return M ? [...O, M] : O;
|
|
909
908
|
}, []);
|
|
910
|
-
|
|
909
|
+
v.length > 0 && s(w, { updated: v });
|
|
911
910
|
}, f = (g, w = k.LOCAL) => {
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
911
|
+
const v = t.get(g.annotation);
|
|
912
|
+
if (v) {
|
|
914
913
|
const O = {
|
|
915
|
-
...
|
|
916
|
-
bodies: [...
|
|
914
|
+
...v,
|
|
915
|
+
bodies: [...v.bodies, g]
|
|
917
916
|
};
|
|
918
|
-
t.set(
|
|
919
|
-
oldValue:
|
|
917
|
+
t.set(v.id, O), e.set(g.id, O.id), s(w, { updated: [{
|
|
918
|
+
oldValue: v,
|
|
920
919
|
newValue: O,
|
|
921
920
|
bodiesCreated: [g]
|
|
922
921
|
}] });
|
|
@@ -925,44 +924,44 @@ const kn = (t, e) => {
|
|
|
925
924
|
}, l = () => [...t.values()], p = (g = k.LOCAL) => {
|
|
926
925
|
const w = [...t.values()];
|
|
927
926
|
t.clear(), e.clear(), s(g, { deleted: w });
|
|
928
|
-
}, h = (g, w = !0,
|
|
929
|
-
const O = g.map(
|
|
927
|
+
}, h = (g, w = !0, v = k.LOCAL) => {
|
|
928
|
+
const O = g.map(Mt);
|
|
930
929
|
if (w) {
|
|
931
930
|
const B = [...t.values()];
|
|
932
931
|
t.clear(), e.clear(), O.forEach((M) => {
|
|
933
|
-
t.set(M.id, M), M.bodies.forEach((
|
|
934
|
-
}), s(
|
|
932
|
+
t.set(M.id, M), M.bodies.forEach((K) => e.set(K.id, M.id));
|
|
933
|
+
}), s(v, { created: O, deleted: B });
|
|
935
934
|
} else {
|
|
936
|
-
const B = g.reduce((M,
|
|
937
|
-
const
|
|
938
|
-
return
|
|
935
|
+
const B = g.reduce((M, K) => {
|
|
936
|
+
const Y = K.id && t.get(K.id);
|
|
937
|
+
return Y ? [...M, Y] : M;
|
|
939
938
|
}, []);
|
|
940
939
|
if (B.length > 0)
|
|
941
940
|
throw Error(`Bulk insert would overwrite the following annotations: ${B.map((M) => M.id).join(", ")}`);
|
|
942
941
|
O.forEach((M) => {
|
|
943
|
-
t.set(M.id, M), M.bodies.forEach((
|
|
944
|
-
}), s(
|
|
942
|
+
t.set(M.id, M), M.bodies.forEach((K) => e.set(K.id, M.id));
|
|
943
|
+
}), s(v, { created: O });
|
|
945
944
|
}
|
|
946
|
-
},
|
|
947
|
-
const w = typeof g == "string" ? g : g.id,
|
|
948
|
-
if (
|
|
949
|
-
return t.delete(w),
|
|
945
|
+
}, A = (g) => {
|
|
946
|
+
const w = typeof g == "string" ? g : g.id, v = t.get(w);
|
|
947
|
+
if (v)
|
|
948
|
+
return t.delete(w), v.bodies.forEach((O) => e.delete(O.id)), v;
|
|
950
949
|
console.warn(`Attempt to delete missing annotation: ${w}`);
|
|
951
950
|
}, b = (g, w = k.LOCAL) => {
|
|
952
|
-
const
|
|
953
|
-
|
|
951
|
+
const v = A(g);
|
|
952
|
+
v && s(w, { deleted: [v] });
|
|
954
953
|
}, E = (g, w = k.LOCAL) => {
|
|
955
|
-
const
|
|
956
|
-
const M =
|
|
954
|
+
const v = g.reduce((O, B) => {
|
|
955
|
+
const M = A(B);
|
|
957
956
|
return M ? [...O, M] : O;
|
|
958
957
|
}, []);
|
|
959
|
-
|
|
958
|
+
v.length > 0 && s(w, { deleted: v });
|
|
960
959
|
}, m = (g) => {
|
|
961
960
|
const w = t.get(g.annotation);
|
|
962
961
|
if (w) {
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
e.delete(
|
|
962
|
+
const v = w.bodies.find((O) => O.id === g.id);
|
|
963
|
+
if (v) {
|
|
964
|
+
e.delete(v.id);
|
|
966
965
|
const O = {
|
|
967
966
|
...w,
|
|
968
967
|
bodies: w.bodies.filter((B) => B.id !== g.id)
|
|
@@ -970,65 +969,65 @@ const kn = (t, e) => {
|
|
|
970
969
|
return t.set(w.id, O), {
|
|
971
970
|
oldValue: w,
|
|
972
971
|
newValue: O,
|
|
973
|
-
bodiesDeleted: [
|
|
972
|
+
bodiesDeleted: [v]
|
|
974
973
|
};
|
|
975
974
|
} else
|
|
976
975
|
console.warn(`Attempt to delete missing body ${g.id} from annotation ${g.annotation}`);
|
|
977
976
|
} else
|
|
978
977
|
console.warn(`Attempt to delete body from missing annotation ${g.annotation}`);
|
|
979
978
|
}, u = (g, w = k.LOCAL) => {
|
|
980
|
-
const
|
|
981
|
-
|
|
979
|
+
const v = m(g);
|
|
980
|
+
v && s(w, { updated: [v] });
|
|
982
981
|
}, y = (g, w = k.LOCAL) => {
|
|
983
|
-
const
|
|
984
|
-
|
|
982
|
+
const v = g.map((O) => m(O)).filter(Boolean);
|
|
983
|
+
v.length > 0 && s(w, { updated: v });
|
|
985
984
|
}, C = (g) => {
|
|
986
985
|
const w = t.get(g);
|
|
987
986
|
return w ? { ...w } : void 0;
|
|
988
|
-
},
|
|
987
|
+
}, x = (g) => {
|
|
989
988
|
const w = e.get(g);
|
|
990
989
|
if (w) {
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
return
|
|
990
|
+
const v = C(w).bodies.find((O) => O.id === g);
|
|
991
|
+
if (v)
|
|
992
|
+
return v;
|
|
994
993
|
console.error(`Store integrity error: body ${g} in index, but not in annotation`);
|
|
995
994
|
} else
|
|
996
995
|
console.warn(`Attempt to retrieve missing body: ${g}`);
|
|
997
996
|
}, L = (g, w) => {
|
|
998
997
|
if (g.annotation !== w.annotation)
|
|
999
998
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
1000
|
-
const
|
|
1001
|
-
if (
|
|
1002
|
-
const O =
|
|
1003
|
-
...
|
|
1004
|
-
bodies:
|
|
999
|
+
const v = t.get(g.annotation);
|
|
1000
|
+
if (v) {
|
|
1001
|
+
const O = v.bodies.find((M) => M.id === g.id), B = {
|
|
1002
|
+
...v,
|
|
1003
|
+
bodies: v.bodies.map((M) => M.id === O.id ? w : M)
|
|
1005
1004
|
};
|
|
1006
|
-
return t.set(
|
|
1007
|
-
oldValue:
|
|
1005
|
+
return t.set(v.id, B), O.id !== w.id && (e.delete(O.id), e.set(w.id, B.id)), {
|
|
1006
|
+
oldValue: v,
|
|
1008
1007
|
newValue: B,
|
|
1009
1008
|
bodiesUpdated: [{ oldBody: O, newBody: w }]
|
|
1010
1009
|
};
|
|
1011
1010
|
} else
|
|
1012
1011
|
console.warn(`Attempt to add body to missing annotation ${g.annotation}`);
|
|
1013
|
-
}, R = (g, w,
|
|
1012
|
+
}, R = (g, w, v = k.LOCAL) => {
|
|
1014
1013
|
const O = L(g, w);
|
|
1015
|
-
O && s(
|
|
1014
|
+
O && s(v, { updated: [O] });
|
|
1016
1015
|
}, T = (g, w = k.LOCAL) => {
|
|
1017
|
-
const
|
|
1018
|
-
s(w, { updated:
|
|
1016
|
+
const v = g.map((O) => L({ id: O.id, annotation: O.annotation }, O)).filter(Boolean);
|
|
1017
|
+
s(w, { updated: v });
|
|
1019
1018
|
}, S = (g) => {
|
|
1020
1019
|
const w = t.get(g.annotation);
|
|
1021
1020
|
if (w) {
|
|
1022
|
-
const
|
|
1021
|
+
const v = {
|
|
1023
1022
|
...w,
|
|
1024
1023
|
target: {
|
|
1025
1024
|
...w.target,
|
|
1026
1025
|
...g
|
|
1027
1026
|
}
|
|
1028
1027
|
};
|
|
1029
|
-
return t.set(w.id,
|
|
1028
|
+
return t.set(w.id, v), {
|
|
1030
1029
|
oldValue: w,
|
|
1031
|
-
newValue:
|
|
1030
|
+
newValue: v,
|
|
1032
1031
|
targetUpdated: {
|
|
1033
1032
|
oldTarget: w.target,
|
|
1034
1033
|
newTarget: g
|
|
@@ -1047,21 +1046,21 @@ const kn = (t, e) => {
|
|
|
1047
1046
|
bulkUpdateAnnotation: c,
|
|
1048
1047
|
bulkUpdateBodies: T,
|
|
1049
1048
|
bulkUpdateTargets: (g, w = k.LOCAL) => {
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1049
|
+
const v = g.map((O) => S(O)).filter(Boolean);
|
|
1050
|
+
v.length > 0 && s(w, { updated: v });
|
|
1052
1051
|
},
|
|
1053
1052
|
clear: p,
|
|
1054
1053
|
deleteAnnotation: b,
|
|
1055
1054
|
deleteBody: u,
|
|
1056
1055
|
getAnnotation: C,
|
|
1057
|
-
getBody:
|
|
1056
|
+
getBody: x,
|
|
1058
1057
|
observe: o,
|
|
1059
1058
|
unobserve: i,
|
|
1060
1059
|
updateAnnotation: d,
|
|
1061
1060
|
updateBody: R,
|
|
1062
1061
|
updateTarget: (g, w = k.LOCAL) => {
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1062
|
+
const v = S(g);
|
|
1063
|
+
v && s(w, { updated: [v] });
|
|
1065
1064
|
}
|
|
1066
1065
|
};
|
|
1067
1066
|
};
|
|
@@ -1084,41 +1083,41 @@ const Dn = 250, Vn = (t) => {
|
|
|
1084
1083
|
let o = -1, i = !1, s = 0;
|
|
1085
1084
|
const r = (h) => {
|
|
1086
1085
|
if (!i) {
|
|
1087
|
-
const { changes:
|
|
1086
|
+
const { changes: A } = h, b = performance.now();
|
|
1088
1087
|
if (b - s > Dn)
|
|
1089
|
-
n.splice(o + 1), n.push(
|
|
1088
|
+
n.splice(o + 1), n.push(A), o = n.length - 1;
|
|
1090
1089
|
else {
|
|
1091
1090
|
const E = n.length - 1;
|
|
1092
|
-
n[E] = In(n[E],
|
|
1091
|
+
n[E] = In(n[E], A);
|
|
1093
1092
|
}
|
|
1094
1093
|
s = b;
|
|
1095
1094
|
}
|
|
1096
1095
|
i = !1;
|
|
1097
1096
|
};
|
|
1098
1097
|
t.observe(r, { origin: k.LOCAL });
|
|
1099
|
-
const a = (h) => h && h.length > 0 && t.bulkDeleteAnnotation(h), d = (h) => h && h.length > 0 && t.bulkAddAnnotation(h, !1), c = (h) => h && h.length > 0 && t.bulkUpdateAnnotation(h.map(({ oldValue:
|
|
1098
|
+
const a = (h) => h && h.length > 0 && t.bulkDeleteAnnotation(h), d = (h) => h && h.length > 0 && t.bulkAddAnnotation(h, !1), c = (h) => h && h.length > 0 && t.bulkUpdateAnnotation(h.map(({ oldValue: A }) => A)), f = (h) => h && h.length > 0 && t.bulkUpdateAnnotation(h.map(({ newValue: A }) => A)), l = (h) => h && h.length > 0 && t.bulkAddAnnotation(h, !1), p = (h) => h && h.length > 0 && t.bulkDeleteAnnotation(h);
|
|
1100
1099
|
return {
|
|
1101
1100
|
canRedo: () => n.length - 1 > o,
|
|
1102
1101
|
canUndo: () => o > -1,
|
|
1103
1102
|
destroy: () => t.unobserve(r),
|
|
1104
|
-
on: (h,
|
|
1103
|
+
on: (h, A) => e.on(h, A),
|
|
1105
1104
|
redo: () => {
|
|
1106
1105
|
if (n.length - 1 > o) {
|
|
1107
1106
|
i = !0;
|
|
1108
|
-
const { created: h, updated:
|
|
1109
|
-
d(h), f(
|
|
1107
|
+
const { created: h, updated: A, deleted: b } = n[o + 1];
|
|
1108
|
+
d(h), f(A), p(b), e.emit("redo", n[o + 1]), o += 1;
|
|
1110
1109
|
}
|
|
1111
1110
|
},
|
|
1112
1111
|
undo: () => {
|
|
1113
1112
|
if (o > -1) {
|
|
1114
1113
|
i = !0;
|
|
1115
|
-
const { created: h, updated:
|
|
1116
|
-
a(h), c(
|
|
1114
|
+
const { created: h, updated: A, deleted: b } = n[o];
|
|
1115
|
+
a(h), c(A), l(b), e.emit("undo", n[o]), o -= 1;
|
|
1117
1116
|
}
|
|
1118
1117
|
}
|
|
1119
1118
|
};
|
|
1120
1119
|
}, Kn = () => {
|
|
1121
|
-
const { subscribe: t, set: e } =
|
|
1120
|
+
const { subscribe: t, set: e } = $t([]);
|
|
1122
1121
|
return {
|
|
1123
1122
|
subscribe: t,
|
|
1124
1123
|
set: e
|
|
@@ -1138,7 +1137,7 @@ const Dn = 250, Vn = (t) => {
|
|
|
1138
1137
|
d.has(b) && setTimeout(() => {
|
|
1139
1138
|
d.get(b).forEach((u) => {
|
|
1140
1139
|
if (n) {
|
|
1141
|
-
const y = Array.isArray(E) ? E.map((
|
|
1140
|
+
const y = Array.isArray(E) ? E.map((x) => n.serialize(x)) : n.serialize(E), C = m ? m instanceof PointerEvent ? m : n.serialize(m) : void 0;
|
|
1142
1141
|
u(y, C);
|
|
1143
1142
|
} else
|
|
1144
1143
|
u(E, m);
|
|
@@ -1152,13 +1151,13 @@ const Dn = 250, Vn = (t) => {
|
|
|
1152
1151
|
else if (c.length > 0 && b.length === 0)
|
|
1153
1152
|
c.forEach((E) => {
|
|
1154
1153
|
const m = r.getAnnotation(E.id);
|
|
1155
|
-
m && !
|
|
1154
|
+
m && !q(m, E) && h("updateAnnotation", m, E);
|
|
1156
1155
|
}), c = [];
|
|
1157
1156
|
else {
|
|
1158
1157
|
const E = new Set(c.map((u) => u.id)), m = new Set(b.map(({ id: u }) => u));
|
|
1159
1158
|
c.filter((u) => !m.has(u.id)).forEach((u) => {
|
|
1160
1159
|
const y = r.getAnnotation(u.id);
|
|
1161
|
-
y && !
|
|
1160
|
+
y && !q(y, u) && h("updateAnnotation", y, u);
|
|
1162
1161
|
}), c = [
|
|
1163
1162
|
// Remove annotations that were deselected
|
|
1164
1163
|
...c.filter((u) => m.has(u.id)),
|
|
@@ -1177,8 +1176,8 @@ const Dn = 250, Vn = (t) => {
|
|
|
1177
1176
|
...u.bodiesDeleted || [],
|
|
1178
1177
|
...u.bodiesUpdated || []
|
|
1179
1178
|
].length > 0).forEach(({ oldValue: u, newValue: y }) => {
|
|
1180
|
-
const C = c.find((
|
|
1181
|
-
c = c.map((
|
|
1179
|
+
const C = c.find((x) => x.id === u.id) || u;
|
|
1180
|
+
c = c.map((x) => x.id === u.id ? y : x), h("updateAnnotation", y, C);
|
|
1182
1181
|
});
|
|
1183
1182
|
}, { origin: k.LOCAL }), r.observe((b) => {
|
|
1184
1183
|
if (c) {
|
|
@@ -1186,11 +1185,11 @@ const Dn = 250, Vn = (t) => {
|
|
|
1186
1185
|
m.length > 0 && (c = c.map((u) => m.find((C) => C.id === u.id) || u));
|
|
1187
1186
|
}
|
|
1188
1187
|
}, { origin: k.REMOTE });
|
|
1189
|
-
const
|
|
1188
|
+
const A = (b) => (E) => {
|
|
1190
1189
|
const { updated: m } = E;
|
|
1191
1190
|
b ? (m || []).forEach((u) => h("updateAnnotation", u.oldValue, u.newValue)) : (m || []).forEach((u) => h("updateAnnotation", u.newValue, u.oldValue));
|
|
1192
1191
|
};
|
|
1193
|
-
return e.on("undo",
|
|
1192
|
+
return e.on("undo", A(!0)), e.on("redo", A(!1)), { on: l, off: p, emit: h };
|
|
1194
1193
|
}, Xn = (t) => (e) => e.reduce((n, o) => {
|
|
1195
1194
|
const { parsed: i, error: s } = t.parse(o);
|
|
1196
1195
|
return s ? {
|
|
@@ -1208,7 +1207,7 @@ const Dn = 250, Vn = (t) => {
|
|
|
1208
1207
|
const { parsed: u, error: y } = n.parse(m);
|
|
1209
1208
|
u ? o.addAnnotation(u, k.REMOTE) : console.error(y);
|
|
1210
1209
|
} else
|
|
1211
|
-
o.addAnnotation(
|
|
1210
|
+
o.addAnnotation(Rt(m), k.REMOTE);
|
|
1212
1211
|
}, r = () => i.clear(), a = () => o.clear(), d = (m) => {
|
|
1213
1212
|
const u = o.getAnnotation(m);
|
|
1214
1213
|
return n && u ? n.serialize(u) : u;
|
|
@@ -1228,11 +1227,11 @@ const Dn = 250, Vn = (t) => {
|
|
|
1228
1227
|
}
|
|
1229
1228
|
}, h = (m, u = !0) => {
|
|
1230
1229
|
if (n) {
|
|
1231
|
-
const y = n.parseAll || Xn(n), { parsed: C, failed:
|
|
1232
|
-
|
|
1230
|
+
const y = n.parseAll || Xn(n), { parsed: C, failed: x } = y(m);
|
|
1231
|
+
x.length > 0 && console.warn(`Discarded ${x.length} invalid annotations`, x), o.bulkAddAnnotation(C, u, k.REMOTE);
|
|
1233
1232
|
} else
|
|
1234
|
-
o.bulkAddAnnotation(m.map(
|
|
1235
|
-
},
|
|
1233
|
+
o.bulkAddAnnotation(m.map(Rt), u, k.REMOTE);
|
|
1234
|
+
}, A = (m, u) => {
|
|
1236
1235
|
m ? i.setSelected(m, u) : i.clear();
|
|
1237
1236
|
}, b = (m) => {
|
|
1238
1237
|
i.clear(), i.setUserSelectAction(m);
|
|
@@ -1242,7 +1241,7 @@ const Dn = 250, Vn = (t) => {
|
|
|
1242
1241
|
return o.updateAnnotation(u), y;
|
|
1243
1242
|
} else {
|
|
1244
1243
|
const u = o.getAnnotation(m.id);
|
|
1245
|
-
return o.updateAnnotation(
|
|
1244
|
+
return o.updateAnnotation(Rt(m)), u;
|
|
1246
1245
|
}
|
|
1247
1246
|
};
|
|
1248
1247
|
return {
|
|
@@ -1258,7 +1257,7 @@ const Dn = 250, Vn = (t) => {
|
|
|
1258
1257
|
redo: e.redo,
|
|
1259
1258
|
removeAnnotation: p,
|
|
1260
1259
|
setAnnotations: h,
|
|
1261
|
-
setSelected:
|
|
1260
|
+
setSelected: A,
|
|
1262
1261
|
setUserSelectAction: b,
|
|
1263
1262
|
undo: e.undo,
|
|
1264
1263
|
updateAnnotation: E
|
|
@@ -1288,7 +1287,7 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1288
1287
|
n = (n << 5) - n + s, n |= 0;
|
|
1289
1288
|
}
|
|
1290
1289
|
return `${n}`;
|
|
1291
|
-
},
|
|
1290
|
+
}, we = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Gn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1292
1291
|
const { id: o, type: i, purpose: s, value: r, created: a, modified: d, creator: c, ...f } = n;
|
|
1293
1292
|
return {
|
|
1294
1293
|
id: o || `temp-${qn(n)}`,
|
|
@@ -1296,7 +1295,7 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1296
1295
|
type: i,
|
|
1297
1296
|
purpose: s,
|
|
1298
1297
|
value: r,
|
|
1299
|
-
creator:
|
|
1298
|
+
creator: we(c),
|
|
1300
1299
|
created: a ? new Date(a) : void 0,
|
|
1301
1300
|
updated: d ? new Date(d) : void 0,
|
|
1302
1301
|
...f
|
|
@@ -1311,7 +1310,7 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1311
1310
|
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
1312
1311
|
});
|
|
1313
1312
|
Fn();
|
|
1314
|
-
const
|
|
1313
|
+
const ko = (t, e) => ({
|
|
1315
1314
|
parse: (n) => to(n),
|
|
1316
1315
|
serialize: (n) => eo(n, t, e)
|
|
1317
1316
|
}), Jn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, Zn = (t) => {
|
|
@@ -1325,7 +1324,7 @@ const Io = (t, e) => ({
|
|
|
1325
1324
|
if (r.length === 0)
|
|
1326
1325
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1327
1326
|
const a = {
|
|
1328
|
-
creator:
|
|
1327
|
+
creator: we(n),
|
|
1329
1328
|
created: o ? new Date(o) : void 0,
|
|
1330
1329
|
updated: i ? new Date(i) : void 0,
|
|
1331
1330
|
annotation: e,
|
|
@@ -1356,7 +1355,7 @@ const Io = (t, e) => ({
|
|
|
1356
1355
|
}
|
|
1357
1356
|
return { parsed: a };
|
|
1358
1357
|
}, to = (t) => {
|
|
1359
|
-
const e = t.id ||
|
|
1358
|
+
const e = t.id || me(), {
|
|
1360
1359
|
creator: n,
|
|
1361
1360
|
created: o,
|
|
1362
1361
|
modified: i,
|
|
@@ -1379,14 +1378,14 @@ const Io = (t, e) => ({
|
|
|
1379
1378
|
updated: c,
|
|
1380
1379
|
...f
|
|
1381
1380
|
} = i, l = r.map((p) => {
|
|
1382
|
-
const { quote: h, start:
|
|
1381
|
+
const { quote: h, start: A, end: b, range: E } = p, { prefix: m, suffix: u } = Ue(E, n), y = [{
|
|
1383
1382
|
type: "TextQuoteSelector",
|
|
1384
1383
|
exact: h,
|
|
1385
1384
|
prefix: m,
|
|
1386
1385
|
suffix: u
|
|
1387
1386
|
}, {
|
|
1388
1387
|
type: "TextPositionSelector",
|
|
1389
|
-
start:
|
|
1388
|
+
start: A,
|
|
1390
1389
|
end: b
|
|
1391
1390
|
}];
|
|
1392
1391
|
return {
|
|
@@ -1408,22 +1407,22 @@ const Io = (t, e) => ({
|
|
|
1408
1407
|
target: l
|
|
1409
1408
|
};
|
|
1410
1409
|
};
|
|
1411
|
-
function
|
|
1410
|
+
function ve(t, e, n = 0, o = t.length - 1, i = no) {
|
|
1412
1411
|
for (; o > n; ) {
|
|
1413
1412
|
if (o - n > 600) {
|
|
1414
|
-
const d = o - n + 1, c = e - n + 1, f = Math.log(d), l = 0.5 * Math.exp(2 * f / 3), p = 0.5 * Math.sqrt(f * l * (d - l) / d) * (c - d / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(e - c * l / d + p)),
|
|
1415
|
-
|
|
1413
|
+
const d = o - n + 1, c = e - n + 1, f = Math.log(d), l = 0.5 * Math.exp(2 * f / 3), p = 0.5 * Math.sqrt(f * l * (d - l) / d) * (c - d / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(e - c * l / d + p)), A = Math.min(o, Math.floor(e + (d - c) * l / d + p));
|
|
1414
|
+
ve(t, e, h, A, i);
|
|
1416
1415
|
}
|
|
1417
1416
|
const s = t[e];
|
|
1418
1417
|
let r = n, a = o;
|
|
1419
|
-
for (
|
|
1420
|
-
for (
|
|
1418
|
+
for (tt(t, n, e), i(t[o], s) > 0 && tt(t, n, o); r < a; ) {
|
|
1419
|
+
for (tt(t, r, a), r++, a--; i(t[r], s) < 0; ) r++;
|
|
1421
1420
|
for (; i(t[a], s) > 0; ) a--;
|
|
1422
1421
|
}
|
|
1423
|
-
i(t[n], s) === 0 ?
|
|
1422
|
+
i(t[n], s) === 0 ? tt(t, n, a) : (a++, tt(t, a, o)), a <= e && (n = a + 1), e <= a && (o = a - 1);
|
|
1424
1423
|
}
|
|
1425
1424
|
}
|
|
1426
|
-
function
|
|
1425
|
+
function tt(t, e, n) {
|
|
1427
1426
|
const o = t[e];
|
|
1428
1427
|
t[e] = t[n], t[n] = o;
|
|
1429
1428
|
}
|
|
@@ -1445,7 +1444,7 @@ class oo {
|
|
|
1445
1444
|
for (; n; ) {
|
|
1446
1445
|
for (let r = 0; r < n.children.length; r++) {
|
|
1447
1446
|
const a = n.children[r], d = n.leaf ? i(a) : a;
|
|
1448
|
-
yt(e, d) && (n.leaf ? o.push(a) :
|
|
1447
|
+
yt(e, d) && (n.leaf ? o.push(a) : kt(e, d) ? this._all(a, o) : s.push(a));
|
|
1449
1448
|
}
|
|
1450
1449
|
n = s.pop();
|
|
1451
1450
|
}
|
|
@@ -1459,7 +1458,7 @@ class oo {
|
|
|
1459
1458
|
for (let i = 0; i < n.children.length; i++) {
|
|
1460
1459
|
const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
|
|
1461
1460
|
if (yt(e, r)) {
|
|
1462
|
-
if (n.leaf ||
|
|
1461
|
+
if (n.leaf || kt(e, r)) return !0;
|
|
1463
1462
|
o.push(s);
|
|
1464
1463
|
}
|
|
1465
1464
|
}
|
|
@@ -1492,7 +1491,7 @@ class oo {
|
|
|
1492
1491
|
return e && this._insert(e, this.data.height - 1), this;
|
|
1493
1492
|
}
|
|
1494
1493
|
clear() {
|
|
1495
|
-
return this.data =
|
|
1494
|
+
return this.data = J([]), this;
|
|
1496
1495
|
}
|
|
1497
1496
|
remove(e, n) {
|
|
1498
1497
|
if (!e) return this;
|
|
@@ -1505,7 +1504,7 @@ class oo {
|
|
|
1505
1504
|
if (f !== -1)
|
|
1506
1505
|
return o.children.splice(f, 1), s.push(o), this._condense(s), this;
|
|
1507
1506
|
}
|
|
1508
|
-
!c && !o.leaf &&
|
|
1507
|
+
!c && !o.leaf && kt(o, i) ? (s.push(o), r.push(a), a = 0, d = o, o = o.children[0]) : d ? (a++, o = d.children[a], c = !1) : o = null;
|
|
1509
1508
|
}
|
|
1510
1509
|
return this;
|
|
1511
1510
|
}
|
|
@@ -1534,25 +1533,25 @@ class oo {
|
|
|
1534
1533
|
const s = o - n + 1;
|
|
1535
1534
|
let r = this._maxEntries, a;
|
|
1536
1535
|
if (s <= r)
|
|
1537
|
-
return a =
|
|
1538
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a =
|
|
1536
|
+
return a = J(e.slice(n, o + 1)), Q(a, this.toBBox), a;
|
|
1537
|
+
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;
|
|
1539
1538
|
const d = Math.ceil(s / r), c = d * Math.ceil(Math.sqrt(r));
|
|
1540
|
-
|
|
1539
|
+
oe(e, n, o, c, this.compareMinX);
|
|
1541
1540
|
for (let f = n; f <= o; f += c) {
|
|
1542
1541
|
const l = Math.min(f + c - 1, o);
|
|
1543
|
-
|
|
1542
|
+
oe(e, f, l, d, this.compareMinY);
|
|
1544
1543
|
for (let p = f; p <= l; p += d) {
|
|
1545
1544
|
const h = Math.min(p + d - 1, l);
|
|
1546
1545
|
a.children.push(this._build(e, p, h, i - 1));
|
|
1547
1546
|
}
|
|
1548
1547
|
}
|
|
1549
|
-
return
|
|
1548
|
+
return Q(a, this.toBBox), a;
|
|
1550
1549
|
}
|
|
1551
1550
|
_chooseSubtree(e, n, o, i) {
|
|
1552
1551
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1553
1552
|
let s = 1 / 0, r = 1 / 0, a;
|
|
1554
1553
|
for (let d = 0; d < n.children.length; d++) {
|
|
1555
|
-
const c = n.children[d], f =
|
|
1554
|
+
const c = n.children[d], f = Bt(c), l = ao(e, c) - f;
|
|
1556
1555
|
l < r ? (r = l, s = f < s ? f : s, a = c) : l === r && f < s && (s = f, a = c);
|
|
1557
1556
|
}
|
|
1558
1557
|
n = a || n.children[0];
|
|
@@ -1569,16 +1568,16 @@ class oo {
|
|
|
1569
1568
|
_split(e, n) {
|
|
1570
1569
|
const o = e[n], i = o.children.length, s = this._minEntries;
|
|
1571
1570
|
this._chooseSplitAxis(o, s, i);
|
|
1572
|
-
const r = this._chooseSplitIndex(o, s, i), a =
|
|
1573
|
-
a.height = o.height, a.leaf = o.leaf,
|
|
1571
|
+
const r = this._chooseSplitIndex(o, s, i), a = J(o.children.splice(r, o.children.length - r));
|
|
1572
|
+
a.height = o.height, a.leaf = o.leaf, Q(o, this.toBBox), Q(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(o, a);
|
|
1574
1573
|
}
|
|
1575
1574
|
_splitRoot(e, n) {
|
|
1576
|
-
this.data =
|
|
1575
|
+
this.data = J([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, Q(this.data, this.toBBox);
|
|
1577
1576
|
}
|
|
1578
1577
|
_chooseSplitIndex(e, n, o) {
|
|
1579
1578
|
let i, s = 1 / 0, r = 1 / 0;
|
|
1580
1579
|
for (let a = n; a <= o - n; a++) {
|
|
1581
|
-
const d = ot(e, 0, a, this.toBBox), c = ot(e, a, o, this.toBBox), f = co(d, c), l =
|
|
1580
|
+
const d = ot(e, 0, a, this.toBBox), c = ot(e, a, o, this.toBBox), f = co(d, c), l = Bt(d) + Bt(c);
|
|
1582
1581
|
f < s ? (s = f, i = a, r = l < r ? l : r) : f === s && l < r && (r = l, i = a);
|
|
1583
1582
|
}
|
|
1584
1583
|
return i || o - n;
|
|
@@ -1609,7 +1608,7 @@ class oo {
|
|
|
1609
1608
|
}
|
|
1610
1609
|
_condense(e) {
|
|
1611
1610
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1612
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1611
|
+
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);
|
|
1613
1612
|
}
|
|
1614
1613
|
}
|
|
1615
1614
|
function io(t, e, n) {
|
|
@@ -1618,11 +1617,11 @@ function io(t, e, n) {
|
|
|
1618
1617
|
if (n(t, e[o])) return o;
|
|
1619
1618
|
return -1;
|
|
1620
1619
|
}
|
|
1621
|
-
function
|
|
1620
|
+
function Q(t, e) {
|
|
1622
1621
|
ot(t, 0, t.children.length, e, t);
|
|
1623
1622
|
}
|
|
1624
1623
|
function ot(t, e, n, o, i) {
|
|
1625
|
-
i || (i =
|
|
1624
|
+
i || (i = J(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1626
1625
|
for (let s = e; s < n; s++) {
|
|
1627
1626
|
const r = t.children[s];
|
|
1628
1627
|
it(i, t.leaf ? o(r) : r);
|
|
@@ -1638,7 +1637,7 @@ function so(t, e) {
|
|
|
1638
1637
|
function ro(t, e) {
|
|
1639
1638
|
return t.minY - e.minY;
|
|
1640
1639
|
}
|
|
1641
|
-
function
|
|
1640
|
+
function Bt(t) {
|
|
1642
1641
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1643
1642
|
}
|
|
1644
1643
|
function mt(t) {
|
|
@@ -1651,13 +1650,13 @@ function co(t, e) {
|
|
|
1651
1650
|
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);
|
|
1652
1651
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
1653
1652
|
}
|
|
1654
|
-
function
|
|
1653
|
+
function kt(t, e) {
|
|
1655
1654
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1656
1655
|
}
|
|
1657
1656
|
function yt(t, e) {
|
|
1658
1657
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1659
1658
|
}
|
|
1660
|
-
function
|
|
1659
|
+
function J(t) {
|
|
1661
1660
|
return {
|
|
1662
1661
|
children: t,
|
|
1663
1662
|
height: 1,
|
|
@@ -1668,12 +1667,12 @@ function Z(t) {
|
|
|
1668
1667
|
maxY: -1 / 0
|
|
1669
1668
|
};
|
|
1670
1669
|
}
|
|
1671
|
-
function
|
|
1670
|
+
function oe(t, e, n, o, i) {
|
|
1672
1671
|
const s = [e, n];
|
|
1673
1672
|
for (; s.length; ) {
|
|
1674
1673
|
if (n = s.pop(), e = s.pop(), n - e <= o) continue;
|
|
1675
1674
|
const r = e + Math.ceil((n - e) / o / 2) * o;
|
|
1676
|
-
|
|
1675
|
+
ve(t, r, e, n, i), s.push(e, r, r, n);
|
|
1677
1676
|
}
|
|
1678
1677
|
}
|
|
1679
1678
|
let lo = () => ({
|
|
@@ -1692,10 +1691,10 @@ let lo = () => ({
|
|
|
1692
1691
|
});
|
|
1693
1692
|
const uo = (t, e) => {
|
|
1694
1693
|
const n = new oo(), o = /* @__PURE__ */ new Map(), i = lo(), s = (y, C) => {
|
|
1695
|
-
const
|
|
1696
|
-
const T =
|
|
1694
|
+
const x = y.selector.flatMap((R) => {
|
|
1695
|
+
const T = F([R]) ? R.range : le(R, e).range;
|
|
1697
1696
|
return Array.from(T.getClientRects());
|
|
1698
|
-
}), L = Xe(
|
|
1697
|
+
}), L = Xe(x).map((R) => He(R, C));
|
|
1699
1698
|
return L.map((R) => {
|
|
1700
1699
|
const { x: T, y: S, width: g, height: w } = R;
|
|
1701
1700
|
return {
|
|
@@ -1713,37 +1712,37 @@ const uo = (t, e) => {
|
|
|
1713
1712
|
n.clear(), o.clear();
|
|
1714
1713
|
}, d = (y) => {
|
|
1715
1714
|
const C = s(y, e.getBoundingClientRect());
|
|
1716
|
-
C.forEach((
|
|
1715
|
+
C.forEach((x) => n.insert(x)), o.set(y.annotation, C);
|
|
1717
1716
|
}, c = (y) => {
|
|
1718
1717
|
const C = o.get(y.annotation);
|
|
1719
|
-
C && (C.forEach((
|
|
1718
|
+
C && (C.forEach((x) => n.remove(x)), o.delete(y.annotation));
|
|
1720
1719
|
}, f = (y) => {
|
|
1721
1720
|
c(y), d(y);
|
|
1722
1721
|
}, l = (y, C = !0) => {
|
|
1723
1722
|
C && a();
|
|
1724
|
-
const
|
|
1723
|
+
const x = e.getBoundingClientRect(), L = y.map((T) => ({ target: T, rects: s(T, x) }));
|
|
1725
1724
|
L.forEach(({ target: T, rects: S }) => o.set(T.annotation, S));
|
|
1726
1725
|
const R = L.flatMap(({ rects: T }) => T);
|
|
1727
1726
|
n.load(R);
|
|
1728
|
-
}, p = (y, C,
|
|
1727
|
+
}, p = (y, C, x = !1) => {
|
|
1729
1728
|
const L = n.search({
|
|
1730
1729
|
minX: y,
|
|
1731
1730
|
minY: C,
|
|
1732
1731
|
maxX: y,
|
|
1733
1732
|
maxY: C
|
|
1734
1733
|
}), R = (T) => T.annotation.rects.reduce((S, g) => S + g.width * g.height, 0);
|
|
1735
|
-
return L.length > 0 ? (L.sort((T, S) => R(T) - R(S)),
|
|
1734
|
+
return L.length > 0 ? (L.sort((T, S) => R(T) - R(S)), x ? L.map((T) => T.annotation.id) : [L[0].annotation.id]) : [];
|
|
1736
1735
|
}, h = (y) => {
|
|
1737
|
-
const C =
|
|
1736
|
+
const C = A(y);
|
|
1738
1737
|
if (C.length === 0)
|
|
1739
1738
|
return;
|
|
1740
|
-
let
|
|
1739
|
+
let x = C[0].left, L = C[0].top, R = C[0].right, T = C[0].bottom;
|
|
1741
1740
|
for (let S = 1; S < C.length; S++) {
|
|
1742
1741
|
const g = C[S];
|
|
1743
|
-
|
|
1742
|
+
x = Math.min(x, g.left), L = Math.min(L, g.top), R = Math.max(R, g.right), T = Math.max(T, g.bottom);
|
|
1744
1743
|
}
|
|
1745
|
-
return new DOMRect(
|
|
1746
|
-
},
|
|
1744
|
+
return new DOMRect(x, L, R - x, T - L);
|
|
1745
|
+
}, A = (y) => {
|
|
1747
1746
|
const C = o.get(y);
|
|
1748
1747
|
return C ? C[0].annotation.rects : [];
|
|
1749
1748
|
};
|
|
@@ -1752,12 +1751,12 @@ const uo = (t, e) => {
|
|
|
1752
1751
|
clear: a,
|
|
1753
1752
|
getAt: p,
|
|
1754
1753
|
getAnnotationBounds: h,
|
|
1755
|
-
getAnnotationRects:
|
|
1756
|
-
getIntersecting: (y, C,
|
|
1757
|
-
const R = n.search({ minX: y, minY: C, maxX:
|
|
1754
|
+
getAnnotationRects: A,
|
|
1755
|
+
getIntersecting: (y, C, x, L) => {
|
|
1756
|
+
const R = n.search({ minX: y, minY: C, maxX: x, maxY: L }), T = new Set(R.map((S) => S.annotation.id));
|
|
1758
1757
|
return Array.from(T).map((S) => ({
|
|
1759
1758
|
annotation: t.getAnnotation(S),
|
|
1760
|
-
rects:
|
|
1759
|
+
rects: A(S)
|
|
1761
1760
|
})).filter((S) => !!S.annotation);
|
|
1762
1761
|
},
|
|
1763
1762
|
insert: d,
|
|
@@ -1771,41 +1770,41 @@ const uo = (t, e) => {
|
|
|
1771
1770
|
on: (y, C) => i.on(y, C)
|
|
1772
1771
|
};
|
|
1773
1772
|
}, fo = (t, e) => {
|
|
1774
|
-
const n =
|
|
1773
|
+
const n = _n(), o = uo(n, t), i = En(n);
|
|
1775
1774
|
i.setUserSelectAction(e);
|
|
1776
1775
|
const s = An(n), r = Kn(), a = (u, y = k.LOCAL) => {
|
|
1777
|
-
const C =
|
|
1778
|
-
return
|
|
1776
|
+
const C = At(u, t), x = F(C.target.selector);
|
|
1777
|
+
return x && n.addAnnotation(C, y), x;
|
|
1779
1778
|
}, d = (u, y = !0, C = k.LOCAL) => {
|
|
1780
|
-
const
|
|
1781
|
-
return L.length > 0 ? (console.warn("Could not revive all targets for these annotations:", L), n.bulkAddAnnotation(
|
|
1779
|
+
const x = u.map((R) => At(R, t)), L = x.filter((R) => !F(R.target.selector));
|
|
1780
|
+
return L.length > 0 ? (console.warn("Could not revive all targets for these annotations:", L), n.bulkAddAnnotation(x, y, C), L) : (n.bulkAddAnnotation(x, y, C), []);
|
|
1782
1781
|
}, c = (u, y = k.LOCAL) => {
|
|
1783
|
-
const C = u.map((L) =>
|
|
1784
|
-
return
|
|
1782
|
+
const C = u.map((L) => At(L, t)), x = C.filter((L) => !F(L.target.selector));
|
|
1783
|
+
return x.length > 0 && console.warn("Could not revive all targets for these annotations:", x), C.forEach((L) => {
|
|
1785
1784
|
n.getAnnotation(L.id) ? n.updateAnnotation(L, y) : n.addAnnotation(L, y);
|
|
1786
|
-
}),
|
|
1785
|
+
}), x;
|
|
1787
1786
|
}, f = (u, y = k.LOCAL) => {
|
|
1788
1787
|
const C = wt(u, t);
|
|
1789
1788
|
n.updateTarget(C, y);
|
|
1790
1789
|
}, l = (u, y = k.LOCAL) => {
|
|
1791
|
-
const C = u.map((
|
|
1790
|
+
const C = u.map((x) => wt(x, t));
|
|
1792
1791
|
n.bulkUpdateTargets(C, y);
|
|
1793
1792
|
}, p = (u, y, C) => {
|
|
1794
|
-
const
|
|
1793
|
+
const x = o.getAt(u, y, !!C).map((R) => n.getAnnotation(R)), L = C ? x.filter(C) : x;
|
|
1795
1794
|
return L.length > 0 ? L[0] : void 0;
|
|
1796
|
-
}, h = (u, y, C,
|
|
1795
|
+
}, h = (u, y, C, x = 5) => {
|
|
1797
1796
|
const L = o.getAnnotationRects(u);
|
|
1798
1797
|
if (L.length !== 0) {
|
|
1799
1798
|
if (y && C) {
|
|
1800
|
-
const R = L.find(({ top: T, right: S, bottom: g, left: w }) => y >= w -
|
|
1799
|
+
const R = L.find(({ top: T, right: S, bottom: g, left: w }) => y >= w - x && y <= S + x && C >= T - x && C <= g + x);
|
|
1801
1800
|
if (R) return R;
|
|
1802
1801
|
}
|
|
1803
1802
|
return o.getAnnotationBounds(u);
|
|
1804
1803
|
}
|
|
1805
|
-
},
|
|
1804
|
+
}, A = (u, y, C, x) => o.getIntersecting(u, y, C, x), b = (u) => o.getAnnotationRects(u), E = () => o.recalculate(), m = (u) => o.on("recalculate", u);
|
|
1806
1805
|
return n.observe(({ changes: u }) => {
|
|
1807
|
-
const y = (u.deleted || []).filter((L) =>
|
|
1808
|
-
(y == null ? void 0 : y.length) > 0 && y.forEach((L) => o.remove(L.target)), C.length > 0 && o.set(C.map((L) => L.target), !1), (
|
|
1806
|
+
const y = (u.deleted || []).filter((L) => F(L.target.selector)), C = (u.created || []).filter((L) => F(L.target.selector)), x = (u.updated || []).filter((L) => F(L.newValue.target.selector));
|
|
1807
|
+
(y == null ? void 0 : y.length) > 0 && y.forEach((L) => o.remove(L.target)), C.length > 0 && o.set(C.map((L) => L.target), !1), (x == null ? void 0 : x.length) > 0 && x.forEach(({ newValue: L }) => o.update(L.target));
|
|
1809
1808
|
}), {
|
|
1810
1809
|
store: {
|
|
1811
1810
|
...n,
|
|
@@ -1815,7 +1814,7 @@ const uo = (t, e) => {
|
|
|
1815
1814
|
bulkUpsertAnnotations: c,
|
|
1816
1815
|
getAnnotationBounds: h,
|
|
1817
1816
|
getAnnotationRects: b,
|
|
1818
|
-
getIntersecting:
|
|
1817
|
+
getIntersecting: A,
|
|
1819
1818
|
getAt: p,
|
|
1820
1819
|
recalculatePositions: E,
|
|
1821
1820
|
onRecalculatePositions: m,
|
|
@@ -1848,8 +1847,8 @@ const uo = (t, e) => {
|
|
|
1848
1847
|
e.font && (o.font = e.font);
|
|
1849
1848
|
const h = i.get(f.annotation.id);
|
|
1850
1849
|
if (h) {
|
|
1851
|
-
const { height:
|
|
1852
|
-
o.fillStyle = h.appearance.color, o.fillRect(b - 2, E - 2.5, 2,
|
|
1850
|
+
const { height: A } = f.rects[0], b = f.rects[0].x + l.left, E = f.rects[0].y + l.top;
|
|
1851
|
+
o.fillStyle = h.appearance.color, o.fillRect(b - 2, E - 2.5, 2, A + 5);
|
|
1853
1852
|
const m = o.measureText(h.appearance.label), u = m.width + 6, y = m.actualBoundingBoxAscent + m.actualBoundingBoxDescent + 8, C = m.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1854
1853
|
return o.fillRect(b - 2, E - 2.5 - y, u, y), o.fillStyle = "#fff", o.fillText(h.appearance.label, b + 1, E - C), {
|
|
1855
1854
|
fill: h.appearance.color,
|
|
@@ -1863,19 +1862,19 @@ const uo = (t, e) => {
|
|
|
1863
1862
|
f.scale(2, 2), f.translate(0.5, 0.5);
|
|
1864
1863
|
}
|
|
1865
1864
|
};
|
|
1866
|
-
},
|
|
1865
|
+
}, It = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1867
1866
|
function Nt(t, e, n, o) {
|
|
1868
1867
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1869
1868
|
}
|
|
1870
|
-
function
|
|
1869
|
+
function et(t, e, n, o) {
|
|
1871
1870
|
t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
|
|
1872
1871
|
}
|
|
1873
|
-
function
|
|
1872
|
+
function Ae(t, e) {
|
|
1874
1873
|
const n = e.slice(0, e.length - 1);
|
|
1875
1874
|
for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
|
|
1876
1875
|
return n;
|
|
1877
1876
|
}
|
|
1878
|
-
function
|
|
1877
|
+
function xe(t) {
|
|
1879
1878
|
typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
|
|
1880
1879
|
const e = t.split(",");
|
|
1881
1880
|
let n = e.lastIndexOf("");
|
|
@@ -1935,14 +1934,14 @@ const at = {
|
|
|
1935
1934
|
".": 190,
|
|
1936
1935
|
"/": 191,
|
|
1937
1936
|
"`": 192,
|
|
1938
|
-
"-":
|
|
1939
|
-
"=":
|
|
1940
|
-
";":
|
|
1937
|
+
"-": It ? 173 : 189,
|
|
1938
|
+
"=": It ? 61 : 187,
|
|
1939
|
+
";": It ? 59 : 186,
|
|
1941
1940
|
"'": 222,
|
|
1942
1941
|
"[": 219,
|
|
1943
1942
|
"]": 221,
|
|
1944
1943
|
"\\": 220
|
|
1945
|
-
},
|
|
1944
|
+
}, j = {
|
|
1946
1945
|
// shiftKey
|
|
1947
1946
|
"⇧": 16,
|
|
1948
1947
|
shift: 16,
|
|
@@ -1958,7 +1957,7 @@ const at = {
|
|
|
1958
1957
|
"⌘": 91,
|
|
1959
1958
|
cmd: 91,
|
|
1960
1959
|
command: 91
|
|
1961
|
-
},
|
|
1960
|
+
}, Vt = {
|
|
1962
1961
|
16: "shiftKey",
|
|
1963
1962
|
18: "altKey",
|
|
1964
1963
|
17: "ctrlKey",
|
|
@@ -1967,21 +1966,21 @@ const at = {
|
|
|
1967
1966
|
ctrlKey: 17,
|
|
1968
1967
|
altKey: 18,
|
|
1969
1968
|
metaKey: 91
|
|
1970
|
-
},
|
|
1969
|
+
}, V = {
|
|
1971
1970
|
16: !1,
|
|
1972
1971
|
18: !1,
|
|
1973
1972
|
17: !1,
|
|
1974
1973
|
91: !1
|
|
1975
|
-
},
|
|
1974
|
+
}, N = {};
|
|
1976
1975
|
for (let t = 1; t < 20; t++)
|
|
1977
1976
|
at["f".concat(t)] = 111 + t;
|
|
1978
|
-
let I = [], rt = null,
|
|
1979
|
-
const
|
|
1980
|
-
function
|
|
1981
|
-
|
|
1977
|
+
let I = [], rt = null, Ee = "all";
|
|
1978
|
+
const z = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), mo = (t) => Object.keys(at).find((e) => at[e] === t), yo = (t) => Object.keys(j).find((e) => j[e] === t);
|
|
1979
|
+
function Se(t) {
|
|
1980
|
+
Ee = t || "all";
|
|
1982
1981
|
}
|
|
1983
1982
|
function ct() {
|
|
1984
|
-
return
|
|
1983
|
+
return Ee || "all";
|
|
1985
1984
|
}
|
|
1986
1985
|
function bo() {
|
|
1987
1986
|
return I.slice(0);
|
|
@@ -1991,8 +1990,8 @@ function wo() {
|
|
|
1991
1990
|
}
|
|
1992
1991
|
function vo() {
|
|
1993
1992
|
const t = [];
|
|
1994
|
-
return Object.keys(
|
|
1995
|
-
|
|
1993
|
+
return Object.keys(N).forEach((e) => {
|
|
1994
|
+
N[e].forEach((n) => {
|
|
1996
1995
|
let {
|
|
1997
1996
|
key: o,
|
|
1998
1997
|
scope: i,
|
|
@@ -2022,30 +2021,30 @@ function xo(t) {
|
|
|
2022
2021
|
function Eo(t, e) {
|
|
2023
2022
|
let n, o;
|
|
2024
2023
|
t || (t = ct());
|
|
2025
|
-
for (const i in
|
|
2026
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
2027
|
-
for (n =
|
|
2024
|
+
for (const i in N)
|
|
2025
|
+
if (Object.prototype.hasOwnProperty.call(N, i))
|
|
2026
|
+
for (n = N[i], o = 0; o < n.length; )
|
|
2028
2027
|
n[o].scope === t ? n.splice(o, 1).forEach((r) => {
|
|
2029
2028
|
let {
|
|
2030
2029
|
element: a
|
|
2031
2030
|
} = r;
|
|
2032
|
-
return
|
|
2031
|
+
return Pt(a);
|
|
2033
2032
|
}) : o++;
|
|
2034
|
-
ct() === t &&
|
|
2033
|
+
ct() === t && Se(e || "all");
|
|
2035
2034
|
}
|
|
2036
2035
|
function So(t) {
|
|
2037
2036
|
let e = t.keyCode || t.which || t.charCode;
|
|
2038
2037
|
const n = I.indexOf(e);
|
|
2039
|
-
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
|
|
2040
|
-
|
|
2041
|
-
for (const o in
|
|
2038
|
+
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) {
|
|
2039
|
+
V[e] = !1;
|
|
2040
|
+
for (const o in j) j[o] === e && ($[o] = !1);
|
|
2042
2041
|
}
|
|
2043
2042
|
}
|
|
2044
|
-
function
|
|
2043
|
+
function Ce(t) {
|
|
2045
2044
|
if (typeof t > "u")
|
|
2046
|
-
Object.keys(
|
|
2047
|
-
Array.isArray(
|
|
2048
|
-
}),
|
|
2045
|
+
Object.keys(N).forEach((i) => {
|
|
2046
|
+
Array.isArray(N[i]) && N[i].forEach((s) => bt(s)), delete N[i];
|
|
2047
|
+
}), Pt(null);
|
|
2049
2048
|
else if (Array.isArray(t))
|
|
2050
2049
|
t.forEach((i) => {
|
|
2051
2050
|
i.key && bt(i);
|
|
@@ -2071,50 +2070,50 @@ const bt = (t) => {
|
|
|
2071
2070
|
method: o,
|
|
2072
2071
|
splitKey: i = "+"
|
|
2073
2072
|
} = t;
|
|
2074
|
-
|
|
2073
|
+
xe(e).forEach((r) => {
|
|
2075
2074
|
const a = r.split(i), d = a.length, c = a[d - 1], f = c === "*" ? "*" : lt(c);
|
|
2076
|
-
if (!
|
|
2075
|
+
if (!N[f]) return;
|
|
2077
2076
|
n || (n = ct());
|
|
2078
|
-
const l = d > 1 ?
|
|
2079
|
-
|
|
2077
|
+
const l = d > 1 ? Ae(j, a) : [], p = [];
|
|
2078
|
+
N[f] = N[f].filter((h) => {
|
|
2080
2079
|
const b = (o ? h.method === o : !0) && h.scope === n && po(h.mods, l);
|
|
2081
2080
|
return b && p.push(h.element), !b;
|
|
2082
|
-
}), p.forEach((h) =>
|
|
2081
|
+
}), p.forEach((h) => Pt(h));
|
|
2083
2082
|
});
|
|
2084
2083
|
};
|
|
2085
|
-
function
|
|
2084
|
+
function ie(t, e, n, o) {
|
|
2086
2085
|
if (e.element !== o)
|
|
2087
2086
|
return;
|
|
2088
2087
|
let i;
|
|
2089
2088
|
if (e.scope === n || e.scope === "all") {
|
|
2090
2089
|
i = e.mods.length > 0;
|
|
2091
|
-
for (const s in
|
|
2092
|
-
Object.prototype.hasOwnProperty.call(
|
|
2093
|
-
(e.mods.length === 0 && !
|
|
2090
|
+
for (const s in V)
|
|
2091
|
+
Object.prototype.hasOwnProperty.call(V, s) && (!V[s] && e.mods.indexOf(+s) > -1 || V[s] && e.mods.indexOf(+s) === -1) && (i = !1);
|
|
2092
|
+
(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)));
|
|
2094
2093
|
}
|
|
2095
2094
|
}
|
|
2096
|
-
function
|
|
2097
|
-
const n =
|
|
2095
|
+
function se(t, e) {
|
|
2096
|
+
const n = N["*"];
|
|
2098
2097
|
let o = t.keyCode || t.which || t.charCode;
|
|
2099
2098
|
if (!$.filter.call(this, t)) return;
|
|
2100
2099
|
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
|
|
2101
|
-
const d =
|
|
2100
|
+
const d = Vt[a];
|
|
2102
2101
|
t[a] && I.indexOf(d) === -1 ? I.push(d) : !t[a] && I.indexOf(d) > -1 ? I.splice(I.indexOf(d), 1) : a === "metaKey" && t[a] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(d))));
|
|
2103
|
-
}), o in
|
|
2104
|
-
|
|
2105
|
-
for (const a in
|
|
2106
|
-
|
|
2102
|
+
}), o in V) {
|
|
2103
|
+
V[o] = !0;
|
|
2104
|
+
for (const a in j)
|
|
2105
|
+
j[a] === o && ($[a] = !0);
|
|
2107
2106
|
if (!n) return;
|
|
2108
2107
|
}
|
|
2109
|
-
for (const a in
|
|
2110
|
-
Object.prototype.hasOwnProperty.call(
|
|
2111
|
-
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18),
|
|
2108
|
+
for (const a in V)
|
|
2109
|
+
Object.prototype.hasOwnProperty.call(V, a) && (V[a] = t[Vt[a]]);
|
|
2110
|
+
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);
|
|
2112
2111
|
const i = ct();
|
|
2113
2112
|
if (n)
|
|
2114
2113
|
for (let a = 0; a < n.length; a++)
|
|
2115
|
-
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) &&
|
|
2116
|
-
if (!(o in
|
|
2117
|
-
const s =
|
|
2114
|
+
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) && ie(t, n[a], i, e);
|
|
2115
|
+
if (!(o in N)) return;
|
|
2116
|
+
const s = N[o], r = s.length;
|
|
2118
2117
|
for (let a = 0; a < r; a++)
|
|
2119
2118
|
if ((t.type === "keydown" && s[a].keydown || t.type === "keyup" && s[a].keyup) && s[a].key) {
|
|
2120
2119
|
const d = s[a], {
|
|
@@ -2122,15 +2121,15 @@ function ae(t, e) {
|
|
|
2122
2121
|
} = d, f = d.key.split(c), l = [];
|
|
2123
2122
|
for (let p = 0; p < f.length; p++)
|
|
2124
2123
|
l.push(lt(f[p]));
|
|
2125
|
-
l.sort().join("") === I.sort().join("") &&
|
|
2124
|
+
l.sort().join("") === I.sort().join("") && ie(t, d, i, e);
|
|
2126
2125
|
}
|
|
2127
2126
|
}
|
|
2128
2127
|
function $(t, e, n) {
|
|
2129
2128
|
I = [];
|
|
2130
|
-
const o =
|
|
2129
|
+
const o = xe(t);
|
|
2131
2130
|
let i = [], s = "all", r = document, a = 0, d = !1, c = !0, f = "+", l = !1, p = !1;
|
|
2132
|
-
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 && (d = e.keyup), e.keydown !== void 0 && (c = e.keydown), e.capture !== void 0 && (l = e.capture), typeof e.splitKey == "string" && (f = e.splitKey), e.single === !0 && (p = !0)), typeof e == "string" && (s = e), p &&
|
|
2133
|
-
t = o[a].split(f), i = [], t.length > 1 && (i =
|
|
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 && (d = e.keyup), e.keydown !== void 0 && (c = e.keydown), e.capture !== void 0 && (l = e.capture), typeof e.splitKey == "string" && (f = e.splitKey), e.single === !0 && (p = !0)), typeof e == "string" && (s = e), p && Ce(t, s); a < o.length; a++)
|
|
2132
|
+
t = o[a].split(f), i = [], t.length > 1 && (i = Ae(j, t)), t = t[t.length - 1], t = t === "*" ? "*" : lt(t), t in N || (N[t] = []), N[t].push({
|
|
2134
2133
|
keyup: d,
|
|
2135
2134
|
keydown: c,
|
|
2136
2135
|
scope: s,
|
|
@@ -2142,19 +2141,19 @@ function $(t, e, n) {
|
|
|
2142
2141
|
element: r
|
|
2143
2142
|
});
|
|
2144
2143
|
if (typeof r < "u" && window) {
|
|
2145
|
-
if (!
|
|
2144
|
+
if (!z.has(r)) {
|
|
2146
2145
|
const h = function() {
|
|
2147
2146
|
let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2148
|
-
return
|
|
2149
|
-
},
|
|
2147
|
+
return se(b, r);
|
|
2148
|
+
}, A = function() {
|
|
2150
2149
|
let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2151
|
-
|
|
2150
|
+
se(b, r), So(b);
|
|
2152
2151
|
};
|
|
2153
|
-
|
|
2152
|
+
z.set(r, {
|
|
2154
2153
|
keydownListener: h,
|
|
2155
|
-
keyupListenr:
|
|
2154
|
+
keyupListenr: A,
|
|
2156
2155
|
capture: l
|
|
2157
|
-
}), Nt(r, "keydown", h, l), Nt(r, "keyup",
|
|
2156
|
+
}), Nt(r, "keydown", h, l), Nt(r, "keyup", A, l);
|
|
2158
2157
|
}
|
|
2159
2158
|
if (!rt) {
|
|
2160
2159
|
const h = () => {
|
|
@@ -2169,14 +2168,14 @@ function $(t, e, n) {
|
|
|
2169
2168
|
}
|
|
2170
2169
|
function Co(t) {
|
|
2171
2170
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2172
|
-
Object.keys(
|
|
2173
|
-
|
|
2171
|
+
Object.keys(N).forEach((n) => {
|
|
2172
|
+
N[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
|
|
2174
2173
|
i && i.method && i.method();
|
|
2175
2174
|
});
|
|
2176
2175
|
});
|
|
2177
2176
|
}
|
|
2178
|
-
function
|
|
2179
|
-
const e = Object.values(
|
|
2177
|
+
function Pt(t) {
|
|
2178
|
+
const e = Object.values(N).flat();
|
|
2180
2179
|
if (e.findIndex((o) => {
|
|
2181
2180
|
let {
|
|
2182
2181
|
element: i
|
|
@@ -2187,27 +2186,27 @@ function jt(t) {
|
|
|
2187
2186
|
keydownListener: o,
|
|
2188
2187
|
keyupListenr: i,
|
|
2189
2188
|
capture: s
|
|
2190
|
-
} =
|
|
2191
|
-
o && i && (
|
|
2189
|
+
} = z.get(t) || {};
|
|
2190
|
+
o && i && (et(t, "keyup", i, s), et(t, "keydown", o, s), z.delete(t));
|
|
2192
2191
|
}
|
|
2193
|
-
if ((e.length <= 0 ||
|
|
2192
|
+
if ((e.length <= 0 || z.size <= 0) && (Object.keys(z).forEach((i) => {
|
|
2194
2193
|
const {
|
|
2195
2194
|
keydownListener: s,
|
|
2196
2195
|
keyupListenr: r,
|
|
2197
2196
|
capture: a
|
|
2198
|
-
} =
|
|
2199
|
-
s && r && (
|
|
2200
|
-
}),
|
|
2197
|
+
} = z.get(i) || {};
|
|
2198
|
+
s && r && (et(i, "keyup", r, a), et(i, "keydown", s, a), z.delete(i));
|
|
2199
|
+
}), z.clear(), Object.keys(N).forEach((i) => delete N[i]), rt)) {
|
|
2201
2200
|
const {
|
|
2202
2201
|
listener: i,
|
|
2203
2202
|
capture: s
|
|
2204
2203
|
} = rt;
|
|
2205
|
-
|
|
2204
|
+
et(window, "focus", i, s), rt = null;
|
|
2206
2205
|
}
|
|
2207
2206
|
}
|
|
2208
|
-
const
|
|
2207
|
+
const _t = {
|
|
2209
2208
|
getPressedKeyString: wo,
|
|
2210
|
-
setScope:
|
|
2209
|
+
setScope: Se,
|
|
2211
2210
|
getScope: ct,
|
|
2212
2211
|
deleteScope: Eo,
|
|
2213
2212
|
getPressedKeyCodes: bo,
|
|
@@ -2215,20 +2214,20 @@ const Ut = {
|
|
|
2215
2214
|
isPressed: xo,
|
|
2216
2215
|
filter: Ao,
|
|
2217
2216
|
trigger: Co,
|
|
2218
|
-
unbind:
|
|
2217
|
+
unbind: Ce,
|
|
2219
2218
|
keyMap: at,
|
|
2220
|
-
modifier:
|
|
2221
|
-
modifierMap:
|
|
2219
|
+
modifier: j,
|
|
2220
|
+
modifierMap: Vt
|
|
2222
2221
|
};
|
|
2223
|
-
for (const t in
|
|
2224
|
-
Object.prototype.hasOwnProperty.call(
|
|
2222
|
+
for (const t in _t)
|
|
2223
|
+
Object.prototype.hasOwnProperty.call(_t, t) && ($[t] = _t[t]);
|
|
2225
2224
|
if (typeof window < "u") {
|
|
2226
2225
|
const t = window.hotkeys;
|
|
2227
2226
|
$.noConflict = (e) => (e && window.hotkeys === $ && (window.hotkeys = t), $), window.hotkeys = $;
|
|
2228
2227
|
}
|
|
2229
|
-
const
|
|
2230
|
-
...
|
|
2231
|
-
|
|
2228
|
+
const re = 300, Le = ["up", "down", "left", "right"], Oe = Ne ? "⌘+a" : "ctrl+a", Lo = [
|
|
2229
|
+
...Le.map((t) => `shift+${t}`),
|
|
2230
|
+
Oe
|
|
2232
2231
|
], Oo = (t, e, n) => {
|
|
2233
2232
|
const { store: o, selection: i } = e;
|
|
2234
2233
|
let s;
|
|
@@ -2236,45 +2235,41 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2236
2235
|
let a;
|
|
2237
2236
|
const d = (S) => a = S;
|
|
2238
2237
|
let c, f, l, p = !1, h = !0;
|
|
2239
|
-
const
|
|
2238
|
+
const A = (S) => {
|
|
2240
2239
|
h = S, E.clear(), S || (c = void 0, l = void 0, p = !1);
|
|
2241
2240
|
}, b = (S) => {
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
c = !((w = S.target.parentElement) != null && w.closest(j)) ? {
|
|
2245
|
-
annotation: be(),
|
|
2241
|
+
h && (p = !1, f !== !1 && (c = nt(S.target) ? void 0 : {
|
|
2242
|
+
annotation: me(),
|
|
2246
2243
|
selector: [],
|
|
2247
2244
|
creator: s,
|
|
2248
2245
|
created: /* @__PURE__ */ new Date()
|
|
2249
|
-
}
|
|
2250
|
-
}, E =
|
|
2251
|
-
var N, dt;
|
|
2246
|
+
}));
|
|
2247
|
+
}, E = Yt((S) => {
|
|
2252
2248
|
if (!h) return;
|
|
2253
2249
|
const g = document.getSelection();
|
|
2254
|
-
if (
|
|
2250
|
+
if (nt(g.anchorNode)) {
|
|
2255
2251
|
c = void 0;
|
|
2256
2252
|
return;
|
|
2257
2253
|
}
|
|
2258
|
-
const
|
|
2259
|
-
if ((l == null ? void 0 : l.type) === "pointerdown" && (
|
|
2254
|
+
const w = S.timeStamp - ((l == null ? void 0 : l.timeStamp) || S.timeStamp);
|
|
2255
|
+
if ((l == null ? void 0 : l.type) === "pointerdown" && (w < 1e3 && !c || g.isCollapsed && w < re) && b(l || S), !c) return;
|
|
2260
2256
|
if (g.isCollapsed) {
|
|
2261
2257
|
o.getAnnotation(c.annotation) && (i.clear(), o.deleteAnnotation(c.annotation));
|
|
2262
2258
|
return;
|
|
2263
2259
|
}
|
|
2264
|
-
const
|
|
2265
|
-
if (Ve(
|
|
2266
|
-
const
|
|
2267
|
-
(
|
|
2268
|
-
var
|
|
2269
|
-
return
|
|
2260
|
+
const v = g.getRangeAt(0), O = je(v, t);
|
|
2261
|
+
if (Ve(O)) return;
|
|
2262
|
+
const B = ke(O.cloneRange());
|
|
2263
|
+
(B.length !== c.selector.length || B.some((K, Y) => {
|
|
2264
|
+
var dt;
|
|
2265
|
+
return K.toString() !== ((dt = c.selector[Y]) == null ? void 0 : dt.quote);
|
|
2270
2266
|
})) && (c = {
|
|
2271
2267
|
...c,
|
|
2272
|
-
selector:
|
|
2268
|
+
selector: B.map((K) => $e(K, t, n)),
|
|
2273
2269
|
updated: /* @__PURE__ */ new Date()
|
|
2274
2270
|
}, o.getAnnotation(c.annotation) ? o.updateTarget(c, k.LOCAL) : i.clear());
|
|
2275
2271
|
}, 10), m = (S) => {
|
|
2276
|
-
|
|
2277
|
-
p || (w = S.target.parentElement) != null && w.closest(j) || (l = Et(S), f = l.button === 0);
|
|
2272
|
+
p || nt(S.target) || (l = xt(S), f = l.button === 0);
|
|
2278
2273
|
}, u = () => {
|
|
2279
2274
|
o.getAnnotation(c.annotation) ? o.updateTarget(c) : o.addAnnotation({
|
|
2280
2275
|
id: c.annotation,
|
|
@@ -2282,25 +2277,24 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2282
2277
|
target: c
|
|
2283
2278
|
});
|
|
2284
2279
|
}, y = (S) => {
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
(N.length !== 1 || N[0].id !== D.id) && i.userSelect(D.id, S);
|
|
2280
|
+
if (p || nt(S.target) || !f) return;
|
|
2281
|
+
const g = () => {
|
|
2282
|
+
const { x: v, y: O } = t.getBoundingClientRect(), B = S.target instanceof Node && t.contains(S.target) && o.getAt(S.clientX - v, S.clientY - O, a);
|
|
2283
|
+
if (B) {
|
|
2284
|
+
const { selected: M } = i;
|
|
2285
|
+
(M.length !== 1 || M[0].id !== B.id) && i.userSelect(B.id, S);
|
|
2292
2286
|
} else
|
|
2293
2287
|
i.clear();
|
|
2294
|
-
},
|
|
2288
|
+
}, w = S.timeStamp - l.timeStamp;
|
|
2295
2289
|
setTimeout(() => {
|
|
2296
|
-
const
|
|
2297
|
-
|
|
2298
|
-
});
|
|
2290
|
+
const v = document.getSelection();
|
|
2291
|
+
v != null && v.isCollapsed && w < re ? (c = void 0, g()) : c && c.selector.length > 0 && (i.clear(), u(), i.userSelect(c.annotation, xt(S)));
|
|
2292
|
+
}, 1);
|
|
2299
2293
|
}, C = (S) => {
|
|
2300
2294
|
p = !0;
|
|
2301
2295
|
const g = document.getSelection();
|
|
2302
|
-
g != null && g.isCollapsed || ((!c || c.selector.length === 0) && E(S), u(), i.userSelect(c.annotation,
|
|
2303
|
-
},
|
|
2296
|
+
g != null && g.isCollapsed || ((!c || c.selector.length === 0) && E(S), u(), i.userSelect(c.annotation, xt(S)));
|
|
2297
|
+
}, x = (S) => {
|
|
2304
2298
|
h && S.key === "Shift" && c && (document.getSelection().isCollapsed || (i.clear(), u(), i.userSelect(c.annotation, ut(S))));
|
|
2305
2299
|
}, L = (S) => {
|
|
2306
2300
|
const g = () => setTimeout(() => {
|
|
@@ -2314,49 +2308,49 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2314
2308
|
};
|
|
2315
2309
|
$(Lo.join(","), { element: t, keydown: !0, keyup: !1 }, (S) => {
|
|
2316
2310
|
S.repeat || (l = ut(S));
|
|
2317
|
-
}), $(
|
|
2311
|
+
}), $(Oe, { keydown: !0, keyup: !1 }, (S) => {
|
|
2318
2312
|
l = ut(S), L(S);
|
|
2319
2313
|
});
|
|
2320
2314
|
const R = (S) => {
|
|
2321
2315
|
S.repeat || S.target !== t && S.target !== document.body || (c = void 0, i.clear());
|
|
2322
2316
|
};
|
|
2323
|
-
return $(
|
|
2317
|
+
return $(Le.join(","), { keydown: !0, keyup: !1 }, R), document.addEventListener("pointerdown", m), document.addEventListener("pointerup", y), document.addEventListener("contextmenu", C), t.addEventListener("keyup", x), t.addEventListener("selectstart", b), document.addEventListener("selectionchange", E), {
|
|
2324
2318
|
destroy: () => {
|
|
2325
|
-
c = void 0, f = void 0, l = void 0, p = !1, E.clear(), document.removeEventListener("pointerdown", m), document.removeEventListener("pointerup", y), document.removeEventListener("contextmenu", C), t.removeEventListener("keyup",
|
|
2319
|
+
c = void 0, f = void 0, l = void 0, p = !1, E.clear(), document.removeEventListener("pointerdown", m), document.removeEventListener("pointerup", y), document.removeEventListener("contextmenu", C), t.removeEventListener("keyup", x), t.removeEventListener("selectstart", b), document.removeEventListener("selectionchange", E), $.unbind();
|
|
2326
2320
|
},
|
|
2327
2321
|
setFilter: d,
|
|
2328
2322
|
setUser: r,
|
|
2329
|
-
setAnnotatingEnabled:
|
|
2323
|
+
setAnnotatingEnabled: A
|
|
2330
2324
|
};
|
|
2331
2325
|
}, To = (t, e) => ({
|
|
2332
2326
|
...t,
|
|
2333
2327
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2334
2328
|
user: t.user || e.user
|
|
2335
|
-
}),
|
|
2336
|
-
Ie(t),
|
|
2329
|
+
}), ae = "SPANS", Io = (t, e = {}) => {
|
|
2330
|
+
Ie(t), _e(t);
|
|
2337
2331
|
const n = To(e, {
|
|
2338
2332
|
annotatingEnabled: !0,
|
|
2339
2333
|
user: Wn()
|
|
2340
2334
|
}), o = fo(t, n.userSelectAction), { selection: i, viewport: s } = o, r = o.store, a = Vn(r), d = Yn(o, a, n.adapter);
|
|
2341
2335
|
let c = n.user;
|
|
2342
|
-
const f = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" :
|
|
2336
|
+
const f = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ae : n.renderer || ae, l = f === "SPANS" ? pn(t, o, s) : f === "CSS_HIGHLIGHTS" ? fn(t, o, s) : f === "CANVAS" ? en(t, o, s) : void 0;
|
|
2343
2337
|
if (!l)
|
|
2344
2338
|
throw `Unknown renderer implementation: ${f}`;
|
|
2345
2339
|
console.debug(`Using ${f} renderer`), n.style && l.setStyle(n.style);
|
|
2346
2340
|
const p = Oo(t, o, n.offsetReferenceSelector);
|
|
2347
2341
|
p.setUser(c), p.setAnnotatingEnabled(n.annotatingEnabled);
|
|
2348
|
-
const h = $n(o, a, n.adapter),
|
|
2342
|
+
const h = $n(o, a, n.adapter), A = () => c, b = (x) => {
|
|
2349
2343
|
p.setAnnotatingEnabled(
|
|
2350
|
-
|
|
2344
|
+
x === void 0 ? !0 : x
|
|
2351
2345
|
);
|
|
2352
|
-
}, E = (
|
|
2353
|
-
l.setFilter(
|
|
2354
|
-
}, m = (
|
|
2355
|
-
c =
|
|
2356
|
-
}, u = (
|
|
2357
|
-
|
|
2358
|
-
}, y = (
|
|
2359
|
-
|
|
2346
|
+
}, E = (x) => {
|
|
2347
|
+
l.setFilter(x), p.setFilter(x);
|
|
2348
|
+
}, m = (x) => {
|
|
2349
|
+
c = x, p.setUser(x);
|
|
2350
|
+
}, u = (x) => {
|
|
2351
|
+
x && (l.setPainter(go(x, n.presence)), x.on("selectionChange", () => l.redraw()));
|
|
2352
|
+
}, y = (x) => {
|
|
2353
|
+
x ? i.setSelected(x) : i.clear();
|
|
2360
2354
|
};
|
|
2361
2355
|
return {
|
|
2362
2356
|
...h,
|
|
@@ -2364,7 +2358,7 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2364
2358
|
l.destroy(), p.destroy(), a.destroy();
|
|
2365
2359
|
},
|
|
2366
2360
|
element: t,
|
|
2367
|
-
getUser:
|
|
2361
|
+
getUser: A,
|
|
2368
2362
|
setAnnotatingEnabled: b,
|
|
2369
2363
|
setFilter: E,
|
|
2370
2364
|
setStyle: l.setStyle.bind(l),
|
|
@@ -2381,46 +2375,47 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2381
2375
|
};
|
|
2382
2376
|
export {
|
|
2383
2377
|
vt as DEFAULT_SELECTED_STYLE,
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2378
|
+
W as DEFAULT_STYLE,
|
|
2379
|
+
ce as NOT_ANNOTATABLE_CLASS,
|
|
2380
|
+
Z as NOT_ANNOTATABLE_SELECTOR,
|
|
2387
2381
|
k as Origin,
|
|
2388
2382
|
xn as UserSelectAction,
|
|
2389
|
-
|
|
2383
|
+
ko as W3CTextFormat,
|
|
2390
2384
|
Ie as cancelSingleClickEvents,
|
|
2391
2385
|
ut as cloneKeyboardEvent,
|
|
2392
|
-
|
|
2393
|
-
|
|
2386
|
+
xt as clonePointerEvent,
|
|
2387
|
+
Bo as createBody,
|
|
2394
2388
|
en as createCanvasRenderer,
|
|
2395
2389
|
fn as createHighlightsRenderer,
|
|
2396
2390
|
go as createPresencePainter,
|
|
2397
2391
|
un as createRenderer,
|
|
2398
2392
|
Oo as createSelectionHandler,
|
|
2399
2393
|
pn as createSpansRenderer,
|
|
2400
|
-
|
|
2394
|
+
Io as createTextAnnotator,
|
|
2401
2395
|
fo as createTextAnnotatorState,
|
|
2402
|
-
|
|
2396
|
+
Mo as denormalizeRectWithOffset,
|
|
2403
2397
|
To as fillDefaults,
|
|
2404
|
-
Ro as getAnnotatableFragment,
|
|
2405
2398
|
Ue as getQuoteContext,
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2399
|
+
Ut as getRangeAnnotatableContents,
|
|
2400
|
+
Ne as isMac,
|
|
2401
|
+
nt as isNotAnnotatable,
|
|
2402
|
+
Me as isRangeAnnotatable,
|
|
2403
|
+
F as isRevived,
|
|
2409
2404
|
Ve as isWhitespaceOrEmpty,
|
|
2410
2405
|
Xe as mergeClientRects,
|
|
2411
2406
|
He as normalizeRectWithOffset,
|
|
2412
2407
|
Fe as paint,
|
|
2413
2408
|
to as parseW3CTextAnnotation,
|
|
2414
|
-
|
|
2409
|
+
_e as programmaticallyFocusable,
|
|
2415
2410
|
Pe as rangeContains,
|
|
2416
2411
|
$e as rangeToSelector,
|
|
2417
|
-
|
|
2418
|
-
|
|
2412
|
+
At as reviveAnnotation,
|
|
2413
|
+
le as reviveSelector,
|
|
2419
2414
|
wt as reviveTarget,
|
|
2420
2415
|
ze as scrollIntoView,
|
|
2421
2416
|
eo as serializeW3CTextAnnotation,
|
|
2422
2417
|
ke as splitAnnotatableRanges,
|
|
2423
|
-
|
|
2418
|
+
Ro as toDomRectList,
|
|
2424
2419
|
je as trimRangeToContainer,
|
|
2425
2420
|
De as whitespaceOrEmptyRegex
|
|
2426
2421
|
};
|