@annotorious/annotorious 3.0.0-rc.3 → 3.0.0-rc.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/Annotorious.d.ts +2 -0
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/AnnotoriousOpts.d.ts +2 -0
- package/dist/AnnotoriousOpts.d.ts.map +1 -1
- package/dist/annotorious.es.js +1290 -1272
- package/dist/annotorious.es.js.map +1 -1
- package/dist/annotorious.js +1 -1
- package/dist/annotorious.js.map +1 -1
- package/dist/keyboardCommands.d.ts +2 -2
- package/dist/keyboardCommands.d.ts.map +1 -1
- package/dist/themes/smart/setTheme.d.ts +3 -1
- package/dist/themes/smart/setTheme.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/Annotorious.ts +14 -17
- package/src/AnnotoriousOpts.ts +6 -1
- package/src/annotation/tools/polygon/RubberbandPolygon.svelte +4 -2
- package/src/keyboardCommands.ts +3 -3
- package/src/model/w3c/W3CImageFormatAdapter.ts +2 -1
- package/src/themes/smart/setTheme.ts +8 -4
package/dist/annotorious.es.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
function
|
|
1
|
+
function F() {
|
|
2
2
|
}
|
|
3
|
-
function
|
|
3
|
+
function Qt(e, t) {
|
|
4
4
|
for (const n in t)
|
|
5
5
|
e[n] = t[n];
|
|
6
6
|
return e;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Xt(e) {
|
|
9
9
|
return e();
|
|
10
10
|
}
|
|
11
11
|
function ct() {
|
|
12
12
|
return /* @__PURE__ */ Object.create(null);
|
|
13
13
|
}
|
|
14
14
|
function ae(e) {
|
|
15
|
-
e.forEach(
|
|
15
|
+
e.forEach(Xt);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function W(e) {
|
|
18
18
|
return typeof e == "function";
|
|
19
19
|
}
|
|
20
20
|
function $(e, t) {
|
|
21
21
|
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function xt(e) {
|
|
24
24
|
return Object.keys(e).length === 0;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Ut(e, ...t) {
|
|
27
27
|
if (e == null)
|
|
28
|
-
return
|
|
28
|
+
return F;
|
|
29
29
|
const n = e.subscribe(...t);
|
|
30
30
|
return n.unsubscribe ? () => n.unsubscribe() : n;
|
|
31
31
|
}
|
|
32
32
|
function ft(e, t, n) {
|
|
33
|
-
e.$$.on_destroy.push(
|
|
33
|
+
e.$$.on_destroy.push(Ut(t, n));
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function $t(e, t, n, o) {
|
|
36
36
|
if (e) {
|
|
37
|
-
const i =
|
|
37
|
+
const i = Nt(e, t, n, o);
|
|
38
38
|
return e[0](i);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return e[1] && o ?
|
|
41
|
+
function Nt(e, t, n, o) {
|
|
42
|
+
return e[1] && o ? Qt(n.ctx.slice(), e[1](o(t))) : n.ctx;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function en(e, t, n, o) {
|
|
45
45
|
if (e[2] && o) {
|
|
46
46
|
const i = e[2](o(n));
|
|
47
47
|
if (t.dirty === void 0)
|
|
@@ -56,13 +56,13 @@ function xt(e, t, n, o) {
|
|
|
56
56
|
}
|
|
57
57
|
return t.dirty;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function tn(e, t, n, o, i, s) {
|
|
60
60
|
if (i) {
|
|
61
|
-
const r =
|
|
61
|
+
const r = Nt(t, n, o, s);
|
|
62
62
|
e.p(r, i);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function nn(e) {
|
|
66
66
|
if (e.ctx.length > 32) {
|
|
67
67
|
const t = [], n = e.ctx.length / 32;
|
|
68
68
|
for (let o = 0; o < n; o++)
|
|
@@ -74,41 +74,41 @@ function en(e) {
|
|
|
74
74
|
function fe(e, t) {
|
|
75
75
|
e.appendChild(t);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function C(e, t, n) {
|
|
78
78
|
e.insertBefore(t, n || null);
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function I(e) {
|
|
81
81
|
e.parentNode && e.parentNode.removeChild(e);
|
|
82
82
|
}
|
|
83
83
|
function ot(e, t) {
|
|
84
84
|
for (let n = 0; n < e.length; n += 1)
|
|
85
85
|
e[n] && e[n].d(t);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function D(e) {
|
|
88
88
|
return document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Gt(e) {
|
|
91
91
|
return document.createTextNode(e);
|
|
92
92
|
}
|
|
93
93
|
function ne() {
|
|
94
|
-
return
|
|
94
|
+
return Gt(" ");
|
|
95
95
|
}
|
|
96
96
|
function ce() {
|
|
97
|
-
return
|
|
97
|
+
return Gt("");
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function K(e, t, n, o) {
|
|
100
100
|
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
|
|
101
101
|
}
|
|
102
102
|
function u(e, t, n) {
|
|
103
103
|
n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function on(e) {
|
|
106
106
|
return Array.from(e.childNodes);
|
|
107
107
|
}
|
|
108
108
|
function ut(e, t, n) {
|
|
109
109
|
e.classList[n ? "add" : "remove"](t);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function sn(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
|
|
112
112
|
const i = document.createEvent("CustomEvent");
|
|
113
113
|
return i.initCustomEvent(e, n, o, t), i;
|
|
114
114
|
}
|
|
@@ -116,20 +116,20 @@ let Be;
|
|
|
116
116
|
function ke(e) {
|
|
117
117
|
Be = e;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Ht() {
|
|
120
120
|
if (!Be)
|
|
121
121
|
throw new Error("Function called outside component initialization");
|
|
122
122
|
return Be;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function Ie(e) {
|
|
125
|
+
Ht().$$.on_mount.push(e);
|
|
126
126
|
}
|
|
127
127
|
function Se() {
|
|
128
|
-
const e =
|
|
128
|
+
const e = Ht();
|
|
129
129
|
return (t, n, { cancelable: o = !1 } = {}) => {
|
|
130
130
|
const i = e.$$.callbacks[t];
|
|
131
131
|
if (i) {
|
|
132
|
-
const s =
|
|
132
|
+
const s = sn(t, n, { cancelable: o });
|
|
133
133
|
return i.slice().forEach((r) => {
|
|
134
134
|
r.call(e, s);
|
|
135
135
|
}), !s.defaultPrevented;
|
|
@@ -143,17 +143,17 @@ function Ae(e, t) {
|
|
|
143
143
|
}
|
|
144
144
|
const be = [], Ge = [];
|
|
145
145
|
let Te = [];
|
|
146
|
-
const dt = [],
|
|
146
|
+
const dt = [], rn = /* @__PURE__ */ Promise.resolve();
|
|
147
147
|
let et = !1;
|
|
148
|
-
function
|
|
149
|
-
et || (et = !0,
|
|
148
|
+
function ln() {
|
|
149
|
+
et || (et = !0, rn.then(Ft));
|
|
150
150
|
}
|
|
151
151
|
function tt(e) {
|
|
152
152
|
Te.push(e);
|
|
153
153
|
}
|
|
154
154
|
const qe = /* @__PURE__ */ new Set();
|
|
155
155
|
let _e = 0;
|
|
156
|
-
function
|
|
156
|
+
function Ft() {
|
|
157
157
|
if (_e !== 0)
|
|
158
158
|
return;
|
|
159
159
|
const e = Be;
|
|
@@ -161,7 +161,7 @@ function Ht() {
|
|
|
161
161
|
try {
|
|
162
162
|
for (; _e < be.length; ) {
|
|
163
163
|
const t = be[_e];
|
|
164
|
-
_e++, ke(t),
|
|
164
|
+
_e++, ke(t), an(t.$$);
|
|
165
165
|
}
|
|
166
166
|
} catch (t) {
|
|
167
167
|
throw be.length = 0, _e = 0, t;
|
|
@@ -178,14 +178,14 @@ function Ht() {
|
|
|
178
178
|
dt.pop()();
|
|
179
179
|
et = !1, qe.clear(), ke(e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function an(e) {
|
|
182
182
|
if (e.fragment !== null) {
|
|
183
183
|
e.update(), ae(e.before_update);
|
|
184
184
|
const t = e.dirty;
|
|
185
185
|
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(tt);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function cn(e) {
|
|
189
189
|
const t = [], n = [];
|
|
190
190
|
Te.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Te = t;
|
|
191
191
|
}
|
|
@@ -202,7 +202,7 @@ function re() {
|
|
|
202
202
|
function le() {
|
|
203
203
|
me.r || ae(me.c), me = me.p;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function X(e, t) {
|
|
206
206
|
e && e.i && (Ne.delete(e), e.i(t));
|
|
207
207
|
}
|
|
208
208
|
function N(e, t, n, o) {
|
|
@@ -221,26 +221,26 @@ function pe(e) {
|
|
|
221
221
|
function ue(e, t, n, o) {
|
|
222
222
|
const { fragment: i, after_update: s } = e.$$;
|
|
223
223
|
i && i.m(t, n), o || tt(() => {
|
|
224
|
-
const r = e.$$.on_mount.map(
|
|
224
|
+
const r = e.$$.on_mount.map(Xt).filter(W);
|
|
225
225
|
e.$$.on_destroy ? e.$$.on_destroy.push(...r) : ae(r), e.$$.on_mount = [];
|
|
226
226
|
}), s.forEach(tt);
|
|
227
227
|
}
|
|
228
228
|
function de(e, t) {
|
|
229
229
|
const n = e.$$;
|
|
230
|
-
n.fragment !== null && (
|
|
230
|
+
n.fragment !== null && (cn(n.after_update), ae(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
e.$$.dirty[0] === -1 && (be.push(e),
|
|
232
|
+
function fn(e, t) {
|
|
233
|
+
e.$$.dirty[0] === -1 && (be.push(e), ln(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
234
234
|
}
|
|
235
235
|
function oe(e, t, n, o, i, s, r, a = [-1]) {
|
|
236
236
|
const l = Be;
|
|
237
237
|
ke(e);
|
|
238
|
-
const
|
|
238
|
+
const f = e.$$ = {
|
|
239
239
|
fragment: null,
|
|
240
240
|
ctx: [],
|
|
241
241
|
// state
|
|
242
242
|
props: s,
|
|
243
|
-
update:
|
|
243
|
+
update: F,
|
|
244
244
|
not_equal: i,
|
|
245
245
|
bound: ct(),
|
|
246
246
|
// lifecycle
|
|
@@ -256,28 +256,28 @@ function oe(e, t, n, o, i, s, r, a = [-1]) {
|
|
|
256
256
|
skip_bound: !1,
|
|
257
257
|
root: t.target || l.$$.root
|
|
258
258
|
};
|
|
259
|
-
r && r(
|
|
260
|
-
let
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
return
|
|
264
|
-
}) : [],
|
|
259
|
+
r && r(f.root);
|
|
260
|
+
let h = !1;
|
|
261
|
+
if (f.ctx = n ? n(e, t.props || {}, (c, d, ...m) => {
|
|
262
|
+
const g = m.length ? m[0] : d;
|
|
263
|
+
return f.ctx && i(f.ctx[c], f.ctx[c] = g) && (!f.skip_bound && f.bound[c] && f.bound[c](g), h && fn(e, c)), d;
|
|
264
|
+
}) : [], f.update(), h = !0, ae(f.before_update), f.fragment = o ? o(f.ctx) : !1, t.target) {
|
|
265
265
|
if (t.hydrate) {
|
|
266
|
-
const c =
|
|
267
|
-
|
|
266
|
+
const c = on(t.target);
|
|
267
|
+
f.fragment && f.fragment.l(c), c.forEach(I);
|
|
268
268
|
} else
|
|
269
|
-
|
|
270
|
-
t.intro &&
|
|
269
|
+
f.fragment && f.fragment.c();
|
|
270
|
+
t.intro && X(e.$$.fragment), ue(e, t.target, t.anchor, t.customElement), Ft();
|
|
271
271
|
}
|
|
272
272
|
ke(l);
|
|
273
273
|
}
|
|
274
274
|
class ie {
|
|
275
275
|
$destroy() {
|
|
276
|
-
de(this, 1), this.$destroy =
|
|
276
|
+
de(this, 1), this.$destroy = F;
|
|
277
277
|
}
|
|
278
278
|
$on(t, n) {
|
|
279
|
-
if (!
|
|
280
|
-
return
|
|
279
|
+
if (!W(n))
|
|
280
|
+
return F;
|
|
281
281
|
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
282
282
|
return o.push(n), () => {
|
|
283
283
|
const i = o.indexOf(n);
|
|
@@ -285,24 +285,24 @@ class ie {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
$set(t) {
|
|
288
|
-
this.$$set && !
|
|
288
|
+
this.$$set && !xt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
var
|
|
292
|
-
const it = {}, st = (e, t) => it[e] = t, nt = (e) => it[e.type].area(e),
|
|
291
|
+
var j = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(j || {});
|
|
292
|
+
const it = {}, st = (e, t) => it[e] = t, nt = (e) => it[e.type].area(e), un = (e, t, n) => it[e.type].intersects(e, t, n), He = (e) => {
|
|
293
293
|
let t = 1 / 0, n = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
294
294
|
return e.forEach(([s, r]) => {
|
|
295
295
|
t = Math.min(t, s), n = Math.min(n, r), o = Math.max(o, s), i = Math.max(i, r);
|
|
296
296
|
}), { minX: t, minY: n, maxX: o, maxY: i };
|
|
297
|
-
},
|
|
297
|
+
}, dn = {
|
|
298
298
|
area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
|
|
299
299
|
intersects: (e, t, n) => {
|
|
300
|
-
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a),
|
|
301
|
-
return
|
|
300
|
+
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a), f = Math.sin(a), h = t - o, c = n - i, d = l * h + f * c, m = f * h - l * c;
|
|
301
|
+
return d * d / (s * s) + m * m / (r * r) <= 1;
|
|
302
302
|
}
|
|
303
303
|
};
|
|
304
|
-
st(
|
|
305
|
-
const
|
|
304
|
+
st(j.ELLIPSE, dn);
|
|
305
|
+
const hn = {
|
|
306
306
|
area: (e) => {
|
|
307
307
|
const { points: t } = e.geometry;
|
|
308
308
|
let n = 0, o = t.length - 1;
|
|
@@ -314,81 +314,81 @@ const un = {
|
|
|
314
314
|
const { points: o } = e.geometry;
|
|
315
315
|
let i = !1;
|
|
316
316
|
for (let s = 0, r = o.length - 1; s < o.length; r = s++) {
|
|
317
|
-
const a = o[s][0], l = o[s][1],
|
|
318
|
-
l > n !=
|
|
317
|
+
const a = o[s][0], l = o[s][1], f = o[r][0], h = o[r][1];
|
|
318
|
+
l > n != h > n && t < (f - a) * (n - l) / (h - l) + a && (i = !i);
|
|
319
319
|
}
|
|
320
320
|
return i;
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
|
-
st(
|
|
324
|
-
const
|
|
323
|
+
st(j.POLYGON, hn);
|
|
324
|
+
const mn = {
|
|
325
325
|
area: (e) => e.geometry.w * e.geometry.h,
|
|
326
326
|
intersects: (e, t, n) => t >= e.geometry.x && t <= e.geometry.x + e.geometry.w && n >= e.geometry.y && n <= e.geometry.y + e.geometry.h
|
|
327
327
|
};
|
|
328
|
-
st(
|
|
329
|
-
const
|
|
330
|
-
const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l,
|
|
328
|
+
st(j.RECTANGLE, mn);
|
|
329
|
+
const gn = (e, t = !1) => {
|
|
330
|
+
const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l, f, h, c] = i;
|
|
331
331
|
if (r !== "xywh")
|
|
332
332
|
throw new Error("Unsupported MediaFragment: " + n);
|
|
333
333
|
if (a && a !== "pixel")
|
|
334
334
|
throw new Error(`Unsupported MediaFragment unit: ${a}`);
|
|
335
|
-
const [
|
|
335
|
+
const [d, m, g, y] = [l, f, h, c].map(parseFloat);
|
|
336
336
|
return {
|
|
337
|
-
type:
|
|
337
|
+
type: j.RECTANGLE,
|
|
338
338
|
geometry: {
|
|
339
|
-
x:
|
|
340
|
-
y:
|
|
341
|
-
w:
|
|
342
|
-
h:
|
|
339
|
+
x: d,
|
|
340
|
+
y: m,
|
|
341
|
+
w: g,
|
|
342
|
+
h: y,
|
|
343
343
|
bounds: {
|
|
344
|
-
minX:
|
|
345
|
-
minY: t ?
|
|
346
|
-
maxX:
|
|
347
|
-
maxY: t ?
|
|
344
|
+
minX: d,
|
|
345
|
+
minY: t ? m - y : m,
|
|
346
|
+
maxX: d + g,
|
|
347
|
+
maxY: t ? m : m + y
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
|
-
},
|
|
351
|
+
}, pn = (e) => {
|
|
352
352
|
const { x: t, y: n, w: o, h: i } = e;
|
|
353
353
|
return {
|
|
354
354
|
type: "FragmentSelector",
|
|
355
355
|
conformsTo: "http://www.w3.org/TR/media-frags/",
|
|
356
356
|
value: `xywh=pixel:${t},${n},${o},${i}`
|
|
357
357
|
};
|
|
358
|
-
},
|
|
358
|
+
}, zt = "http://www.w3.org/2000/svg", ht = (e) => {
|
|
359
359
|
const t = (o) => {
|
|
360
360
|
Array.from(o.attributes).forEach((i) => {
|
|
361
361
|
i.name.startsWith("on") && o.removeAttribute(i.name);
|
|
362
362
|
});
|
|
363
363
|
}, n = e.getElementsByTagName("script");
|
|
364
364
|
return Array.from(n).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(e.querySelectorAll("*")).forEach(t), e;
|
|
365
|
-
}, gn = (e) => {
|
|
366
|
-
const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${Ft}">`);
|
|
367
|
-
return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
|
|
368
|
-
}, pn = (e) => {
|
|
369
|
-
const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(Ft), i = n.lookupNamespaceURI(null);
|
|
370
|
-
return o || i ? ht(n).firstChild : ht(gn(n)).firstChild;
|
|
371
365
|
}, _n = (e) => {
|
|
366
|
+
const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${zt}">`);
|
|
367
|
+
return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
|
|
368
|
+
}, yn = (e) => {
|
|
369
|
+
const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(zt), i = n.lookupNamespaceURI(null);
|
|
370
|
+
return o || i ? ht(n).firstChild : ht(_n(n)).firstChild;
|
|
371
|
+
}, wn = (e) => {
|
|
372
372
|
const [t, n, o] = e.match(/(<polygon points=["|'])([^("|')]*)/) || [];
|
|
373
373
|
if (!o)
|
|
374
374
|
return;
|
|
375
375
|
const i = o.split(" ").map((s) => s.split(",").map(parseFloat));
|
|
376
376
|
return {
|
|
377
|
-
type:
|
|
377
|
+
type: j.POLYGON,
|
|
378
378
|
geometry: {
|
|
379
379
|
points: i,
|
|
380
380
|
bounds: He(i)
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
},
|
|
384
|
-
const t =
|
|
383
|
+
}, bn = (e) => {
|
|
384
|
+
const t = yn(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
|
|
385
385
|
minX: n - i,
|
|
386
386
|
minY: o - s,
|
|
387
387
|
maxX: n + i,
|
|
388
388
|
maxY: o + s
|
|
389
389
|
};
|
|
390
390
|
return {
|
|
391
|
-
type:
|
|
391
|
+
type: j.ELLIPSE,
|
|
392
392
|
geometry: {
|
|
393
393
|
cx: n,
|
|
394
394
|
cy: o,
|
|
@@ -397,18 +397,18 @@ const hn = (e, t = !1) => {
|
|
|
397
397
|
bounds: r
|
|
398
398
|
}
|
|
399
399
|
};
|
|
400
|
-
},
|
|
400
|
+
}, En = (e) => {
|
|
401
401
|
const t = typeof e == "string" ? e : e.value;
|
|
402
402
|
if (t.includes("<polygon points="))
|
|
403
|
-
return
|
|
403
|
+
return wn(t);
|
|
404
404
|
if (t.includes("<ellipse "))
|
|
405
|
-
return
|
|
406
|
-
},
|
|
405
|
+
return bn(t);
|
|
406
|
+
}, An = (e) => {
|
|
407
407
|
let t;
|
|
408
|
-
if (e.type ===
|
|
408
|
+
if (e.type === j.POLYGON) {
|
|
409
409
|
const n = e.geometry, { points: o } = n;
|
|
410
410
|
t = `<svg><polygon points="${o.map((i) => i.join(",")).join(" ")}" /></svg>`;
|
|
411
|
-
} else if (e.type ===
|
|
411
|
+
} else if (e.type === j.ELLIPSE) {
|
|
412
412
|
const n = e.geometry;
|
|
413
413
|
t = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
|
|
414
414
|
}
|
|
@@ -417,33 +417,33 @@ const hn = (e, t = !1) => {
|
|
|
417
417
|
throw `Unsupported shape type: ${e.type}`;
|
|
418
418
|
};
|
|
419
419
|
let De;
|
|
420
|
-
const
|
|
421
|
-
function
|
|
420
|
+
const Tn = new Uint8Array(16);
|
|
421
|
+
function Sn() {
|
|
422
422
|
if (!De && (De = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !De))
|
|
423
423
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
424
|
-
return De(
|
|
424
|
+
return De(Tn);
|
|
425
425
|
}
|
|
426
|
-
const
|
|
426
|
+
const J = [];
|
|
427
427
|
for (let e = 0; e < 256; ++e)
|
|
428
|
-
|
|
429
|
-
function
|
|
430
|
-
return
|
|
428
|
+
J.push((e + 256).toString(16).slice(1));
|
|
429
|
+
function Mn(e, t = 0) {
|
|
430
|
+
return J[e[t + 0]] + J[e[t + 1]] + J[e[t + 2]] + J[e[t + 3]] + "-" + J[e[t + 4]] + J[e[t + 5]] + "-" + J[e[t + 6]] + J[e[t + 7]] + "-" + J[e[t + 8]] + J[e[t + 9]] + "-" + J[e[t + 10]] + J[e[t + 11]] + J[e[t + 12]] + J[e[t + 13]] + J[e[t + 14]] + J[e[t + 15]];
|
|
431
431
|
}
|
|
432
|
-
const
|
|
433
|
-
randomUUID:
|
|
432
|
+
const Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), mt = {
|
|
433
|
+
randomUUID: Ln
|
|
434
434
|
};
|
|
435
435
|
function rt(e, t, n) {
|
|
436
436
|
if (mt.randomUUID && !t && !e)
|
|
437
437
|
return mt.randomUUID();
|
|
438
438
|
e = e || {};
|
|
439
|
-
const o = e.random || (e.rng ||
|
|
439
|
+
const o = e.random || (e.rng || Sn)();
|
|
440
440
|
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
|
|
441
441
|
n = n || 0;
|
|
442
442
|
for (let i = 0; i < 16; ++i)
|
|
443
443
|
t[n + i] = o[i];
|
|
444
444
|
return t;
|
|
445
445
|
}
|
|
446
|
-
return
|
|
446
|
+
return Mn(o);
|
|
447
447
|
}
|
|
448
448
|
var gt = Object.prototype.hasOwnProperty;
|
|
449
449
|
function ge(e, t) {
|
|
@@ -472,17 +472,17 @@ function ge(e, t) {
|
|
|
472
472
|
return e !== e && t !== t;
|
|
473
473
|
}
|
|
474
474
|
const ye = [];
|
|
475
|
-
function Fe(e, t =
|
|
475
|
+
function Fe(e, t = F) {
|
|
476
476
|
let n;
|
|
477
477
|
const o = /* @__PURE__ */ new Set();
|
|
478
478
|
function i(a) {
|
|
479
479
|
if ($(e, a) && (e = a, n)) {
|
|
480
480
|
const l = !ye.length;
|
|
481
|
-
for (const
|
|
482
|
-
|
|
481
|
+
for (const f of o)
|
|
482
|
+
f[1](), ye.push(f, e);
|
|
483
483
|
if (l) {
|
|
484
|
-
for (let
|
|
485
|
-
ye[
|
|
484
|
+
for (let f = 0; f < ye.length; f += 2)
|
|
485
|
+
ye[f][0](ye[f + 1]);
|
|
486
486
|
ye.length = 0;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
@@ -490,15 +490,15 @@ function Fe(e, t = H) {
|
|
|
490
490
|
function s(a) {
|
|
491
491
|
i(a(e));
|
|
492
492
|
}
|
|
493
|
-
function r(a, l =
|
|
494
|
-
const
|
|
495
|
-
return o.add(
|
|
496
|
-
o.delete(
|
|
493
|
+
function r(a, l = F) {
|
|
494
|
+
const f = [a, l];
|
|
495
|
+
return o.add(f), o.size === 1 && (n = t(i) || F), a(e), () => {
|
|
496
|
+
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
499
|
return { set: i, update: s, subscribe: r };
|
|
500
500
|
}
|
|
501
|
-
const
|
|
501
|
+
const On = (e) => {
|
|
502
502
|
const { subscribe: t, set: n } = Fe(null);
|
|
503
503
|
let o = null;
|
|
504
504
|
return t((i) => o = i), e.observe(({ changes: i }) => {
|
|
@@ -515,8 +515,8 @@ const Mn = (e) => {
|
|
|
515
515
|
set: n
|
|
516
516
|
};
|
|
517
517
|
};
|
|
518
|
-
var
|
|
519
|
-
const Je = { selected: [] },
|
|
518
|
+
var Vt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Vt || {});
|
|
519
|
+
const Je = { selected: [] }, vn = (e, t = "EDIT") => {
|
|
520
520
|
const { subscribe: n, set: o } = Fe(Je);
|
|
521
521
|
let i = Je;
|
|
522
522
|
n((c) => i = c);
|
|
@@ -526,25 +526,25 @@ const Je = { selected: [] }, Ln = (e, t = "EDIT") => {
|
|
|
526
526
|
}, a = (c) => {
|
|
527
527
|
if (i.selected.length === 0)
|
|
528
528
|
return !1;
|
|
529
|
-
const
|
|
530
|
-
return i.selected.some((
|
|
531
|
-
}, l = (c,
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
535
|
-
o(
|
|
529
|
+
const d = typeof c == "string" ? c : c.id;
|
|
530
|
+
return i.selected.some((m) => m.id === d);
|
|
531
|
+
}, l = (c, d) => {
|
|
532
|
+
const m = e.getAnnotation(c);
|
|
533
|
+
if (m) {
|
|
534
|
+
const g = kn(m, t);
|
|
535
|
+
o(g === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: d } : g === "SELECT" ? { selected: [{ id: c }], pointerEvent: d } : { selected: [], pointerEvent: d });
|
|
536
536
|
} else
|
|
537
537
|
console.warn("Invalid selection: " + c);
|
|
538
|
-
},
|
|
539
|
-
const
|
|
540
|
-
o({ selected:
|
|
541
|
-
},
|
|
538
|
+
}, f = (c, d = !0) => {
|
|
539
|
+
const m = Array.isArray(c) ? c : [c], g = m.map((y) => e.getAnnotation(y)).filter((y) => y);
|
|
540
|
+
o({ selected: g.map(({ id: y }) => ({ id: y, editable: d })) }), g.length !== m.length && console.warn("Invalid selection", c);
|
|
541
|
+
}, h = (c) => {
|
|
542
542
|
if (i.selected.length === 0)
|
|
543
543
|
return !1;
|
|
544
|
-
const { selected:
|
|
545
|
-
|
|
544
|
+
const { selected: d } = i;
|
|
545
|
+
d.filter(({ id: g }) => c.includes(g)).length > 0 && o({ selected: d.filter(({ id: g }) => !c.includes(g)) });
|
|
546
546
|
};
|
|
547
|
-
return e.observe(({ changes: c }) =>
|
|
547
|
+
return e.observe(({ changes: c }) => h(c.deleted.map((d) => d.id))), {
|
|
548
548
|
clear: s,
|
|
549
549
|
clickSelect: l,
|
|
550
550
|
get selected() {
|
|
@@ -555,390 +555,414 @@ const Je = { selected: [] }, Ln = (e, t = "EDIT") => {
|
|
|
555
555
|
},
|
|
556
556
|
isEmpty: r,
|
|
557
557
|
isSelected: a,
|
|
558
|
-
setSelected:
|
|
558
|
+
setSelected: f,
|
|
559
559
|
subscribe: n
|
|
560
560
|
};
|
|
561
|
-
},
|
|
561
|
+
}, kn = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", _i = (e) => {
|
|
562
562
|
const { creator: t, updatedBy: n } = e.target, o = e.bodies.reduce((i, s) => [...i, s.creator, s.updatedBy], []);
|
|
563
563
|
return [
|
|
564
564
|
t,
|
|
565
565
|
n,
|
|
566
566
|
...o
|
|
567
567
|
].filter((i) => i);
|
|
568
|
-
},
|
|
568
|
+
}, yi = (e, t, n, o) => ({
|
|
569
569
|
id: rt(),
|
|
570
570
|
annotation: e.id,
|
|
571
571
|
created: n || /* @__PURE__ */ new Date(),
|
|
572
572
|
creator: o,
|
|
573
573
|
...t
|
|
574
|
-
}),
|
|
574
|
+
}), Bn = (e, t) => {
|
|
575
575
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
576
576
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
577
|
-
},
|
|
577
|
+
}, In = (e, t) => {
|
|
578
578
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
579
579
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
580
|
-
},
|
|
580
|
+
}, Cn = (e, t) => t.bodies.map((n) => {
|
|
581
581
|
const o = e.bodies.find((i) => i.id === n.id);
|
|
582
582
|
return { newBody: n, oldBody: o && !ge(o, n) ? o : void 0 };
|
|
583
|
-
}).filter(({ oldBody: n }) => n),
|
|
584
|
-
const n =
|
|
583
|
+
}).filter(({ oldBody: n }) => n), Pn = (e, t) => !ge(e.target, t.target), jt = (e, t) => {
|
|
584
|
+
const n = Bn(e, t), o = In(e, t), i = Cn(e, t);
|
|
585
585
|
return {
|
|
586
586
|
oldValue: e,
|
|
587
587
|
newValue: t,
|
|
588
588
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
589
589
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
590
590
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
591
|
-
targetUpdated:
|
|
591
|
+
targetUpdated: Pn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
|
|
592
592
|
};
|
|
593
593
|
};
|
|
594
594
|
var G = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(G || {});
|
|
595
|
-
const
|
|
595
|
+
const Yn = (e, t) => {
|
|
596
596
|
var s, r;
|
|
597
597
|
const { changes: n, origin: o } = t;
|
|
598
598
|
if (!(!e.options.origin || e.options.origin === o))
|
|
599
599
|
return !1;
|
|
600
600
|
if (e.options.ignore) {
|
|
601
|
-
const { ignore: a } = e.options, l = (
|
|
601
|
+
const { ignore: a } = e.options, l = (h) => (h == null ? void 0 : h.length) > 0;
|
|
602
602
|
if (!(l(n.created) || l(n.deleted))) {
|
|
603
|
-
const
|
|
604
|
-
if (a === "BODY_ONLY" &&
|
|
603
|
+
const h = (s = n.updated) == null ? void 0 : s.some((d) => l(d.bodiesCreated) || l(d.bodiesDeleted) || l(d.bodiesUpdated)), c = (r = n.updated) == null ? void 0 : r.some((d) => d.targetUpdated);
|
|
604
|
+
if (a === "BODY_ONLY" && h && !c || a === "TARGET_ONLY" && c && !h)
|
|
605
605
|
return !1;
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
if (e.options.annotations) {
|
|
609
609
|
const a = /* @__PURE__ */ new Set([
|
|
610
|
-
...n.created.map((
|
|
611
|
-
...n.deleted.map((
|
|
612
|
-
...n.updated.map(({ oldValue:
|
|
610
|
+
...n.created.map((f) => f.id),
|
|
611
|
+
...n.deleted.map((f) => f.id),
|
|
612
|
+
...n.updated.map(({ oldValue: f }) => f.id)
|
|
613
613
|
]);
|
|
614
|
-
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((
|
|
614
|
+
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((f) => a.has(f));
|
|
615
615
|
} else
|
|
616
616
|
return !0;
|
|
617
|
-
},
|
|
617
|
+
}, Rn = (e, t) => {
|
|
618
618
|
const n = new Set((e.created || []).map((c) => c.id)), o = new Set((e.updated || []).map(({ newValue: c }) => c.id)), i = new Set((t.created || []).map((c) => c.id)), s = new Set((t.deleted || []).map((c) => c.id)), r = new Set((t.updated || []).map(({ oldValue: c }) => c.id)), a = new Set((t.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), l = [
|
|
619
|
-
...(e.created || []).filter((c) => !s.has(c.id)).map((c) => r.has(c.id) ? t.updated.find(({ oldValue:
|
|
619
|
+
...(e.created || []).filter((c) => !s.has(c.id)).map((c) => r.has(c.id) ? t.updated.find(({ oldValue: d }) => d.id === c.id).newValue : c),
|
|
620
620
|
...t.created || []
|
|
621
|
-
],
|
|
621
|
+
], f = [
|
|
622
622
|
...(e.deleted || []).filter((c) => !i.has(c.id)),
|
|
623
623
|
...(t.deleted || []).filter((c) => !n.has(c.id))
|
|
624
|
-
],
|
|
624
|
+
], h = [
|
|
625
625
|
...(e.updated || []).filter(({ newValue: c }) => !s.has(c.id)).map((c) => {
|
|
626
|
-
const { oldValue:
|
|
627
|
-
if (r.has(
|
|
628
|
-
const
|
|
629
|
-
return
|
|
626
|
+
const { oldValue: d, newValue: m } = c;
|
|
627
|
+
if (r.has(m.id)) {
|
|
628
|
+
const g = t.updated.find((y) => y.oldValue.id === m.id).newValue;
|
|
629
|
+
return jt(d, g);
|
|
630
630
|
} else
|
|
631
631
|
return c;
|
|
632
632
|
}),
|
|
633
633
|
...(t.updated || []).filter(({ oldValue: c }) => !a.has(c.id))
|
|
634
634
|
];
|
|
635
|
-
return { created: l, deleted:
|
|
636
|
-
},
|
|
637
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
}, s = (
|
|
641
|
-
const
|
|
642
|
-
origin:
|
|
635
|
+
return { created: l, deleted: f, updated: h };
|
|
636
|
+
}, Dn = (e) => e.id !== void 0, Xn = () => {
|
|
637
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (w, A = {}) => n.push({ onChange: w, options: A }), i = (w) => {
|
|
638
|
+
const A = n.findIndex((T) => T.onChange == w);
|
|
639
|
+
A > -1 && n.splice(A, 1);
|
|
640
|
+
}, s = (w, A) => {
|
|
641
|
+
const T = {
|
|
642
|
+
origin: w,
|
|
643
643
|
changes: {
|
|
644
|
-
created:
|
|
645
|
-
updated:
|
|
646
|
-
deleted:
|
|
644
|
+
created: A.created || [],
|
|
645
|
+
updated: A.updated || [],
|
|
646
|
+
deleted: A.deleted || []
|
|
647
647
|
},
|
|
648
648
|
state: [...e.values()]
|
|
649
649
|
};
|
|
650
|
-
n.forEach((
|
|
651
|
-
|
|
650
|
+
n.forEach((M) => {
|
|
651
|
+
Yn(M, T) && M.onChange(T);
|
|
652
652
|
});
|
|
653
|
-
}, r = (
|
|
654
|
-
if (e.get(
|
|
655
|
-
throw Error(`Cannot add annotation ${
|
|
656
|
-
e.set(
|
|
657
|
-
}, a = (
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
const U =
|
|
661
|
-
return
|
|
653
|
+
}, r = (w, A = G.LOCAL) => {
|
|
654
|
+
if (e.get(w.id))
|
|
655
|
+
throw Error(`Cannot add annotation ${w.id} - exists already`);
|
|
656
|
+
e.set(w.id, w), w.bodies.forEach((M) => t.set(M.id, w.id)), s(A, { created: [w] });
|
|
657
|
+
}, a = (w, A) => {
|
|
658
|
+
const T = typeof w == "string" ? A : w, M = typeof w == "string" ? w : w.id, P = e.get(M);
|
|
659
|
+
if (P) {
|
|
660
|
+
const U = jt(P, T);
|
|
661
|
+
return M === T.id ? e.set(M, T) : (e.delete(M), e.set(T.id, T)), P.bodies.forEach((Q) => t.delete(Q.id)), T.bodies.forEach((Q) => t.set(Q.id, T.id)), U;
|
|
662
662
|
} else
|
|
663
|
-
console.warn(`Cannot update annotation ${
|
|
664
|
-
}, l = (
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
},
|
|
668
|
-
const
|
|
669
|
-
const U = a(
|
|
670
|
-
return U ? [...
|
|
663
|
+
console.warn(`Cannot update annotation ${M} - does not exist`);
|
|
664
|
+
}, l = (w, A = G.LOCAL, T = G.LOCAL) => {
|
|
665
|
+
const M = Dn(A) ? T : A, P = a(w, A);
|
|
666
|
+
P && s(M, { updated: [P] });
|
|
667
|
+
}, f = (w, A = G.LOCAL) => {
|
|
668
|
+
const T = w.reduce((M, P) => {
|
|
669
|
+
const U = a(P);
|
|
670
|
+
return U ? [...M, U] : M;
|
|
671
671
|
}, []);
|
|
672
|
-
|
|
673
|
-
},
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
const
|
|
677
|
-
...
|
|
678
|
-
bodies: [...
|
|
672
|
+
T.length > 0 && s(A, { updated: T });
|
|
673
|
+
}, h = (w, A = G.LOCAL) => {
|
|
674
|
+
const T = e.get(w.annotation);
|
|
675
|
+
if (T) {
|
|
676
|
+
const M = {
|
|
677
|
+
...T,
|
|
678
|
+
bodies: [...T.bodies, w]
|
|
679
679
|
};
|
|
680
|
-
e.set(
|
|
681
|
-
oldValue:
|
|
682
|
-
newValue:
|
|
683
|
-
bodiesCreated: [
|
|
680
|
+
e.set(T.id, M), t.set(w.id, M.id), s(A, { updated: [{
|
|
681
|
+
oldValue: T,
|
|
682
|
+
newValue: M,
|
|
683
|
+
bodiesCreated: [w]
|
|
684
684
|
}] });
|
|
685
685
|
} else
|
|
686
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
687
|
-
}, c = () => [...e.values()],
|
|
688
|
-
const
|
|
689
|
-
e.clear(), t.clear(), s(
|
|
690
|
-
},
|
|
691
|
-
if (
|
|
692
|
-
const
|
|
693
|
-
e.clear(), t.clear(),
|
|
694
|
-
e.set(
|
|
695
|
-
}), s(
|
|
686
|
+
console.warn(`Attempt to add body to missing annotation: ${w.annotation}`);
|
|
687
|
+
}, c = () => [...e.values()], d = (w = G.LOCAL) => {
|
|
688
|
+
const A = [...e.values()];
|
|
689
|
+
e.clear(), t.clear(), s(w, { deleted: A });
|
|
690
|
+
}, m = (w, A = !0, T = G.LOCAL) => {
|
|
691
|
+
if (A) {
|
|
692
|
+
const M = [...e.values()];
|
|
693
|
+
e.clear(), t.clear(), w.forEach((P) => {
|
|
694
|
+
e.set(P.id, P), P.bodies.forEach((U) => t.set(U.id, P.id));
|
|
695
|
+
}), s(T, { created: w, deleted: M });
|
|
696
696
|
} else {
|
|
697
|
-
const
|
|
697
|
+
const M = w.reduce((P, U) => {
|
|
698
698
|
const Q = e.get(U.id);
|
|
699
|
-
return Q ? [...
|
|
699
|
+
return Q ? [...P, Q] : P;
|
|
700
700
|
}, []);
|
|
701
|
-
if (
|
|
702
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${
|
|
703
|
-
|
|
704
|
-
e.set(
|
|
705
|
-
}), s(
|
|
706
|
-
}
|
|
707
|
-
},
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
710
|
-
return e.delete(
|
|
711
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
712
|
-
},
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
},
|
|
716
|
-
const
|
|
717
|
-
const U =
|
|
718
|
-
return U ? [...
|
|
701
|
+
if (M.length > 0)
|
|
702
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${M.map((P) => P.id).join(", ")}`);
|
|
703
|
+
w.forEach((P) => {
|
|
704
|
+
e.set(P.id, P), P.bodies.forEach((U) => t.set(U.id, P.id));
|
|
705
|
+
}), s(T, { created: w });
|
|
706
|
+
}
|
|
707
|
+
}, g = (w) => {
|
|
708
|
+
const A = typeof w == "string" ? w : w.id, T = e.get(A);
|
|
709
|
+
if (T)
|
|
710
|
+
return e.delete(A), T.bodies.forEach((M) => t.delete(M.id)), T;
|
|
711
|
+
console.warn(`Attempt to delete missing annotation: ${A}`);
|
|
712
|
+
}, y = (w, A = G.LOCAL) => {
|
|
713
|
+
const T = g(w);
|
|
714
|
+
T && s(A, { deleted: [T] });
|
|
715
|
+
}, E = (w, A = G.LOCAL) => {
|
|
716
|
+
const T = w.reduce((M, P) => {
|
|
717
|
+
const U = g(P);
|
|
718
|
+
return U ? [...M, U] : M;
|
|
719
719
|
}, []);
|
|
720
|
-
|
|
721
|
-
},
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
726
|
-
t.delete(
|
|
727
|
-
const
|
|
728
|
-
...
|
|
729
|
-
bodies:
|
|
720
|
+
T.length > 0 && s(A, { deleted: T });
|
|
721
|
+
}, b = (w, A = G.LOCAL) => {
|
|
722
|
+
const T = e.get(w.annotation);
|
|
723
|
+
if (T) {
|
|
724
|
+
const M = T.bodies.find((P) => P.id === w.id);
|
|
725
|
+
if (M) {
|
|
726
|
+
t.delete(M.id);
|
|
727
|
+
const P = {
|
|
728
|
+
...T,
|
|
729
|
+
bodies: T.bodies.filter((Q) => Q.id !== w.id)
|
|
730
730
|
};
|
|
731
|
-
e.set(
|
|
732
|
-
oldValue:
|
|
733
|
-
newValue:
|
|
734
|
-
bodiesDeleted: [
|
|
731
|
+
e.set(T.id, P), s(A, { updated: [{
|
|
732
|
+
oldValue: T,
|
|
733
|
+
newValue: P,
|
|
734
|
+
bodiesDeleted: [M]
|
|
735
735
|
}] });
|
|
736
736
|
} else
|
|
737
|
-
console.warn(`Attempt to delete missing body ${
|
|
737
|
+
console.warn(`Attempt to delete missing body ${w.id} from annotation ${w.annotation}`);
|
|
738
738
|
} else
|
|
739
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
740
|
-
}, _ = (
|
|
741
|
-
const
|
|
742
|
-
return
|
|
743
|
-
},
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
return
|
|
749
|
-
console.error(`Store integrity error: body ${
|
|
739
|
+
console.warn(`Attempt to delete body from missing annotation ${w.annotation}`);
|
|
740
|
+
}, _ = (w) => {
|
|
741
|
+
const A = e.get(w);
|
|
742
|
+
return A ? { ...A } : void 0;
|
|
743
|
+
}, p = (w) => {
|
|
744
|
+
const A = t.get(w);
|
|
745
|
+
if (A) {
|
|
746
|
+
const M = _(A).bodies.find((P) => P.id === w);
|
|
747
|
+
if (M)
|
|
748
|
+
return M;
|
|
749
|
+
console.error(`Store integrity error: body ${w} in index, but not in annotation`);
|
|
750
750
|
} else
|
|
751
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
752
|
-
},
|
|
753
|
-
if (
|
|
751
|
+
console.warn(`Attempt to retrieve missing body: ${w}`);
|
|
752
|
+
}, L = (w, A) => {
|
|
753
|
+
if (w.annotation !== A.annotation)
|
|
754
754
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
755
|
-
const
|
|
756
|
-
if (
|
|
757
|
-
const
|
|
758
|
-
...
|
|
759
|
-
bodies:
|
|
755
|
+
const T = e.get(w.annotation);
|
|
756
|
+
if (T) {
|
|
757
|
+
const M = T.bodies.find((U) => U.id === w.id), P = {
|
|
758
|
+
...T,
|
|
759
|
+
bodies: T.bodies.map((U) => U.id === M.id ? A : U)
|
|
760
760
|
};
|
|
761
|
-
return e.set(
|
|
762
|
-
oldValue:
|
|
763
|
-
newValue:
|
|
764
|
-
bodiesUpdated: [{ oldBody:
|
|
761
|
+
return e.set(T.id, P), M.id !== A.id && (t.delete(M.id), t.set(A.id, P.id)), {
|
|
762
|
+
oldValue: T,
|
|
763
|
+
newValue: P,
|
|
764
|
+
bodiesUpdated: [{ oldBody: M, newBody: A }]
|
|
765
765
|
};
|
|
766
766
|
} else
|
|
767
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
768
|
-
},
|
|
769
|
-
const
|
|
770
|
-
s(
|
|
771
|
-
},
|
|
772
|
-
const
|
|
773
|
-
s(
|
|
774
|
-
},
|
|
775
|
-
const
|
|
776
|
-
if (
|
|
777
|
-
const
|
|
778
|
-
...
|
|
767
|
+
console.warn(`Attempt to add body to missing annotation ${w.annotation}`);
|
|
768
|
+
}, S = (w, A, T = G.LOCAL) => {
|
|
769
|
+
const M = L(w, A);
|
|
770
|
+
s(T, { updated: [M] });
|
|
771
|
+
}, B = (w, A = G.LOCAL) => {
|
|
772
|
+
const T = w.map((M) => L({ id: M.id, annotation: M.annotation }, M));
|
|
773
|
+
s(A, { updated: T });
|
|
774
|
+
}, z = (w) => {
|
|
775
|
+
const A = e.get(w.annotation);
|
|
776
|
+
if (A) {
|
|
777
|
+
const T = {
|
|
778
|
+
...A,
|
|
779
779
|
target: {
|
|
780
|
-
...
|
|
781
|
-
...
|
|
780
|
+
...A.target,
|
|
781
|
+
...w
|
|
782
782
|
}
|
|
783
783
|
};
|
|
784
|
-
return e.set(
|
|
785
|
-
oldValue:
|
|
786
|
-
newValue:
|
|
784
|
+
return e.set(A.id, T), {
|
|
785
|
+
oldValue: A,
|
|
786
|
+
newValue: T,
|
|
787
787
|
targetUpdated: {
|
|
788
|
-
oldTarget:
|
|
789
|
-
newTarget:
|
|
788
|
+
oldTarget: A.target,
|
|
789
|
+
newTarget: w
|
|
790
790
|
}
|
|
791
791
|
};
|
|
792
792
|
} else
|
|
793
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
793
|
+
console.warn(`Attempt to update target on missing annotation: ${w.annotation}`);
|
|
794
794
|
};
|
|
795
795
|
return {
|
|
796
796
|
addAnnotation: r,
|
|
797
|
-
addBody:
|
|
797
|
+
addBody: h,
|
|
798
798
|
all: c,
|
|
799
|
-
bulkAddAnnotation:
|
|
800
|
-
bulkDeleteAnnotation:
|
|
801
|
-
bulkUpdateAnnotation:
|
|
802
|
-
bulkUpdateBodies:
|
|
803
|
-
bulkUpdateTargets: (
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
},
|
|
807
|
-
clear:
|
|
808
|
-
deleteAnnotation:
|
|
809
|
-
deleteBody:
|
|
799
|
+
bulkAddAnnotation: m,
|
|
800
|
+
bulkDeleteAnnotation: E,
|
|
801
|
+
bulkUpdateAnnotation: f,
|
|
802
|
+
bulkUpdateBodies: B,
|
|
803
|
+
bulkUpdateTargets: (w, A = G.LOCAL) => {
|
|
804
|
+
const T = w.map(z).filter((M) => M);
|
|
805
|
+
T.length > 0 && s(A, { updated: T });
|
|
806
|
+
},
|
|
807
|
+
clear: d,
|
|
808
|
+
deleteAnnotation: y,
|
|
809
|
+
deleteBody: b,
|
|
810
810
|
getAnnotation: _,
|
|
811
|
-
getBody:
|
|
811
|
+
getBody: p,
|
|
812
812
|
observe: o,
|
|
813
813
|
unobserve: i,
|
|
814
814
|
updateAnnotation: l,
|
|
815
|
-
updateBody:
|
|
816
|
-
updateTarget: (
|
|
817
|
-
const
|
|
818
|
-
|
|
815
|
+
updateBody: S,
|
|
816
|
+
updateTarget: (w, A = G.LOCAL) => {
|
|
817
|
+
const T = z(w);
|
|
818
|
+
T && s(A, { updated: [T] });
|
|
819
819
|
}
|
|
820
820
|
};
|
|
821
|
-
},
|
|
821
|
+
}, Un = (e) => ({
|
|
822
822
|
...e,
|
|
823
823
|
subscribe: (n) => {
|
|
824
824
|
const o = (i) => n(i.state);
|
|
825
825
|
return e.observe(o), n(e.all()), () => e.unobserve(o);
|
|
826
826
|
}
|
|
827
|
-
})
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
827
|
+
});
|
|
828
|
+
let Wt = () => ({
|
|
829
|
+
emit(e, ...t) {
|
|
830
|
+
let n = this.events[e] || [];
|
|
831
|
+
for (let o = 0, i = n.length; o < i; o++)
|
|
832
|
+
n[o](...t);
|
|
833
|
+
},
|
|
834
|
+
events: {},
|
|
835
|
+
on(e, t) {
|
|
836
|
+
var n;
|
|
837
|
+
return (n = this.events[e]) != null && n.push(t) || (this.events[e] = [t]), () => {
|
|
838
|
+
var o;
|
|
839
|
+
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
const Nn = 250, Gn = (e) => {
|
|
844
|
+
const t = Wt(), n = [];
|
|
845
|
+
let o = -1, i = !1, s = 0;
|
|
846
|
+
const r = (p) => {
|
|
847
|
+
if (!i) {
|
|
848
|
+
const { changes: L } = p, S = performance.now();
|
|
849
|
+
if (S - s > Nn)
|
|
850
|
+
n.splice(o + 1), n.push(L), o = n.length - 1;
|
|
835
851
|
else {
|
|
836
|
-
const
|
|
837
|
-
|
|
852
|
+
const B = n.length - 1;
|
|
853
|
+
n[B] = Rn(n[B], L);
|
|
838
854
|
}
|
|
839
|
-
|
|
855
|
+
s = S;
|
|
840
856
|
}
|
|
841
|
-
|
|
857
|
+
i = !1;
|
|
842
858
|
};
|
|
843
|
-
e.observe(
|
|
844
|
-
const
|
|
859
|
+
e.observe(r, { origin: G.LOCAL });
|
|
860
|
+
const a = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkDeleteAnnotation(p), l = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkAddAnnotation(p, !1), f = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkUpdateAnnotation(p.map(({ oldValue: L }) => L)), h = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkUpdateAnnotation(p.map(({ newValue: L }) => L)), c = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkAddAnnotation(p, !1), d = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkDeleteAnnotation(p);
|
|
845
861
|
return {
|
|
846
|
-
|
|
862
|
+
canRedo: () => n.length - 1 > o,
|
|
863
|
+
canUndo: () => o > -1,
|
|
864
|
+
destroy: () => e.unobserve(r),
|
|
865
|
+
on: (p, L) => t.on(p, L),
|
|
847
866
|
redo: () => {
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
const { created:
|
|
851
|
-
|
|
867
|
+
if (n.length - 1 > o) {
|
|
868
|
+
i = !0;
|
|
869
|
+
const { created: p, updated: L, deleted: S } = n[o + 1];
|
|
870
|
+
l(p), h(L), d(S), t.emit("redo", n[o + 1]), o += 1;
|
|
852
871
|
}
|
|
853
872
|
},
|
|
854
873
|
undo: () => {
|
|
855
|
-
if (
|
|
856
|
-
|
|
857
|
-
const { created:
|
|
858
|
-
|
|
874
|
+
if (o > -1) {
|
|
875
|
+
i = !0;
|
|
876
|
+
const { created: p, updated: L, deleted: S } = n[o];
|
|
877
|
+
a(p), f(L), c(S), t.emit("undo", n[o]), o -= 1;
|
|
859
878
|
}
|
|
860
879
|
}
|
|
861
880
|
};
|
|
862
|
-
},
|
|
881
|
+
}, Hn = () => {
|
|
863
882
|
const { subscribe: e, set: t } = Fe([]);
|
|
864
883
|
return {
|
|
865
884
|
subscribe: e,
|
|
866
885
|
set: t
|
|
867
886
|
};
|
|
868
|
-
},
|
|
869
|
-
const r = /* @__PURE__ */ new Map();
|
|
870
|
-
let
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
},
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
},
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (
|
|
880
|
-
const
|
|
881
|
-
|
|
887
|
+
}, Fn = (e, t, n, o) => {
|
|
888
|
+
const { store: i, selection: s, hover: r, viewport: a } = e, l = /* @__PURE__ */ new Map();
|
|
889
|
+
let f = [], h, c;
|
|
890
|
+
const d = (b, _) => {
|
|
891
|
+
l.has(b) ? l.get(b).push(_) : l.set(b, [_]);
|
|
892
|
+
}, m = (b, _) => {
|
|
893
|
+
const p = l.get(b);
|
|
894
|
+
p && p.indexOf(_) > 0 && p.splice(p.indexOf(_), 1);
|
|
895
|
+
}, g = (b, _, p) => {
|
|
896
|
+
l.has(b) && setTimeout(() => {
|
|
897
|
+
l.get(b).forEach((L) => {
|
|
898
|
+
if (n) {
|
|
899
|
+
const S = Array.isArray(_) ? _.map((z) => n.serialize(z)) : n.serialize(_), B = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
|
|
900
|
+
L(S, B);
|
|
882
901
|
} else
|
|
883
|
-
|
|
902
|
+
L(_, p);
|
|
884
903
|
});
|
|
885
904
|
}, 1);
|
|
886
|
-
},
|
|
887
|
-
const { selected:
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
(!
|
|
891
|
-
}),
|
|
892
|
-
const
|
|
893
|
-
return
|
|
905
|
+
}, y = () => {
|
|
906
|
+
const { selected: b } = s, _ = b.map(({ id: p }) => i.getAnnotation(p));
|
|
907
|
+
_.forEach((p) => {
|
|
908
|
+
const L = f.find((S) => S.id === p.id);
|
|
909
|
+
(!L || !ge(L, p)) && g("updateAnnotation", p, L);
|
|
910
|
+
}), f = f.map((p) => {
|
|
911
|
+
const L = _.find(({ id: S }) => S === p.id);
|
|
912
|
+
return L || p;
|
|
894
913
|
});
|
|
895
914
|
};
|
|
896
|
-
|
|
897
|
-
if (!(
|
|
898
|
-
if (
|
|
899
|
-
|
|
900
|
-
else if (
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
}),
|
|
915
|
+
s.subscribe(({ selected: b }) => {
|
|
916
|
+
if (!(f.length === 0 && b.length === 0)) {
|
|
917
|
+
if (f.length === 0 && b.length > 0)
|
|
918
|
+
f = b.map(({ id: _ }) => i.getAnnotation(_));
|
|
919
|
+
else if (f.length > 0 && b.length === 0)
|
|
920
|
+
f.forEach((_) => {
|
|
921
|
+
const p = i.getAnnotation(_.id);
|
|
922
|
+
p && !ge(p, _) && g("updateAnnotation", p, _);
|
|
923
|
+
}), f = [];
|
|
905
924
|
else {
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
}),
|
|
925
|
+
const _ = new Set(f.map((S) => S.id)), p = new Set(b.map(({ id: S }) => S));
|
|
926
|
+
f.filter((S) => !p.has(S.id)).forEach((S) => {
|
|
927
|
+
const B = i.getAnnotation(S.id);
|
|
928
|
+
B && !ge(B, S) && g("updateAnnotation", B, S);
|
|
929
|
+
}), f = [
|
|
911
930
|
// Remove annotations that were deselected
|
|
912
|
-
...
|
|
931
|
+
...f.filter((S) => p.has(S.id)),
|
|
913
932
|
// Add editable annotations that were selected
|
|
914
|
-
...
|
|
933
|
+
...b.filter(({ id: S }) => !_.has(S)).map(({ id: S }) => i.getAnnotation(S))
|
|
915
934
|
];
|
|
916
935
|
}
|
|
917
|
-
|
|
918
|
-
}
|
|
919
|
-
}),
|
|
920
|
-
!
|
|
921
|
-
}),
|
|
922
|
-
|
|
923
|
-
const { created:
|
|
924
|
-
|
|
925
|
-
...
|
|
926
|
-
...
|
|
927
|
-
...
|
|
928
|
-
].length > 0).forEach(({ oldValue:
|
|
929
|
-
const
|
|
930
|
-
|
|
936
|
+
g("selectionChanged", f);
|
|
937
|
+
}
|
|
938
|
+
}), r.subscribe((b) => {
|
|
939
|
+
!h && b ? g("mouseEnterAnnotation", i.getAnnotation(b)) : h && !b ? g("mouseLeaveAnnotation", i.getAnnotation(h)) : h && b && (g("mouseLeaveAnnotation", i.getAnnotation(h)), g("mouseEnterAnnotation", i.getAnnotation(b))), h = b;
|
|
940
|
+
}), a == null || a.subscribe((b) => g("viewportIntersect", b.map(i.getAnnotation))), i.observe((b) => {
|
|
941
|
+
o && (c && clearTimeout(c), c = setTimeout(y, 1e3));
|
|
942
|
+
const { created: _, deleted: p } = b.changes;
|
|
943
|
+
_.forEach((S) => g("createAnnotation", S)), p.forEach((S) => g("deleteAnnotation", S)), b.changes.updated.filter((S) => [
|
|
944
|
+
...S.bodiesCreated || [],
|
|
945
|
+
...S.bodiesDeleted || [],
|
|
946
|
+
...S.bodiesUpdated || []
|
|
947
|
+
].length > 0).forEach(({ oldValue: S, newValue: B }) => {
|
|
948
|
+
const z = f.find((k) => k.id === S.id) || S;
|
|
949
|
+
f = f.map((k) => k.id === S.id ? B : k), g("updateAnnotation", B, z);
|
|
931
950
|
});
|
|
932
|
-
}, { origin: G.LOCAL }),
|
|
933
|
-
if (
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
const
|
|
937
|
-
return
|
|
951
|
+
}, { origin: G.LOCAL }), i.observe((b) => {
|
|
952
|
+
if (f) {
|
|
953
|
+
const _ = new Set(f.map((L) => L.id)), p = b.changes.updated.filter(({ newValue: L }) => _.has(L.id)).map(({ newValue: L }) => L);
|
|
954
|
+
p.length > 0 && (f = f.map((L) => {
|
|
955
|
+
const S = p.find((B) => B.id === L.id);
|
|
956
|
+
return S || L;
|
|
938
957
|
}));
|
|
939
958
|
}
|
|
940
|
-
}, { origin: G.REMOTE })
|
|
941
|
-
|
|
959
|
+
}, { origin: G.REMOTE });
|
|
960
|
+
const E = (b) => (_) => {
|
|
961
|
+
const { created: p, deleted: L, updated: S } = _;
|
|
962
|
+
p.forEach((B) => g("createAnnotation", B)), L.forEach((B) => g("deleteAnnotation", B)), b ? S.forEach((B) => g("updateAnnotation", B.oldValue, B.newValue)) : S.forEach((B) => g("updateAnnotation", B.newValue, B.oldValue));
|
|
963
|
+
};
|
|
964
|
+
return t.on("undo", E(!0)), t.on("redo", E(!1)), { on: d, off: m, emit: g };
|
|
965
|
+
}, wi = (e) => (t) => t.map((n) => e.serialize(n)), zn = (e) => (t) => t.reduce((n, o) => {
|
|
942
966
|
const { parsed: i, error: s } = e.parse(o);
|
|
943
967
|
return s ? {
|
|
944
968
|
parsed: n.parsed,
|
|
@@ -947,53 +971,64 @@ const In = (e, t) => {
|
|
|
947
971
|
parsed: [...n.parsed, i],
|
|
948
972
|
failed: n.failed
|
|
949
973
|
};
|
|
950
|
-
}, { parsed: [], failed: [] }),
|
|
951
|
-
const o = (
|
|
974
|
+
}, { parsed: [], failed: [] }), Vn = (e, t, n) => {
|
|
975
|
+
const { store: o, selection: i } = e, s = (E) => {
|
|
952
976
|
if (n) {
|
|
953
|
-
const { parsed:
|
|
954
|
-
|
|
977
|
+
const { parsed: b, error: _ } = n.parse(E);
|
|
978
|
+
b ? o.addAnnotation(b, G.REMOTE) : console.error(_);
|
|
955
979
|
} else
|
|
956
|
-
|
|
957
|
-
}, i = () =>
|
|
958
|
-
const
|
|
959
|
-
return n &&
|
|
960
|
-
},
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
980
|
+
o.addAnnotation(E, G.REMOTE);
|
|
981
|
+
}, r = () => i.clear(), a = () => o.clear(), l = (E) => {
|
|
982
|
+
const b = o.getAnnotation(E);
|
|
983
|
+
return n && b ? n.serialize(b) : b;
|
|
984
|
+
}, f = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
|
|
985
|
+
var _;
|
|
986
|
+
const b = (((_ = i.selected) == null ? void 0 : _.map((p) => p.id)) || []).map((p) => o.getAnnotation(p));
|
|
987
|
+
return n ? b.map(n.serialize) : b;
|
|
988
|
+
}, c = (E) => fetch(E).then((b) => b.json()).then((b) => (m(b), b)), d = (E) => {
|
|
989
|
+
if (typeof E == "string") {
|
|
990
|
+
const b = o.getAnnotation(E);
|
|
991
|
+
return o.deleteAnnotation(E), n ? n.serialize(b) : b;
|
|
964
992
|
} else {
|
|
965
|
-
const
|
|
966
|
-
return
|
|
993
|
+
const b = n ? n.parse(E).parsed : E;
|
|
994
|
+
return o.deleteAnnotation(b), E;
|
|
967
995
|
}
|
|
968
|
-
},
|
|
996
|
+
}, m = (E) => {
|
|
969
997
|
if (n) {
|
|
970
|
-
const { parsed:
|
|
971
|
-
|
|
998
|
+
const { parsed: b, failed: _ } = zn(n)(E);
|
|
999
|
+
_.length > 0 && console.warn(`Discarded ${_.length} invalid annotations`, _), o.bulkAddAnnotation(b, !0, G.REMOTE);
|
|
972
1000
|
} else
|
|
973
|
-
|
|
974
|
-
},
|
|
1001
|
+
o.bulkAddAnnotation(E, !0, G.REMOTE);
|
|
1002
|
+
}, g = (E) => {
|
|
1003
|
+
E ? i.setSelected(E) : i.clear();
|
|
1004
|
+
}, y = (E) => {
|
|
975
1005
|
if (n) {
|
|
976
|
-
const
|
|
977
|
-
return
|
|
1006
|
+
const b = n.parse(E).parsed, _ = n.serialize(o.getAnnotation(b.id));
|
|
1007
|
+
return o.updateAnnotation(b), _;
|
|
978
1008
|
} else {
|
|
979
|
-
const
|
|
980
|
-
return
|
|
1009
|
+
const b = o.getAnnotation(E.id);
|
|
1010
|
+
return o.updateAnnotation(E), b;
|
|
981
1011
|
}
|
|
982
1012
|
};
|
|
983
1013
|
return {
|
|
984
|
-
addAnnotation:
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1014
|
+
addAnnotation: s,
|
|
1015
|
+
cancelSelected: r,
|
|
1016
|
+
canRedo: t.canRedo,
|
|
1017
|
+
canUndo: t.canUndo,
|
|
1018
|
+
clearAnnotations: a,
|
|
1019
|
+
getAnnotationById: l,
|
|
1020
|
+
getAnnotations: f,
|
|
1021
|
+
getSelected: h,
|
|
1022
|
+
loadAnnotations: c,
|
|
989
1023
|
redo: t.redo,
|
|
990
|
-
removeAnnotation:
|
|
991
|
-
setAnnotations:
|
|
1024
|
+
removeAnnotation: d,
|
|
1025
|
+
setAnnotations: m,
|
|
1026
|
+
setSelected: g,
|
|
992
1027
|
undo: t.undo,
|
|
993
|
-
updateAnnotation:
|
|
1028
|
+
updateAnnotation: y
|
|
994
1029
|
};
|
|
995
1030
|
};
|
|
996
|
-
let
|
|
1031
|
+
let jn = (e) => crypto.getRandomValues(new Uint8Array(e)), Wn = (e, t, n) => {
|
|
997
1032
|
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
|
|
998
1033
|
return (s = t) => {
|
|
999
1034
|
let r = "";
|
|
@@ -1004,8 +1039,8 @@ let zn = (e) => crypto.getRandomValues(new Uint8Array(e)), Vn = (e, t, n) => {
|
|
|
1004
1039
|
return r;
|
|
1005
1040
|
}
|
|
1006
1041
|
};
|
|
1007
|
-
},
|
|
1008
|
-
const
|
|
1042
|
+
}, qn = (e, t = 21) => Wn(e, t, jn), Jn = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
|
|
1043
|
+
const Kn = () => ({ isGuest: !0, id: qn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Zn = (e) => {
|
|
1009
1044
|
const t = JSON.stringify(e);
|
|
1010
1045
|
let n = 0;
|
|
1011
1046
|
for (let o = 0, i = t.length; o < i; o++) {
|
|
@@ -1013,23 +1048,23 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1013
1048
|
n = (n << 5) - n + s, n |= 0;
|
|
1014
1049
|
}
|
|
1015
1050
|
return `${n}`;
|
|
1016
|
-
},
|
|
1017
|
-
const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...
|
|
1051
|
+
}, Qn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
|
|
1052
|
+
const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...f } = n;
|
|
1018
1053
|
return {
|
|
1019
|
-
id: o || `temp-${
|
|
1054
|
+
id: o || `temp-${Zn(n)}`,
|
|
1020
1055
|
annotation: t,
|
|
1021
1056
|
type: i,
|
|
1022
1057
|
purpose: s,
|
|
1023
1058
|
value: r,
|
|
1024
1059
|
created: a,
|
|
1025
1060
|
creator: l ? typeof l == "object" ? { ...l } : l : void 0,
|
|
1026
|
-
...
|
|
1061
|
+
...f
|
|
1027
1062
|
};
|
|
1028
|
-
}),
|
|
1063
|
+
}), xn = (e) => e.map((t) => {
|
|
1029
1064
|
var o;
|
|
1030
1065
|
const n = { ...t };
|
|
1031
1066
|
return delete n.annotation, (o = n.id) != null && o.startsWith("temp-") && delete n.id, n;
|
|
1032
|
-
}),
|
|
1067
|
+
}), $n = [
|
|
1033
1068
|
"#ff7c00",
|
|
1034
1069
|
// orange
|
|
1035
1070
|
"#1ac938",
|
|
@@ -1048,14 +1083,14 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1048
1083
|
// cyan
|
|
1049
1084
|
"#023eff"
|
|
1050
1085
|
// blue
|
|
1051
|
-
],
|
|
1052
|
-
const e = [
|
|
1086
|
+
], eo = () => {
|
|
1087
|
+
const e = [...$n];
|
|
1053
1088
|
return { assignRandomColor: () => {
|
|
1054
1089
|
const o = Math.floor(Math.random() * e.length), i = e[o];
|
|
1055
1090
|
return e.splice(o, 1), i;
|
|
1056
1091
|
}, releaseColor: (o) => e.push(o) };
|
|
1057
|
-
},
|
|
1058
|
-
const e =
|
|
1092
|
+
}, to = () => {
|
|
1093
|
+
const e = eo();
|
|
1059
1094
|
return { addUser: (o, i) => {
|
|
1060
1095
|
const s = e.assignRandomColor();
|
|
1061
1096
|
return {
|
|
@@ -1064,72 +1099,56 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1064
1099
|
color: s
|
|
1065
1100
|
};
|
|
1066
1101
|
}, removeUser: (o) => e.releaseColor(o.appearance.color) };
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
emit(e, ...t) {
|
|
1070
|
-
let n = this.events[e] || [];
|
|
1071
|
-
for (let o = 0, i = n.length; o < i; o++)
|
|
1072
|
-
n[o](...t);
|
|
1073
|
-
},
|
|
1074
|
-
events: {},
|
|
1075
|
-
on(e, t) {
|
|
1076
|
-
var n;
|
|
1077
|
-
return (n = this.events[e]) != null && n.push(t) || (this.events[e] = [t]), () => {
|
|
1078
|
-
var o;
|
|
1079
|
-
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
});
|
|
1083
|
-
const to = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), wi = Wn(), bi = (e = $n()) => {
|
|
1084
|
-
const t = eo(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, f) => {
|
|
1102
|
+
}, no = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), bi = Jn(), Ei = (e = to()) => {
|
|
1103
|
+
const t = Wt(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, d) => {
|
|
1085
1104
|
if (n.has(c)) {
|
|
1086
|
-
console.warn("Attempt to add user that is already present", c,
|
|
1105
|
+
console.warn("Attempt to add user that is already present", c, d);
|
|
1087
1106
|
return;
|
|
1088
1107
|
}
|
|
1089
|
-
const
|
|
1108
|
+
const m = e.addUser(c, d);
|
|
1090
1109
|
n.set(c, {
|
|
1091
|
-
...
|
|
1110
|
+
...d,
|
|
1092
1111
|
presenceKey: c,
|
|
1093
|
-
appearance:
|
|
1112
|
+
appearance: m
|
|
1094
1113
|
});
|
|
1095
1114
|
}, s = (c) => {
|
|
1096
|
-
const
|
|
1097
|
-
if (!
|
|
1115
|
+
const d = n.get(c);
|
|
1116
|
+
if (!d) {
|
|
1098
1117
|
console.warn("Attempt to remove user that is not present", c);
|
|
1099
1118
|
return;
|
|
1100
1119
|
}
|
|
1101
|
-
e.removeUser(
|
|
1120
|
+
e.removeUser(d), n.delete(c);
|
|
1102
1121
|
}, r = (c) => {
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
const { presenceKey:
|
|
1106
|
-
o.has(
|
|
1107
|
-
}), (
|
|
1108
|
-
}, a = (c,
|
|
1109
|
-
const
|
|
1110
|
-
if (!
|
|
1122
|
+
const d = new Set(c.map((y) => y.presenceKey)), m = c.filter(({ presenceKey: y }) => !n.has(y)), g = Array.from(n.values()).filter((y) => !d.has(y.presenceKey));
|
|
1123
|
+
m.forEach(({ presenceKey: y, user: E }) => i(y, E)), g.forEach((y) => {
|
|
1124
|
+
const { presenceKey: E } = y;
|
|
1125
|
+
o.has(E) && t.emit("selectionChange", y, null), s(E);
|
|
1126
|
+
}), (m.length > 0 || g.length > 0) && t.emit("presence", f());
|
|
1127
|
+
}, a = (c, d) => {
|
|
1128
|
+
const m = n.get(c);
|
|
1129
|
+
if (!m) {
|
|
1111
1130
|
console.warn("Activity notification from user that is not present");
|
|
1112
1131
|
return;
|
|
1113
1132
|
}
|
|
1114
|
-
const
|
|
1115
|
-
(!
|
|
1116
|
-
}, l = (c,
|
|
1117
|
-
const
|
|
1118
|
-
if (!
|
|
1133
|
+
const g = o.get(c);
|
|
1134
|
+
(!g || !no(g, d)) && (o.set(c, d), t.emit("selectionChange", m, d));
|
|
1135
|
+
}, l = (c, d) => {
|
|
1136
|
+
const m = n.get(c);
|
|
1137
|
+
if (!m) {
|
|
1119
1138
|
console.warn("Selection change for user that is not present", c);
|
|
1120
1139
|
return;
|
|
1121
1140
|
}
|
|
1122
|
-
|
|
1123
|
-
},
|
|
1141
|
+
d ? o.set(c, d) : o.delete(c), t.emit("selectionChange", m, d);
|
|
1142
|
+
}, f = () => [...Array.from(n.values())];
|
|
1124
1143
|
return {
|
|
1125
|
-
getPresentUsers:
|
|
1144
|
+
getPresentUsers: f,
|
|
1126
1145
|
notifyActivity: a,
|
|
1127
|
-
on: (c,
|
|
1146
|
+
on: (c, d) => t.on(c, d),
|
|
1128
1147
|
syncUsers: r,
|
|
1129
1148
|
updateSelection: l
|
|
1130
1149
|
};
|
|
1131
|
-
},
|
|
1132
|
-
const n = e.id || rt(), { body: o, ...i } = e, s =
|
|
1150
|
+
}, Ai = (e, t = !1) => ({ parse: (i) => oo(i, t), serialize: (i) => io(i, e) }), oo = (e, t = !1) => {
|
|
1151
|
+
const n = e.id || rt(), { body: o, ...i } = e, s = Qn(o, n), r = Array.isArray(e.target) ? e.target[0] : e.target, a = Array.isArray(r.selector) ? r.selector[0] : r.selector, l = a.type === "FragmentSelector" ? gn(a, t) : a.type === "SvgSelector" ? En(a) : void 0;
|
|
1133
1152
|
return l ? {
|
|
1134
1153
|
parsed: {
|
|
1135
1154
|
...i,
|
|
@@ -1141,16 +1160,16 @@ const to = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(
|
|
|
1141
1160
|
}
|
|
1142
1161
|
}
|
|
1143
1162
|
} : {
|
|
1144
|
-
error: Error(`Unknown selector type: ${
|
|
1163
|
+
error: Error(`Unknown selector type: ${a.type}`)
|
|
1145
1164
|
};
|
|
1146
|
-
},
|
|
1147
|
-
const n = e.target.selector, o = n.type ==
|
|
1165
|
+
}, io = (e, t) => {
|
|
1166
|
+
const n = e.target.selector, o = n.type == j.RECTANGLE ? pn(n.geometry) : An(n);
|
|
1148
1167
|
return {
|
|
1149
1168
|
...e,
|
|
1150
1169
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1151
1170
|
id: e.id,
|
|
1152
1171
|
type: "Annotation",
|
|
1153
|
-
body:
|
|
1172
|
+
body: xn(e.bodies),
|
|
1154
1173
|
target: {
|
|
1155
1174
|
source: t,
|
|
1156
1175
|
selector: o
|
|
@@ -1165,7 +1184,7 @@ function _t(e) {
|
|
|
1165
1184
|
let t, n, o, i, s;
|
|
1166
1185
|
return {
|
|
1167
1186
|
c() {
|
|
1168
|
-
t =
|
|
1187
|
+
t = D("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*point*/
|
|
1169
1188
|
e[11][0] - /*handleSize*/
|
|
1170
1189
|
e[3] / 2), u(t, "y", o = /*point*/
|
|
1171
1190
|
e[11][1] - /*handleSize*/
|
|
@@ -1182,14 +1201,14 @@ function _t(e) {
|
|
|
1182
1201
|
);
|
|
1183
1202
|
},
|
|
1184
1203
|
m(r, a) {
|
|
1185
|
-
|
|
1186
|
-
|
|
1204
|
+
C(r, t, a), i || (s = K(t, "pointerdown", function() {
|
|
1205
|
+
W(
|
|
1187
1206
|
/*grab*/
|
|
1188
|
-
e[10](
|
|
1207
|
+
e[10](v(
|
|
1189
1208
|
/*idx*/
|
|
1190
1209
|
e[13]
|
|
1191
1210
|
))
|
|
1192
|
-
) && e[10](
|
|
1211
|
+
) && e[10](v(
|
|
1193
1212
|
/*idx*/
|
|
1194
1213
|
e[13]
|
|
1195
1214
|
)).apply(this, arguments);
|
|
@@ -1217,22 +1236,22 @@ function _t(e) {
|
|
|
1217
1236
|
);
|
|
1218
1237
|
},
|
|
1219
1238
|
d(r) {
|
|
1220
|
-
r &&
|
|
1239
|
+
r && I(t), i = !1, s();
|
|
1221
1240
|
}
|
|
1222
1241
|
};
|
|
1223
1242
|
}
|
|
1224
|
-
function
|
|
1225
|
-
let t, n, o, i, s, r, a, l,
|
|
1243
|
+
function so(e) {
|
|
1244
|
+
let t, n, o, i, s, r, a, l, f, h, c = (
|
|
1226
1245
|
/*geom*/
|
|
1227
1246
|
e[4].points
|
|
1228
|
-
),
|
|
1229
|
-
for (let
|
|
1230
|
-
|
|
1247
|
+
), d = [];
|
|
1248
|
+
for (let m = 0; m < c.length; m += 1)
|
|
1249
|
+
d[m] = _t(pt(e, c, m));
|
|
1231
1250
|
return {
|
|
1232
1251
|
c() {
|
|
1233
|
-
t =
|
|
1234
|
-
for (let
|
|
1235
|
-
|
|
1252
|
+
t = D("polygon"), i = ne(), s = D("polygon"), a = ne();
|
|
1253
|
+
for (let m = 0; m < d.length; m += 1)
|
|
1254
|
+
d[m].c();
|
|
1236
1255
|
l = ce(), u(t, "class", "a9s-outer"), u(t, "style", n = /*computedStyle*/
|
|
1237
1256
|
e[1] ? "display:none;" : void 0), u(t, "points", o = /*geom*/
|
|
1238
1257
|
e[4].points.map(yt).join(" ")), u(s, "class", "a9s-inner a9s-shape-handle"), u(
|
|
@@ -1243,60 +1262,60 @@ function io(e) {
|
|
|
1243
1262
|
), u(s, "points", r = /*geom*/
|
|
1244
1263
|
e[4].points.map(wt).join(" "));
|
|
1245
1264
|
},
|
|
1246
|
-
m(
|
|
1247
|
-
|
|
1248
|
-
for (let
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1265
|
+
m(m, g) {
|
|
1266
|
+
C(m, t, g), C(m, i, g), C(m, s, g), C(m, a, g);
|
|
1267
|
+
for (let y = 0; y < d.length; y += 1)
|
|
1268
|
+
d[y] && d[y].m(m, g);
|
|
1269
|
+
C(m, l, g), f || (h = [
|
|
1270
|
+
K(t, "pointerdown", function() {
|
|
1271
|
+
W(
|
|
1253
1272
|
/*grab*/
|
|
1254
|
-
e[10](
|
|
1255
|
-
) && e[10](
|
|
1273
|
+
e[10](v.SHAPE)
|
|
1274
|
+
) && e[10](v.SHAPE).apply(this, arguments);
|
|
1256
1275
|
}),
|
|
1257
|
-
|
|
1258
|
-
|
|
1276
|
+
K(s, "pointerdown", function() {
|
|
1277
|
+
W(
|
|
1259
1278
|
/*grab*/
|
|
1260
|
-
e[10](
|
|
1261
|
-
) && e[10](
|
|
1279
|
+
e[10](v.SHAPE)
|
|
1280
|
+
) && e[10](v.SHAPE).apply(this, arguments);
|
|
1262
1281
|
})
|
|
1263
|
-
],
|
|
1282
|
+
], f = !0);
|
|
1264
1283
|
},
|
|
1265
|
-
p(
|
|
1266
|
-
if (e =
|
|
1284
|
+
p(m, g) {
|
|
1285
|
+
if (e = m, g & /*computedStyle*/
|
|
1267
1286
|
2 && n !== (n = /*computedStyle*/
|
|
1268
|
-
e[1] ? "display:none;" : void 0) && u(t, "style", n),
|
|
1287
|
+
e[1] ? "display:none;" : void 0) && u(t, "style", n), g & /*geom*/
|
|
1269
1288
|
16 && o !== (o = /*geom*/
|
|
1270
|
-
e[4].points.map(yt).join(" ")) && u(t, "points", o),
|
|
1289
|
+
e[4].points.map(yt).join(" ")) && u(t, "points", o), g & /*computedStyle*/
|
|
1271
1290
|
2 && u(
|
|
1272
1291
|
s,
|
|
1273
1292
|
"style",
|
|
1274
1293
|
/*computedStyle*/
|
|
1275
1294
|
e[1]
|
|
1276
|
-
),
|
|
1295
|
+
), g & /*geom*/
|
|
1277
1296
|
16 && r !== (r = /*geom*/
|
|
1278
|
-
e[4].points.map(wt).join(" ")) && u(s, "points", r),
|
|
1297
|
+
e[4].points.map(wt).join(" ")) && u(s, "points", r), g & /*geom, handleSize, grab, Handle*/
|
|
1279
1298
|
1048) {
|
|
1280
1299
|
c = /*geom*/
|
|
1281
1300
|
e[4].points;
|
|
1282
|
-
let
|
|
1283
|
-
for (
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1301
|
+
let y;
|
|
1302
|
+
for (y = 0; y < c.length; y += 1) {
|
|
1303
|
+
const E = pt(e, c, y);
|
|
1304
|
+
d[y] ? d[y].p(E, g) : (d[y] = _t(E), d[y].c(), d[y].m(l.parentNode, l));
|
|
1286
1305
|
}
|
|
1287
|
-
for (;
|
|
1288
|
-
|
|
1289
|
-
|
|
1306
|
+
for (; y < d.length; y += 1)
|
|
1307
|
+
d[y].d(1);
|
|
1308
|
+
d.length = c.length;
|
|
1290
1309
|
}
|
|
1291
1310
|
},
|
|
1292
|
-
d(
|
|
1293
|
-
|
|
1311
|
+
d(m) {
|
|
1312
|
+
m && I(t), m && I(i), m && I(s), m && I(a), ot(d, m), m && I(l), f = !1, ae(h);
|
|
1294
1313
|
}
|
|
1295
1314
|
};
|
|
1296
1315
|
}
|
|
1297
|
-
function
|
|
1316
|
+
function ro(e) {
|
|
1298
1317
|
let t, n;
|
|
1299
|
-
return t = new
|
|
1318
|
+
return t = new Jt({
|
|
1300
1319
|
props: {
|
|
1301
1320
|
shape: (
|
|
1302
1321
|
/*shape*/
|
|
@@ -1312,7 +1331,7 @@ function so(e) {
|
|
|
1312
1331
|
),
|
|
1313
1332
|
$$slots: {
|
|
1314
1333
|
default: [
|
|
1315
|
-
|
|
1334
|
+
so,
|
|
1316
1335
|
({ grab: o }) => ({ 10: o }),
|
|
1317
1336
|
({ grab: o }) => o ? 1024 : 0
|
|
1318
1337
|
]
|
|
@@ -1348,7 +1367,7 @@ function so(e) {
|
|
|
1348
1367
|
17434 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
|
|
1349
1368
|
},
|
|
1350
1369
|
i(o) {
|
|
1351
|
-
n || (
|
|
1370
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
1352
1371
|
},
|
|
1353
1372
|
o(o) {
|
|
1354
1373
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -1359,25 +1378,25 @@ function so(e) {
|
|
|
1359
1378
|
};
|
|
1360
1379
|
}
|
|
1361
1380
|
const yt = (e) => e.join(","), wt = (e) => e.join(",");
|
|
1362
|
-
function
|
|
1381
|
+
function lo(e, t, n) {
|
|
1363
1382
|
let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
|
|
1364
|
-
const
|
|
1365
|
-
let
|
|
1366
|
-
|
|
1367
|
-
const
|
|
1368
|
-
return { ...
|
|
1383
|
+
const f = (m, g, y) => {
|
|
1384
|
+
let E;
|
|
1385
|
+
g === v.SHAPE ? E = m.geometry.points.map(([_, p]) => [_ + y[0], p + y[1]]) : E = m.geometry.points.map(([_, p], L) => g === v(L) ? [_ + y[0], p + y[1]] : [_, p]);
|
|
1386
|
+
const b = He(E);
|
|
1387
|
+
return { ...m, geometry: { points: E, bounds: b } };
|
|
1369
1388
|
};
|
|
1370
|
-
function m
|
|
1371
|
-
Ae.call(this, e,
|
|
1389
|
+
function h(m) {
|
|
1390
|
+
Ae.call(this, e, m);
|
|
1372
1391
|
}
|
|
1373
|
-
function c(
|
|
1374
|
-
Ae.call(this, e,
|
|
1392
|
+
function c(m) {
|
|
1393
|
+
Ae.call(this, e, m);
|
|
1375
1394
|
}
|
|
1376
|
-
function
|
|
1377
|
-
Ae.call(this, e,
|
|
1395
|
+
function d(m) {
|
|
1396
|
+
Ae.call(this, e, m);
|
|
1378
1397
|
}
|
|
1379
|
-
return e.$$set = (
|
|
1380
|
-
"shape" in
|
|
1398
|
+
return e.$$set = (m) => {
|
|
1399
|
+
"shape" in m && n(0, s = m.shape), "computedStyle" in m && n(1, r = m.computedStyle), "transform" in m && n(2, a = m.transform), "viewportScale" in m && n(6, l = m.viewportScale);
|
|
1381
1400
|
}, e.$$.update = () => {
|
|
1382
1401
|
e.$$.dirty & /*shape*/
|
|
1383
1402
|
1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
|
|
@@ -1388,16 +1407,16 @@ function ro(e, t, n) {
|
|
|
1388
1407
|
a,
|
|
1389
1408
|
i,
|
|
1390
1409
|
o,
|
|
1391
|
-
|
|
1410
|
+
f,
|
|
1392
1411
|
l,
|
|
1393
|
-
|
|
1412
|
+
h,
|
|
1394
1413
|
c,
|
|
1395
|
-
|
|
1414
|
+
d
|
|
1396
1415
|
];
|
|
1397
1416
|
}
|
|
1398
|
-
class
|
|
1417
|
+
class ao extends ie {
|
|
1399
1418
|
constructor(t) {
|
|
1400
|
-
super(), oe(this, t,
|
|
1419
|
+
super(), oe(this, t, lo, ro, $, {
|
|
1401
1420
|
shape: 0,
|
|
1402
1421
|
computedStyle: 1,
|
|
1403
1422
|
transform: 2,
|
|
@@ -1405,11 +1424,11 @@ class lo extends ie {
|
|
|
1405
1424
|
});
|
|
1406
1425
|
}
|
|
1407
1426
|
}
|
|
1408
|
-
function
|
|
1409
|
-
let t, n, o, i, s, r, a, l,
|
|
1427
|
+
function co(e) {
|
|
1428
|
+
let t, n, o, i, s, r, a, l, f, h, c, d, m, g, y, E, b, _, p, L, S, B, z, k, H, w, A, T, M, P, U, Q, Me, x, Y, Z, V, q, se, he, Ve, ee, Ce, Pe, je, te, Ye, Re, We, at;
|
|
1410
1429
|
return {
|
|
1411
1430
|
c() {
|
|
1412
|
-
t =
|
|
1431
|
+
t = D("rect"), a = ne(), l = D("rect"), m = ne(), g = D("rect"), _ = ne(), p = D("rect"), z = ne(), k = D("rect"), T = ne(), M = D("rect"), Me = ne(), x = D("rect"), V = ne(), q = D("rect"), Ve = ne(), ee = D("rect"), je = ne(), te = D("rect"), u(t, "class", "a9s-outer"), u(t, "style", n = /*computedStyle*/
|
|
1413
1432
|
e[1] ? "display:none;" : void 0), u(t, "x", o = /*geom*/
|
|
1414
1433
|
e[4].x), u(t, "y", i = /*geom*/
|
|
1415
1434
|
e[4].y), u(t, "width", s = /*geom*/
|
|
@@ -1419,25 +1438,25 @@ function ao(e) {
|
|
|
1419
1438
|
"style",
|
|
1420
1439
|
/*computedStyle*/
|
|
1421
1440
|
e[1]
|
|
1422
|
-
), u(l, "x",
|
|
1423
|
-
e[4].x), u(l, "y",
|
|
1441
|
+
), u(l, "x", f = /*geom*/
|
|
1442
|
+
e[4].x), u(l, "y", h = /*geom*/
|
|
1424
1443
|
e[4].y), u(l, "width", c = /*geom*/
|
|
1425
|
-
e[4].w), u(l, "height",
|
|
1426
|
-
e[4].h), u(
|
|
1427
|
-
e[4].x), u(
|
|
1428
|
-
e[4].y), u(
|
|
1429
|
-
e[4].w), u(
|
|
1444
|
+
e[4].w), u(l, "height", d = /*geom*/
|
|
1445
|
+
e[4].h), u(g, "class", "a9s-edge-handle a9s-edge-handle-top"), u(g, "x", y = /*geom*/
|
|
1446
|
+
e[4].x), u(g, "y", E = /*geom*/
|
|
1447
|
+
e[4].y), u(g, "height", 1), u(g, "width", b = /*geom*/
|
|
1448
|
+
e[4].w), u(p, "class", "a9s-edge-handle a9s-edge-handle-right"), u(p, "x", L = /*geom*/
|
|
1430
1449
|
e[4].x + /*geom*/
|
|
1431
|
-
e[4].w), u(
|
|
1432
|
-
e[4].y), u(
|
|
1433
|
-
e[4].h), u(
|
|
1434
|
-
e[4].x), u(
|
|
1450
|
+
e[4].w), u(p, "y", S = /*geom*/
|
|
1451
|
+
e[4].y), u(p, "height", B = /*geom*/
|
|
1452
|
+
e[4].h), u(p, "width", 1), u(k, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(k, "x", H = /*geom*/
|
|
1453
|
+
e[4].x), u(k, "y", w = /*geom*/
|
|
1435
1454
|
e[4].y + /*geom*/
|
|
1436
|
-
e[4].h), u(
|
|
1437
|
-
e[4].w), u(
|
|
1438
|
-
e[4].x), u(
|
|
1439
|
-
e[4].y), u(
|
|
1440
|
-
e[4].h), u(
|
|
1455
|
+
e[4].h), u(k, "height", 1), u(k, "width", A = /*geom*/
|
|
1456
|
+
e[4].w), u(M, "class", "a9s-edge-handle a9s-edge-handle-left"), u(M, "x", P = /*geom*/
|
|
1457
|
+
e[4].x), u(M, "y", U = /*geom*/
|
|
1458
|
+
e[4].y), u(M, "height", Q = /*geom*/
|
|
1459
|
+
e[4].h), u(M, "width", 1), u(x, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(x, "x", Y = /*geom*/
|
|
1441
1460
|
e[4].x - /*handleSize*/
|
|
1442
1461
|
e[3] / 2), u(x, "y", Z = /*geom*/
|
|
1443
1462
|
e[4].y - /*handleSize*/
|
|
@@ -1451,22 +1470,22 @@ function ao(e) {
|
|
|
1451
1470
|
"width",
|
|
1452
1471
|
/*handleSize*/
|
|
1453
1472
|
e[3]
|
|
1454
|
-
), u(
|
|
1473
|
+
), u(q, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(q, "x", se = /*geom*/
|
|
1455
1474
|
e[4].x + /*geom*/
|
|
1456
1475
|
e[4].w - /*handleSize*/
|
|
1457
|
-
e[3] / 2), u(
|
|
1476
|
+
e[3] / 2), u(q, "y", he = /*geom*/
|
|
1458
1477
|
e[4].y - /*handleSize*/
|
|
1459
1478
|
e[3] / 2), u(
|
|
1460
|
-
|
|
1479
|
+
q,
|
|
1461
1480
|
"height",
|
|
1462
1481
|
/*handleSize*/
|
|
1463
1482
|
e[3]
|
|
1464
1483
|
), u(
|
|
1465
|
-
|
|
1484
|
+
q,
|
|
1466
1485
|
"width",
|
|
1467
1486
|
/*handleSize*/
|
|
1468
1487
|
e[3]
|
|
1469
|
-
), u(ee, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(ee, "x",
|
|
1488
|
+
), u(ee, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(ee, "x", Ce = /*geom*/
|
|
1470
1489
|
e[4].x + /*geom*/
|
|
1471
1490
|
e[4].w - /*handleSize*/
|
|
1472
1491
|
e[3] / 2), u(ee, "y", Pe = /*geom*/
|
|
@@ -1499,192 +1518,192 @@ function ao(e) {
|
|
|
1499
1518
|
e[3]
|
|
1500
1519
|
);
|
|
1501
1520
|
},
|
|
1502
|
-
m(
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1521
|
+
m(R, O) {
|
|
1522
|
+
C(R, t, O), C(R, a, O), C(R, l, O), C(R, m, O), C(R, g, O), C(R, _, O), C(R, p, O), C(R, z, O), C(R, k, O), C(R, T, O), C(R, M, O), C(R, Me, O), C(R, x, O), C(R, V, O), C(R, q, O), C(R, Ve, O), C(R, ee, O), C(R, je, O), C(R, te, O), We || (at = [
|
|
1523
|
+
K(t, "pointerdown", function() {
|
|
1524
|
+
W(
|
|
1506
1525
|
/*grab*/
|
|
1507
|
-
e[10](
|
|
1508
|
-
) && e[10](
|
|
1526
|
+
e[10](v.SHAPE)
|
|
1527
|
+
) && e[10](v.SHAPE).apply(this, arguments);
|
|
1509
1528
|
}),
|
|
1510
|
-
|
|
1511
|
-
|
|
1529
|
+
K(l, "pointerdown", function() {
|
|
1530
|
+
W(
|
|
1512
1531
|
/*grab*/
|
|
1513
|
-
e[10](
|
|
1514
|
-
) && e[10](
|
|
1532
|
+
e[10](v.SHAPE)
|
|
1533
|
+
) && e[10](v.SHAPE).apply(this, arguments);
|
|
1515
1534
|
}),
|
|
1516
|
-
|
|
1517
|
-
|
|
1535
|
+
K(g, "pointerdown", function() {
|
|
1536
|
+
W(
|
|
1518
1537
|
/*grab*/
|
|
1519
|
-
e[10](
|
|
1520
|
-
) && e[10](
|
|
1538
|
+
e[10](v.TOP)
|
|
1539
|
+
) && e[10](v.TOP).apply(this, arguments);
|
|
1521
1540
|
}),
|
|
1522
|
-
|
|
1523
|
-
|
|
1541
|
+
K(p, "pointerdown", function() {
|
|
1542
|
+
W(
|
|
1524
1543
|
/*grab*/
|
|
1525
|
-
e[10](
|
|
1526
|
-
) && e[10](
|
|
1544
|
+
e[10](v.RIGHT)
|
|
1545
|
+
) && e[10](v.RIGHT).apply(this, arguments);
|
|
1527
1546
|
}),
|
|
1528
|
-
|
|
1529
|
-
|
|
1547
|
+
K(k, "pointerdown", function() {
|
|
1548
|
+
W(
|
|
1530
1549
|
/*grab*/
|
|
1531
|
-
e[10](
|
|
1532
|
-
) && e[10](
|
|
1550
|
+
e[10](v.BOTTOM)
|
|
1551
|
+
) && e[10](v.BOTTOM).apply(this, arguments);
|
|
1533
1552
|
}),
|
|
1534
|
-
|
|
1535
|
-
|
|
1553
|
+
K(M, "pointerdown", function() {
|
|
1554
|
+
W(
|
|
1536
1555
|
/*grab*/
|
|
1537
|
-
e[10](
|
|
1538
|
-
) && e[10](
|
|
1556
|
+
e[10](v.LEFT)
|
|
1557
|
+
) && e[10](v.LEFT).apply(this, arguments);
|
|
1539
1558
|
}),
|
|
1540
|
-
|
|
1541
|
-
|
|
1559
|
+
K(x, "pointerdown", function() {
|
|
1560
|
+
W(
|
|
1542
1561
|
/*grab*/
|
|
1543
|
-
e[10](
|
|
1544
|
-
) && e[10](
|
|
1562
|
+
e[10](v.TOP_LEFT)
|
|
1563
|
+
) && e[10](v.TOP_LEFT).apply(this, arguments);
|
|
1545
1564
|
}),
|
|
1546
|
-
|
|
1547
|
-
|
|
1565
|
+
K(q, "pointerdown", function() {
|
|
1566
|
+
W(
|
|
1548
1567
|
/*grab*/
|
|
1549
|
-
e[10](
|
|
1550
|
-
) && e[10](
|
|
1568
|
+
e[10](v.TOP_RIGHT)
|
|
1569
|
+
) && e[10](v.TOP_RIGHT).apply(this, arguments);
|
|
1551
1570
|
}),
|
|
1552
|
-
|
|
1553
|
-
|
|
1571
|
+
K(ee, "pointerdown", function() {
|
|
1572
|
+
W(
|
|
1554
1573
|
/*grab*/
|
|
1555
|
-
e[10](
|
|
1556
|
-
) && e[10](
|
|
1574
|
+
e[10](v.BOTTOM_RIGHT)
|
|
1575
|
+
) && e[10](v.BOTTOM_RIGHT).apply(this, arguments);
|
|
1557
1576
|
}),
|
|
1558
|
-
|
|
1559
|
-
|
|
1577
|
+
K(te, "pointerdown", function() {
|
|
1578
|
+
W(
|
|
1560
1579
|
/*grab*/
|
|
1561
|
-
e[10](
|
|
1562
|
-
) && e[10](
|
|
1580
|
+
e[10](v.BOTTOM_LEFT)
|
|
1581
|
+
) && e[10](v.BOTTOM_LEFT).apply(this, arguments);
|
|
1563
1582
|
})
|
|
1564
1583
|
], We = !0);
|
|
1565
1584
|
},
|
|
1566
|
-
p(
|
|
1567
|
-
e =
|
|
1585
|
+
p(R, O) {
|
|
1586
|
+
e = R, O & /*computedStyle*/
|
|
1568
1587
|
2 && n !== (n = /*computedStyle*/
|
|
1569
|
-
e[1] ? "display:none;" : void 0) && u(t, "style", n),
|
|
1588
|
+
e[1] ? "display:none;" : void 0) && u(t, "style", n), O & /*geom*/
|
|
1570
1589
|
16 && o !== (o = /*geom*/
|
|
1571
|
-
e[4].x) && u(t, "x", o),
|
|
1590
|
+
e[4].x) && u(t, "x", o), O & /*geom*/
|
|
1572
1591
|
16 && i !== (i = /*geom*/
|
|
1573
|
-
e[4].y) && u(t, "y", i),
|
|
1592
|
+
e[4].y) && u(t, "y", i), O & /*geom*/
|
|
1574
1593
|
16 && s !== (s = /*geom*/
|
|
1575
|
-
e[4].w) && u(t, "width", s),
|
|
1594
|
+
e[4].w) && u(t, "width", s), O & /*geom*/
|
|
1576
1595
|
16 && r !== (r = /*geom*/
|
|
1577
|
-
e[4].h) && u(t, "height", r),
|
|
1596
|
+
e[4].h) && u(t, "height", r), O & /*computedStyle*/
|
|
1578
1597
|
2 && u(
|
|
1579
1598
|
l,
|
|
1580
1599
|
"style",
|
|
1581
1600
|
/*computedStyle*/
|
|
1582
1601
|
e[1]
|
|
1583
|
-
),
|
|
1584
|
-
16 && d !== (d = /*geom*/
|
|
1585
|
-
e[4].x) && u(l, "x", d), S & /*geom*/
|
|
1586
|
-
16 && m !== (m = /*geom*/
|
|
1587
|
-
e[4].y) && u(l, "y", m), S & /*geom*/
|
|
1588
|
-
16 && c !== (c = /*geom*/
|
|
1589
|
-
e[4].w) && u(l, "width", c), S & /*geom*/
|
|
1602
|
+
), O & /*geom*/
|
|
1590
1603
|
16 && f !== (f = /*geom*/
|
|
1591
|
-
e[4].
|
|
1592
|
-
16 &&
|
|
1593
|
-
e[4].
|
|
1594
|
-
16 &&
|
|
1595
|
-
e[4].
|
|
1596
|
-
16 &&
|
|
1597
|
-
e[4].
|
|
1598
|
-
16 && X !== (X = /*geom*/
|
|
1599
|
-
e[4].x + /*geom*/
|
|
1600
|
-
e[4].w) && u(M, "x", X), S & /*geom*/
|
|
1601
|
-
16 && R !== (R = /*geom*/
|
|
1602
|
-
e[4].y) && u(M, "y", R), S & /*geom*/
|
|
1603
|
-
16 && z !== (z = /*geom*/
|
|
1604
|
-
e[4].h) && u(M, "height", z), S & /*geom*/
|
|
1605
|
-
16 && P !== (P = /*geom*/
|
|
1606
|
-
e[4].x) && u(D, "x", P), S & /*geom*/
|
|
1604
|
+
e[4].x) && u(l, "x", f), O & /*geom*/
|
|
1605
|
+
16 && h !== (h = /*geom*/
|
|
1606
|
+
e[4].y) && u(l, "y", h), O & /*geom*/
|
|
1607
|
+
16 && c !== (c = /*geom*/
|
|
1608
|
+
e[4].w) && u(l, "width", c), O & /*geom*/
|
|
1609
|
+
16 && d !== (d = /*geom*/
|
|
1610
|
+
e[4].h) && u(l, "height", d), O & /*geom*/
|
|
1607
1611
|
16 && y !== (y = /*geom*/
|
|
1608
|
-
e[4].y
|
|
1609
|
-
|
|
1612
|
+
e[4].x) && u(g, "x", y), O & /*geom*/
|
|
1613
|
+
16 && E !== (E = /*geom*/
|
|
1614
|
+
e[4].y) && u(g, "y", E), O & /*geom*/
|
|
1610
1615
|
16 && b !== (b = /*geom*/
|
|
1611
|
-
e[4].w) && u(
|
|
1612
|
-
16 &&
|
|
1613
|
-
e[4].x
|
|
1616
|
+
e[4].w) && u(g, "width", b), O & /*geom*/
|
|
1617
|
+
16 && L !== (L = /*geom*/
|
|
1618
|
+
e[4].x + /*geom*/
|
|
1619
|
+
e[4].w) && u(p, "x", L), O & /*geom*/
|
|
1620
|
+
16 && S !== (S = /*geom*/
|
|
1621
|
+
e[4].y) && u(p, "y", S), O & /*geom*/
|
|
1622
|
+
16 && B !== (B = /*geom*/
|
|
1623
|
+
e[4].h) && u(p, "height", B), O & /*geom*/
|
|
1624
|
+
16 && H !== (H = /*geom*/
|
|
1625
|
+
e[4].x) && u(k, "x", H), O & /*geom*/
|
|
1626
|
+
16 && w !== (w = /*geom*/
|
|
1627
|
+
e[4].y + /*geom*/
|
|
1628
|
+
e[4].h) && u(k, "y", w), O & /*geom*/
|
|
1629
|
+
16 && A !== (A = /*geom*/
|
|
1630
|
+
e[4].w) && u(k, "width", A), O & /*geom*/
|
|
1631
|
+
16 && P !== (P = /*geom*/
|
|
1632
|
+
e[4].x) && u(M, "x", P), O & /*geom*/
|
|
1614
1633
|
16 && U !== (U = /*geom*/
|
|
1615
|
-
e[4].y) && u(
|
|
1634
|
+
e[4].y) && u(M, "y", U), O & /*geom*/
|
|
1616
1635
|
16 && Q !== (Q = /*geom*/
|
|
1617
|
-
e[4].h) && u(
|
|
1618
|
-
24 &&
|
|
1636
|
+
e[4].h) && u(M, "height", Q), O & /*geom, handleSize*/
|
|
1637
|
+
24 && Y !== (Y = /*geom*/
|
|
1619
1638
|
e[4].x - /*handleSize*/
|
|
1620
|
-
e[3] / 2) && u(x, "x",
|
|
1639
|
+
e[3] / 2) && u(x, "x", Y), O & /*geom, handleSize*/
|
|
1621
1640
|
24 && Z !== (Z = /*geom*/
|
|
1622
1641
|
e[4].y - /*handleSize*/
|
|
1623
|
-
e[3] / 2) && u(x, "y", Z),
|
|
1642
|
+
e[3] / 2) && u(x, "y", Z), O & /*handleSize*/
|
|
1624
1643
|
8 && u(
|
|
1625
1644
|
x,
|
|
1626
1645
|
"height",
|
|
1627
1646
|
/*handleSize*/
|
|
1628
1647
|
e[3]
|
|
1629
|
-
),
|
|
1648
|
+
), O & /*handleSize*/
|
|
1630
1649
|
8 && u(
|
|
1631
1650
|
x,
|
|
1632
1651
|
"width",
|
|
1633
1652
|
/*handleSize*/
|
|
1634
1653
|
e[3]
|
|
1635
|
-
),
|
|
1654
|
+
), O & /*geom, handleSize*/
|
|
1636
1655
|
24 && se !== (se = /*geom*/
|
|
1637
1656
|
e[4].x + /*geom*/
|
|
1638
1657
|
e[4].w - /*handleSize*/
|
|
1639
|
-
e[3] / 2) && u(
|
|
1658
|
+
e[3] / 2) && u(q, "x", se), O & /*geom, handleSize*/
|
|
1640
1659
|
24 && he !== (he = /*geom*/
|
|
1641
1660
|
e[4].y - /*handleSize*/
|
|
1642
|
-
e[3] / 2) && u(
|
|
1661
|
+
e[3] / 2) && u(q, "y", he), O & /*handleSize*/
|
|
1643
1662
|
8 && u(
|
|
1644
|
-
|
|
1663
|
+
q,
|
|
1645
1664
|
"height",
|
|
1646
1665
|
/*handleSize*/
|
|
1647
1666
|
e[3]
|
|
1648
|
-
),
|
|
1667
|
+
), O & /*handleSize*/
|
|
1649
1668
|
8 && u(
|
|
1650
|
-
|
|
1669
|
+
q,
|
|
1651
1670
|
"width",
|
|
1652
1671
|
/*handleSize*/
|
|
1653
1672
|
e[3]
|
|
1654
|
-
),
|
|
1655
|
-
24 &&
|
|
1673
|
+
), O & /*geom, handleSize*/
|
|
1674
|
+
24 && Ce !== (Ce = /*geom*/
|
|
1656
1675
|
e[4].x + /*geom*/
|
|
1657
1676
|
e[4].w - /*handleSize*/
|
|
1658
|
-
e[3] / 2) && u(ee, "x",
|
|
1677
|
+
e[3] / 2) && u(ee, "x", Ce), O & /*geom, handleSize*/
|
|
1659
1678
|
24 && Pe !== (Pe = /*geom*/
|
|
1660
1679
|
e[4].y + /*geom*/
|
|
1661
1680
|
e[4].h - /*handleSize*/
|
|
1662
|
-
e[3] / 2) && u(ee, "y", Pe),
|
|
1681
|
+
e[3] / 2) && u(ee, "y", Pe), O & /*handleSize*/
|
|
1663
1682
|
8 && u(
|
|
1664
1683
|
ee,
|
|
1665
1684
|
"height",
|
|
1666
1685
|
/*handleSize*/
|
|
1667
1686
|
e[3]
|
|
1668
|
-
),
|
|
1687
|
+
), O & /*handleSize*/
|
|
1669
1688
|
8 && u(
|
|
1670
1689
|
ee,
|
|
1671
1690
|
"width",
|
|
1672
1691
|
/*handleSize*/
|
|
1673
1692
|
e[3]
|
|
1674
|
-
),
|
|
1693
|
+
), O & /*geom, handleSize*/
|
|
1675
1694
|
24 && Ye !== (Ye = /*geom*/
|
|
1676
1695
|
e[4].x - /*handleSize*/
|
|
1677
|
-
e[3] / 2) && u(te, "x", Ye),
|
|
1696
|
+
e[3] / 2) && u(te, "x", Ye), O & /*geom, handleSize*/
|
|
1678
1697
|
24 && Re !== (Re = /*geom*/
|
|
1679
1698
|
e[4].y + /*geom*/
|
|
1680
1699
|
e[4].h - /*handleSize*/
|
|
1681
|
-
e[3] / 2) && u(te, "y", Re),
|
|
1700
|
+
e[3] / 2) && u(te, "y", Re), O & /*handleSize*/
|
|
1682
1701
|
8 && u(
|
|
1683
1702
|
te,
|
|
1684
1703
|
"height",
|
|
1685
1704
|
/*handleSize*/
|
|
1686
1705
|
e[3]
|
|
1687
|
-
),
|
|
1706
|
+
), O & /*handleSize*/
|
|
1688
1707
|
8 && u(
|
|
1689
1708
|
te,
|
|
1690
1709
|
"width",
|
|
@@ -1692,14 +1711,14 @@ function ao(e) {
|
|
|
1692
1711
|
e[3]
|
|
1693
1712
|
);
|
|
1694
1713
|
},
|
|
1695
|
-
d(
|
|
1696
|
-
|
|
1714
|
+
d(R) {
|
|
1715
|
+
R && I(t), R && I(a), R && I(l), R && I(m), R && I(g), R && I(_), R && I(p), R && I(z), R && I(k), R && I(T), R && I(M), R && I(Me), R && I(x), R && I(V), R && I(q), R && I(Ve), R && I(ee), R && I(je), R && I(te), We = !1, ae(at);
|
|
1697
1716
|
}
|
|
1698
1717
|
};
|
|
1699
1718
|
}
|
|
1700
|
-
function
|
|
1719
|
+
function fo(e) {
|
|
1701
1720
|
let t, n;
|
|
1702
|
-
return t = new
|
|
1721
|
+
return t = new Jt({
|
|
1703
1722
|
props: {
|
|
1704
1723
|
shape: (
|
|
1705
1724
|
/*shape*/
|
|
@@ -1715,7 +1734,7 @@ function co(e) {
|
|
|
1715
1734
|
),
|
|
1716
1735
|
$$slots: {
|
|
1717
1736
|
default: [
|
|
1718
|
-
|
|
1737
|
+
co,
|
|
1719
1738
|
({ grab: o }) => ({ 10: o }),
|
|
1720
1739
|
({ grab: o }) => o ? 1024 : 0
|
|
1721
1740
|
]
|
|
@@ -1751,7 +1770,7 @@ function co(e) {
|
|
|
1751
1770
|
3098 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
|
|
1752
1771
|
},
|
|
1753
1772
|
i(o) {
|
|
1754
|
-
n || (
|
|
1773
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
1755
1774
|
},
|
|
1756
1775
|
o(o) {
|
|
1757
1776
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -1761,72 +1780,72 @@ function co(e) {
|
|
|
1761
1780
|
}
|
|
1762
1781
|
};
|
|
1763
1782
|
}
|
|
1764
|
-
function
|
|
1783
|
+
function uo(e, t, n) {
|
|
1765
1784
|
let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
|
|
1766
|
-
const
|
|
1767
|
-
const
|
|
1768
|
-
let [
|
|
1769
|
-
const [
|
|
1770
|
-
if (
|
|
1771
|
-
|
|
1785
|
+
const f = (m, g, y) => {
|
|
1786
|
+
const E = m.geometry.bounds;
|
|
1787
|
+
let [b, _] = [E.minX, E.minY], [p, L] = [E.maxX, E.maxY];
|
|
1788
|
+
const [S, B] = y;
|
|
1789
|
+
if (g === v.SHAPE)
|
|
1790
|
+
b += S, p += S, _ += B, L += B;
|
|
1772
1791
|
else {
|
|
1773
|
-
switch (
|
|
1774
|
-
case
|
|
1775
|
-
case
|
|
1776
|
-
case
|
|
1777
|
-
_ +=
|
|
1792
|
+
switch (g) {
|
|
1793
|
+
case v.TOP:
|
|
1794
|
+
case v.TOP_LEFT:
|
|
1795
|
+
case v.TOP_RIGHT: {
|
|
1796
|
+
_ += B;
|
|
1778
1797
|
break;
|
|
1779
1798
|
}
|
|
1780
|
-
case
|
|
1781
|
-
case
|
|
1782
|
-
case
|
|
1783
|
-
|
|
1799
|
+
case v.BOTTOM:
|
|
1800
|
+
case v.BOTTOM_LEFT:
|
|
1801
|
+
case v.BOTTOM_RIGHT: {
|
|
1802
|
+
L += B;
|
|
1784
1803
|
break;
|
|
1785
1804
|
}
|
|
1786
1805
|
}
|
|
1787
|
-
switch (
|
|
1788
|
-
case
|
|
1789
|
-
case
|
|
1790
|
-
case
|
|
1791
|
-
|
|
1806
|
+
switch (g) {
|
|
1807
|
+
case v.LEFT:
|
|
1808
|
+
case v.TOP_LEFT:
|
|
1809
|
+
case v.BOTTOM_LEFT: {
|
|
1810
|
+
b += S;
|
|
1792
1811
|
break;
|
|
1793
1812
|
}
|
|
1794
|
-
case
|
|
1795
|
-
case
|
|
1796
|
-
case
|
|
1797
|
-
|
|
1813
|
+
case v.RIGHT:
|
|
1814
|
+
case v.TOP_RIGHT:
|
|
1815
|
+
case v.BOTTOM_RIGHT: {
|
|
1816
|
+
p += S;
|
|
1798
1817
|
break;
|
|
1799
1818
|
}
|
|
1800
1819
|
}
|
|
1801
1820
|
}
|
|
1802
|
-
const
|
|
1821
|
+
const z = Math.min(b, p), k = Math.min(_, L), H = Math.abs(p - b), w = Math.abs(L - _);
|
|
1803
1822
|
return {
|
|
1804
|
-
...
|
|
1823
|
+
...m,
|
|
1805
1824
|
geometry: {
|
|
1806
|
-
x:
|
|
1807
|
-
y:
|
|
1808
|
-
w:
|
|
1809
|
-
h:
|
|
1825
|
+
x: z,
|
|
1826
|
+
y: k,
|
|
1827
|
+
w: H,
|
|
1828
|
+
h: w,
|
|
1810
1829
|
bounds: {
|
|
1811
|
-
minX:
|
|
1812
|
-
minY:
|
|
1813
|
-
maxX:
|
|
1814
|
-
maxY:
|
|
1830
|
+
minX: z,
|
|
1831
|
+
minY: k,
|
|
1832
|
+
maxX: z + H,
|
|
1833
|
+
maxY: k + w
|
|
1815
1834
|
}
|
|
1816
1835
|
}
|
|
1817
1836
|
};
|
|
1818
1837
|
};
|
|
1819
|
-
function m
|
|
1820
|
-
Ae.call(this, e,
|
|
1838
|
+
function h(m) {
|
|
1839
|
+
Ae.call(this, e, m);
|
|
1821
1840
|
}
|
|
1822
|
-
function c(
|
|
1823
|
-
Ae.call(this, e,
|
|
1841
|
+
function c(m) {
|
|
1842
|
+
Ae.call(this, e, m);
|
|
1824
1843
|
}
|
|
1825
|
-
function
|
|
1826
|
-
Ae.call(this, e,
|
|
1844
|
+
function d(m) {
|
|
1845
|
+
Ae.call(this, e, m);
|
|
1827
1846
|
}
|
|
1828
|
-
return e.$$set = (
|
|
1829
|
-
"shape" in
|
|
1847
|
+
return e.$$set = (m) => {
|
|
1848
|
+
"shape" in m && n(0, s = m.shape), "computedStyle" in m && n(1, r = m.computedStyle), "transform" in m && n(2, a = m.transform), "viewportScale" in m && n(6, l = m.viewportScale);
|
|
1830
1849
|
}, e.$$.update = () => {
|
|
1831
1850
|
e.$$.dirty & /*shape*/
|
|
1832
1851
|
1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
|
|
@@ -1837,16 +1856,16 @@ function fo(e, t, n) {
|
|
|
1837
1856
|
a,
|
|
1838
1857
|
i,
|
|
1839
1858
|
o,
|
|
1840
|
-
|
|
1859
|
+
f,
|
|
1841
1860
|
l,
|
|
1842
|
-
|
|
1861
|
+
h,
|
|
1843
1862
|
c,
|
|
1844
|
-
|
|
1863
|
+
d
|
|
1845
1864
|
];
|
|
1846
1865
|
}
|
|
1847
|
-
class
|
|
1866
|
+
class ho extends ie {
|
|
1848
1867
|
constructor(t) {
|
|
1849
|
-
super(), oe(this, t,
|
|
1868
|
+
super(), oe(this, t, uo, fo, $, {
|
|
1850
1869
|
shape: 0,
|
|
1851
1870
|
computedStyle: 1,
|
|
1852
1871
|
transform: 2,
|
|
@@ -1854,29 +1873,29 @@ class uo extends ie {
|
|
|
1854
1873
|
});
|
|
1855
1874
|
}
|
|
1856
1875
|
}
|
|
1857
|
-
const
|
|
1858
|
-
[
|
|
1859
|
-
[
|
|
1860
|
-
]), bt = (e) =>
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
const
|
|
1876
|
+
const qt = /* @__PURE__ */ new Map([
|
|
1877
|
+
[j.RECTANGLE, ho],
|
|
1878
|
+
[j.POLYGON, ao]
|
|
1879
|
+
]), bt = (e) => qt.get(e.type), mo = (e, t) => qt.set(e, t), v = (e) => `HANDLE-${e}`;
|
|
1880
|
+
v.SHAPE = "SHAPE";
|
|
1881
|
+
v.TOP = "TOP";
|
|
1882
|
+
v.RIGHT = "RIGHT";
|
|
1883
|
+
v.BOTTOM = "BOTTOM";
|
|
1884
|
+
v.LEFT = "LEFT";
|
|
1885
|
+
v.TOP_LEFT = "TOP_LEFT";
|
|
1886
|
+
v.TOP_RIGHT = "TOP_RIGHT";
|
|
1887
|
+
v.BOTTOM_RIGHT = "BOTTOM_RIGHT";
|
|
1888
|
+
v.BOTTOM_LEFT = "BOTTOM_LEFT";
|
|
1889
|
+
const go = (e) => ({}), Et = (e) => ({ grab: (
|
|
1871
1890
|
/*onGrab*/
|
|
1872
1891
|
e[0]
|
|
1873
1892
|
) });
|
|
1874
|
-
function
|
|
1893
|
+
function po(e) {
|
|
1875
1894
|
let t, n, o, i;
|
|
1876
1895
|
const s = (
|
|
1877
1896
|
/*#slots*/
|
|
1878
1897
|
e[7].default
|
|
1879
|
-
), r =
|
|
1898
|
+
), r = $t(
|
|
1880
1899
|
s,
|
|
1881
1900
|
e,
|
|
1882
1901
|
/*$$scope*/
|
|
@@ -1885,17 +1904,17 @@ function go(e) {
|
|
|
1885
1904
|
);
|
|
1886
1905
|
return {
|
|
1887
1906
|
c() {
|
|
1888
|
-
t =
|
|
1907
|
+
t = D("g"), r && r.c(), u(t, "class", "a9s-annotation selected");
|
|
1889
1908
|
},
|
|
1890
1909
|
m(a, l) {
|
|
1891
|
-
|
|
1892
|
-
|
|
1910
|
+
C(a, t, l), r && r.m(t, null), n = !0, o || (i = [
|
|
1911
|
+
K(
|
|
1893
1912
|
t,
|
|
1894
1913
|
"pointerup",
|
|
1895
1914
|
/*onRelease*/
|
|
1896
1915
|
e[2]
|
|
1897
1916
|
),
|
|
1898
|
-
|
|
1917
|
+
K(
|
|
1899
1918
|
t,
|
|
1900
1919
|
"pointermove",
|
|
1901
1920
|
/*onPointerMove*/
|
|
@@ -1905,19 +1924,19 @@ function go(e) {
|
|
|
1905
1924
|
},
|
|
1906
1925
|
p(a, [l]) {
|
|
1907
1926
|
r && r.p && (!n || l & /*$$scope*/
|
|
1908
|
-
64) &&
|
|
1927
|
+
64) && tn(
|
|
1909
1928
|
r,
|
|
1910
1929
|
s,
|
|
1911
1930
|
a,
|
|
1912
1931
|
/*$$scope*/
|
|
1913
1932
|
a[6],
|
|
1914
|
-
n ?
|
|
1933
|
+
n ? en(
|
|
1915
1934
|
s,
|
|
1916
1935
|
/*$$scope*/
|
|
1917
1936
|
a[6],
|
|
1918
1937
|
l,
|
|
1919
|
-
|
|
1920
|
-
) :
|
|
1938
|
+
go
|
|
1939
|
+
) : nn(
|
|
1921
1940
|
/*$$scope*/
|
|
1922
1941
|
a[6]
|
|
1923
1942
|
),
|
|
@@ -1925,37 +1944,37 @@ function go(e) {
|
|
|
1925
1944
|
);
|
|
1926
1945
|
},
|
|
1927
1946
|
i(a) {
|
|
1928
|
-
n || (
|
|
1947
|
+
n || (X(r, a), n = !0);
|
|
1929
1948
|
},
|
|
1930
1949
|
o(a) {
|
|
1931
1950
|
N(r, a), n = !1;
|
|
1932
1951
|
},
|
|
1933
1952
|
d(a) {
|
|
1934
|
-
a &&
|
|
1953
|
+
a && I(t), r && r.d(a), o = !1, ae(i);
|
|
1935
1954
|
}
|
|
1936
1955
|
};
|
|
1937
1956
|
}
|
|
1938
|
-
function
|
|
1957
|
+
function _o(e, t, n) {
|
|
1939
1958
|
let { $$slots: o = {}, $$scope: i } = t;
|
|
1940
1959
|
const s = Se();
|
|
1941
|
-
let { shape: r } = t, { editor: a } = t, { transform: l } = t,
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1944
|
-
},
|
|
1945
|
-
if (
|
|
1946
|
-
const [
|
|
1947
|
-
n(3, r = a(c,
|
|
1948
|
-
}
|
|
1949
|
-
},
|
|
1950
|
-
|
|
1951
|
-
};
|
|
1952
|
-
return e.$$set = (
|
|
1953
|
-
"shape" in
|
|
1954
|
-
}, [
|
|
1955
|
-
}
|
|
1956
|
-
class
|
|
1960
|
+
let { shape: r } = t, { editor: a } = t, { transform: l } = t, f = null, h, c = null;
|
|
1961
|
+
const d = (y) => (E) => {
|
|
1962
|
+
f = y, h = l.elementToImage(E.offsetX, E.offsetY), c = r, E.target.setPointerCapture(E.pointerId), s("grab");
|
|
1963
|
+
}, m = (y) => {
|
|
1964
|
+
if (f) {
|
|
1965
|
+
const [E, b] = l.elementToImage(y.offsetX, y.offsetY), _ = [E - h[0], b - h[1]];
|
|
1966
|
+
n(3, r = a(c, f, _)), s("change", r);
|
|
1967
|
+
}
|
|
1968
|
+
}, g = (y) => {
|
|
1969
|
+
y.target.releasePointerCapture(y.pointerId), f = null, c = r, s("release");
|
|
1970
|
+
};
|
|
1971
|
+
return e.$$set = (y) => {
|
|
1972
|
+
"shape" in y && n(3, r = y.shape), "editor" in y && n(4, a = y.editor), "transform" in y && n(5, l = y.transform), "$$scope" in y && n(6, i = y.$$scope);
|
|
1973
|
+
}, [d, m, g, r, a, l, i, o];
|
|
1974
|
+
}
|
|
1975
|
+
class Jt extends ie {
|
|
1957
1976
|
constructor(t) {
|
|
1958
|
-
super(), oe(this, t,
|
|
1977
|
+
super(), oe(this, t, _o, po, $, { shape: 3, editor: 4, transform: 5 });
|
|
1959
1978
|
}
|
|
1960
1979
|
}
|
|
1961
1980
|
const ze = (e, t) => {
|
|
@@ -1966,35 +1985,35 @@ const ze = (e, t) => {
|
|
|
1966
1985
|
return o && (s += `fill:${o};stroke:${o};`), s += `fill-opacity:${i || "0.25"};`, s;
|
|
1967
1986
|
}
|
|
1968
1987
|
};
|
|
1969
|
-
function
|
|
1988
|
+
function yo(e, t, n) {
|
|
1970
1989
|
let o;
|
|
1971
1990
|
const i = Se();
|
|
1972
|
-
let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform:
|
|
1973
|
-
return
|
|
1991
|
+
let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform: f } = t, { viewportScale: h } = t, c;
|
|
1992
|
+
return Ie(() => (n(6, c = new r({
|
|
1974
1993
|
target: l,
|
|
1975
1994
|
props: {
|
|
1976
1995
|
shape: s.target.selector,
|
|
1977
1996
|
computedStyle: o,
|
|
1978
|
-
transform:
|
|
1979
|
-
viewportScale:
|
|
1997
|
+
transform: f,
|
|
1998
|
+
viewportScale: h
|
|
1980
1999
|
}
|
|
1981
|
-
})), c.$on("change", (
|
|
1982
|
-
c.$$set({ shape:
|
|
1983
|
-
}), c.$on("grab", (
|
|
2000
|
+
})), c.$on("change", (d) => {
|
|
2001
|
+
c.$$set({ shape: d.detail }), i("change", d.detail);
|
|
2002
|
+
}), c.$on("grab", (d) => i("grab", d.detail)), c.$on("release", (d) => i("release", d.detail)), () => {
|
|
1984
2003
|
c.$destroy();
|
|
1985
|
-
})), e.$$set = (
|
|
1986
|
-
"annotation" in
|
|
2004
|
+
})), e.$$set = (d) => {
|
|
2005
|
+
"annotation" in d && n(0, s = d.annotation), "editor" in d && n(1, r = d.editor), "style" in d && n(2, a = d.style), "target" in d && n(3, l = d.target), "transform" in d && n(4, f = d.transform), "viewportScale" in d && n(5, h = d.viewportScale);
|
|
1987
2006
|
}, e.$$.update = () => {
|
|
1988
2007
|
e.$$.dirty & /*annotation, style*/
|
|
1989
2008
|
5 && (o = ze(s, a)), e.$$.dirty & /*annotation, editorComponent*/
|
|
1990
2009
|
65 && s && (c == null || c.$set({ shape: s.target.selector })), e.$$.dirty & /*editorComponent, transform*/
|
|
1991
|
-
80 && c && c.$set({ transform:
|
|
1992
|
-
96 && c && c.$set({ viewportScale:
|
|
1993
|
-
}, [s, r, a, l,
|
|
2010
|
+
80 && c && c.$set({ transform: f }), e.$$.dirty & /*editorComponent, viewportScale*/
|
|
2011
|
+
96 && c && c.$set({ viewportScale: h });
|
|
2012
|
+
}, [s, r, a, l, f, h, c];
|
|
1994
2013
|
}
|
|
1995
|
-
class
|
|
2014
|
+
class wo extends ie {
|
|
1996
2015
|
constructor(t) {
|
|
1997
|
-
super(), oe(this, t,
|
|
2016
|
+
super(), oe(this, t, yo, null, $, {
|
|
1998
2017
|
annotation: 0,
|
|
1999
2018
|
editor: 1,
|
|
2000
2019
|
style: 2,
|
|
@@ -2004,35 +2023,35 @@ class yo extends ie {
|
|
|
2004
2023
|
});
|
|
2005
2024
|
}
|
|
2006
2025
|
}
|
|
2007
|
-
function
|
|
2026
|
+
function bo(e, t, n) {
|
|
2008
2027
|
const o = Se();
|
|
2009
|
-
let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t,
|
|
2010
|
-
return
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2028
|
+
let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t, f;
|
|
2029
|
+
return Ie(() => {
|
|
2030
|
+
const h = s.closest("svg"), c = [], d = (m, g, y) => {
|
|
2031
|
+
h.addEventListener(m, g, y), c.push(() => h.removeEventListener(m, g, y));
|
|
2013
2032
|
};
|
|
2014
|
-
return n(5,
|
|
2033
|
+
return n(5, f = new r({
|
|
2015
2034
|
target: s,
|
|
2016
2035
|
props: {
|
|
2017
|
-
addEventListener:
|
|
2036
|
+
addEventListener: d,
|
|
2018
2037
|
drawingMode: i,
|
|
2019
2038
|
transform: a,
|
|
2020
2039
|
viewportScale: l
|
|
2021
2040
|
}
|
|
2022
|
-
})),
|
|
2023
|
-
c.forEach((
|
|
2041
|
+
})), f.$on("create", (m) => o("create", m.detail)), () => {
|
|
2042
|
+
c.forEach((m) => m()), f.$destroy();
|
|
2024
2043
|
};
|
|
2025
|
-
}), e.$$set = (
|
|
2026
|
-
"drawingMode" in
|
|
2044
|
+
}), e.$$set = (h) => {
|
|
2045
|
+
"drawingMode" in h && n(0, i = h.drawingMode), "target" in h && n(1, s = h.target), "tool" in h && n(2, r = h.tool), "transform" in h && n(3, a = h.transform), "viewportScale" in h && n(4, l = h.viewportScale);
|
|
2027
2046
|
}, e.$$.update = () => {
|
|
2028
2047
|
e.$$.dirty & /*toolComponent, transform*/
|
|
2029
|
-
40 &&
|
|
2030
|
-
48 &&
|
|
2031
|
-
}, [i, s, r, a, l,
|
|
2048
|
+
40 && f && f.$set({ transform: a }), e.$$.dirty & /*toolComponent, viewportScale*/
|
|
2049
|
+
48 && f && f.$set({ viewportScale: l });
|
|
2050
|
+
}, [i, s, r, a, l, f];
|
|
2032
2051
|
}
|
|
2033
|
-
class
|
|
2052
|
+
class Eo extends ie {
|
|
2034
2053
|
constructor(t) {
|
|
2035
|
-
super(), oe(this, t,
|
|
2054
|
+
super(), oe(this, t, bo, null, $, {
|
|
2036
2055
|
drawingMode: 0,
|
|
2037
2056
|
target: 1,
|
|
2038
2057
|
tool: 2,
|
|
@@ -2045,7 +2064,7 @@ function At(e) {
|
|
|
2045
2064
|
let t, n;
|
|
2046
2065
|
return {
|
|
2047
2066
|
c() {
|
|
2048
|
-
t =
|
|
2067
|
+
t = D("rect"), n = D("rect"), u(t, "class", "a9s-outer"), u(
|
|
2049
2068
|
t,
|
|
2050
2069
|
"x",
|
|
2051
2070
|
/*x*/
|
|
@@ -2088,7 +2107,7 @@ function At(e) {
|
|
|
2088
2107
|
);
|
|
2089
2108
|
},
|
|
2090
2109
|
m(o, i) {
|
|
2091
|
-
|
|
2110
|
+
C(o, t, i), C(o, n, i);
|
|
2092
2111
|
},
|
|
2093
2112
|
p(o, i) {
|
|
2094
2113
|
i & /*x*/
|
|
@@ -2142,78 +2161,78 @@ function At(e) {
|
|
|
2142
2161
|
);
|
|
2143
2162
|
},
|
|
2144
2163
|
d(o) {
|
|
2145
|
-
o &&
|
|
2164
|
+
o && I(t), o && I(n);
|
|
2146
2165
|
}
|
|
2147
2166
|
};
|
|
2148
2167
|
}
|
|
2149
|
-
function
|
|
2168
|
+
function Ao(e) {
|
|
2150
2169
|
let t, n = (
|
|
2151
2170
|
/*origin*/
|
|
2152
2171
|
e[0] && At(e)
|
|
2153
2172
|
);
|
|
2154
2173
|
return {
|
|
2155
2174
|
c() {
|
|
2156
|
-
t =
|
|
2175
|
+
t = D("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
|
|
2157
2176
|
},
|
|
2158
2177
|
m(o, i) {
|
|
2159
|
-
|
|
2178
|
+
C(o, t, i), n && n.m(t, null);
|
|
2160
2179
|
},
|
|
2161
2180
|
p(o, [i]) {
|
|
2162
2181
|
/*origin*/
|
|
2163
2182
|
o[0] ? n ? n.p(o, i) : (n = At(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
|
|
2164
2183
|
},
|
|
2165
|
-
i:
|
|
2166
|
-
o:
|
|
2184
|
+
i: F,
|
|
2185
|
+
o: F,
|
|
2167
2186
|
d(o) {
|
|
2168
|
-
o &&
|
|
2187
|
+
o && I(t), n && n.d();
|
|
2169
2188
|
}
|
|
2170
2189
|
};
|
|
2171
2190
|
}
|
|
2172
|
-
function
|
|
2191
|
+
function To(e, t, n) {
|
|
2173
2192
|
const o = Se();
|
|
2174
|
-
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l,
|
|
2175
|
-
const
|
|
2176
|
-
a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(_.offsetX, _.offsetY)),
|
|
2177
|
-
},
|
|
2178
|
-
l && (
|
|
2179
|
-
},
|
|
2180
|
-
const
|
|
2193
|
+
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l, f, h, c, d, m;
|
|
2194
|
+
const g = (_) => {
|
|
2195
|
+
a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), f = l, n(1, h = l[0]), n(2, c = l[1]), n(3, d = 1), n(4, m = 1));
|
|
2196
|
+
}, y = (_) => {
|
|
2197
|
+
l && (f = r.elementToImage(_.offsetX, _.offsetY), n(1, h = Math.min(f[0], l[0])), n(2, c = Math.min(f[1], l[1])), n(3, d = Math.abs(f[0] - l[0])), n(4, m = Math.abs(f[1] - l[1])));
|
|
2198
|
+
}, E = (_) => {
|
|
2199
|
+
const p = performance.now() - a;
|
|
2181
2200
|
if (s === "click") {
|
|
2182
|
-
if (
|
|
2201
|
+
if (p > 300)
|
|
2183
2202
|
return;
|
|
2184
|
-
_.stopPropagation(), l ?
|
|
2203
|
+
_.stopPropagation(), l ? b() : (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), f = l, n(1, h = l[0]), n(2, c = l[1]), n(3, d = 1), n(4, m = 1));
|
|
2185
2204
|
} else
|
|
2186
|
-
l && (
|
|
2187
|
-
},
|
|
2188
|
-
if (
|
|
2205
|
+
l && (p > 300 || d * m > 100 ? (_.stopPropagation(), b()) : (n(0, l = null), f = null));
|
|
2206
|
+
}, b = () => {
|
|
2207
|
+
if (d * m > 15) {
|
|
2189
2208
|
const _ = {
|
|
2190
|
-
type:
|
|
2209
|
+
type: j.RECTANGLE,
|
|
2191
2210
|
geometry: {
|
|
2192
2211
|
bounds: {
|
|
2193
|
-
minX:
|
|
2212
|
+
minX: h,
|
|
2194
2213
|
minY: c,
|
|
2195
|
-
maxX:
|
|
2196
|
-
maxY: c +
|
|
2214
|
+
maxX: h + d,
|
|
2215
|
+
maxY: c + m
|
|
2197
2216
|
},
|
|
2198
|
-
x:
|
|
2217
|
+
x: h,
|
|
2199
2218
|
y: c,
|
|
2200
|
-
w:
|
|
2201
|
-
h
|
|
2219
|
+
w: d,
|
|
2220
|
+
h: m
|
|
2202
2221
|
}
|
|
2203
2222
|
};
|
|
2204
2223
|
o("create", _);
|
|
2205
2224
|
}
|
|
2206
|
-
n(0, l = null),
|
|
2225
|
+
n(0, l = null), f = null;
|
|
2207
2226
|
};
|
|
2208
|
-
return
|
|
2209
|
-
i("pointerdown",
|
|
2227
|
+
return Ie(() => {
|
|
2228
|
+
i("pointerdown", g), i("pointermove", y), i("pointerup", E, !0);
|
|
2210
2229
|
}), e.$$set = (_) => {
|
|
2211
2230
|
"addEventListener" in _ && n(5, i = _.addEventListener), "drawingMode" in _ && n(6, s = _.drawingMode), "transform" in _ && n(7, r = _.transform);
|
|
2212
|
-
}, [l,
|
|
2231
|
+
}, [l, h, c, d, m, i, s, r];
|
|
2213
2232
|
}
|
|
2214
|
-
class
|
|
2233
|
+
class So extends ie {
|
|
2215
2234
|
constructor(t) {
|
|
2216
|
-
super(), oe(this, t,
|
|
2235
|
+
super(), oe(this, t, To, Ao, $, {
|
|
2217
2236
|
addEventListener: 5,
|
|
2218
2237
|
drawingMode: 6,
|
|
2219
2238
|
transform: 7
|
|
@@ -2223,7 +2242,7 @@ class To extends ie {
|
|
|
2223
2242
|
const Ke = (e, t) => {
|
|
2224
2243
|
const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
|
|
2225
2244
|
return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
|
|
2226
|
-
},
|
|
2245
|
+
}, Mo = (e, t) => {
|
|
2227
2246
|
const { naturalWidth: n, naturalHeight: o } = e;
|
|
2228
2247
|
if (!n && !o) {
|
|
2229
2248
|
const { width: i, height: s } = e;
|
|
@@ -2233,20 +2252,20 @@ const Ke = (e, t) => {
|
|
|
2233
2252
|
});
|
|
2234
2253
|
} else
|
|
2235
2254
|
t.setAttribute("viewBox", `0 0 ${n} ${o}`);
|
|
2236
|
-
},
|
|
2237
|
-
|
|
2255
|
+
}, Lo = (e, t) => {
|
|
2256
|
+
Mo(e, t);
|
|
2238
2257
|
const { subscribe: n, set: o } = Fe(1);
|
|
2239
2258
|
let i;
|
|
2240
2259
|
return window.ResizeObserver && (i = new ResizeObserver(() => {
|
|
2241
|
-
const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal,
|
|
2260
|
+
const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal, f = Math.max(
|
|
2242
2261
|
r.width / a,
|
|
2243
2262
|
r.height / l
|
|
2244
2263
|
);
|
|
2245
|
-
o(
|
|
2264
|
+
o(f);
|
|
2246
2265
|
}), i.observe(t.parentElement)), { destroy: () => {
|
|
2247
2266
|
i && i.disconnect();
|
|
2248
2267
|
}, subscribe: n };
|
|
2249
|
-
},
|
|
2268
|
+
}, Ti = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
2250
2269
|
function Ze(e) {
|
|
2251
2270
|
const t = e.slice(), n = (
|
|
2252
2271
|
/*isClosable*/
|
|
@@ -2269,12 +2288,12 @@ function Tt(e) {
|
|
|
2269
2288
|
);
|
|
2270
2289
|
return {
|
|
2271
2290
|
c() {
|
|
2272
|
-
t =
|
|
2291
|
+
t = D("polygon"), o = D("polygon"), r && r.c(), s = ce(), u(t, "class", "a9s-outer"), u(t, "points", n = /*coords*/
|
|
2273
2292
|
e[15]), u(o, "class", "a9s-inner"), u(o, "points", i = /*coords*/
|
|
2274
2293
|
e[15]);
|
|
2275
2294
|
},
|
|
2276
2295
|
m(a, l) {
|
|
2277
|
-
|
|
2296
|
+
C(a, t, l), C(a, o, l), r && r.m(a, l), C(a, s, l);
|
|
2278
2297
|
},
|
|
2279
2298
|
p(a, l) {
|
|
2280
2299
|
l & /*isClosable, points, cursor*/
|
|
@@ -2285,7 +2304,7 @@ function Tt(e) {
|
|
|
2285
2304
|
a[2] ? r ? r.p(a, l) : (r = St(a), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
|
|
2286
2305
|
},
|
|
2287
2306
|
d(a) {
|
|
2288
|
-
a &&
|
|
2307
|
+
a && I(t), a && I(o), r && r.d(a), a && I(s);
|
|
2289
2308
|
}
|
|
2290
2309
|
};
|
|
2291
2310
|
}
|
|
@@ -2293,7 +2312,7 @@ function St(e) {
|
|
|
2293
2312
|
let t, n, o;
|
|
2294
2313
|
return {
|
|
2295
2314
|
c() {
|
|
2296
|
-
t =
|
|
2315
|
+
t = D("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*points*/
|
|
2297
2316
|
e[0][0][0] - /*handleSize*/
|
|
2298
2317
|
e[3] / 2), u(t, "y", o = /*points*/
|
|
2299
2318
|
e[0][0][1] - /*handleSize*/
|
|
@@ -2310,7 +2329,7 @@ function St(e) {
|
|
|
2310
2329
|
);
|
|
2311
2330
|
},
|
|
2312
2331
|
m(i, s) {
|
|
2313
|
-
|
|
2332
|
+
C(i, t, s);
|
|
2314
2333
|
},
|
|
2315
2334
|
p(i, s) {
|
|
2316
2335
|
s & /*points, handleSize*/
|
|
@@ -2334,94 +2353,95 @@ function St(e) {
|
|
|
2334
2353
|
);
|
|
2335
2354
|
},
|
|
2336
2355
|
d(i) {
|
|
2337
|
-
i &&
|
|
2356
|
+
i && I(t);
|
|
2338
2357
|
}
|
|
2339
2358
|
};
|
|
2340
2359
|
}
|
|
2341
|
-
function
|
|
2360
|
+
function Oo(e) {
|
|
2342
2361
|
let t, n = (
|
|
2343
2362
|
/*cursor*/
|
|
2344
2363
|
e[1] && Tt(Ze(e))
|
|
2345
2364
|
);
|
|
2346
2365
|
return {
|
|
2347
2366
|
c() {
|
|
2348
|
-
t =
|
|
2367
|
+
t = D("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
|
|
2349
2368
|
},
|
|
2350
2369
|
m(o, i) {
|
|
2351
|
-
|
|
2370
|
+
C(o, t, i), n && n.m(t, null);
|
|
2352
2371
|
},
|
|
2353
2372
|
p(o, [i]) {
|
|
2354
2373
|
/*cursor*/
|
|
2355
2374
|
o[1] ? n ? n.p(Ze(o), i) : (n = Tt(Ze(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
|
|
2356
2375
|
},
|
|
2357
|
-
i:
|
|
2358
|
-
o:
|
|
2376
|
+
i: F,
|
|
2377
|
+
o: F,
|
|
2359
2378
|
d(o) {
|
|
2360
|
-
o &&
|
|
2379
|
+
o && I(t), n && n.d();
|
|
2361
2380
|
}
|
|
2362
2381
|
};
|
|
2363
2382
|
}
|
|
2364
|
-
const
|
|
2365
|
-
function
|
|
2383
|
+
const vo = 20;
|
|
2384
|
+
function ko(e, t, n) {
|
|
2366
2385
|
let o;
|
|
2367
2386
|
const i = Se();
|
|
2368
|
-
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t,
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
}, p = (_) => {
|
|
2375
|
-
if (m.length > 0 && (n(1, c = a.elementToImage(_.offsetX, _.offsetY)), m.length > 2)) {
|
|
2376
|
-
const M = Ke(c, m[0]) * l;
|
|
2377
|
-
n(2, f = M < Oo);
|
|
2387
|
+
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t, f, h = [], c = null, d = !1;
|
|
2388
|
+
const m = (_) => {
|
|
2389
|
+
const { timeStamp: p, offsetX: L, offsetY: S } = _;
|
|
2390
|
+
if (f = { timeStamp: p, offsetX: L, offsetY: S }, r === "drag" && h.length === 0) {
|
|
2391
|
+
const B = a.elementToImage(_.offsetX, _.offsetY);
|
|
2392
|
+
h.push(B), n(1, c = B);
|
|
2378
2393
|
}
|
|
2379
2394
|
}, g = (_) => {
|
|
2395
|
+
if (h.length > 0 && (n(1, c = a.elementToImage(_.offsetX, _.offsetY)), h.length > 2)) {
|
|
2396
|
+
const p = Ke(c, h[0]) * l;
|
|
2397
|
+
n(2, d = p < vo);
|
|
2398
|
+
}
|
|
2399
|
+
}, y = (_) => {
|
|
2380
2400
|
if (r === "click") {
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2401
|
+
const p = _.timeStamp - f.timeStamp, L = Ke([f.offsetX, f.offsetY], [_.offsetX, _.offsetY]);
|
|
2402
|
+
if (p > 300 || L > 15)
|
|
2383
2403
|
return;
|
|
2384
|
-
if (
|
|
2385
|
-
|
|
2386
|
-
else if (
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2404
|
+
if (d)
|
|
2405
|
+
b();
|
|
2406
|
+
else if (h.length === 0) {
|
|
2407
|
+
const S = a.elementToImage(_.offsetX, _.offsetY);
|
|
2408
|
+
h.push(S), n(1, c = S);
|
|
2389
2409
|
} else
|
|
2390
|
-
|
|
2410
|
+
h.push(c);
|
|
2391
2411
|
} else {
|
|
2392
|
-
if (
|
|
2393
|
-
n(0,
|
|
2412
|
+
if (h.length === 1 && Ke(h[0], c) <= 4) {
|
|
2413
|
+
n(0, h = []), n(1, c = null);
|
|
2394
2414
|
return;
|
|
2395
2415
|
}
|
|
2396
|
-
_.stopImmediatePropagation(),
|
|
2416
|
+
_.stopImmediatePropagation(), d ? b() : h.push(c);
|
|
2397
2417
|
}
|
|
2398
|
-
},
|
|
2399
|
-
const _ = [...
|
|
2400
|
-
type:
|
|
2418
|
+
}, E = () => {
|
|
2419
|
+
const _ = [...h, c], p = {
|
|
2420
|
+
type: j.POLYGON,
|
|
2401
2421
|
geometry: { bounds: He(_), points: _ }
|
|
2402
2422
|
};
|
|
2403
|
-
nt(
|
|
2404
|
-
},
|
|
2423
|
+
nt(p) > 4 && (n(0, h = []), n(1, c = null), i("create", p));
|
|
2424
|
+
}, b = () => {
|
|
2405
2425
|
const _ = {
|
|
2406
|
-
type:
|
|
2426
|
+
type: j.POLYGON,
|
|
2407
2427
|
geometry: {
|
|
2408
|
-
bounds: He(
|
|
2409
|
-
points: [...
|
|
2428
|
+
bounds: He(h),
|
|
2429
|
+
points: [...h]
|
|
2410
2430
|
}
|
|
2411
2431
|
};
|
|
2412
|
-
n(0,
|
|
2432
|
+
n(0, h = []), n(1, c = null), i("create", _);
|
|
2413
2433
|
};
|
|
2414
|
-
return
|
|
2415
|
-
s("pointerdown",
|
|
2434
|
+
return Ie(() => {
|
|
2435
|
+
s("pointerdown", m, !0), s("pointermove", g), s("pointerup", y, !0), s("dblclick", E, !0);
|
|
2416
2436
|
}), e.$$set = (_) => {
|
|
2417
2437
|
"addEventListener" in _ && n(4, s = _.addEventListener), "drawingMode" in _ && n(5, r = _.drawingMode), "transform" in _ && n(6, a = _.transform), "viewportScale" in _ && n(7, l = _.viewportScale);
|
|
2418
2438
|
}, e.$$.update = () => {
|
|
2419
2439
|
e.$$.dirty & /*viewportScale*/
|
|
2420
2440
|
128 && n(3, o = 10 / l);
|
|
2421
2441
|
}, [
|
|
2422
|
-
|
|
2442
|
+
h,
|
|
2423
2443
|
c,
|
|
2424
|
-
|
|
2444
|
+
d,
|
|
2425
2445
|
o,
|
|
2426
2446
|
s,
|
|
2427
2447
|
r,
|
|
@@ -2429,9 +2449,9 @@ function vo(e, t, n) {
|
|
|
2429
2449
|
l
|
|
2430
2450
|
];
|
|
2431
2451
|
}
|
|
2432
|
-
class
|
|
2452
|
+
class Bo extends ie {
|
|
2433
2453
|
constructor(t) {
|
|
2434
|
-
super(), oe(this, t,
|
|
2454
|
+
super(), oe(this, t, ko, Oo, $, {
|
|
2435
2455
|
addEventListener: 4,
|
|
2436
2456
|
drawingMode: 5,
|
|
2437
2457
|
transform: 6,
|
|
@@ -2440,14 +2460,14 @@ class ko extends ie {
|
|
|
2440
2460
|
}
|
|
2441
2461
|
}
|
|
2442
2462
|
const lt = /* @__PURE__ */ new Map([
|
|
2443
|
-
["rectangle", { tool:
|
|
2444
|
-
["polygon", { tool:
|
|
2445
|
-
]),
|
|
2446
|
-
function
|
|
2463
|
+
["rectangle", { tool: So }],
|
|
2464
|
+
["polygon", { tool: Bo }]
|
|
2465
|
+
]), Io = () => [...lt.keys()], Kt = (e) => lt.get(e), Co = (e, t, n) => lt.set(e, { tool: t, opts: n });
|
|
2466
|
+
function Po(e) {
|
|
2447
2467
|
let t, n, o, i, s;
|
|
2448
2468
|
return {
|
|
2449
2469
|
c() {
|
|
2450
|
-
t =
|
|
2470
|
+
t = D("g"), n = D("ellipse"), i = D("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2451
2471
|
e[1] ? "display:none;" : void 0), u(
|
|
2452
2472
|
n,
|
|
2453
2473
|
"cx",
|
|
@@ -2497,7 +2517,7 @@ function Io(e) {
|
|
|
2497
2517
|
e[0].id);
|
|
2498
2518
|
},
|
|
2499
2519
|
m(r, a) {
|
|
2500
|
-
|
|
2520
|
+
C(r, t, a), fe(t, n), fe(t, i);
|
|
2501
2521
|
},
|
|
2502
2522
|
p(r, [a]) {
|
|
2503
2523
|
a & /*computedStyle*/
|
|
@@ -2512,38 +2532,38 @@ function Io(e) {
|
|
|
2512
2532
|
1 && s !== (s = /*annotation*/
|
|
2513
2533
|
r[0].id) && u(t, "data-id", s);
|
|
2514
2534
|
},
|
|
2515
|
-
i:
|
|
2516
|
-
o:
|
|
2535
|
+
i: F,
|
|
2536
|
+
o: F,
|
|
2517
2537
|
d(r) {
|
|
2518
|
-
r &&
|
|
2538
|
+
r && I(t);
|
|
2519
2539
|
}
|
|
2520
2540
|
};
|
|
2521
2541
|
}
|
|
2522
|
-
function
|
|
2542
|
+
function Yo(e, t, n) {
|
|
2523
2543
|
let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
|
|
2524
|
-
const { cx: a, cy: l, rx:
|
|
2544
|
+
const { cx: a, cy: l, rx: f, ry: h } = s;
|
|
2525
2545
|
return e.$$set = (c) => {
|
|
2526
2546
|
"annotation" in c && n(0, i = c.annotation), "geom" in c && n(6, s = c.geom), "style" in c && n(7, r = c.style);
|
|
2527
2547
|
}, e.$$.update = () => {
|
|
2528
2548
|
e.$$.dirty & /*annotation, style*/
|
|
2529
2549
|
129 && n(1, o = ze(i, r));
|
|
2530
|
-
}, [i, o, a, l,
|
|
2550
|
+
}, [i, o, a, l, f, h, s, r];
|
|
2531
2551
|
}
|
|
2532
|
-
class
|
|
2552
|
+
class Ro extends ie {
|
|
2533
2553
|
constructor(t) {
|
|
2534
|
-
super(), oe(this, t,
|
|
2554
|
+
super(), oe(this, t, Yo, Po, $, { annotation: 0, geom: 6, style: 7 });
|
|
2535
2555
|
}
|
|
2536
2556
|
}
|
|
2537
|
-
function
|
|
2557
|
+
function Do(e) {
|
|
2538
2558
|
let t, n, o, i, s;
|
|
2539
2559
|
return {
|
|
2540
2560
|
c() {
|
|
2541
|
-
t =
|
|
2561
|
+
t = D("g"), n = D("polygon"), i = D("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2542
2562
|
e[1] ? "display:none;" : void 0), u(
|
|
2543
2563
|
n,
|
|
2544
2564
|
"points",
|
|
2545
2565
|
/*points*/
|
|
2546
|
-
e[2].map(
|
|
2566
|
+
e[2].map(Xo).join(" ")
|
|
2547
2567
|
), u(i, "class", "a9s-inner"), u(
|
|
2548
2568
|
i,
|
|
2549
2569
|
"style",
|
|
@@ -2553,12 +2573,12 @@ function Ro(e) {
|
|
|
2553
2573
|
i,
|
|
2554
2574
|
"points",
|
|
2555
2575
|
/*points*/
|
|
2556
|
-
e[2].map(
|
|
2576
|
+
e[2].map(Uo).join(" ")
|
|
2557
2577
|
), u(t, "data-id", s = /*annotation*/
|
|
2558
2578
|
e[0].id);
|
|
2559
2579
|
},
|
|
2560
2580
|
m(r, a) {
|
|
2561
|
-
|
|
2581
|
+
C(r, t, a), fe(t, n), fe(t, i);
|
|
2562
2582
|
},
|
|
2563
2583
|
p(r, [a]) {
|
|
2564
2584
|
a & /*computedStyle*/
|
|
@@ -2573,15 +2593,15 @@ function Ro(e) {
|
|
|
2573
2593
|
1 && s !== (s = /*annotation*/
|
|
2574
2594
|
r[0].id) && u(t, "data-id", s);
|
|
2575
2595
|
},
|
|
2576
|
-
i:
|
|
2577
|
-
o:
|
|
2596
|
+
i: F,
|
|
2597
|
+
o: F,
|
|
2578
2598
|
d(r) {
|
|
2579
|
-
r &&
|
|
2599
|
+
r && I(t);
|
|
2580
2600
|
}
|
|
2581
2601
|
};
|
|
2582
2602
|
}
|
|
2583
|
-
const
|
|
2584
|
-
function
|
|
2603
|
+
const Xo = (e) => e.join(","), Uo = (e) => e.join(",");
|
|
2604
|
+
function No(e, t, n) {
|
|
2585
2605
|
let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
|
|
2586
2606
|
const { points: a } = s;
|
|
2587
2607
|
return e.$$set = (l) => {
|
|
@@ -2591,16 +2611,16 @@ function Uo(e, t, n) {
|
|
|
2591
2611
|
17 && n(1, o = ze(i, r));
|
|
2592
2612
|
}, [i, o, a, s, r];
|
|
2593
2613
|
}
|
|
2594
|
-
class
|
|
2614
|
+
class Go extends ie {
|
|
2595
2615
|
constructor(t) {
|
|
2596
|
-
super(), oe(this, t,
|
|
2616
|
+
super(), oe(this, t, No, Do, $, { annotation: 0, geom: 3, style: 4 });
|
|
2597
2617
|
}
|
|
2598
2618
|
}
|
|
2599
|
-
function
|
|
2619
|
+
function Ho(e) {
|
|
2600
2620
|
let t, n, o, i, s;
|
|
2601
2621
|
return {
|
|
2602
2622
|
c() {
|
|
2603
|
-
t =
|
|
2623
|
+
t = D("g"), n = D("rect"), i = D("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2604
2624
|
e[5] ? "display:none;" : void 0), u(
|
|
2605
2625
|
n,
|
|
2606
2626
|
"x",
|
|
@@ -2650,7 +2670,7 @@ function Go(e) {
|
|
|
2650
2670
|
e[0].id);
|
|
2651
2671
|
},
|
|
2652
2672
|
m(r, a) {
|
|
2653
|
-
|
|
2673
|
+
C(r, t, a), fe(t, n), fe(t, i);
|
|
2654
2674
|
},
|
|
2655
2675
|
p(r, [a]) {
|
|
2656
2676
|
a & /*computedStyle*/
|
|
@@ -2713,47 +2733,47 @@ function Go(e) {
|
|
|
2713
2733
|
1 && s !== (s = /*annotation*/
|
|
2714
2734
|
r[0].id) && u(t, "data-id", s);
|
|
2715
2735
|
},
|
|
2716
|
-
i:
|
|
2717
|
-
o:
|
|
2736
|
+
i: F,
|
|
2737
|
+
o: F,
|
|
2718
2738
|
d(r) {
|
|
2719
|
-
r &&
|
|
2739
|
+
r && I(t);
|
|
2720
2740
|
}
|
|
2721
2741
|
};
|
|
2722
2742
|
}
|
|
2723
|
-
function
|
|
2724
|
-
let o, i, s, r, a, { annotation: l } = t, { geom:
|
|
2743
|
+
function Fo(e, t, n) {
|
|
2744
|
+
let o, i, s, r, a, { annotation: l } = t, { geom: f } = t, { style: h = void 0 } = t;
|
|
2725
2745
|
return e.$$set = (c) => {
|
|
2726
|
-
"annotation" in c && n(0, l = c.annotation), "geom" in c && n(6,
|
|
2746
|
+
"annotation" in c && n(0, l = c.annotation), "geom" in c && n(6, f = c.geom), "style" in c && n(7, h = c.style);
|
|
2727
2747
|
}, e.$$.update = () => {
|
|
2728
2748
|
e.$$.dirty & /*annotation, style*/
|
|
2729
|
-
129 && n(5, o = ze(l,
|
|
2730
|
-
64 && n(4, { x: i, y: s, w: r, h: a } =
|
|
2731
|
-
}, [l, a, r, s, i, o,
|
|
2749
|
+
129 && n(5, o = ze(l, h)), e.$$.dirty & /*geom*/
|
|
2750
|
+
64 && n(4, { x: i, y: s, w: r, h: a } = f, i, (n(3, s), n(6, f)), (n(2, r), n(6, f)), (n(1, a), n(6, f)));
|
|
2751
|
+
}, [l, a, r, s, i, o, f, h];
|
|
2732
2752
|
}
|
|
2733
|
-
class
|
|
2753
|
+
class zo extends ie {
|
|
2734
2754
|
constructor(t) {
|
|
2735
|
-
super(), oe(this, t,
|
|
2755
|
+
super(), oe(this, t, Fo, Ho, $, { annotation: 0, geom: 6, style: 7 });
|
|
2736
2756
|
}
|
|
2737
2757
|
}
|
|
2738
|
-
const
|
|
2758
|
+
const Si = {
|
|
2739
2759
|
elementToImage: (e, t) => [e, t]
|
|
2740
|
-
},
|
|
2760
|
+
}, Vo = (e) => ({
|
|
2741
2761
|
elementToImage: (t, n) => {
|
|
2742
2762
|
const o = e.getBoundingClientRect(), i = e.createSVGPoint();
|
|
2743
2763
|
i.x = t + o.x, i.y = n + o.y;
|
|
2744
2764
|
const { x: s, y: r } = i.matrixTransform(e.getScreenCTM().inverse());
|
|
2745
2765
|
return [s, r];
|
|
2746
2766
|
}
|
|
2747
|
-
}),
|
|
2767
|
+
}), jo = 250, Wo = (e, t) => {
|
|
2748
2768
|
const n = Se();
|
|
2749
2769
|
let o;
|
|
2750
2770
|
return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
|
|
2751
|
-
if (performance.now() - o <
|
|
2752
|
-
const { x: l, y:
|
|
2753
|
-
|
|
2771
|
+
if (performance.now() - o < jo) {
|
|
2772
|
+
const { x: l, y: f } = qo(r, e), h = t.getAt(l, f);
|
|
2773
|
+
h ? n("click", { originalEvent: r, annotation: h }) : n("click", { originalEvent: r });
|
|
2754
2774
|
}
|
|
2755
2775
|
} };
|
|
2756
|
-
},
|
|
2776
|
+
}, qo = (e, t) => {
|
|
2757
2777
|
const n = t.createSVGPoint(), o = t.getBoundingClientRect(), i = e.clientX - o.x, s = e.clientY - o.y, { left: r, top: a } = t.getBoundingClientRect();
|
|
2758
2778
|
return n.x = i + r, n.y = s + a, n.matrixTransform(t.getScreenCTM().inverse());
|
|
2759
2779
|
};
|
|
@@ -2782,27 +2802,27 @@ function Ot(e) {
|
|
|
2782
2802
|
i.c(), n = ce();
|
|
2783
2803
|
},
|
|
2784
2804
|
m(s, r) {
|
|
2785
|
-
i.m(s, r),
|
|
2805
|
+
i.m(s, r), C(s, n, r), o = !0;
|
|
2786
2806
|
},
|
|
2787
2807
|
p(s, r) {
|
|
2788
2808
|
r[0] & /*$store*/
|
|
2789
2809
|
4096 && $(t, t = /*annotation*/
|
|
2790
|
-
s[31].id) ? (re(), N(i, 1, 1,
|
|
2810
|
+
s[31].id) ? (re(), N(i, 1, 1, F), le(), i = vt(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
2791
2811
|
},
|
|
2792
2812
|
i(s) {
|
|
2793
|
-
o || (
|
|
2813
|
+
o || (X(i), o = !0);
|
|
2794
2814
|
},
|
|
2795
2815
|
o(s) {
|
|
2796
2816
|
N(i), o = !1;
|
|
2797
2817
|
},
|
|
2798
2818
|
d(s) {
|
|
2799
|
-
s &&
|
|
2819
|
+
s && I(n), i.d(s);
|
|
2800
2820
|
}
|
|
2801
2821
|
};
|
|
2802
2822
|
}
|
|
2803
|
-
function
|
|
2823
|
+
function Jo(e) {
|
|
2804
2824
|
let t, n;
|
|
2805
|
-
return t = new
|
|
2825
|
+
return t = new Go({
|
|
2806
2826
|
props: {
|
|
2807
2827
|
annotation: (
|
|
2808
2828
|
/*annotation*/
|
|
@@ -2835,7 +2855,7 @@ function qo(e) {
|
|
|
2835
2855
|
o[1]), t.$set(s);
|
|
2836
2856
|
},
|
|
2837
2857
|
i(o) {
|
|
2838
|
-
n || (
|
|
2858
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
2839
2859
|
},
|
|
2840
2860
|
o(o) {
|
|
2841
2861
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2845,9 +2865,9 @@ function qo(e) {
|
|
|
2845
2865
|
}
|
|
2846
2866
|
};
|
|
2847
2867
|
}
|
|
2848
|
-
function
|
|
2868
|
+
function Ko(e) {
|
|
2849
2869
|
let t, n;
|
|
2850
|
-
return t = new
|
|
2870
|
+
return t = new zo({
|
|
2851
2871
|
props: {
|
|
2852
2872
|
annotation: (
|
|
2853
2873
|
/*annotation*/
|
|
@@ -2880,7 +2900,7 @@ function Jo(e) {
|
|
|
2880
2900
|
o[1]), t.$set(s);
|
|
2881
2901
|
},
|
|
2882
2902
|
i(o) {
|
|
2883
|
-
n || (
|
|
2903
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
2884
2904
|
},
|
|
2885
2905
|
o(o) {
|
|
2886
2906
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2890,9 +2910,9 @@ function Jo(e) {
|
|
|
2890
2910
|
}
|
|
2891
2911
|
};
|
|
2892
2912
|
}
|
|
2893
|
-
function
|
|
2913
|
+
function Zo(e) {
|
|
2894
2914
|
let t, n;
|
|
2895
|
-
return t = new
|
|
2915
|
+
return t = new Ro({
|
|
2896
2916
|
props: {
|
|
2897
2917
|
annotation: (
|
|
2898
2918
|
/*annotation*/
|
|
@@ -2925,7 +2945,7 @@ function Ko(e) {
|
|
|
2925
2945
|
o[1]), t.$set(s);
|
|
2926
2946
|
},
|
|
2927
2947
|
i(o) {
|
|
2928
|
-
n || (
|
|
2948
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
2929
2949
|
},
|
|
2930
2950
|
o(o) {
|
|
2931
2951
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2937,15 +2957,15 @@ function Ko(e) {
|
|
|
2937
2957
|
}
|
|
2938
2958
|
function vt(e) {
|
|
2939
2959
|
let t, n, o, i;
|
|
2940
|
-
const s = [Ko, Jo
|
|
2941
|
-
function a(l,
|
|
2960
|
+
const s = [Zo, Ko, Jo], r = [];
|
|
2961
|
+
function a(l, f) {
|
|
2942
2962
|
return (
|
|
2943
2963
|
/*selector*/
|
|
2944
|
-
l[34].type ===
|
|
2964
|
+
l[34].type === j.ELLIPSE ? 0 : (
|
|
2945
2965
|
/*selector*/
|
|
2946
|
-
l[34].type ===
|
|
2966
|
+
l[34].type === j.RECTANGLE ? 1 : (
|
|
2947
2967
|
/*selector*/
|
|
2948
|
-
l[34].type ===
|
|
2968
|
+
l[34].type === j.POLYGON ? 2 : -1
|
|
2949
2969
|
)
|
|
2950
2970
|
)
|
|
2951
2971
|
);
|
|
@@ -2954,23 +2974,23 @@ function vt(e) {
|
|
|
2954
2974
|
c() {
|
|
2955
2975
|
n && n.c(), o = ce();
|
|
2956
2976
|
},
|
|
2957
|
-
m(l,
|
|
2958
|
-
~t && r[t].m(l,
|
|
2977
|
+
m(l, f) {
|
|
2978
|
+
~t && r[t].m(l, f), C(l, o, f), i = !0;
|
|
2959
2979
|
},
|
|
2960
|
-
p(l,
|
|
2961
|
-
let
|
|
2962
|
-
t = a(l), t ===
|
|
2963
|
-
r[
|
|
2964
|
-
}), le()), ~t ? (n = r[t], n ? n.p(l,
|
|
2980
|
+
p(l, f) {
|
|
2981
|
+
let h = t;
|
|
2982
|
+
t = a(l), t === h ? ~t && r[t].p(l, f) : (n && (re(), N(r[h], 1, 1, () => {
|
|
2983
|
+
r[h] = null;
|
|
2984
|
+
}), le()), ~t ? (n = r[t], n ? n.p(l, f) : (n = r[t] = s[t](l), n.c()), X(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
2965
2985
|
},
|
|
2966
2986
|
i(l) {
|
|
2967
|
-
i || (
|
|
2987
|
+
i || (X(n), i = !0);
|
|
2968
2988
|
},
|
|
2969
2989
|
o(l) {
|
|
2970
2990
|
N(n), i = !1;
|
|
2971
2991
|
},
|
|
2972
2992
|
d(l) {
|
|
2973
|
-
~t && r[t].d(l), l &&
|
|
2993
|
+
~t && r[t].d(l), l && I(o);
|
|
2974
2994
|
}
|
|
2975
2995
|
};
|
|
2976
2996
|
}
|
|
@@ -2985,7 +3005,7 @@ function kt(e) {
|
|
|
2985
3005
|
i && i.c(), n = ce();
|
|
2986
3006
|
},
|
|
2987
3007
|
m(s, r) {
|
|
2988
|
-
i && i.m(s, r),
|
|
3008
|
+
i && i.m(s, r), C(s, n, r), o = !0;
|
|
2989
3009
|
},
|
|
2990
3010
|
p(s, r) {
|
|
2991
3011
|
r[0] & /*isEditable, $store*/
|
|
@@ -2994,25 +3014,25 @@ function kt(e) {
|
|
|
2994
3014
|
/*annotation*/
|
|
2995
3015
|
s[31]
|
|
2996
3016
|
)), t ? i ? (i.p(Qe(s), r), r[0] & /*isEditable, $store*/
|
|
2997
|
-
4224 &&
|
|
3017
|
+
4224 && X(i, 1)) : (i = Ot(Qe(s)), i.c(), X(i, 1), i.m(n.parentNode, n)) : i && (re(), N(i, 1, 1, () => {
|
|
2998
3018
|
i = null;
|
|
2999
3019
|
}), le());
|
|
3000
3020
|
},
|
|
3001
3021
|
i(s) {
|
|
3002
|
-
o || (
|
|
3022
|
+
o || (X(i), o = !0);
|
|
3003
3023
|
},
|
|
3004
3024
|
o(s) {
|
|
3005
3025
|
N(i), o = !1;
|
|
3006
3026
|
},
|
|
3007
3027
|
d(s) {
|
|
3008
|
-
i && i.d(s), s &&
|
|
3028
|
+
i && i.d(s), s && I(n);
|
|
3009
3029
|
}
|
|
3010
3030
|
};
|
|
3011
3031
|
}
|
|
3012
3032
|
function Bt(e) {
|
|
3013
3033
|
let t, n, o, i;
|
|
3014
|
-
const s = [
|
|
3015
|
-
function a(l,
|
|
3034
|
+
const s = [xo, Qo], r = [];
|
|
3035
|
+
function a(l, f) {
|
|
3016
3036
|
return (
|
|
3017
3037
|
/*editableAnnotations*/
|
|
3018
3038
|
l[6] ? 0 : (
|
|
@@ -3026,55 +3046,55 @@ function Bt(e) {
|
|
|
3026
3046
|
c() {
|
|
3027
3047
|
n && n.c(), o = ce();
|
|
3028
3048
|
},
|
|
3029
|
-
m(l,
|
|
3030
|
-
~t && r[t].m(l,
|
|
3049
|
+
m(l, f) {
|
|
3050
|
+
~t && r[t].m(l, f), C(l, o, f), i = !0;
|
|
3031
3051
|
},
|
|
3032
|
-
p(l,
|
|
3033
|
-
let
|
|
3034
|
-
t = a(l), t ===
|
|
3035
|
-
r[
|
|
3036
|
-
}), le()), ~t ? (n = r[t], n ? n.p(l,
|
|
3052
|
+
p(l, f) {
|
|
3053
|
+
let h = t;
|
|
3054
|
+
t = a(l), t === h ? ~t && r[t].p(l, f) : (n && (re(), N(r[h], 1, 1, () => {
|
|
3055
|
+
r[h] = null;
|
|
3056
|
+
}), le()), ~t ? (n = r[t], n ? n.p(l, f) : (n = r[t] = s[t](l), n.c()), X(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
3037
3057
|
},
|
|
3038
3058
|
i(l) {
|
|
3039
|
-
i || (
|
|
3059
|
+
i || (X(n), i = !0);
|
|
3040
3060
|
},
|
|
3041
3061
|
o(l) {
|
|
3042
3062
|
N(n), i = !1;
|
|
3043
3063
|
},
|
|
3044
3064
|
d(l) {
|
|
3045
|
-
~t && r[t].d(l), l &&
|
|
3065
|
+
~t && r[t].d(l), l && I(o);
|
|
3046
3066
|
}
|
|
3047
3067
|
};
|
|
3048
3068
|
}
|
|
3049
|
-
function
|
|
3069
|
+
function Qo(e) {
|
|
3050
3070
|
let t = (
|
|
3051
3071
|
/*tool*/
|
|
3052
3072
|
e[2]
|
|
3053
|
-
), n, o, i =
|
|
3073
|
+
), n, o, i = It(e);
|
|
3054
3074
|
return {
|
|
3055
3075
|
c() {
|
|
3056
3076
|
i.c(), n = ce();
|
|
3057
3077
|
},
|
|
3058
3078
|
m(s, r) {
|
|
3059
|
-
i.m(s, r),
|
|
3079
|
+
i.m(s, r), C(s, n, r), o = !0;
|
|
3060
3080
|
},
|
|
3061
3081
|
p(s, r) {
|
|
3062
3082
|
r[0] & /*tool*/
|
|
3063
3083
|
4 && $(t, t = /*tool*/
|
|
3064
|
-
s[2]) ? (re(), N(i, 1, 1,
|
|
3084
|
+
s[2]) ? (re(), N(i, 1, 1, F), le(), i = It(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
3065
3085
|
},
|
|
3066
3086
|
i(s) {
|
|
3067
|
-
o || (
|
|
3087
|
+
o || (X(i), o = !0);
|
|
3068
3088
|
},
|
|
3069
3089
|
o(s) {
|
|
3070
3090
|
N(i), o = !1;
|
|
3071
3091
|
},
|
|
3072
3092
|
d(s) {
|
|
3073
|
-
s &&
|
|
3093
|
+
s && I(n), i.d(s);
|
|
3074
3094
|
}
|
|
3075
3095
|
};
|
|
3076
3096
|
}
|
|
3077
|
-
function
|
|
3097
|
+
function xo(e) {
|
|
3078
3098
|
let t, n, o = (
|
|
3079
3099
|
/*editableAnnotations*/
|
|
3080
3100
|
e[6]
|
|
@@ -3093,7 +3113,7 @@ function Qo(e) {
|
|
|
3093
3113
|
m(r, a) {
|
|
3094
3114
|
for (let l = 0; l < i.length; l += 1)
|
|
3095
3115
|
i[l] && i[l].m(r, a);
|
|
3096
|
-
|
|
3116
|
+
C(r, t, a), n = !0;
|
|
3097
3117
|
},
|
|
3098
3118
|
p(r, a) {
|
|
3099
3119
|
if (a[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
|
|
@@ -3102,8 +3122,8 @@ function Qo(e) {
|
|
|
3102
3122
|
r[6];
|
|
3103
3123
|
let l;
|
|
3104
3124
|
for (l = 0; l < o.length; l += 1) {
|
|
3105
|
-
const
|
|
3106
|
-
i[l] ? (i[l].p(
|
|
3125
|
+
const f = Mt(r, o, l);
|
|
3126
|
+
i[l] ? (i[l].p(f, a), X(i[l], 1)) : (i[l] = Pt(f), i[l].c(), X(i[l], 1), i[l].m(t.parentNode, t));
|
|
3107
3127
|
}
|
|
3108
3128
|
for (re(), l = o.length; l < i.length; l += 1)
|
|
3109
3129
|
s(l);
|
|
@@ -3113,7 +3133,7 @@ function Qo(e) {
|
|
|
3113
3133
|
i(r) {
|
|
3114
3134
|
if (!n) {
|
|
3115
3135
|
for (let a = 0; a < o.length; a += 1)
|
|
3116
|
-
|
|
3136
|
+
X(i[a]);
|
|
3117
3137
|
n = !0;
|
|
3118
3138
|
}
|
|
3119
3139
|
},
|
|
@@ -3124,13 +3144,13 @@ function Qo(e) {
|
|
|
3124
3144
|
n = !1;
|
|
3125
3145
|
},
|
|
3126
3146
|
d(r) {
|
|
3127
|
-
ot(i, r), r &&
|
|
3147
|
+
ot(i, r), r && I(t);
|
|
3128
3148
|
}
|
|
3129
3149
|
};
|
|
3130
3150
|
}
|
|
3131
|
-
function
|
|
3151
|
+
function It(e) {
|
|
3132
3152
|
let t, n;
|
|
3133
|
-
return t = new
|
|
3153
|
+
return t = new Eo({
|
|
3134
3154
|
props: {
|
|
3135
3155
|
target: (
|
|
3136
3156
|
/*drawingEl*/
|
|
@@ -3179,7 +3199,7 @@ function Ct(e) {
|
|
|
3179
3199
|
o[13]), t.$set(s);
|
|
3180
3200
|
},
|
|
3181
3201
|
i(o) {
|
|
3182
|
-
n || (
|
|
3202
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
3183
3203
|
},
|
|
3184
3204
|
o(o) {
|
|
3185
3205
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -3189,9 +3209,9 @@ function Ct(e) {
|
|
|
3189
3209
|
}
|
|
3190
3210
|
};
|
|
3191
3211
|
}
|
|
3192
|
-
function
|
|
3212
|
+
function Ct(e) {
|
|
3193
3213
|
let t, n;
|
|
3194
|
-
return t = new
|
|
3214
|
+
return t = new wo({
|
|
3195
3215
|
props: {
|
|
3196
3216
|
target: (
|
|
3197
3217
|
/*drawingEl*/
|
|
@@ -3219,7 +3239,7 @@ function It(e) {
|
|
|
3219
3239
|
)
|
|
3220
3240
|
}
|
|
3221
3241
|
}), t.$on("change", function() {
|
|
3222
|
-
|
|
3242
|
+
W(
|
|
3223
3243
|
/*onChangeSelected*/
|
|
3224
3244
|
e[17](
|
|
3225
3245
|
/*editable*/
|
|
@@ -3256,7 +3276,7 @@ function It(e) {
|
|
|
3256
3276
|
e[13]), t.$set(s);
|
|
3257
3277
|
},
|
|
3258
3278
|
i(o) {
|
|
3259
|
-
n || (
|
|
3279
|
+
n || (X(t.$$.fragment, o), n = !0);
|
|
3260
3280
|
},
|
|
3261
3281
|
o(o) {
|
|
3262
3282
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -3270,94 +3290,94 @@ function Pt(e) {
|
|
|
3270
3290
|
let t = (
|
|
3271
3291
|
/*editable*/
|
|
3272
3292
|
e[28].id
|
|
3273
|
-
), n, o, i =
|
|
3293
|
+
), n, o, i = Ct(e);
|
|
3274
3294
|
return {
|
|
3275
3295
|
c() {
|
|
3276
3296
|
i.c(), n = ce();
|
|
3277
3297
|
},
|
|
3278
3298
|
m(s, r) {
|
|
3279
|
-
i.m(s, r),
|
|
3299
|
+
i.m(s, r), C(s, n, r), o = !0;
|
|
3280
3300
|
},
|
|
3281
3301
|
p(s, r) {
|
|
3282
3302
|
r[0] & /*editableAnnotations*/
|
|
3283
3303
|
64 && $(t, t = /*editable*/
|
|
3284
|
-
s[28].id) ? (re(), N(i, 1, 1,
|
|
3304
|
+
s[28].id) ? (re(), N(i, 1, 1, F), le(), i = Ct(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
3285
3305
|
},
|
|
3286
3306
|
i(s) {
|
|
3287
|
-
o || (
|
|
3307
|
+
o || (X(i), o = !0);
|
|
3288
3308
|
},
|
|
3289
3309
|
o(s) {
|
|
3290
3310
|
N(i), o = !1;
|
|
3291
3311
|
},
|
|
3292
3312
|
d(s) {
|
|
3293
|
-
s &&
|
|
3313
|
+
s && I(n), i.d(s);
|
|
3294
3314
|
}
|
|
3295
3315
|
};
|
|
3296
3316
|
}
|
|
3297
|
-
function
|
|
3317
|
+
function $o(e) {
|
|
3298
3318
|
let t, n, o, i, s, r, a = (
|
|
3299
3319
|
/*$store*/
|
|
3300
3320
|
e[12]
|
|
3301
3321
|
), l = [];
|
|
3302
3322
|
for (let c = 0; c < a.length; c += 1)
|
|
3303
3323
|
l[c] = kt(Lt(e, a, c));
|
|
3304
|
-
const
|
|
3324
|
+
const f = (c) => N(l[c], 1, 1, () => {
|
|
3305
3325
|
l[c] = null;
|
|
3306
3326
|
});
|
|
3307
|
-
let
|
|
3327
|
+
let h = (
|
|
3308
3328
|
/*drawingEl*/
|
|
3309
3329
|
e[4] && Bt(e)
|
|
3310
3330
|
);
|
|
3311
3331
|
return {
|
|
3312
3332
|
c() {
|
|
3313
|
-
t =
|
|
3333
|
+
t = D("svg"), n = D("g");
|
|
3314
3334
|
for (let c = 0; c < l.length; c += 1)
|
|
3315
3335
|
l[c].c();
|
|
3316
|
-
o =
|
|
3336
|
+
o = D("g"), h && h.c(), u(o, "class", "drawing"), u(t, "class", "a9s-annotationlayer"), ut(
|
|
3317
3337
|
t,
|
|
3318
3338
|
"drawing",
|
|
3319
3339
|
/*tool*/
|
|
3320
3340
|
e[2]
|
|
3321
3341
|
);
|
|
3322
3342
|
},
|
|
3323
|
-
m(c,
|
|
3324
|
-
|
|
3325
|
-
for (let
|
|
3326
|
-
l[
|
|
3327
|
-
fe(t, o),
|
|
3328
|
-
|
|
3329
|
-
|
|
3343
|
+
m(c, d) {
|
|
3344
|
+
C(c, t, d), fe(t, n);
|
|
3345
|
+
for (let m = 0; m < l.length; m += 1)
|
|
3346
|
+
l[m] && l[m].m(n, null);
|
|
3347
|
+
fe(t, o), h && h.m(o, null), e[24](o), e[25](t), i = !0, s || (r = [
|
|
3348
|
+
K(t, "pointerup", function() {
|
|
3349
|
+
W(
|
|
3330
3350
|
/*onPointerUp*/
|
|
3331
3351
|
e[8]
|
|
3332
3352
|
) && e[8].apply(this, arguments);
|
|
3333
3353
|
}),
|
|
3334
|
-
|
|
3335
|
-
|
|
3354
|
+
K(t, "pointerdown", function() {
|
|
3355
|
+
W(
|
|
3336
3356
|
/*onPointerDown*/
|
|
3337
3357
|
e[9]
|
|
3338
3358
|
) && e[9].apply(this, arguments);
|
|
3339
3359
|
})
|
|
3340
3360
|
], s = !0);
|
|
3341
3361
|
},
|
|
3342
|
-
p(c,
|
|
3343
|
-
if (e = c,
|
|
3362
|
+
p(c, d) {
|
|
3363
|
+
if (e = c, d[0] & /*$store, style, isEditable*/
|
|
3344
3364
|
4226) {
|
|
3345
3365
|
a = /*$store*/
|
|
3346
3366
|
e[12];
|
|
3347
|
-
let
|
|
3348
|
-
for (
|
|
3349
|
-
const
|
|
3350
|
-
l[
|
|
3367
|
+
let m;
|
|
3368
|
+
for (m = 0; m < a.length; m += 1) {
|
|
3369
|
+
const g = Lt(e, a, m);
|
|
3370
|
+
l[m] ? (l[m].p(g, d), X(l[m], 1)) : (l[m] = kt(g), l[m].c(), X(l[m], 1), l[m].m(n, null));
|
|
3351
3371
|
}
|
|
3352
|
-
for (re(),
|
|
3353
|
-
|
|
3372
|
+
for (re(), m = a.length; m < l.length; m += 1)
|
|
3373
|
+
f(m);
|
|
3354
3374
|
le();
|
|
3355
3375
|
}
|
|
3356
3376
|
/*drawingEl*/
|
|
3357
|
-
e[4] ?
|
|
3358
|
-
16 &&
|
|
3359
|
-
|
|
3360
|
-
}), le()), (!i ||
|
|
3377
|
+
e[4] ? h ? (h.p(e, d), d[0] & /*drawingEl*/
|
|
3378
|
+
16 && X(h, 1)) : (h = Bt(e), h.c(), X(h, 1), h.m(o, null)) : h && (re(), N(h, 1, 1, () => {
|
|
3379
|
+
h = null;
|
|
3380
|
+
}), le()), (!i || d[0] & /*tool*/
|
|
3361
3381
|
4) && ut(
|
|
3362
3382
|
t,
|
|
3363
3383
|
"drawing",
|
|
@@ -3367,115 +3387,115 @@ function xo(e) {
|
|
|
3367
3387
|
},
|
|
3368
3388
|
i(c) {
|
|
3369
3389
|
if (!i) {
|
|
3370
|
-
for (let
|
|
3371
|
-
|
|
3372
|
-
|
|
3390
|
+
for (let d = 0; d < a.length; d += 1)
|
|
3391
|
+
X(l[d]);
|
|
3392
|
+
X(h), i = !0;
|
|
3373
3393
|
}
|
|
3374
3394
|
},
|
|
3375
3395
|
o(c) {
|
|
3376
3396
|
l = l.filter(Boolean);
|
|
3377
|
-
for (let
|
|
3378
|
-
N(l[
|
|
3379
|
-
N(
|
|
3397
|
+
for (let d = 0; d < l.length; d += 1)
|
|
3398
|
+
N(l[d]);
|
|
3399
|
+
N(h), i = !1;
|
|
3380
3400
|
},
|
|
3381
3401
|
d(c) {
|
|
3382
|
-
c &&
|
|
3402
|
+
c && I(t), ot(l, c), h && h.d(), e[24](null), e[25](null), s = !1, ae(r);
|
|
3383
3403
|
}
|
|
3384
3404
|
};
|
|
3385
3405
|
}
|
|
3386
|
-
function
|
|
3387
|
-
let o, i, s, r, a, l,
|
|
3406
|
+
function ei(e, t, n) {
|
|
3407
|
+
let o, i, s, r, a, l, f, h, c = F, d = () => (c(), c = Ut(H, (Y) => n(13, h = Y)), H);
|
|
3388
3408
|
e.$$.on_destroy.push(() => c());
|
|
3389
|
-
let { drawingEnabled:
|
|
3390
|
-
|
|
3391
|
-
const { selection:
|
|
3392
|
-
ft(e,
|
|
3393
|
-
let
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3396
|
-
const Z =
|
|
3397
|
-
Z.length > 0 ? (n(6,
|
|
3398
|
-
const { updated:
|
|
3399
|
-
n(6,
|
|
3400
|
-
},
|
|
3401
|
-
}, U = (
|
|
3402
|
-
const Z = rt(),
|
|
3409
|
+
let { drawingEnabled: m } = t, { image: g } = t, { preferredDrawingMode: y } = t, { state: E } = t, { style: b = void 0 } = t, { tool: _, opts: p } = Kt("rectangle"), { tool: L = _, opts: S = p } = t, { user: B } = t, z, k, H;
|
|
3410
|
+
Ie(() => d(n(5, H = Lo(g, k))));
|
|
3411
|
+
const { selection: w, store: A } = E;
|
|
3412
|
+
ft(e, w, (Y) => n(23, l = Y)), ft(e, A, (Y) => n(12, f = Y));
|
|
3413
|
+
let T = null, M = null;
|
|
3414
|
+
const P = (Y) => {
|
|
3415
|
+
A.unobserve(T);
|
|
3416
|
+
const Z = Y.filter(({ editable: V }) => V).map(({ id: V }) => V);
|
|
3417
|
+
Z.length > 0 ? (n(6, M = Z.map((V) => A.getAnnotation(V))), T = (V) => {
|
|
3418
|
+
const { updated: q } = V.changes;
|
|
3419
|
+
n(6, M = q.map((se) => se.newValue));
|
|
3420
|
+
}, A.observe(T, { annotations: Z })) : n(6, M = null);
|
|
3421
|
+
}, U = (Y) => {
|
|
3422
|
+
const Z = rt(), V = {
|
|
3403
3423
|
id: Z,
|
|
3404
3424
|
bodies: [],
|
|
3405
3425
|
target: {
|
|
3406
3426
|
annotation: Z,
|
|
3407
|
-
selector:
|
|
3408
|
-
creator:
|
|
3427
|
+
selector: Y.detail,
|
|
3428
|
+
creator: B,
|
|
3409
3429
|
created: /* @__PURE__ */ new Date()
|
|
3410
3430
|
}
|
|
3411
3431
|
};
|
|
3412
|
-
|
|
3413
|
-
}, Q = (
|
|
3432
|
+
A.addAnnotation(V), w.setSelected(V.id);
|
|
3433
|
+
}, Q = (Y) => (Z) => {
|
|
3414
3434
|
var he;
|
|
3415
|
-
const { target:
|
|
3416
|
-
|
|
3417
|
-
...
|
|
3435
|
+
const { target: V } = Y, q = 10 * 60 * 1e3, se = ((he = V.creator) == null ? void 0 : he.id) !== B.id || !V.created || (/* @__PURE__ */ new Date()).getTime() - V.created.getTime() > q;
|
|
3436
|
+
A.updateTarget({
|
|
3437
|
+
...V,
|
|
3418
3438
|
selector: Z.detail,
|
|
3419
|
-
created: se ?
|
|
3439
|
+
created: se ? V.created : /* @__PURE__ */ new Date(),
|
|
3420
3440
|
updated: se ? /* @__PURE__ */ new Date() : null,
|
|
3421
|
-
updatedBy: se ?
|
|
3441
|
+
updatedBy: se ? B : null
|
|
3422
3442
|
});
|
|
3423
3443
|
};
|
|
3424
|
-
function Me(
|
|
3425
|
-
Ge[
|
|
3426
|
-
|
|
3444
|
+
function Me(Y) {
|
|
3445
|
+
Ge[Y ? "unshift" : "push"](() => {
|
|
3446
|
+
z = Y, n(4, z);
|
|
3427
3447
|
});
|
|
3428
3448
|
}
|
|
3429
|
-
function x(
|
|
3430
|
-
Ge[
|
|
3431
|
-
|
|
3449
|
+
function x(Y) {
|
|
3450
|
+
Ge[Y ? "unshift" : "push"](() => {
|
|
3451
|
+
k = Y, n(3, k);
|
|
3432
3452
|
});
|
|
3433
3453
|
}
|
|
3434
|
-
return e.$$set = (
|
|
3435
|
-
"drawingEnabled" in
|
|
3454
|
+
return e.$$set = (Y) => {
|
|
3455
|
+
"drawingEnabled" in Y && n(0, m = Y.drawingEnabled), "image" in Y && n(18, g = Y.image), "preferredDrawingMode" in Y && n(19, y = Y.preferredDrawingMode), "state" in Y && n(20, E = Y.state), "style" in Y && n(1, b = Y.style), "tool" in Y && n(2, L = Y.tool), "opts" in Y && n(21, S = Y.opts), "user" in Y && n(22, B = Y.user);
|
|
3436
3456
|
}, e.$$.update = () => {
|
|
3437
3457
|
e.$$.dirty[0] & /*opts, preferredDrawingMode*/
|
|
3438
|
-
2621440 && n(11, o = (
|
|
3439
|
-
8 && n(10, i =
|
|
3440
|
-
8 && n(9, { onPointerDown: s, onPointerUp: r } =
|
|
3441
|
-
8388608 && n(7, a = (
|
|
3442
|
-
8388608 &&
|
|
3458
|
+
2621440 && n(11, o = (S == null ? void 0 : S.drawingMode) || y), e.$$.dirty[0] & /*svgEl*/
|
|
3459
|
+
8 && n(10, i = Vo(k)), e.$$.dirty[0] & /*svgEl*/
|
|
3460
|
+
8 && n(9, { onPointerDown: s, onPointerUp: r } = Wo(k, A), s, (n(8, r), n(3, k))), e.$$.dirty[0] & /*$selection*/
|
|
3461
|
+
8388608 && n(7, a = (Y) => l.selected.find((Z) => Z.id === Y.id && Z.editable)), e.$$.dirty[0] & /*$selection*/
|
|
3462
|
+
8388608 && P(l.selected);
|
|
3443
3463
|
}, [
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3464
|
+
m,
|
|
3465
|
+
b,
|
|
3466
|
+
L,
|
|
3467
|
+
k,
|
|
3468
|
+
z,
|
|
3469
|
+
H,
|
|
3470
|
+
M,
|
|
3451
3471
|
a,
|
|
3452
3472
|
r,
|
|
3453
3473
|
s,
|
|
3454
3474
|
i,
|
|
3455
3475
|
o,
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3476
|
+
f,
|
|
3477
|
+
h,
|
|
3478
|
+
w,
|
|
3479
|
+
A,
|
|
3460
3480
|
U,
|
|
3461
3481
|
Q,
|
|
3462
|
-
p,
|
|
3463
3482
|
g,
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3483
|
+
y,
|
|
3484
|
+
E,
|
|
3485
|
+
S,
|
|
3486
|
+
B,
|
|
3467
3487
|
l,
|
|
3468
3488
|
Me,
|
|
3469
3489
|
x
|
|
3470
3490
|
];
|
|
3471
3491
|
}
|
|
3472
|
-
class
|
|
3492
|
+
class ti extends ie {
|
|
3473
3493
|
constructor(t) {
|
|
3474
3494
|
super(), oe(
|
|
3475
3495
|
this,
|
|
3476
3496
|
t,
|
|
3497
|
+
ei,
|
|
3477
3498
|
$o,
|
|
3478
|
-
xo,
|
|
3479
3499
|
$,
|
|
3480
3500
|
{
|
|
3481
3501
|
drawingEnabled: 0,
|
|
@@ -3492,33 +3512,33 @@ class ei extends ie {
|
|
|
3492
3512
|
);
|
|
3493
3513
|
}
|
|
3494
3514
|
}
|
|
3495
|
-
function
|
|
3496
|
-
|
|
3515
|
+
function ni(e, t, n, o, i) {
|
|
3516
|
+
Zt(e, t, n || 0, o || e.length - 1, i || oi);
|
|
3497
3517
|
}
|
|
3498
|
-
function
|
|
3518
|
+
function Zt(e, t, n, o, i) {
|
|
3499
3519
|
for (; o > n; ) {
|
|
3500
3520
|
if (o - n > 600) {
|
|
3501
|
-
var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3),
|
|
3502
|
-
|
|
3521
|
+
var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3), f = 0.5 * Math.sqrt(a * l * (s - l) / s) * (r - s / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(t - r * l / s + f)), c = Math.min(o, Math.floor(t + (s - r) * l / s + f));
|
|
3522
|
+
Zt(e, t, h, c, i);
|
|
3503
3523
|
}
|
|
3504
|
-
var
|
|
3505
|
-
for (Le(e, n, t), i(e[o],
|
|
3506
|
-
for (Le(e,
|
|
3507
|
-
|
|
3508
|
-
for (; i(e[
|
|
3509
|
-
|
|
3524
|
+
var d = e[t], m = n, g = o;
|
|
3525
|
+
for (Le(e, n, t), i(e[o], d) > 0 && Le(e, n, o); m < g; ) {
|
|
3526
|
+
for (Le(e, m, g), m++, g--; i(e[m], d) < 0; )
|
|
3527
|
+
m++;
|
|
3528
|
+
for (; i(e[g], d) > 0; )
|
|
3529
|
+
g--;
|
|
3510
3530
|
}
|
|
3511
|
-
i(e[n],
|
|
3531
|
+
i(e[n], d) === 0 ? Le(e, n, g) : (g++, Le(e, g, o)), g <= t && (n = g + 1), t <= g && (o = g - 1);
|
|
3512
3532
|
}
|
|
3513
3533
|
}
|
|
3514
3534
|
function Le(e, t, n) {
|
|
3515
3535
|
var o = e[t];
|
|
3516
3536
|
e[t] = e[n], e[n] = o;
|
|
3517
3537
|
}
|
|
3518
|
-
function
|
|
3538
|
+
function oi(e, t) {
|
|
3519
3539
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
3520
3540
|
}
|
|
3521
|
-
class
|
|
3541
|
+
class ii {
|
|
3522
3542
|
constructor(t = 9) {
|
|
3523
3543
|
this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
3524
3544
|
}
|
|
@@ -3591,14 +3611,14 @@ class oi {
|
|
|
3591
3611
|
return this;
|
|
3592
3612
|
let o = this.data;
|
|
3593
3613
|
const i = this.toBBox(t), s = [], r = [];
|
|
3594
|
-
let a, l,
|
|
3614
|
+
let a, l, f;
|
|
3595
3615
|
for (; o || s.length; ) {
|
|
3596
|
-
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(),
|
|
3597
|
-
const
|
|
3598
|
-
if (
|
|
3599
|
-
return o.children.splice(
|
|
3616
|
+
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), f = !0), o.leaf) {
|
|
3617
|
+
const h = si(t, o.children, n);
|
|
3618
|
+
if (h !== -1)
|
|
3619
|
+
return o.children.splice(h, 1), s.push(o), this._condense(s), this;
|
|
3600
3620
|
}
|
|
3601
|
-
!
|
|
3621
|
+
!f && !o.leaf && $e(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], f = !1) : o = null;
|
|
3602
3622
|
}
|
|
3603
3623
|
return this;
|
|
3604
3624
|
}
|
|
@@ -3629,14 +3649,14 @@ class oi {
|
|
|
3629
3649
|
if (s <= r)
|
|
3630
3650
|
return a = Ee(t.slice(n, o + 1)), we(a, this.toBBox), a;
|
|
3631
3651
|
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = Ee([]), a.leaf = !1, a.height = i;
|
|
3632
|
-
const l = Math.ceil(s / r),
|
|
3633
|
-
Yt(t, n, o,
|
|
3634
|
-
for (let
|
|
3635
|
-
const c = Math.min(
|
|
3636
|
-
Yt(t,
|
|
3637
|
-
for (let
|
|
3638
|
-
const
|
|
3639
|
-
a.children.push(this._build(t,
|
|
3652
|
+
const l = Math.ceil(s / r), f = l * Math.ceil(Math.sqrt(r));
|
|
3653
|
+
Yt(t, n, o, f, this.compareMinX);
|
|
3654
|
+
for (let h = n; h <= o; h += f) {
|
|
3655
|
+
const c = Math.min(h + f - 1, o);
|
|
3656
|
+
Yt(t, h, c, l, this.compareMinY);
|
|
3657
|
+
for (let d = h; d <= c; d += l) {
|
|
3658
|
+
const m = Math.min(d + l - 1, c);
|
|
3659
|
+
a.children.push(this._build(t, d, m, i - 1));
|
|
3640
3660
|
}
|
|
3641
3661
|
}
|
|
3642
3662
|
return we(a, this.toBBox), a;
|
|
@@ -3645,8 +3665,8 @@ class oi {
|
|
|
3645
3665
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
3646
3666
|
let s = 1 / 0, r = 1 / 0, a;
|
|
3647
3667
|
for (let l = 0; l < n.children.length; l++) {
|
|
3648
|
-
const
|
|
3649
|
-
c < r ? (r = c, s =
|
|
3668
|
+
const f = n.children[l], h = xe(f), c = ai(t, f) - h;
|
|
3669
|
+
c < r ? (r = c, s = h < s ? h : s, a = f) : c === r && h < s && (s = h, a = f);
|
|
3650
3670
|
}
|
|
3651
3671
|
n = a || n.children[0];
|
|
3652
3672
|
}
|
|
@@ -3671,14 +3691,14 @@ class oi {
|
|
|
3671
3691
|
_chooseSplitIndex(t, n, o) {
|
|
3672
3692
|
let i, s = 1 / 0, r = 1 / 0;
|
|
3673
3693
|
for (let a = n; a <= o - n; a++) {
|
|
3674
|
-
const l = Oe(t, 0, a, this.toBBox),
|
|
3675
|
-
|
|
3694
|
+
const l = Oe(t, 0, a, this.toBBox), f = Oe(t, a, o, this.toBBox), h = ci(l, f), c = xe(l) + xe(f);
|
|
3695
|
+
h < s ? (s = h, i = a, r = c < r ? c : r) : h === s && c < r && (r = c, i = a);
|
|
3676
3696
|
}
|
|
3677
3697
|
return i || o - n;
|
|
3678
3698
|
}
|
|
3679
3699
|
// sorts node children by the best axis for split
|
|
3680
3700
|
_chooseSplitAxis(t, n, o) {
|
|
3681
|
-
const i = t.leaf ? this.compareMinX :
|
|
3701
|
+
const i = t.leaf ? this.compareMinX : ri, s = t.leaf ? this.compareMinY : li, r = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, s);
|
|
3682
3702
|
r < a && t.children.sort(i);
|
|
3683
3703
|
}
|
|
3684
3704
|
// total margin of all possible split distributions where each node is at least m full
|
|
@@ -3686,13 +3706,13 @@ class oi {
|
|
|
3686
3706
|
t.children.sort(i);
|
|
3687
3707
|
const s = this.toBBox, r = Oe(t, 0, n, s), a = Oe(t, o - n, o, s);
|
|
3688
3708
|
let l = Xe(r) + Xe(a);
|
|
3689
|
-
for (let
|
|
3690
|
-
const
|
|
3691
|
-
ve(r, t.leaf ? s(
|
|
3709
|
+
for (let f = n; f < o - n; f++) {
|
|
3710
|
+
const h = t.children[f];
|
|
3711
|
+
ve(r, t.leaf ? s(h) : h), l += Xe(r);
|
|
3692
3712
|
}
|
|
3693
|
-
for (let
|
|
3694
|
-
const
|
|
3695
|
-
ve(a, t.leaf ? s(
|
|
3713
|
+
for (let f = o - n - 1; f >= n; f--) {
|
|
3714
|
+
const h = t.children[f];
|
|
3715
|
+
ve(a, t.leaf ? s(h) : h), l += Xe(a);
|
|
3696
3716
|
}
|
|
3697
3717
|
return l;
|
|
3698
3718
|
}
|
|
@@ -3705,7 +3725,7 @@ class oi {
|
|
|
3705
3725
|
t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : we(t[n], this.toBBox);
|
|
3706
3726
|
}
|
|
3707
3727
|
}
|
|
3708
|
-
function
|
|
3728
|
+
function si(e, t, n) {
|
|
3709
3729
|
if (!n)
|
|
3710
3730
|
return t.indexOf(e);
|
|
3711
3731
|
for (let o = 0; o < t.length; o++)
|
|
@@ -3727,10 +3747,10 @@ function Oe(e, t, n, o, i) {
|
|
|
3727
3747
|
function ve(e, t) {
|
|
3728
3748
|
return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
|
|
3729
3749
|
}
|
|
3730
|
-
function
|
|
3750
|
+
function ri(e, t) {
|
|
3731
3751
|
return e.minX - t.minX;
|
|
3732
3752
|
}
|
|
3733
|
-
function
|
|
3753
|
+
function li(e, t) {
|
|
3734
3754
|
return e.minY - t.minY;
|
|
3735
3755
|
}
|
|
3736
3756
|
function xe(e) {
|
|
@@ -3739,10 +3759,10 @@ function xe(e) {
|
|
|
3739
3759
|
function Xe(e) {
|
|
3740
3760
|
return e.maxX - e.minX + (e.maxY - e.minY);
|
|
3741
3761
|
}
|
|
3742
|
-
function
|
|
3762
|
+
function ai(e, t) {
|
|
3743
3763
|
return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
|
|
3744
3764
|
}
|
|
3745
|
-
function
|
|
3765
|
+
function ci(e, t) {
|
|
3746
3766
|
const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), s = Math.min(e.maxY, t.maxY);
|
|
3747
3767
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
3748
3768
|
}
|
|
@@ -3769,77 +3789,77 @@ function Yt(e, t, n, o, i) {
|
|
|
3769
3789
|
if (n = s.pop(), t = s.pop(), n - t <= o)
|
|
3770
3790
|
continue;
|
|
3771
3791
|
const r = t + Math.ceil((n - t) / o / 2) * o;
|
|
3772
|
-
|
|
3792
|
+
ni(e, r, t, n, i), s.push(t, r, r, n);
|
|
3773
3793
|
}
|
|
3774
3794
|
}
|
|
3775
|
-
const
|
|
3776
|
-
const e = new
|
|
3795
|
+
const fi = () => {
|
|
3796
|
+
const e = new ii(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
|
|
3777
3797
|
e.clear(), t.clear();
|
|
3778
3798
|
}, i = (c) => {
|
|
3779
|
-
const { minX:
|
|
3780
|
-
e.insert(
|
|
3799
|
+
const { minX: d, minY: m, maxX: g, maxY: y } = c.selector.geometry.bounds, E = { minX: d, minY: m, maxX: g, maxY: y, target: c };
|
|
3800
|
+
e.insert(E), t.set(c.annotation, E);
|
|
3781
3801
|
}, s = (c) => {
|
|
3782
|
-
const
|
|
3783
|
-
e.remove(
|
|
3802
|
+
const d = t.get(c.annotation);
|
|
3803
|
+
e.remove(d), t.delete(c.annotation);
|
|
3784
3804
|
};
|
|
3785
3805
|
return {
|
|
3786
3806
|
all: n,
|
|
3787
3807
|
clear: o,
|
|
3788
|
-
getAt: (c,
|
|
3789
|
-
const
|
|
3808
|
+
getAt: (c, d) => {
|
|
3809
|
+
const g = e.search({
|
|
3790
3810
|
minX: c,
|
|
3791
|
-
minY:
|
|
3811
|
+
minY: d,
|
|
3792
3812
|
maxX: c,
|
|
3793
|
-
maxY:
|
|
3794
|
-
}).map((
|
|
3795
|
-
if (
|
|
3796
|
-
return
|
|
3813
|
+
maxY: d
|
|
3814
|
+
}).map((y) => y.target).filter((y) => y.selector.type === j.RECTANGLE || un(y.selector, c, d));
|
|
3815
|
+
if (g.length > 0)
|
|
3816
|
+
return g.sort((y, E) => nt(y.selector) - nt(E.selector)), g[0];
|
|
3797
3817
|
},
|
|
3798
|
-
getIntersecting: (c,
|
|
3818
|
+
getIntersecting: (c, d, m, g) => e.search({
|
|
3799
3819
|
minX: c,
|
|
3800
|
-
minY:
|
|
3801
|
-
maxX: c +
|
|
3802
|
-
maxY:
|
|
3803
|
-
}).map((
|
|
3820
|
+
minY: d,
|
|
3821
|
+
maxX: c + m,
|
|
3822
|
+
maxY: d + g
|
|
3823
|
+
}).map((y) => y.target),
|
|
3804
3824
|
insert: i,
|
|
3805
3825
|
remove: s,
|
|
3806
|
-
set: (c,
|
|
3807
|
-
|
|
3808
|
-
const
|
|
3809
|
-
const { minX:
|
|
3810
|
-
return { minX:
|
|
3826
|
+
set: (c, d = !0) => {
|
|
3827
|
+
d && o();
|
|
3828
|
+
const m = c.map((g) => {
|
|
3829
|
+
const { minX: y, minY: E, maxX: b, maxY: _ } = g.selector.geometry.bounds;
|
|
3830
|
+
return { minX: y, minY: E, maxX: b, maxY: _, target: g };
|
|
3811
3831
|
});
|
|
3812
|
-
|
|
3832
|
+
m.forEach((g) => t.set(g.target.annotation, g)), e.load(m);
|
|
3813
3833
|
},
|
|
3814
3834
|
size: () => e.all().length,
|
|
3815
|
-
update: (c,
|
|
3816
|
-
s(c), i(
|
|
3835
|
+
update: (c, d) => {
|
|
3836
|
+
s(c), i(d);
|
|
3817
3837
|
}
|
|
3818
3838
|
};
|
|
3819
|
-
},
|
|
3820
|
-
const t =
|
|
3839
|
+
}, ui = (e) => {
|
|
3840
|
+
const t = Xn(), n = fi(), o = vn(t, e.pointerSelectAction), i = On(t), s = Hn();
|
|
3821
3841
|
return t.observe(({ changes: l }) => {
|
|
3822
|
-
n.set(l.created.map((
|
|
3842
|
+
n.set(l.created.map((f) => f.target), !1), l.deleted.forEach((f) => n.remove(f.target)), l.updated.forEach(({ oldValue: f, newValue: h }) => n.update(f.target, h.target));
|
|
3823
3843
|
}), {
|
|
3824
3844
|
store: {
|
|
3825
3845
|
...t,
|
|
3826
|
-
getAt: (l,
|
|
3827
|
-
const
|
|
3828
|
-
return
|
|
3846
|
+
getAt: (l, f) => {
|
|
3847
|
+
const h = n.getAt(l, f);
|
|
3848
|
+
return h ? t.getAnnotation(h.annotation) : void 0;
|
|
3829
3849
|
},
|
|
3830
|
-
getIntersecting: (l,
|
|
3850
|
+
getIntersecting: (l, f, h, c) => n.getIntersecting(l, f, h, c).map((d) => t.getAnnotation(d.annotation))
|
|
3831
3851
|
},
|
|
3832
3852
|
selection: o,
|
|
3833
3853
|
hover: i,
|
|
3834
3854
|
viewport: s
|
|
3835
3855
|
};
|
|
3836
|
-
},
|
|
3837
|
-
const t =
|
|
3856
|
+
}, di = (e) => {
|
|
3857
|
+
const t = ui(e);
|
|
3838
3858
|
return {
|
|
3839
3859
|
...t,
|
|
3840
|
-
store:
|
|
3860
|
+
store: Un(t.store)
|
|
3841
3861
|
};
|
|
3842
|
-
},
|
|
3862
|
+
}, hi = (e) => {
|
|
3843
3863
|
let t, n;
|
|
3844
3864
|
if (e.nodeName === "CANVAS")
|
|
3845
3865
|
t = e, n = t.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -3850,144 +3870,142 @@ const ci = () => {
|
|
|
3850
3870
|
let o = 0;
|
|
3851
3871
|
for (let i = 1; i < 10; i++)
|
|
3852
3872
|
for (let s = 1; s < 10; s++) {
|
|
3853
|
-
const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data,
|
|
3854
|
-
o +=
|
|
3873
|
+
const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data, f = (0.299 * l[0] + 0.587 * l[1] + 0.114 * l[2]) / 255;
|
|
3874
|
+
o += f;
|
|
3855
3875
|
}
|
|
3856
3876
|
return o / 81;
|
|
3857
|
-
},
|
|
3858
|
-
const
|
|
3859
|
-
console.log(`[Annotorious] Image brightness: ${
|
|
3860
|
-
}, mi = (e) => ({
|
|
3877
|
+
}, mi = (e) => {
|
|
3878
|
+
const t = hi(e), n = t > 0.6 ? "dark" : "light";
|
|
3879
|
+
return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${n} theme.`), n;
|
|
3880
|
+
}, Rt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? mi(e) : n), gi = (e) => ({
|
|
3861
3881
|
...e,
|
|
3862
3882
|
drawingEnabled: e.drawingEnabled === void 0 ? !0 : e.drawingEnabled,
|
|
3863
3883
|
drawingMode: e.drawingMode || "drag",
|
|
3864
|
-
pointerSelectAction: e.pointerSelectAction ||
|
|
3865
|
-
|
|
3884
|
+
pointerSelectAction: e.pointerSelectAction || Vt.EDIT,
|
|
3885
|
+
theme: e.theme || "light"
|
|
3886
|
+
}), Dt = navigator.userAgent.indexOf("Mac OS X") !== -1, pi = (e, t) => {
|
|
3866
3887
|
const n = t || document, o = (r) => {
|
|
3867
3888
|
r.key === "Z" && r.ctrlKey ? e.undo() : r.key === "Y" && r.ctrlKey && e.redo();
|
|
3868
3889
|
}, i = (r) => {
|
|
3869
3890
|
r.key === "z" && r.metaKey && (r.shiftKey ? e.redo() : e.undo());
|
|
3870
3891
|
}, s = () => {
|
|
3871
|
-
|
|
3892
|
+
Dt ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
|
|
3872
3893
|
};
|
|
3873
|
-
return
|
|
3894
|
+
return Dt ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
|
|
3874
3895
|
destroy: s
|
|
3875
3896
|
};
|
|
3876
3897
|
};
|
|
3877
|
-
const
|
|
3898
|
+
const Mi = (e, t = {}) => {
|
|
3878
3899
|
if (!e)
|
|
3879
3900
|
throw "Missing argument: image";
|
|
3880
|
-
const n = typeof e == "string" ? document.getElementById(e) : e, o =
|
|
3901
|
+
const n = typeof e == "string" ? document.getElementById(e) : e, o = gi(t), i = di(o), { selection: s, store: r } = i, a = Gn(r), l = Fn(
|
|
3902
|
+
i,
|
|
3881
3903
|
a,
|
|
3882
|
-
r,
|
|
3883
|
-
s,
|
|
3884
|
-
void 0,
|
|
3885
3904
|
o.adapter,
|
|
3886
3905
|
o.autoSave
|
|
3887
|
-
),
|
|
3888
|
-
|
|
3889
|
-
const
|
|
3890
|
-
let
|
|
3891
|
-
|
|
3892
|
-
const
|
|
3893
|
-
target:
|
|
3906
|
+
), f = document.createElement("DIV");
|
|
3907
|
+
f.style.position = "relative", f.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(f, n), f.appendChild(n);
|
|
3908
|
+
const h = pi(a);
|
|
3909
|
+
let c = Kn();
|
|
3910
|
+
Rt(n, f, o.theme);
|
|
3911
|
+
const d = new ti({
|
|
3912
|
+
target: f,
|
|
3894
3913
|
props: {
|
|
3895
3914
|
drawingEnabled: o.drawingEnabled,
|
|
3896
3915
|
image: n,
|
|
3897
3916
|
preferredDrawingMode: o.drawingMode,
|
|
3898
3917
|
state: i,
|
|
3899
3918
|
style: o.style,
|
|
3900
|
-
user:
|
|
3919
|
+
user: c
|
|
3901
3920
|
}
|
|
3902
3921
|
});
|
|
3903
|
-
|
|
3904
|
-
const { originalEvent:
|
|
3905
|
-
|
|
3922
|
+
d.$on("click", (k) => {
|
|
3923
|
+
const { originalEvent: H, annotation: w } = k.detail;
|
|
3924
|
+
w ? s.clickSelect(w.id, H) : s.isEmpty() || s.clear();
|
|
3906
3925
|
});
|
|
3907
|
-
const
|
|
3908
|
-
|
|
3909
|
-
},
|
|
3910
|
-
const { tool:
|
|
3911
|
-
|
|
3912
|
-
},
|
|
3926
|
+
const m = Vn(i, a, o.adapter), g = () => {
|
|
3927
|
+
d.$destroy(), f.parentNode.insertBefore(n, f), f.parentNode.removeChild(f), h.destroy(), a.destroy();
|
|
3928
|
+
}, y = () => c, E = (k, H, w) => Co(k, H, w), b = (k, H) => mo(k, H), _ = (k) => {
|
|
3929
|
+
const { tool: H, opts: w } = Kt(k);
|
|
3930
|
+
d.$set({ tool: H, opts: w });
|
|
3931
|
+
}, p = (k) => d.$set({ drawingEnabled: k }), L = (k) => {
|
|
3913
3932
|
console.warn("Filter not implemented yet");
|
|
3914
|
-
}, z = (
|
|
3915
|
-
|
|
3916
|
-
}, K = (P) => h.$set({ style: P }), D = (P) => {
|
|
3917
|
-
f = P, h.$set({ user: P });
|
|
3933
|
+
}, S = (k) => d.$set({ style: k }), B = (k) => Rt(n, f, k), z = (k) => {
|
|
3934
|
+
c = k, d.$set({ user: k });
|
|
3918
3935
|
};
|
|
3919
3936
|
return {
|
|
3920
|
-
...
|
|
3937
|
+
...m,
|
|
3921
3938
|
destroy: g,
|
|
3922
|
-
getUser:
|
|
3923
|
-
listDrawingTools:
|
|
3939
|
+
getUser: y,
|
|
3940
|
+
listDrawingTools: Io,
|
|
3924
3941
|
on: l.on,
|
|
3925
3942
|
off: l.off,
|
|
3926
|
-
registerDrawingTool:
|
|
3927
|
-
registerShapeEditor:
|
|
3928
|
-
setDrawingEnabled:
|
|
3929
|
-
setDrawingTool:
|
|
3930
|
-
setFilter:
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
setUser:
|
|
3943
|
+
registerDrawingTool: E,
|
|
3944
|
+
registerShapeEditor: b,
|
|
3945
|
+
setDrawingEnabled: p,
|
|
3946
|
+
setDrawingTool: _,
|
|
3947
|
+
setFilter: L,
|
|
3948
|
+
setStyle: S,
|
|
3949
|
+
setTheme: B,
|
|
3950
|
+
setUser: z,
|
|
3934
3951
|
state: i
|
|
3935
3952
|
};
|
|
3936
3953
|
};
|
|
3937
3954
|
export {
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3955
|
+
Jt as Editor,
|
|
3956
|
+
wo as EditorMount,
|
|
3957
|
+
v as Handle,
|
|
3958
|
+
Si as IdentityTransform,
|
|
3942
3959
|
G as Origin,
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3960
|
+
bi as PRESENCE_KEY,
|
|
3961
|
+
Vt as PointerSelectAction,
|
|
3962
|
+
ao as PolygonEditor,
|
|
3963
|
+
ho as RectangleEditor,
|
|
3964
|
+
mn as RectangleUtil,
|
|
3965
|
+
So as RubberbandRectangle,
|
|
3966
|
+
ti as SVGAnnotationLayer,
|
|
3967
|
+
j as ShapeType,
|
|
3968
|
+
Eo as ToolMount,
|
|
3969
|
+
Ai as W3CImageFormat,
|
|
3970
|
+
Wo as addEventListeners,
|
|
3954
3971
|
He as boundsFromPoints,
|
|
3955
3972
|
nt as computeArea,
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3973
|
+
Kn as createAnonymousGuest,
|
|
3974
|
+
Vn as createBaseAnnotator,
|
|
3975
|
+
yi as createBody,
|
|
3976
|
+
to as createDefaultAppearenceProvider,
|
|
3977
|
+
Mi as createImageAnnotator,
|
|
3978
|
+
ui as createImageAnnotatorState,
|
|
3979
|
+
Ei as createPresenceState,
|
|
3980
|
+
Vo as createSVGTransform,
|
|
3981
|
+
di as createSvelteImageAnnotatorState,
|
|
3982
|
+
eo as defaultColorProvider,
|
|
3983
|
+
mi as detectTheme,
|
|
3984
|
+
jt as diffAnnotations,
|
|
3967
3985
|
Ke as distance,
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3986
|
+
Lo as enableResponsive,
|
|
3987
|
+
gi as fillDefaults,
|
|
3988
|
+
_i as getContributors,
|
|
3971
3989
|
bt as getEditor,
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3990
|
+
Kt as getTool,
|
|
3991
|
+
pi as initKeyboardCommands,
|
|
3992
|
+
un as intersects,
|
|
3993
|
+
Ti as isTouch,
|
|
3994
|
+
Io as listDrawingTools,
|
|
3995
|
+
zn as parseAll,
|
|
3996
|
+
gn as parseFragmentSelector,
|
|
3997
|
+
En as parseSVGSelector,
|
|
3998
|
+
Qn as parseW3CBodies,
|
|
3999
|
+
oo as parseW3CImageAnnotation,
|
|
4000
|
+
mo as registerEditor,
|
|
3983
4001
|
st as registerShapeUtil,
|
|
3984
4002
|
Co as registerTool,
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4003
|
+
hi as sampleBrightness,
|
|
4004
|
+
wi as serializeAll,
|
|
4005
|
+
pn as serializeFragmentSelector,
|
|
4006
|
+
An as serializeSVGSelector,
|
|
4007
|
+
xn as serializeW3CBodies,
|
|
4008
|
+
io as serializeW3CImageAnnotation,
|
|
4009
|
+
Rt as setTheme
|
|
3992
4010
|
};
|
|
3993
4011
|
//# sourceMappingURL=annotorious.es.js.map
|