@annotorious/annotorious 3.0.15 → 3.0.16
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.es.js
CHANGED
|
@@ -90,10 +90,10 @@ function We(e) {
|
|
|
90
90
|
function he(e, t) {
|
|
91
91
|
e.appendChild(t);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function O(e, t, n) {
|
|
94
94
|
e.insertBefore(t, n || null);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function B(e) {
|
|
97
97
|
e.parentNode && e.parentNode.removeChild(e);
|
|
98
98
|
}
|
|
99
99
|
function gt(e, t) {
|
|
@@ -127,15 +127,15 @@ function pe(e, t, n) {
|
|
|
127
127
|
function En(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
|
|
128
128
|
return new CustomEvent(e, { detail: t, bubbles: n, cancelable: o });
|
|
129
129
|
}
|
|
130
|
-
let
|
|
130
|
+
let Ue;
|
|
131
131
|
function Xe(e) {
|
|
132
|
-
|
|
132
|
+
Ue = e;
|
|
133
133
|
}
|
|
134
134
|
function xt() {
|
|
135
|
-
if (!
|
|
136
|
-
return
|
|
135
|
+
if (!Ue) throw new Error("Function called outside component initialization");
|
|
136
|
+
return Ue;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Re(e) {
|
|
139
139
|
xt().$$.on_mount.push(e);
|
|
140
140
|
}
|
|
141
141
|
function ke() {
|
|
@@ -161,21 +161,21 @@ function me(e, t) {
|
|
|
161
161
|
n && n.slice().forEach((o) => o.call(this, t));
|
|
162
162
|
}
|
|
163
163
|
const Te = [], qe = [];
|
|
164
|
-
let
|
|
164
|
+
let ve = [];
|
|
165
165
|
const Et = [], An = /* @__PURE__ */ Promise.resolve();
|
|
166
166
|
let ut = !1;
|
|
167
167
|
function Sn() {
|
|
168
168
|
ut || (ut = !0, An.then($t));
|
|
169
169
|
}
|
|
170
170
|
function dt(e) {
|
|
171
|
-
|
|
171
|
+
ve.push(e);
|
|
172
172
|
}
|
|
173
173
|
const $e = /* @__PURE__ */ new Set();
|
|
174
174
|
let be = 0;
|
|
175
175
|
function $t() {
|
|
176
176
|
if (be !== 0)
|
|
177
177
|
return;
|
|
178
|
-
const e =
|
|
178
|
+
const e = Ue;
|
|
179
179
|
do {
|
|
180
180
|
try {
|
|
181
181
|
for (; be < Te.length; ) {
|
|
@@ -186,11 +186,11 @@ function $t() {
|
|
|
186
186
|
throw Te.length = 0, be = 0, t;
|
|
187
187
|
}
|
|
188
188
|
for (Xe(null), Te.length = 0, be = 0; qe.length; ) qe.pop()();
|
|
189
|
-
for (let t = 0; t <
|
|
190
|
-
const n =
|
|
189
|
+
for (let t = 0; t < ve.length; t += 1) {
|
|
190
|
+
const n = ve[t];
|
|
191
191
|
$e.has(n) || ($e.add(n), n());
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
ve.length = 0;
|
|
194
194
|
} while (Te.length);
|
|
195
195
|
for (; Et.length; )
|
|
196
196
|
Et.pop()();
|
|
@@ -203,9 +203,9 @@ function Tn(e) {
|
|
|
203
203
|
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(dt);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Mn(e) {
|
|
207
207
|
const t = [], n = [];
|
|
208
|
-
|
|
208
|
+
ve.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), ve = t;
|
|
209
209
|
}
|
|
210
210
|
const He = /* @__PURE__ */ new Set();
|
|
211
211
|
let we;
|
|
@@ -246,13 +246,13 @@ function x(e, t, n) {
|
|
|
246
246
|
}
|
|
247
247
|
function $(e, t) {
|
|
248
248
|
const n = e.$$;
|
|
249
|
-
n.fragment !== null && (
|
|
249
|
+
n.fragment !== null && (Mn(n.after_update), ge(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function vn(e, t) {
|
|
252
252
|
e.$$.dirty[0] === -1 && (Te.push(e), Sn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
253
253
|
}
|
|
254
254
|
function te(e, t, n, o, i, s, r = null, l = [-1]) {
|
|
255
|
-
const a =
|
|
255
|
+
const a = Ue;
|
|
256
256
|
Xe(e);
|
|
257
257
|
const c = e.$$ = {
|
|
258
258
|
fragment: null,
|
|
@@ -277,13 +277,13 @@ function te(e, t, n, o, i, s, r = null, l = [-1]) {
|
|
|
277
277
|
};
|
|
278
278
|
r && r(c.root);
|
|
279
279
|
let u = !1;
|
|
280
|
-
if (c.ctx = n ? n(e, t.props || {}, (f, h, ...
|
|
281
|
-
const
|
|
282
|
-
return c.ctx && i(c.ctx[f], c.ctx[f] =
|
|
280
|
+
if (c.ctx = n ? n(e, t.props || {}, (f, h, ...p) => {
|
|
281
|
+
const g = p.length ? p[0] : h;
|
|
282
|
+
return c.ctx && i(c.ctx[f], c.ctx[f] = g) && (!c.skip_bound && c.bound[f] && c.bound[f](g), u && vn(e, f)), h;
|
|
283
283
|
}) : [], c.update(), u = !0, ge(c.before_update), c.fragment = o ? o(c.ctx) : !1, t.target) {
|
|
284
284
|
if (t.hydrate) {
|
|
285
285
|
const f = bn(t.target);
|
|
286
|
-
c.fragment && c.fragment.l(f), f.forEach(
|
|
286
|
+
c.fragment && c.fragment.l(f), f.forEach(B);
|
|
287
287
|
} else
|
|
288
288
|
c.fragment && c.fragment.c();
|
|
289
289
|
t.intro && Y(e.$$.fragment), x(e, t.target, t.anchor), $t();
|
|
@@ -347,12 +347,12 @@ const mt = {}, pt = (e, t) => mt[e] = t, ht = (e) => mt[e.type].area(e), kn = (e
|
|
|
347
347
|
}, In = {
|
|
348
348
|
area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
|
|
349
349
|
intersects: (e, t, n) => {
|
|
350
|
-
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, l = 0, a = Math.cos(l), c = Math.sin(l), u = t - o, f = n - i, h = a * u + c * f,
|
|
351
|
-
return h * h / (s * s) +
|
|
350
|
+
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, l = 0, a = Math.cos(l), c = Math.sin(l), u = t - o, f = n - i, h = a * u + c * f, p = c * u - a * f;
|
|
351
|
+
return h * h / (s * s) + p * p / (r * r) <= 1;
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
pt(F.ELLIPSE, In);
|
|
355
|
-
const
|
|
355
|
+
const Bn = {
|
|
356
356
|
area: (e) => {
|
|
357
357
|
const { points: t } = e.geometry;
|
|
358
358
|
let n = 0, o = t.length - 1;
|
|
@@ -370,12 +370,12 @@ const On = {
|
|
|
370
370
|
return i;
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
pt(F.POLYGON,
|
|
374
|
-
const
|
|
373
|
+
pt(F.POLYGON, Bn);
|
|
374
|
+
const On = {
|
|
375
375
|
area: (e) => e.geometry.w * e.geometry.h,
|
|
376
376
|
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
|
|
377
377
|
};
|
|
378
|
-
pt(F.RECTANGLE,
|
|
378
|
+
pt(F.RECTANGLE, On);
|
|
379
379
|
const Je = (e) => Fe(e.target), Fe = (e) => {
|
|
380
380
|
var t, n;
|
|
381
381
|
return (e == null ? void 0 : e.annotation) !== void 0 && ((n = (t = e == null ? void 0 : e.selector) == null ? void 0 : t.geometry) == null ? void 0 : n.bounds) !== void 0;
|
|
@@ -383,19 +383,19 @@ const Je = (e) => Fe(e.target), Fe = (e) => {
|
|
|
383
383
|
const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, l, a, c, u, f] = i;
|
|
384
384
|
if (r !== "xywh") throw new Error("Unsupported MediaFragment: " + n);
|
|
385
385
|
if (l && l !== "pixel") throw new Error(`Unsupported MediaFragment unit: ${l}`);
|
|
386
|
-
const [h,
|
|
386
|
+
const [h, p, g, _] = [a, c, u, f].map(parseFloat);
|
|
387
387
|
return {
|
|
388
388
|
type: F.RECTANGLE,
|
|
389
389
|
geometry: {
|
|
390
390
|
x: h,
|
|
391
|
-
y:
|
|
392
|
-
w:
|
|
393
|
-
h:
|
|
391
|
+
y: p,
|
|
392
|
+
w: g,
|
|
393
|
+
h: _,
|
|
394
394
|
bounds: {
|
|
395
395
|
minX: h,
|
|
396
|
-
minY: t ?
|
|
397
|
-
maxX: h +
|
|
398
|
-
maxY: t ?
|
|
396
|
+
minY: t ? p - _ : p,
|
|
397
|
+
maxX: h + g,
|
|
398
|
+
maxY: t ? p : p + _
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
};
|
|
@@ -428,7 +428,7 @@ const Je = (e) => Fe(e.target), Fe = (e) => {
|
|
|
428
428
|
bounds: Ke(i)
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
|
-
},
|
|
431
|
+
}, Un = (e) => {
|
|
432
432
|
const t = Cn(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
|
|
433
433
|
minX: n - i,
|
|
434
434
|
minY: o - s,
|
|
@@ -445,14 +445,14 @@ const Je = (e) => Fe(e.target), Fe = (e) => {
|
|
|
445
445
|
bounds: r
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
-
},
|
|
448
|
+
}, Rn = (e) => {
|
|
449
449
|
const t = typeof e == "string" ? e : e.value;
|
|
450
450
|
if (t.includes("<polygon points="))
|
|
451
451
|
return Xn(t);
|
|
452
452
|
if (t.includes("<ellipse "))
|
|
453
|
-
return
|
|
453
|
+
return Un(t);
|
|
454
454
|
throw "Unsupported SVG shape: " + t;
|
|
455
|
-
},
|
|
455
|
+
}, Nn = (e) => {
|
|
456
456
|
let t;
|
|
457
457
|
if (e.type === F.POLYGON) {
|
|
458
458
|
const n = e.geometry, { points: o } = n;
|
|
@@ -562,53 +562,53 @@ var nn = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE =
|
|
|
562
562
|
const Ge = { selected: [] }, Wn = (e, t, n) => {
|
|
563
563
|
const { subscribe: o, set: i } = yt(Ge);
|
|
564
564
|
let s = t, r = Ge;
|
|
565
|
-
o((
|
|
565
|
+
o((g) => r = g);
|
|
566
566
|
const l = () => {
|
|
567
567
|
ye(r, Ge) || i(Ge);
|
|
568
568
|
}, a = () => {
|
|
569
|
-
var
|
|
570
|
-
return ((
|
|
571
|
-
}, c = (
|
|
569
|
+
var g;
|
|
570
|
+
return ((g = r.selected) == null ? void 0 : g.length) === 0;
|
|
571
|
+
}, c = (g) => {
|
|
572
572
|
if (a())
|
|
573
573
|
return !1;
|
|
574
|
-
const
|
|
575
|
-
return r.selected.some((
|
|
576
|
-
}, u = (
|
|
577
|
-
let
|
|
578
|
-
if (Array.isArray(
|
|
579
|
-
if (
|
|
580
|
-
console.warn("Invalid selection: " +
|
|
574
|
+
const _ = typeof g == "string" ? g : g.id;
|
|
575
|
+
return r.selected.some((A) => A.id === _);
|
|
576
|
+
}, u = (g, _) => {
|
|
577
|
+
let A;
|
|
578
|
+
if (Array.isArray(g)) {
|
|
579
|
+
if (A = g.map((y) => e.getAnnotation(y)).filter(Boolean), A.length < g.length) {
|
|
580
|
+
console.warn("Invalid selection: " + g.filter((y) => !A.some((w) => w.id === y)));
|
|
581
581
|
return;
|
|
582
582
|
}
|
|
583
583
|
} else {
|
|
584
|
-
const
|
|
585
|
-
if (!
|
|
586
|
-
console.warn("Invalid selection: " +
|
|
584
|
+
const y = e.getAnnotation(g);
|
|
585
|
+
if (!y) {
|
|
586
|
+
console.warn("Invalid selection: " + g);
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
|
-
|
|
589
|
+
A = [y];
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
const E =
|
|
593
|
-
return E === "EDIT" ? [...
|
|
591
|
+
const m = A.reduce((y, w) => {
|
|
592
|
+
const E = Mt(w, s, n);
|
|
593
|
+
return E === "EDIT" ? [...y, { id: w.id, editable: !0 }] : E === "SELECT" ? [...y, { id: w.id }] : y;
|
|
594
594
|
}, []);
|
|
595
|
-
i({ selected:
|
|
596
|
-
}, f = (
|
|
597
|
-
const
|
|
595
|
+
i({ selected: m, event: _ });
|
|
596
|
+
}, f = (g, _) => {
|
|
597
|
+
const A = Array.isArray(g) ? g : [g], m = A.map((y) => e.getAnnotation(y)).filter((y) => !!y);
|
|
598
598
|
i({
|
|
599
|
-
selected:
|
|
600
|
-
const
|
|
601
|
-
return { id:
|
|
599
|
+
selected: m.map((y) => {
|
|
600
|
+
const w = _ === void 0 ? Mt(y, s, n) === "EDIT" : _;
|
|
601
|
+
return { id: y.id, editable: w };
|
|
602
602
|
})
|
|
603
|
-
}),
|
|
604
|
-
}, h = (
|
|
603
|
+
}), m.length !== A.length && console.warn("Invalid selection", g);
|
|
604
|
+
}, h = (g) => {
|
|
605
605
|
if (a())
|
|
606
606
|
return !1;
|
|
607
|
-
const { selected:
|
|
608
|
-
|
|
609
|
-
},
|
|
607
|
+
const { selected: _ } = r;
|
|
608
|
+
_.some(({ id: A }) => g.includes(A)) && i({ selected: _.filter(({ id: A }) => !g.includes(A)) });
|
|
609
|
+
}, p = (g) => s = g;
|
|
610
610
|
return e.observe(
|
|
611
|
-
({ changes:
|
|
611
|
+
({ changes: g }) => h((g.deleted || []).map((_) => _.id))
|
|
612
612
|
), {
|
|
613
613
|
get event() {
|
|
614
614
|
return r ? r.event : null;
|
|
@@ -623,11 +623,11 @@ const Ge = { selected: [] }, Wn = (e, t, n) => {
|
|
|
623
623
|
isEmpty: a,
|
|
624
624
|
isSelected: c,
|
|
625
625
|
setSelected: f,
|
|
626
|
-
setUserSelectAction:
|
|
626
|
+
setUserSelectAction: p,
|
|
627
627
|
subscribe: o,
|
|
628
628
|
userSelect: u
|
|
629
629
|
};
|
|
630
|
-
},
|
|
630
|
+
}, Mt = (e, t, n) => {
|
|
631
631
|
const o = n ? n.serialize(e) : e;
|
|
632
632
|
return typeof t == "function" ? t(o) : t || "EDIT";
|
|
633
633
|
}, K = [];
|
|
@@ -646,10 +646,10 @@ function Jn() {
|
|
|
646
646
|
}
|
|
647
647
|
return nt(Kn);
|
|
648
648
|
}
|
|
649
|
-
const Qn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
649
|
+
const Qn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), vt = { randomUUID: Qn };
|
|
650
650
|
function on(e, t, n) {
|
|
651
|
-
if (
|
|
652
|
-
return
|
|
651
|
+
if (vt.randomUUID && !t && !e)
|
|
652
|
+
return vt.randomUUID();
|
|
653
653
|
e = e || {};
|
|
654
654
|
const o = e.random || (e.rng || Jn)();
|
|
655
655
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, qn(o);
|
|
@@ -722,10 +722,10 @@ const to = (e, t) => {
|
|
|
722
722
|
...(t.deleted || []).filter((f) => !n.has(f.id))
|
|
723
723
|
], u = [
|
|
724
724
|
...(e.updated || []).filter(({ newValue: f }) => !s.has(f.id)).map((f) => {
|
|
725
|
-
const { oldValue: h, newValue:
|
|
726
|
-
if (r.has(
|
|
727
|
-
const
|
|
728
|
-
return sn(h,
|
|
725
|
+
const { oldValue: h, newValue: p } = f;
|
|
726
|
+
if (r.has(p.id)) {
|
|
727
|
+
const g = t.updated.find((_) => _.oldValue.id === p.id).newValue;
|
|
728
|
+
return sn(h, g);
|
|
729
729
|
} else
|
|
730
730
|
return f;
|
|
731
731
|
}),
|
|
@@ -747,201 +747,201 @@ const to = (e, t) => {
|
|
|
747
747
|
}
|
|
748
748
|
};
|
|
749
749
|
}, oo = (e) => e.id !== void 0, io = () => {
|
|
750
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (
|
|
751
|
-
n.push({ onChange:
|
|
752
|
-
}, i = (
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
}, s = (
|
|
750
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (S, T = {}) => {
|
|
751
|
+
n.push({ onChange: S, options: T });
|
|
752
|
+
}, i = (S) => {
|
|
753
|
+
const T = n.findIndex((b) => b.onChange == S);
|
|
754
|
+
T > -1 && n.splice(T, 1);
|
|
755
|
+
}, s = (S, T) => {
|
|
756
756
|
const b = {
|
|
757
|
-
origin:
|
|
757
|
+
origin: S,
|
|
758
758
|
changes: {
|
|
759
|
-
created:
|
|
760
|
-
updated:
|
|
761
|
-
deleted:
|
|
759
|
+
created: T.created || [],
|
|
760
|
+
updated: T.updated || [],
|
|
761
|
+
deleted: T.deleted || []
|
|
762
762
|
},
|
|
763
763
|
state: [...e.values()]
|
|
764
764
|
};
|
|
765
|
-
n.forEach((
|
|
766
|
-
to(
|
|
765
|
+
n.forEach((M) => {
|
|
766
|
+
to(M, b) && M.onChange(b);
|
|
767
767
|
});
|
|
768
|
-
}, r = (
|
|
769
|
-
if (
|
|
770
|
-
throw Error(`Cannot add annotation ${
|
|
768
|
+
}, r = (S, T = G.LOCAL) => {
|
|
769
|
+
if (S.id && e.get(S.id))
|
|
770
|
+
throw Error(`Cannot add annotation ${S.id} - exists already`);
|
|
771
771
|
{
|
|
772
|
-
const b = it(
|
|
773
|
-
e.set(b.id, b), b.bodies.forEach((
|
|
772
|
+
const b = it(S);
|
|
773
|
+
e.set(b.id, b), b.bodies.forEach((M) => t.set(M.id, b.id)), s(T, { created: [b] });
|
|
774
774
|
}
|
|
775
|
-
}, l = (
|
|
776
|
-
const b = it(typeof
|
|
775
|
+
}, l = (S, T) => {
|
|
776
|
+
const b = it(typeof S == "string" ? T : S), M = typeof S == "string" ? S : S.id, P = M && e.get(M);
|
|
777
777
|
if (P) {
|
|
778
778
|
const D = sn(P, b);
|
|
779
|
-
return
|
|
779
|
+
return M === b.id ? e.set(M, b) : (e.delete(M), e.set(b.id, b)), P.bodies.forEach((z) => t.delete(z.id)), b.bodies.forEach((z) => t.set(z.id, b.id)), D;
|
|
780
780
|
} else
|
|
781
|
-
console.warn(`Cannot update annotation ${
|
|
782
|
-
}, a = (
|
|
783
|
-
const
|
|
784
|
-
P && s(
|
|
785
|
-
}, c = (
|
|
786
|
-
const b =
|
|
781
|
+
console.warn(`Cannot update annotation ${M} - does not exist`);
|
|
782
|
+
}, a = (S, T = G.LOCAL, b = G.LOCAL) => {
|
|
783
|
+
const M = oo(T) ? b : T, P = l(S, T);
|
|
784
|
+
P && s(M, { updated: [P] });
|
|
785
|
+
}, c = (S, T = G.LOCAL) => {
|
|
786
|
+
const b = S.reduce((M, P) => {
|
|
787
787
|
const D = l(P);
|
|
788
|
-
return D ? [...
|
|
788
|
+
return D ? [...M, D] : M;
|
|
789
789
|
}, []);
|
|
790
|
-
b.length > 0 && s(
|
|
791
|
-
}, u = (
|
|
792
|
-
const b = e.get(
|
|
790
|
+
b.length > 0 && s(T, { updated: b });
|
|
791
|
+
}, u = (S, T = G.LOCAL) => {
|
|
792
|
+
const b = e.get(S.annotation);
|
|
793
793
|
if (b) {
|
|
794
|
-
const
|
|
794
|
+
const M = {
|
|
795
795
|
...b,
|
|
796
|
-
bodies: [...b.bodies,
|
|
796
|
+
bodies: [...b.bodies, S]
|
|
797
797
|
};
|
|
798
|
-
e.set(b.id,
|
|
798
|
+
e.set(b.id, M), t.set(S.id, M.id), s(T, { updated: [{
|
|
799
799
|
oldValue: b,
|
|
800
|
-
newValue:
|
|
801
|
-
bodiesCreated: [
|
|
800
|
+
newValue: M,
|
|
801
|
+
bodiesCreated: [S]
|
|
802
802
|
}] });
|
|
803
803
|
} else
|
|
804
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
805
|
-
}, f = () => [...e.values()], h = (
|
|
806
|
-
const
|
|
807
|
-
e.clear(), t.clear(), s(
|
|
808
|
-
},
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
804
|
+
console.warn(`Attempt to add body to missing annotation: ${S.annotation}`);
|
|
805
|
+
}, f = () => [...e.values()], h = (S = G.LOCAL) => {
|
|
806
|
+
const T = [...e.values()];
|
|
807
|
+
e.clear(), t.clear(), s(S, { deleted: T });
|
|
808
|
+
}, p = (S, T = !0, b = G.LOCAL) => {
|
|
809
|
+
const M = S.map(it);
|
|
810
|
+
if (T) {
|
|
811
811
|
const P = [...e.values()];
|
|
812
|
-
e.clear(), t.clear(),
|
|
812
|
+
e.clear(), t.clear(), M.forEach((D) => {
|
|
813
813
|
e.set(D.id, D), D.bodies.forEach((z) => t.set(z.id, D.id));
|
|
814
|
-
}), s(b, { created:
|
|
814
|
+
}), s(b, { created: M, deleted: P });
|
|
815
815
|
} else {
|
|
816
|
-
const P =
|
|
816
|
+
const P = S.reduce((D, z) => {
|
|
817
817
|
const oe = z.id && e.get(z.id);
|
|
818
818
|
return oe ? [...D, oe] : D;
|
|
819
819
|
}, []);
|
|
820
820
|
if (P.length > 0)
|
|
821
821
|
throw Error(`Bulk insert would overwrite the following annotations: ${P.map((D) => D.id).join(", ")}`);
|
|
822
|
-
|
|
822
|
+
M.forEach((D) => {
|
|
823
823
|
e.set(D.id, D), D.bodies.forEach((z) => t.set(z.id, D.id));
|
|
824
|
-
}), s(b, { created:
|
|
824
|
+
}), s(b, { created: M });
|
|
825
825
|
}
|
|
826
|
-
},
|
|
827
|
-
const
|
|
826
|
+
}, g = (S) => {
|
|
827
|
+
const T = typeof S == "string" ? S : S.id, b = e.get(T);
|
|
828
828
|
if (b)
|
|
829
|
-
return e.delete(
|
|
830
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
831
|
-
},
|
|
832
|
-
const b =
|
|
833
|
-
b && s(
|
|
834
|
-
},
|
|
835
|
-
const b =
|
|
836
|
-
const D =
|
|
837
|
-
return D ? [...
|
|
829
|
+
return e.delete(T), b.bodies.forEach((M) => t.delete(M.id)), b;
|
|
830
|
+
console.warn(`Attempt to delete missing annotation: ${T}`);
|
|
831
|
+
}, _ = (S, T = G.LOCAL) => {
|
|
832
|
+
const b = g(S);
|
|
833
|
+
b && s(T, { deleted: [b] });
|
|
834
|
+
}, A = (S, T = G.LOCAL) => {
|
|
835
|
+
const b = S.reduce((M, P) => {
|
|
836
|
+
const D = g(P);
|
|
837
|
+
return D ? [...M, D] : M;
|
|
838
838
|
}, []);
|
|
839
|
-
b.length > 0 && s(
|
|
840
|
-
},
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
843
|
-
const b =
|
|
839
|
+
b.length > 0 && s(T, { deleted: b });
|
|
840
|
+
}, m = (S) => {
|
|
841
|
+
const T = e.get(S.annotation);
|
|
842
|
+
if (T) {
|
|
843
|
+
const b = T.bodies.find((M) => M.id === S.id);
|
|
844
844
|
if (b) {
|
|
845
845
|
t.delete(b.id);
|
|
846
|
-
const
|
|
847
|
-
...
|
|
848
|
-
bodies:
|
|
846
|
+
const M = {
|
|
847
|
+
...T,
|
|
848
|
+
bodies: T.bodies.filter((P) => P.id !== S.id)
|
|
849
849
|
};
|
|
850
|
-
return e.set(
|
|
851
|
-
oldValue:
|
|
852
|
-
newValue:
|
|
850
|
+
return e.set(T.id, M), {
|
|
851
|
+
oldValue: T,
|
|
852
|
+
newValue: M,
|
|
853
853
|
bodiesDeleted: [b]
|
|
854
854
|
};
|
|
855
855
|
} else
|
|
856
|
-
console.warn(`Attempt to delete missing body ${
|
|
856
|
+
console.warn(`Attempt to delete missing body ${S.id} from annotation ${S.annotation}`);
|
|
857
857
|
} else
|
|
858
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
859
|
-
},
|
|
860
|
-
const b =
|
|
861
|
-
b && s(
|
|
862
|
-
},
|
|
863
|
-
const b =
|
|
864
|
-
b.length > 0 && s(
|
|
865
|
-
}, E = (
|
|
866
|
-
const
|
|
867
|
-
return
|
|
868
|
-
}, I = (
|
|
869
|
-
const
|
|
870
|
-
if (
|
|
871
|
-
const b = E(
|
|
858
|
+
console.warn(`Attempt to delete body from missing annotation ${S.annotation}`);
|
|
859
|
+
}, y = (S, T = G.LOCAL) => {
|
|
860
|
+
const b = m(S);
|
|
861
|
+
b && s(T, { updated: [b] });
|
|
862
|
+
}, w = (S, T = G.LOCAL) => {
|
|
863
|
+
const b = S.map((M) => m(M)).filter(Boolean);
|
|
864
|
+
b.length > 0 && s(T, { updated: b });
|
|
865
|
+
}, E = (S) => {
|
|
866
|
+
const T = e.get(S);
|
|
867
|
+
return T ? { ...T } : void 0;
|
|
868
|
+
}, I = (S) => {
|
|
869
|
+
const T = t.get(S);
|
|
870
|
+
if (T) {
|
|
871
|
+
const b = E(T).bodies.find((M) => M.id === S);
|
|
872
872
|
if (b)
|
|
873
873
|
return b;
|
|
874
|
-
console.error(`Store integrity error: body ${
|
|
874
|
+
console.error(`Store integrity error: body ${S} in index, but not in annotation`);
|
|
875
875
|
} else
|
|
876
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
877
|
-
},
|
|
878
|
-
if (
|
|
876
|
+
console.warn(`Attempt to retrieve missing body: ${S}`);
|
|
877
|
+
}, U = (S, T) => {
|
|
878
|
+
if (S.annotation !== T.annotation)
|
|
879
879
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
880
|
-
const b = e.get(
|
|
880
|
+
const b = e.get(S.annotation);
|
|
881
881
|
if (b) {
|
|
882
|
-
const
|
|
882
|
+
const M = b.bodies.find((D) => D.id === S.id), P = {
|
|
883
883
|
...b,
|
|
884
|
-
bodies: b.bodies.map((D) => D.id ===
|
|
884
|
+
bodies: b.bodies.map((D) => D.id === M.id ? T : D)
|
|
885
885
|
};
|
|
886
|
-
return e.set(b.id, P),
|
|
886
|
+
return e.set(b.id, P), M.id !== T.id && (t.delete(M.id), t.set(T.id, P.id)), {
|
|
887
887
|
oldValue: b,
|
|
888
888
|
newValue: P,
|
|
889
|
-
bodiesUpdated: [{ oldBody:
|
|
889
|
+
bodiesUpdated: [{ oldBody: M, newBody: T }]
|
|
890
890
|
};
|
|
891
891
|
} else
|
|
892
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
893
|
-
},
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
}, V = (
|
|
897
|
-
const b =
|
|
898
|
-
s(
|
|
899
|
-
}, Z = (
|
|
900
|
-
const
|
|
901
|
-
if (
|
|
892
|
+
console.warn(`Attempt to add body to missing annotation ${S.annotation}`);
|
|
893
|
+
}, N = (S, T, b = G.LOCAL) => {
|
|
894
|
+
const M = U(S, T);
|
|
895
|
+
M && s(b, { updated: [M] });
|
|
896
|
+
}, V = (S, T = G.LOCAL) => {
|
|
897
|
+
const b = S.map((M) => U({ id: M.id, annotation: M.annotation }, M)).filter(Boolean);
|
|
898
|
+
s(T, { updated: b });
|
|
899
|
+
}, Z = (S) => {
|
|
900
|
+
const T = e.get(S.annotation);
|
|
901
|
+
if (T) {
|
|
902
902
|
const b = {
|
|
903
|
-
...
|
|
903
|
+
...T,
|
|
904
904
|
target: {
|
|
905
|
-
...
|
|
906
|
-
...
|
|
905
|
+
...T.target,
|
|
906
|
+
...S
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
|
-
return e.set(
|
|
910
|
-
oldValue:
|
|
909
|
+
return e.set(T.id, b), {
|
|
910
|
+
oldValue: T,
|
|
911
911
|
newValue: b,
|
|
912
912
|
targetUpdated: {
|
|
913
|
-
oldTarget:
|
|
914
|
-
newTarget:
|
|
913
|
+
oldTarget: T.target,
|
|
914
|
+
newTarget: S
|
|
915
915
|
}
|
|
916
916
|
};
|
|
917
917
|
} else
|
|
918
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
918
|
+
console.warn(`Attempt to update target on missing annotation: ${S.annotation}`);
|
|
919
919
|
};
|
|
920
920
|
return {
|
|
921
921
|
addAnnotation: r,
|
|
922
922
|
addBody: u,
|
|
923
923
|
all: f,
|
|
924
|
-
bulkAddAnnotation:
|
|
925
|
-
bulkDeleteAnnotation:
|
|
926
|
-
bulkDeleteBodies:
|
|
924
|
+
bulkAddAnnotation: p,
|
|
925
|
+
bulkDeleteAnnotation: A,
|
|
926
|
+
bulkDeleteBodies: w,
|
|
927
927
|
bulkUpdateAnnotation: c,
|
|
928
928
|
bulkUpdateBodies: V,
|
|
929
|
-
bulkUpdateTargets: (
|
|
930
|
-
const b =
|
|
931
|
-
b.length > 0 && s(
|
|
929
|
+
bulkUpdateTargets: (S, T = G.LOCAL) => {
|
|
930
|
+
const b = S.map((M) => Z(M)).filter(Boolean);
|
|
931
|
+
b.length > 0 && s(T, { updated: b });
|
|
932
932
|
},
|
|
933
933
|
clear: h,
|
|
934
|
-
deleteAnnotation:
|
|
935
|
-
deleteBody:
|
|
934
|
+
deleteAnnotation: _,
|
|
935
|
+
deleteBody: y,
|
|
936
936
|
getAnnotation: E,
|
|
937
937
|
getBody: I,
|
|
938
938
|
observe: o,
|
|
939
939
|
unobserve: i,
|
|
940
940
|
updateAnnotation: a,
|
|
941
|
-
updateBody:
|
|
942
|
-
updateTarget: (
|
|
943
|
-
const b = Z(
|
|
944
|
-
b && s(
|
|
941
|
+
updateBody: N,
|
|
942
|
+
updateTarget: (S, T = G.LOCAL) => {
|
|
943
|
+
const b = Z(S);
|
|
944
|
+
b && s(T, { updated: [b] });
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
947
|
}, so = (e) => ({
|
|
@@ -965,41 +965,42 @@ let ro = () => ({
|
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
967
|
});
|
|
968
|
-
const lo = 250, ao = (e) => {
|
|
969
|
-
const
|
|
970
|
-
let
|
|
971
|
-
const
|
|
972
|
-
if (!
|
|
973
|
-
const { changes:
|
|
974
|
-
if (
|
|
975
|
-
|
|
968
|
+
const lo = 250, ao = (e, t) => {
|
|
969
|
+
const n = ro(), o = [];
|
|
970
|
+
let i = -1, s = !1, r = 0;
|
|
971
|
+
const l = (g) => {
|
|
972
|
+
if (!s) {
|
|
973
|
+
const { changes: _ } = g, A = performance.now();
|
|
974
|
+
if (A - r > lo)
|
|
975
|
+
o.splice(i + 1), o.push(_), i = o.length - 1;
|
|
976
976
|
else {
|
|
977
|
-
const
|
|
978
|
-
|
|
977
|
+
const m = o.length - 1;
|
|
978
|
+
o[m] = no(o[m], _);
|
|
979
979
|
}
|
|
980
|
-
|
|
980
|
+
r = A;
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
s = !1;
|
|
983
983
|
};
|
|
984
|
-
e.observe(
|
|
985
|
-
const
|
|
984
|
+
e.observe(l, { origin: G.LOCAL });
|
|
985
|
+
const a = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g), c = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), u = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ oldValue: _ }) => _)), f = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ newValue: _ }) => _)), h = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), p = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g);
|
|
986
986
|
return {
|
|
987
|
-
canRedo: () =>
|
|
988
|
-
canUndo: () =>
|
|
989
|
-
destroy: () => e.unobserve(
|
|
990
|
-
|
|
987
|
+
canRedo: () => o.length - 1 > i,
|
|
988
|
+
canUndo: () => i > -1,
|
|
989
|
+
destroy: () => e.unobserve(l),
|
|
990
|
+
getHistory: () => [...o],
|
|
991
|
+
on: (g, _) => n.on(g, _),
|
|
991
992
|
redo: () => {
|
|
992
|
-
if (
|
|
993
|
-
|
|
994
|
-
const { created: g, updated:
|
|
995
|
-
|
|
993
|
+
if (o.length - 1 > i) {
|
|
994
|
+
s = !0;
|
|
995
|
+
const { created: g, updated: _, deleted: A } = o[i + 1];
|
|
996
|
+
c(g), f(_), p(A), n.emit("redo", o[i + 1]), i += 1;
|
|
996
997
|
}
|
|
997
998
|
},
|
|
998
999
|
undo: () => {
|
|
999
|
-
if (
|
|
1000
|
-
|
|
1001
|
-
const { created: g, updated:
|
|
1002
|
-
|
|
1000
|
+
if (i > -1) {
|
|
1001
|
+
s = !0;
|
|
1002
|
+
const { created: g, updated: _, deleted: A } = o[i];
|
|
1003
|
+
a(g), u(_), h(A), n.emit("undo", o[i]), i -= 1;
|
|
1003
1004
|
}
|
|
1004
1005
|
}
|
|
1005
1006
|
};
|
|
@@ -1012,78 +1013,78 @@ const lo = 250, ao = (e) => {
|
|
|
1012
1013
|
}, fo = (e, t, n, o) => {
|
|
1013
1014
|
const { hover: i, selection: s, store: r, viewport: l } = e, a = /* @__PURE__ */ new Map();
|
|
1014
1015
|
let c = [], u, f;
|
|
1015
|
-
const h = (
|
|
1016
|
-
a.has(
|
|
1017
|
-
},
|
|
1018
|
-
const
|
|
1019
|
-
if (
|
|
1020
|
-
const E =
|
|
1021
|
-
E !== -1 &&
|
|
1016
|
+
const h = (m, y) => {
|
|
1017
|
+
a.has(m) ? a.get(m).push(y) : a.set(m, [y]);
|
|
1018
|
+
}, p = (m, y) => {
|
|
1019
|
+
const w = a.get(m);
|
|
1020
|
+
if (w) {
|
|
1021
|
+
const E = w.indexOf(y);
|
|
1022
|
+
E !== -1 && w.splice(E, 1);
|
|
1022
1023
|
}
|
|
1023
|
-
},
|
|
1024
|
-
a.has(
|
|
1025
|
-
a.get(
|
|
1024
|
+
}, g = (m, y, w) => {
|
|
1025
|
+
a.has(m) && setTimeout(() => {
|
|
1026
|
+
a.get(m).forEach((E) => {
|
|
1026
1027
|
if (n) {
|
|
1027
|
-
const I = Array.isArray(
|
|
1028
|
-
E(I,
|
|
1028
|
+
const I = Array.isArray(y) ? y.map((N) => n.serialize(N)) : n.serialize(y), U = w ? w instanceof PointerEvent ? w : n.serialize(w) : void 0;
|
|
1029
|
+
E(I, U);
|
|
1029
1030
|
} else
|
|
1030
|
-
E(
|
|
1031
|
+
E(y, w);
|
|
1031
1032
|
});
|
|
1032
1033
|
}, 1);
|
|
1033
|
-
},
|
|
1034
|
-
const { selected:
|
|
1035
|
-
|
|
1036
|
-
const E = c.find((I) => I.id ===
|
|
1037
|
-
(!E || !ye(E,
|
|
1038
|
-
}), c = c.map((
|
|
1034
|
+
}, _ = () => {
|
|
1035
|
+
const { selected: m } = s, y = (m || []).map(({ id: w }) => r.getAnnotation(w));
|
|
1036
|
+
y.forEach((w) => {
|
|
1037
|
+
const E = c.find((I) => I.id === w.id);
|
|
1038
|
+
(!E || !ye(E, w)) && g("updateAnnotation", w, E);
|
|
1039
|
+
}), c = c.map((w) => y.find(({ id: I }) => I === w.id) || w);
|
|
1039
1040
|
};
|
|
1040
|
-
s.subscribe(({ selected:
|
|
1041
|
-
if (!(c.length === 0 &&
|
|
1042
|
-
if (c.length === 0 &&
|
|
1043
|
-
c =
|
|
1044
|
-
else if (c.length > 0 &&
|
|
1045
|
-
c.forEach((
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1041
|
+
s.subscribe(({ selected: m }) => {
|
|
1042
|
+
if (!(c.length === 0 && m.length === 0)) {
|
|
1043
|
+
if (c.length === 0 && m.length > 0)
|
|
1044
|
+
c = m.map(({ id: y }) => r.getAnnotation(y));
|
|
1045
|
+
else if (c.length > 0 && m.length === 0)
|
|
1046
|
+
c.forEach((y) => {
|
|
1047
|
+
const w = r.getAnnotation(y.id);
|
|
1048
|
+
w && !ye(w, y) && g("updateAnnotation", w, y);
|
|
1048
1049
|
}), c = [];
|
|
1049
1050
|
else {
|
|
1050
|
-
const
|
|
1051
|
-
c.filter((E) => !
|
|
1051
|
+
const y = new Set(c.map((E) => E.id)), w = new Set(m.map(({ id: E }) => E));
|
|
1052
|
+
c.filter((E) => !w.has(E.id)).forEach((E) => {
|
|
1052
1053
|
const I = r.getAnnotation(E.id);
|
|
1053
|
-
I && !ye(I, E) &&
|
|
1054
|
+
I && !ye(I, E) && g("updateAnnotation", I, E);
|
|
1054
1055
|
}), c = [
|
|
1055
1056
|
// Remove annotations that were deselected
|
|
1056
|
-
...c.filter((E) =>
|
|
1057
|
+
...c.filter((E) => w.has(E.id)),
|
|
1057
1058
|
// Add editable annotations that were selected
|
|
1058
|
-
...
|
|
1059
|
+
...m.filter(({ id: E }) => !y.has(E)).map(({ id: E }) => r.getAnnotation(E))
|
|
1059
1060
|
];
|
|
1060
1061
|
}
|
|
1061
|
-
|
|
1062
|
+
g("selectionChanged", c);
|
|
1062
1063
|
}
|
|
1063
|
-
}), i.subscribe((
|
|
1064
|
-
!u &&
|
|
1065
|
-
}), l == null || l.subscribe((
|
|
1066
|
-
o && (f && clearTimeout(f), f = setTimeout(
|
|
1067
|
-
const { created:
|
|
1068
|
-
(
|
|
1064
|
+
}), i.subscribe((m) => {
|
|
1065
|
+
!u && m ? g("mouseEnterAnnotation", r.getAnnotation(m)) : u && !m ? g("mouseLeaveAnnotation", r.getAnnotation(u)) : u && m && (g("mouseLeaveAnnotation", r.getAnnotation(u)), g("mouseEnterAnnotation", r.getAnnotation(m))), u = m;
|
|
1066
|
+
}), l == null || l.subscribe((m) => g("viewportIntersect", m.map((y) => r.getAnnotation(y)))), r.observe((m) => {
|
|
1067
|
+
o && (f && clearTimeout(f), f = setTimeout(_, 1e3));
|
|
1068
|
+
const { created: y, deleted: w } = m.changes;
|
|
1069
|
+
(y || []).forEach((E) => g("createAnnotation", E)), (w || []).forEach((E) => g("deleteAnnotation", E)), (m.changes.updated || []).filter((E) => [
|
|
1069
1070
|
...E.bodiesCreated || [],
|
|
1070
1071
|
...E.bodiesDeleted || [],
|
|
1071
1072
|
...E.bodiesUpdated || []
|
|
1072
1073
|
].length > 0).forEach(({ oldValue: E, newValue: I }) => {
|
|
1073
|
-
const
|
|
1074
|
-
c = c.map((
|
|
1074
|
+
const U = c.find((N) => N.id === E.id) || E;
|
|
1075
|
+
c = c.map((N) => N.id === E.id ? I : N), g("updateAnnotation", I, U);
|
|
1075
1076
|
});
|
|
1076
|
-
}, { origin: G.LOCAL }), r.observe((
|
|
1077
|
+
}, { origin: G.LOCAL }), r.observe((m) => {
|
|
1077
1078
|
if (c) {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1079
|
+
const y = new Set(c.map((E) => E.id)), w = (m.changes.updated || []).filter(({ newValue: E }) => y.has(E.id)).map(({ newValue: E }) => E);
|
|
1080
|
+
w.length > 0 && (c = c.map((E) => w.find((U) => U.id === E.id) || E));
|
|
1080
1081
|
}
|
|
1081
1082
|
}, { origin: G.REMOTE });
|
|
1082
|
-
const
|
|
1083
|
-
const { updated:
|
|
1084
|
-
|
|
1083
|
+
const A = (m) => (y) => {
|
|
1084
|
+
const { updated: w } = y;
|
|
1085
|
+
m ? (w || []).forEach((E) => g("updateAnnotation", E.oldValue, E.newValue)) : (w || []).forEach((E) => g("updateAnnotation", E.newValue, E.oldValue));
|
|
1085
1086
|
};
|
|
1086
|
-
return t.on("undo",
|
|
1087
|
+
return t.on("undo", A(!0)), t.on("redo", A(!1)), { on: h, off: p, emit: g };
|
|
1087
1088
|
}, uo = (e) => (t) => t.reduce((n, o) => {
|
|
1088
1089
|
const { parsed: i, error: s } = e.parse(o);
|
|
1089
1090
|
return s ? {
|
|
@@ -1096,46 +1097,46 @@ const lo = 250, ao = (e) => {
|
|
|
1096
1097
|
...n
|
|
1097
1098
|
};
|
|
1098
1099
|
}, { parsed: [], failed: [] }), ho = (e, t, n) => {
|
|
1099
|
-
const { store: o, selection: i } = e, s = (
|
|
1100
|
+
const { store: o, selection: i } = e, s = (m) => {
|
|
1100
1101
|
if (n) {
|
|
1101
|
-
const { parsed:
|
|
1102
|
-
|
|
1102
|
+
const { parsed: y, error: w } = n.parse(m);
|
|
1103
|
+
y ? o.addAnnotation(y, G.REMOTE) : console.error(w);
|
|
1103
1104
|
} else
|
|
1104
|
-
o.addAnnotation(ot(
|
|
1105
|
-
}, r = () => i.clear(), l = () => o.clear(), a = (
|
|
1106
|
-
const
|
|
1107
|
-
return n &&
|
|
1105
|
+
o.addAnnotation(ot(m), G.REMOTE);
|
|
1106
|
+
}, r = () => i.clear(), l = () => o.clear(), a = (m) => {
|
|
1107
|
+
const y = o.getAnnotation(m);
|
|
1108
|
+
return n && y ? n.serialize(y) : y;
|
|
1108
1109
|
}, c = () => n ? o.all().map(n.serialize) : o.all(), u = () => {
|
|
1109
|
-
var
|
|
1110
|
-
const
|
|
1111
|
-
return n ?
|
|
1112
|
-
}, f = (
|
|
1113
|
-
if (typeof
|
|
1114
|
-
const
|
|
1115
|
-
if (o.deleteAnnotation(
|
|
1116
|
-
return n ? n.serialize(
|
|
1110
|
+
var m;
|
|
1111
|
+
const y = (((m = i.selected) == null ? void 0 : m.map((w) => w.id)) || []).map((w) => o.getAnnotation(w)).filter(Boolean);
|
|
1112
|
+
return n ? y.map(n.serialize) : y;
|
|
1113
|
+
}, f = (m, y = !0) => fetch(m).then((w) => w.json()).then((w) => (p(w, y), w)), h = (m) => {
|
|
1114
|
+
if (typeof m == "string") {
|
|
1115
|
+
const y = o.getAnnotation(m);
|
|
1116
|
+
if (o.deleteAnnotation(m), y)
|
|
1117
|
+
return n ? n.serialize(y) : y;
|
|
1117
1118
|
} else {
|
|
1118
|
-
const
|
|
1119
|
-
if (
|
|
1120
|
-
return o.deleteAnnotation(
|
|
1119
|
+
const y = n ? n.parse(m).parsed : m;
|
|
1120
|
+
if (y)
|
|
1121
|
+
return o.deleteAnnotation(y), m;
|
|
1121
1122
|
}
|
|
1122
|
-
},
|
|
1123
|
+
}, p = (m, y = !0) => {
|
|
1123
1124
|
if (n) {
|
|
1124
|
-
const
|
|
1125
|
-
I.length > 0 && console.warn(`Discarded ${I.length} invalid annotations`, I), o.bulkAddAnnotation(E,
|
|
1125
|
+
const w = n.parseAll || uo(n), { parsed: E, failed: I } = w(m);
|
|
1126
|
+
I.length > 0 && console.warn(`Discarded ${I.length} invalid annotations`, I), o.bulkAddAnnotation(E, y, G.REMOTE);
|
|
1126
1127
|
} else
|
|
1127
|
-
o.bulkAddAnnotation(
|
|
1128
|
-
},
|
|
1129
|
-
|
|
1130
|
-
},
|
|
1131
|
-
i.clear(), i.setUserSelectAction(
|
|
1132
|
-
},
|
|
1128
|
+
o.bulkAddAnnotation(m.map(ot), y, G.REMOTE);
|
|
1129
|
+
}, g = (m, y) => {
|
|
1130
|
+
m ? i.setSelected(m, y) : i.clear();
|
|
1131
|
+
}, _ = (m) => {
|
|
1132
|
+
i.clear(), i.setUserSelectAction(m);
|
|
1133
|
+
}, A = (m) => {
|
|
1133
1134
|
if (n) {
|
|
1134
|
-
const
|
|
1135
|
-
return o.updateAnnotation(
|
|
1135
|
+
const y = n.parse(m).parsed, w = n.serialize(o.getAnnotation(y.id));
|
|
1136
|
+
return o.updateAnnotation(y), w;
|
|
1136
1137
|
} else {
|
|
1137
|
-
const
|
|
1138
|
-
return o.updateAnnotation(ot(
|
|
1138
|
+
const y = o.getAnnotation(m.id);
|
|
1139
|
+
return o.updateAnnotation(ot(m)), y;
|
|
1139
1140
|
}
|
|
1140
1141
|
};
|
|
1141
1142
|
return {
|
|
@@ -1146,15 +1147,16 @@ const lo = 250, ao = (e) => {
|
|
|
1146
1147
|
clearAnnotations: l,
|
|
1147
1148
|
getAnnotationById: a,
|
|
1148
1149
|
getAnnotations: c,
|
|
1150
|
+
getHistory: t.getHistory,
|
|
1149
1151
|
getSelected: u,
|
|
1150
1152
|
loadAnnotations: f,
|
|
1151
1153
|
redo: t.redo,
|
|
1152
1154
|
removeAnnotation: h,
|
|
1153
|
-
setAnnotations:
|
|
1154
|
-
setSelected:
|
|
1155
|
-
setUserSelectAction:
|
|
1155
|
+
setAnnotations: p,
|
|
1156
|
+
setSelected: g,
|
|
1157
|
+
setUserSelectAction: _,
|
|
1156
1158
|
undo: t.undo,
|
|
1157
|
-
updateAnnotation:
|
|
1159
|
+
updateAnnotation: A
|
|
1158
1160
|
};
|
|
1159
1161
|
}, Hi = (e, t, n) => typeof t == "function" ? t(e, n) : t, Fi = (e, t) => typeof e != "function" && typeof t != "function" ? {
|
|
1160
1162
|
...e || {},
|
|
@@ -1238,14 +1240,14 @@ const wo = () => ({ isGuest: !0, id: yo("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1238
1240
|
}, releaseColor: (t) => e.push(t) };
|
|
1239
1241
|
};
|
|
1240
1242
|
_o();
|
|
1241
|
-
const qi = (e, t = { strict: !0, invertY: !1 }) => ({ parse: (i) => To(i, t), serialize: (i) =>
|
|
1243
|
+
const qi = (e, t = { strict: !0, invertY: !1 }) => ({ parse: (i) => To(i, t), serialize: (i) => Mo(i, e, t) }), To = (e, t = { strict: !0, invertY: !1 }) => {
|
|
1242
1244
|
const n = e.id || tn(), {
|
|
1243
1245
|
creator: o,
|
|
1244
1246
|
created: i,
|
|
1245
1247
|
modified: s,
|
|
1246
1248
|
body: r,
|
|
1247
1249
|
...l
|
|
1248
|
-
} = e, a = Eo(r || [], n), c = Array.isArray(e.target) ? e.target[0] : e.target, u = Array.isArray(c.selector) ? c.selector[0] : c.selector, f = (u == null ? void 0 : u.type) === "FragmentSelector" ? Dn(u, t.invertY) : (u == null ? void 0 : u.type) === "SvgSelector" ?
|
|
1250
|
+
} = e, a = Eo(r || [], n), c = Array.isArray(e.target) ? e.target[0] : e.target, u = Array.isArray(c.selector) ? c.selector[0] : c.selector, f = (u == null ? void 0 : u.type) === "FragmentSelector" ? Dn(u, t.invertY) : (u == null ? void 0 : u.type) === "SvgSelector" ? Rn(u) : void 0;
|
|
1249
1251
|
return f || !t.strict ? {
|
|
1250
1252
|
parsed: {
|
|
1251
1253
|
...l,
|
|
@@ -1263,7 +1265,7 @@ const qi = (e, t = { strict: !0, invertY: !1 }) => ({ parse: (i) => To(i, t), se
|
|
|
1263
1265
|
} : {
|
|
1264
1266
|
error: Error(`Invalid selector: ${JSON.stringify(u)}`)
|
|
1265
1267
|
};
|
|
1266
|
-
},
|
|
1268
|
+
}, Mo = (e, t, n = { strict: !0, invertY: !1 }) => {
|
|
1267
1269
|
const {
|
|
1268
1270
|
selector: o,
|
|
1269
1271
|
creator: i,
|
|
@@ -1275,7 +1277,7 @@ const qi = (e, t = { strict: !0, invertY: !1 }) => ({ parse: (i) => To(i, t), se
|
|
|
1275
1277
|
} = e.target;
|
|
1276
1278
|
let c;
|
|
1277
1279
|
try {
|
|
1278
|
-
c = o.type == F.RECTANGLE ? Yn(o.geometry) :
|
|
1280
|
+
c = o.type == F.RECTANGLE ? Yn(o.geometry) : Nn(o);
|
|
1279
1281
|
} catch (f) {
|
|
1280
1282
|
if (n.strict)
|
|
1281
1283
|
throw f;
|
|
@@ -1355,21 +1357,21 @@ function kt(e) {
|
|
|
1355
1357
|
}
|
|
1356
1358
|
};
|
|
1357
1359
|
}
|
|
1358
|
-
function
|
|
1360
|
+
function vo(e) {
|
|
1359
1361
|
let t, n, o, i, s, r, l, a, c, u, f, h = Le(
|
|
1360
1362
|
/*geom*/
|
|
1361
1363
|
e[4].points
|
|
1362
|
-
),
|
|
1363
|
-
for (let
|
|
1364
|
-
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1364
|
+
), p = [];
|
|
1365
|
+
for (let _ = 0; _ < h.length; _ += 1)
|
|
1366
|
+
p[_] = kt(Lt(e, h, _));
|
|
1367
|
+
const g = (_) => C(p[_], 1, 1, () => {
|
|
1368
|
+
p[_] = null;
|
|
1367
1369
|
});
|
|
1368
1370
|
return {
|
|
1369
1371
|
c() {
|
|
1370
1372
|
t = X("polygon"), i = ie(), s = X("polygon"), l = ie();
|
|
1371
|
-
for (let
|
|
1372
|
-
|
|
1373
|
+
for (let _ = 0; _ < p.length; _ += 1)
|
|
1374
|
+
p[_].c();
|
|
1373
1375
|
a = le(), d(t, "class", "a9s-outer"), d(t, "style", n = /*computedStyle*/
|
|
1374
1376
|
e[1] ? "display:none;" : void 0), d(t, "points", o = /*geom*/
|
|
1375
1377
|
e[4].points.map(It).join(" ")), d(s, "class", "a9s-inner a9s-shape-handle"), d(
|
|
@@ -1378,13 +1380,13 @@ function Mo(e) {
|
|
|
1378
1380
|
/*computedStyle*/
|
|
1379
1381
|
e[1]
|
|
1380
1382
|
), d(s, "points", r = /*geom*/
|
|
1381
|
-
e[4].points.map(
|
|
1383
|
+
e[4].points.map(Bt).join(" "));
|
|
1382
1384
|
},
|
|
1383
|
-
m(
|
|
1384
|
-
|
|
1385
|
-
for (let
|
|
1386
|
-
|
|
1387
|
-
|
|
1385
|
+
m(_, A) {
|
|
1386
|
+
O(_, t, A), O(_, i, A), O(_, s, A), O(_, l, A);
|
|
1387
|
+
for (let m = 0; m < p.length; m += 1)
|
|
1388
|
+
p[m] && p[m].m(_, A);
|
|
1389
|
+
O(_, a, A), c = !0, u || (f = [
|
|
1388
1390
|
H(t, "pointerdown", function() {
|
|
1389
1391
|
W(
|
|
1390
1392
|
/*grab*/
|
|
@@ -1399,50 +1401,50 @@ function Mo(e) {
|
|
|
1399
1401
|
})
|
|
1400
1402
|
], u = !0);
|
|
1401
1403
|
},
|
|
1402
|
-
p(
|
|
1403
|
-
if (e =
|
|
1404
|
+
p(_, A) {
|
|
1405
|
+
if (e = _, (!c || A & /*computedStyle*/
|
|
1404
1406
|
2 && n !== (n = /*computedStyle*/
|
|
1405
|
-
e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!c ||
|
|
1407
|
+
e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!c || A & /*geom*/
|
|
1406
1408
|
16 && o !== (o = /*geom*/
|
|
1407
|
-
e[4].points.map(It).join(" "))) && d(t, "points", o), (!c ||
|
|
1409
|
+
e[4].points.map(It).join(" "))) && d(t, "points", o), (!c || A & /*computedStyle*/
|
|
1408
1410
|
2) && d(
|
|
1409
1411
|
s,
|
|
1410
1412
|
"style",
|
|
1411
1413
|
/*computedStyle*/
|
|
1412
1414
|
e[1]
|
|
1413
|
-
), (!c ||
|
|
1415
|
+
), (!c || A & /*geom*/
|
|
1414
1416
|
16 && r !== (r = /*geom*/
|
|
1415
|
-
e[4].points.map(
|
|
1417
|
+
e[4].points.map(Bt).join(" "))) && d(s, "points", r), A & /*geom, viewportScale, grab*/
|
|
1416
1418
|
536) {
|
|
1417
1419
|
h = Le(
|
|
1418
1420
|
/*geom*/
|
|
1419
1421
|
e[4].points
|
|
1420
1422
|
);
|
|
1421
|
-
let
|
|
1422
|
-
for (
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1423
|
+
let m;
|
|
1424
|
+
for (m = 0; m < h.length; m += 1) {
|
|
1425
|
+
const y = Lt(e, h, m);
|
|
1426
|
+
p[m] ? (p[m].p(y, A), Y(p[m], 1)) : (p[m] = kt(y), p[m].c(), Y(p[m], 1), p[m].m(a.parentNode, a));
|
|
1425
1427
|
}
|
|
1426
|
-
for (se(),
|
|
1427
|
-
m
|
|
1428
|
+
for (se(), m = h.length; m < p.length; m += 1)
|
|
1429
|
+
g(m);
|
|
1428
1430
|
re();
|
|
1429
1431
|
}
|
|
1430
1432
|
},
|
|
1431
|
-
i(
|
|
1433
|
+
i(_) {
|
|
1432
1434
|
if (!c) {
|
|
1433
|
-
for (let
|
|
1434
|
-
Y(
|
|
1435
|
+
for (let A = 0; A < h.length; A += 1)
|
|
1436
|
+
Y(p[A]);
|
|
1435
1437
|
c = !0;
|
|
1436
1438
|
}
|
|
1437
1439
|
},
|
|
1438
|
-
o(
|
|
1439
|
-
|
|
1440
|
-
for (let
|
|
1441
|
-
C(
|
|
1440
|
+
o(_) {
|
|
1441
|
+
p = p.filter(Boolean);
|
|
1442
|
+
for (let A = 0; A < p.length; A += 1)
|
|
1443
|
+
C(p[A]);
|
|
1442
1444
|
c = !1;
|
|
1443
1445
|
},
|
|
1444
|
-
d(
|
|
1445
|
-
|
|
1446
|
+
d(_) {
|
|
1447
|
+
_ && (B(t), B(i), B(s), B(l), B(a)), gt(p, _), u = !1, ge(f);
|
|
1446
1448
|
}
|
|
1447
1449
|
};
|
|
1448
1450
|
}
|
|
@@ -1464,7 +1466,7 @@ function Lo(e) {
|
|
|
1464
1466
|
),
|
|
1465
1467
|
$$slots: {
|
|
1466
1468
|
default: [
|
|
1467
|
-
|
|
1469
|
+
vo,
|
|
1468
1470
|
({ grab: o }) => ({ 9: o }),
|
|
1469
1471
|
({ grab: o }) => o ? 512 : 0
|
|
1470
1472
|
]
|
|
@@ -1510,15 +1512,15 @@ function Lo(e) {
|
|
|
1510
1512
|
}
|
|
1511
1513
|
};
|
|
1512
1514
|
}
|
|
1513
|
-
const It = (e) => e.join(","),
|
|
1515
|
+
const It = (e) => e.join(","), Bt = (e) => e.join(",");
|
|
1514
1516
|
function ko(e, t, n) {
|
|
1515
1517
|
let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
|
|
1516
|
-
const a = (h,
|
|
1517
|
-
let
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
const
|
|
1521
|
-
return { ...h, geometry: { points:
|
|
1518
|
+
const a = (h, p, g) => {
|
|
1519
|
+
let _;
|
|
1520
|
+
const A = h.geometry;
|
|
1521
|
+
p === "SHAPE" ? _ = A.points.map(([y, w]) => [y + g[0], w + g[1]]) : _ = A.points.map(([y, w], E) => p === `HANDLE-${E}` ? [y + g[0], w + g[1]] : [y, w]);
|
|
1522
|
+
const m = Ke(_);
|
|
1523
|
+
return { ...h, geometry: { points: _, bounds: m } };
|
|
1522
1524
|
};
|
|
1523
1525
|
function c(h) {
|
|
1524
1526
|
me.call(this, e, h);
|
|
@@ -1560,7 +1562,7 @@ const st = (e, t) => {
|
|
|
1560
1562
|
const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
|
|
1561
1563
|
return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
|
|
1562
1564
|
}, Ae = [];
|
|
1563
|
-
function
|
|
1565
|
+
function Bo(e, t = j) {
|
|
1564
1566
|
let n;
|
|
1565
1567
|
const o = /* @__PURE__ */ new Set();
|
|
1566
1568
|
function i(l) {
|
|
@@ -1586,7 +1588,7 @@ function Oo(e, t = j) {
|
|
|
1586
1588
|
}
|
|
1587
1589
|
return { set: i, update: s, subscribe: r };
|
|
1588
1590
|
}
|
|
1589
|
-
const
|
|
1591
|
+
const Oo = (e, t) => {
|
|
1590
1592
|
const { naturalWidth: n, naturalHeight: o } = e;
|
|
1591
1593
|
if (!n && !o) {
|
|
1592
1594
|
const { width: i, height: s } = e;
|
|
@@ -1597,8 +1599,8 @@ const Bo = (e, t) => {
|
|
|
1597
1599
|
} else
|
|
1598
1600
|
t.setAttribute("viewBox", `0 0 ${n} ${o}`);
|
|
1599
1601
|
}, Do = (e, t) => {
|
|
1600
|
-
|
|
1601
|
-
const { subscribe: n, set: o } =
|
|
1602
|
+
Oo(e, t);
|
|
1603
|
+
const { subscribe: n, set: o } = Bo(1);
|
|
1602
1604
|
let i;
|
|
1603
1605
|
return window.ResizeObserver && (i = new ResizeObserver(() => {
|
|
1604
1606
|
const r = t.getBoundingClientRect(), { width: l, height: a } = t.viewBox.baseVal, c = Math.max(
|
|
@@ -1633,7 +1635,7 @@ function Po(e) {
|
|
|
1633
1635
|
);
|
|
1634
1636
|
},
|
|
1635
1637
|
m(l, a) {
|
|
1636
|
-
|
|
1638
|
+
O(l, t, a), s || (r = H(
|
|
1637
1639
|
t,
|
|
1638
1640
|
"pointerdown",
|
|
1639
1641
|
/*pointerdown_handler_2*/
|
|
@@ -1664,7 +1666,7 @@ function Po(e) {
|
|
|
1664
1666
|
);
|
|
1665
1667
|
},
|
|
1666
1668
|
d(l) {
|
|
1667
|
-
l &&
|
|
1669
|
+
l && B(t), s = !1, r();
|
|
1668
1670
|
}
|
|
1669
1671
|
};
|
|
1670
1672
|
}
|
|
@@ -1707,7 +1709,7 @@ function Co(e) {
|
|
|
1707
1709
|
), d(t, "class", "a9s-touch-handle");
|
|
1708
1710
|
},
|
|
1709
1711
|
m(u, f) {
|
|
1710
|
-
|
|
1712
|
+
O(u, t, f), he(t, n), he(t, i), a || (c = [
|
|
1711
1713
|
H(
|
|
1712
1714
|
n,
|
|
1713
1715
|
"pointerdown",
|
|
@@ -1791,7 +1793,7 @@ function Co(e) {
|
|
|
1791
1793
|
);
|
|
1792
1794
|
},
|
|
1793
1795
|
d(u) {
|
|
1794
|
-
u &&
|
|
1796
|
+
u && B(t), a = !1, ge(c);
|
|
1795
1797
|
}
|
|
1796
1798
|
};
|
|
1797
1799
|
}
|
|
@@ -1806,7 +1808,7 @@ function Xo(e) {
|
|
|
1806
1808
|
i.c(), t = le();
|
|
1807
1809
|
},
|
|
1808
1810
|
m(s, r) {
|
|
1809
|
-
i.m(s, r),
|
|
1811
|
+
i.m(s, r), O(s, t, r);
|
|
1810
1812
|
},
|
|
1811
1813
|
p(s, [r]) {
|
|
1812
1814
|
i.p(s, r);
|
|
@@ -1814,26 +1816,26 @@ function Xo(e) {
|
|
|
1814
1816
|
i: j,
|
|
1815
1817
|
o: j,
|
|
1816
1818
|
d(s) {
|
|
1817
|
-
s &&
|
|
1819
|
+
s && B(t), i.d(s);
|
|
1818
1820
|
}
|
|
1819
1821
|
};
|
|
1820
1822
|
}
|
|
1821
|
-
function
|
|
1823
|
+
function Uo(e, t, n) {
|
|
1822
1824
|
let o, { x: i } = t, { y: s } = t, { scale: r } = t, { radius: l = 30 } = t, a = !1;
|
|
1823
|
-
const c = (
|
|
1824
|
-
|
|
1825
|
+
const c = (g) => {
|
|
1826
|
+
g.pointerType === "touch" && n(4, a = !0);
|
|
1825
1827
|
}, u = () => n(4, a = !1);
|
|
1826
|
-
function f(
|
|
1827
|
-
me.call(this, e,
|
|
1828
|
+
function f(g) {
|
|
1829
|
+
me.call(this, e, g);
|
|
1828
1830
|
}
|
|
1829
|
-
function h(
|
|
1830
|
-
me.call(this, e,
|
|
1831
|
+
function h(g) {
|
|
1832
|
+
me.call(this, e, g);
|
|
1831
1833
|
}
|
|
1832
|
-
function g
|
|
1833
|
-
me.call(this, e,
|
|
1834
|
+
function p(g) {
|
|
1835
|
+
me.call(this, e, g);
|
|
1834
1836
|
}
|
|
1835
|
-
return e.$$set = (
|
|
1836
|
-
n(8, t = ft(ft({}, t), bt(
|
|
1837
|
+
return e.$$set = (g) => {
|
|
1838
|
+
n(8, t = ft(ft({}, t), bt(g))), "x" in g && n(0, i = g.x), "y" in g && n(1, s = g.y), "scale" in g && n(2, r = g.scale), "radius" in g && n(3, l = g.radius);
|
|
1837
1839
|
}, e.$$.update = () => {
|
|
1838
1840
|
e.$$.dirty & /*scale*/
|
|
1839
1841
|
4 && n(5, o = 10 / r);
|
|
@@ -1849,16 +1851,16 @@ function Ro(e, t, n) {
|
|
|
1849
1851
|
t,
|
|
1850
1852
|
f,
|
|
1851
1853
|
h,
|
|
1852
|
-
|
|
1854
|
+
p
|
|
1853
1855
|
];
|
|
1854
1856
|
}
|
|
1855
1857
|
class Ye extends ne {
|
|
1856
1858
|
constructor(t) {
|
|
1857
|
-
super(), te(this, t,
|
|
1859
|
+
super(), te(this, t, Uo, Xo, Q, { x: 0, y: 1, scale: 2, radius: 3 });
|
|
1858
1860
|
}
|
|
1859
1861
|
}
|
|
1860
|
-
function
|
|
1861
|
-
let t, n, o, i, s, r, l, a, c, u, f, h, g,
|
|
1862
|
+
function Ro(e) {
|
|
1863
|
+
let t, n, o, i, s, r, l, a, c, u, f, h, p, g, _, A, m, y, w, E, I, U, N, V, Z, S, T, b, M, P, D, z, oe, ae, Ie, ce, Be, fe, Oe, ue, R, k, J;
|
|
1862
1864
|
return ae = new Ye({
|
|
1863
1865
|
props: {
|
|
1864
1866
|
class: "a9s-corner-handle-topleft",
|
|
@@ -1949,7 +1951,7 @@ function No(e) {
|
|
|
1949
1951
|
) && e[9]("BOTTOM_LEFT").apply(this, arguments);
|
|
1950
1952
|
}), {
|
|
1951
1953
|
c() {
|
|
1952
|
-
t = X("rect"), l = ie(), a = X("rect"),
|
|
1954
|
+
t = X("rect"), l = ie(), a = X("rect"), p = ie(), g = X("rect"), y = ie(), w = X("rect"), N = ie(), V = X("rect"), b = ie(), M = X("rect"), oe = ie(), ee(ae.$$.fragment), Ie = ie(), ee(ce.$$.fragment), Be = ie(), ee(fe.$$.fragment), Oe = ie(), ee(ue.$$.fragment), d(t, "class", "a9s-outer"), d(t, "style", n = /*computedStyle*/
|
|
1953
1955
|
e[1] ? "display:none;" : void 0), d(t, "x", o = /*geom*/
|
|
1954
1956
|
e[4].x), d(t, "y", i = /*geom*/
|
|
1955
1957
|
e[4].y), d(t, "width", s = /*geom*/
|
|
@@ -1963,24 +1965,24 @@ function No(e) {
|
|
|
1963
1965
|
e[4].x), d(a, "y", u = /*geom*/
|
|
1964
1966
|
e[4].y), d(a, "width", f = /*geom*/
|
|
1965
1967
|
e[4].w), d(a, "height", h = /*geom*/
|
|
1966
|
-
e[4].h), d(
|
|
1967
|
-
e[4].x), d(
|
|
1968
|
-
e[4].y), d(
|
|
1969
|
-
e[4].w), d(
|
|
1968
|
+
e[4].h), d(g, "class", "a9s-edge-handle a9s-edge-handle-top"), d(g, "x", _ = /*geom*/
|
|
1969
|
+
e[4].x), d(g, "y", A = /*geom*/
|
|
1970
|
+
e[4].y), d(g, "height", 1), d(g, "width", m = /*geom*/
|
|
1971
|
+
e[4].w), d(w, "class", "a9s-edge-handle a9s-edge-handle-right"), d(w, "x", E = /*geom*/
|
|
1970
1972
|
e[4].x + /*geom*/
|
|
1971
|
-
e[4].w), d(
|
|
1972
|
-
e[4].y), d(
|
|
1973
|
-
e[4].h), d(
|
|
1974
|
-
e[4].x), d(V, "y",
|
|
1973
|
+
e[4].w), d(w, "y", I = /*geom*/
|
|
1974
|
+
e[4].y), d(w, "height", U = /*geom*/
|
|
1975
|
+
e[4].h), d(w, "width", 1), d(V, "class", "a9s-edge-handle a9s-edge-handle-bottom"), d(V, "x", Z = /*geom*/
|
|
1976
|
+
e[4].x), d(V, "y", S = /*geom*/
|
|
1975
1977
|
e[4].y + /*geom*/
|
|
1976
|
-
e[4].h), d(V, "height", 1), d(V, "width",
|
|
1977
|
-
e[4].w), d(
|
|
1978
|
-
e[4].x), d(
|
|
1979
|
-
e[4].y), d(
|
|
1980
|
-
e[4].h), d(
|
|
1981
|
-
},
|
|
1982
|
-
m(L,
|
|
1983
|
-
|
|
1978
|
+
e[4].h), d(V, "height", 1), d(V, "width", T = /*geom*/
|
|
1979
|
+
e[4].w), d(M, "class", "a9s-edge-handle a9s-edge-handle-left"), d(M, "x", P = /*geom*/
|
|
1980
|
+
e[4].x), d(M, "y", D = /*geom*/
|
|
1981
|
+
e[4].y), d(M, "height", z = /*geom*/
|
|
1982
|
+
e[4].h), d(M, "width", 1);
|
|
1983
|
+
},
|
|
1984
|
+
m(L, v) {
|
|
1985
|
+
O(L, t, v), O(L, l, v), O(L, a, v), O(L, p, v), O(L, g, v), O(L, y, v), O(L, w, v), O(L, N, v), O(L, V, v), O(L, b, v), O(L, M, v), O(L, oe, v), x(ae, L, v), O(L, Ie, v), x(ce, L, v), O(L, Be, v), x(fe, L, v), O(L, Oe, v), x(ue, L, v), R = !0, k || (J = [
|
|
1984
1986
|
H(t, "pointerdown", function() {
|
|
1985
1987
|
W(
|
|
1986
1988
|
/*grab*/
|
|
@@ -1993,13 +1995,13 @@ function No(e) {
|
|
|
1993
1995
|
e[9]("SHAPE")
|
|
1994
1996
|
) && e[9]("SHAPE").apply(this, arguments);
|
|
1995
1997
|
}),
|
|
1996
|
-
H(
|
|
1998
|
+
H(g, "pointerdown", function() {
|
|
1997
1999
|
W(
|
|
1998
2000
|
/*grab*/
|
|
1999
2001
|
e[9]("TOP")
|
|
2000
2002
|
) && e[9]("TOP").apply(this, arguments);
|
|
2001
2003
|
}),
|
|
2002
|
-
H(
|
|
2004
|
+
H(w, "pointerdown", function() {
|
|
2003
2005
|
W(
|
|
2004
2006
|
/*grab*/
|
|
2005
2007
|
e[9]("RIGHT")
|
|
@@ -2011,7 +2013,7 @@ function No(e) {
|
|
|
2011
2013
|
e[9]("BOTTOM")
|
|
2012
2014
|
) && e[9]("BOTTOM").apply(this, arguments);
|
|
2013
2015
|
}),
|
|
2014
|
-
H(
|
|
2016
|
+
H(M, "pointerdown", function() {
|
|
2015
2017
|
W(
|
|
2016
2018
|
/*grab*/
|
|
2017
2019
|
e[9]("LEFT")
|
|
@@ -2019,107 +2021,107 @@ function No(e) {
|
|
|
2019
2021
|
})
|
|
2020
2022
|
], k = !0);
|
|
2021
2023
|
},
|
|
2022
|
-
p(L,
|
|
2023
|
-
e = L, (!
|
|
2024
|
+
p(L, v) {
|
|
2025
|
+
e = L, (!R || v & /*computedStyle*/
|
|
2024
2026
|
2 && n !== (n = /*computedStyle*/
|
|
2025
|
-
e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!
|
|
2027
|
+
e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!R || v & /*geom*/
|
|
2026
2028
|
16 && o !== (o = /*geom*/
|
|
2027
|
-
e[4].x)) && d(t, "x", o), (!
|
|
2029
|
+
e[4].x)) && d(t, "x", o), (!R || v & /*geom*/
|
|
2028
2030
|
16 && i !== (i = /*geom*/
|
|
2029
|
-
e[4].y)) && d(t, "y", i), (!
|
|
2031
|
+
e[4].y)) && d(t, "y", i), (!R || v & /*geom*/
|
|
2030
2032
|
16 && s !== (s = /*geom*/
|
|
2031
|
-
e[4].w)) && d(t, "width", s), (!
|
|
2033
|
+
e[4].w)) && d(t, "width", s), (!R || v & /*geom*/
|
|
2032
2034
|
16 && r !== (r = /*geom*/
|
|
2033
|
-
e[4].h)) && d(t, "height", r), (!
|
|
2035
|
+
e[4].h)) && d(t, "height", r), (!R || v & /*computedStyle*/
|
|
2034
2036
|
2) && d(
|
|
2035
2037
|
a,
|
|
2036
2038
|
"style",
|
|
2037
2039
|
/*computedStyle*/
|
|
2038
2040
|
e[1]
|
|
2039
|
-
), (!
|
|
2041
|
+
), (!R || v & /*geom*/
|
|
2040
2042
|
16 && c !== (c = /*geom*/
|
|
2041
|
-
e[4].x)) && d(a, "x", c), (!
|
|
2043
|
+
e[4].x)) && d(a, "x", c), (!R || v & /*geom*/
|
|
2042
2044
|
16 && u !== (u = /*geom*/
|
|
2043
|
-
e[4].y)) && d(a, "y", u), (!
|
|
2045
|
+
e[4].y)) && d(a, "y", u), (!R || v & /*geom*/
|
|
2044
2046
|
16 && f !== (f = /*geom*/
|
|
2045
|
-
e[4].w)) && d(a, "width", f), (!
|
|
2047
|
+
e[4].w)) && d(a, "width", f), (!R || v & /*geom*/
|
|
2046
2048
|
16 && h !== (h = /*geom*/
|
|
2047
|
-
e[4].h)) && d(a, "height", h), (!
|
|
2048
|
-
16 &&
|
|
2049
|
-
e[4].x)) && d(
|
|
2050
|
-
16 &&
|
|
2051
|
-
e[4].y)) && d(
|
|
2052
|
-
16 &&
|
|
2053
|
-
e[4].w)) && d(
|
|
2049
|
+
e[4].h)) && d(a, "height", h), (!R || v & /*geom*/
|
|
2050
|
+
16 && _ !== (_ = /*geom*/
|
|
2051
|
+
e[4].x)) && d(g, "x", _), (!R || v & /*geom*/
|
|
2052
|
+
16 && A !== (A = /*geom*/
|
|
2053
|
+
e[4].y)) && d(g, "y", A), (!R || v & /*geom*/
|
|
2054
|
+
16 && m !== (m = /*geom*/
|
|
2055
|
+
e[4].w)) && d(g, "width", m), (!R || v & /*geom*/
|
|
2054
2056
|
16 && E !== (E = /*geom*/
|
|
2055
2057
|
e[4].x + /*geom*/
|
|
2056
|
-
e[4].w)) && d(
|
|
2058
|
+
e[4].w)) && d(w, "x", E), (!R || v & /*geom*/
|
|
2057
2059
|
16 && I !== (I = /*geom*/
|
|
2058
|
-
e[4].y)) && d(
|
|
2059
|
-
16 &&
|
|
2060
|
-
e[4].h)) && d(
|
|
2060
|
+
e[4].y)) && d(w, "y", I), (!R || v & /*geom*/
|
|
2061
|
+
16 && U !== (U = /*geom*/
|
|
2062
|
+
e[4].h)) && d(w, "height", U), (!R || v & /*geom*/
|
|
2061
2063
|
16 && Z !== (Z = /*geom*/
|
|
2062
|
-
e[4].x)) && d(V, "x", Z), (!
|
|
2063
|
-
16 && A !== (A = /*geom*/
|
|
2064
|
-
e[4].y + /*geom*/
|
|
2065
|
-
e[4].h)) && d(V, "y", A), (!N || M & /*geom*/
|
|
2064
|
+
e[4].x)) && d(V, "x", Z), (!R || v & /*geom*/
|
|
2066
2065
|
16 && S !== (S = /*geom*/
|
|
2067
|
-
e[4].
|
|
2066
|
+
e[4].y + /*geom*/
|
|
2067
|
+
e[4].h)) && d(V, "y", S), (!R || v & /*geom*/
|
|
2068
|
+
16 && T !== (T = /*geom*/
|
|
2069
|
+
e[4].w)) && d(V, "width", T), (!R || v & /*geom*/
|
|
2068
2070
|
16 && P !== (P = /*geom*/
|
|
2069
|
-
e[4].x)) && d(
|
|
2071
|
+
e[4].x)) && d(M, "x", P), (!R || v & /*geom*/
|
|
2070
2072
|
16 && D !== (D = /*geom*/
|
|
2071
|
-
e[4].y)) && d(
|
|
2073
|
+
e[4].y)) && d(M, "y", D), (!R || v & /*geom*/
|
|
2072
2074
|
16 && z !== (z = /*geom*/
|
|
2073
|
-
e[4].h)) && d(
|
|
2075
|
+
e[4].h)) && d(M, "height", z);
|
|
2074
2076
|
const de = {};
|
|
2075
|
-
|
|
2077
|
+
v & /*geom*/
|
|
2076
2078
|
16 && (de.x = /*geom*/
|
|
2077
|
-
e[4].x),
|
|
2079
|
+
e[4].x), v & /*geom*/
|
|
2078
2080
|
16 && (de.y = /*geom*/
|
|
2079
|
-
e[4].y),
|
|
2081
|
+
e[4].y), v & /*viewportScale*/
|
|
2080
2082
|
8 && (de.scale = /*viewportScale*/
|
|
2081
2083
|
e[3]), ae.$set(de);
|
|
2082
2084
|
const _e = {};
|
|
2083
|
-
|
|
2085
|
+
v & /*geom*/
|
|
2084
2086
|
16 && (_e.x = /*geom*/
|
|
2085
2087
|
e[4].x + /*geom*/
|
|
2086
|
-
e[4].w),
|
|
2088
|
+
e[4].w), v & /*geom*/
|
|
2087
2089
|
16 && (_e.y = /*geom*/
|
|
2088
|
-
e[4].y),
|
|
2090
|
+
e[4].y), v & /*viewportScale*/
|
|
2089
2091
|
8 && (_e.scale = /*viewportScale*/
|
|
2090
2092
|
e[3]), ce.$set(_e);
|
|
2091
|
-
const
|
|
2092
|
-
|
|
2093
|
-
16 && (
|
|
2093
|
+
const Ne = {};
|
|
2094
|
+
v & /*geom*/
|
|
2095
|
+
16 && (Ne.x = /*geom*/
|
|
2094
2096
|
e[4].x + /*geom*/
|
|
2095
|
-
e[4].w),
|
|
2096
|
-
16 && (
|
|
2097
|
+
e[4].w), v & /*geom*/
|
|
2098
|
+
16 && (Ne.y = /*geom*/
|
|
2097
2099
|
e[4].y + /*geom*/
|
|
2098
|
-
e[4].h),
|
|
2099
|
-
8 && (
|
|
2100
|
-
e[3]), fe.$set(
|
|
2100
|
+
e[4].h), v & /*viewportScale*/
|
|
2101
|
+
8 && (Ne.scale = /*viewportScale*/
|
|
2102
|
+
e[3]), fe.$set(Ne);
|
|
2101
2103
|
const Ve = {};
|
|
2102
|
-
|
|
2104
|
+
v & /*geom*/
|
|
2103
2105
|
16 && (Ve.x = /*geom*/
|
|
2104
|
-
e[4].x),
|
|
2106
|
+
e[4].x), v & /*geom*/
|
|
2105
2107
|
16 && (Ve.y = /*geom*/
|
|
2106
2108
|
e[4].y + /*geom*/
|
|
2107
|
-
e[4].h),
|
|
2109
|
+
e[4].h), v & /*viewportScale*/
|
|
2108
2110
|
8 && (Ve.scale = /*viewportScale*/
|
|
2109
2111
|
e[3]), ue.$set(Ve);
|
|
2110
2112
|
},
|
|
2111
2113
|
i(L) {
|
|
2112
|
-
|
|
2114
|
+
R || (Y(ae.$$.fragment, L), Y(ce.$$.fragment, L), Y(fe.$$.fragment, L), Y(ue.$$.fragment, L), R = !0);
|
|
2113
2115
|
},
|
|
2114
2116
|
o(L) {
|
|
2115
|
-
C(ae.$$.fragment, L), C(ce.$$.fragment, L), C(fe.$$.fragment, L), C(ue.$$.fragment, L),
|
|
2117
|
+
C(ae.$$.fragment, L), C(ce.$$.fragment, L), C(fe.$$.fragment, L), C(ue.$$.fragment, L), R = !1;
|
|
2116
2118
|
},
|
|
2117
2119
|
d(L) {
|
|
2118
|
-
L && (
|
|
2120
|
+
L && (B(t), B(l), B(a), B(p), B(g), B(y), B(w), B(N), B(V), B(b), B(M), B(oe), B(Ie), B(Be), B(Oe)), $(ae, L), $(ce, L), $(fe, L), $(ue, L), k = !1, ge(J);
|
|
2119
2121
|
}
|
|
2120
2122
|
};
|
|
2121
2123
|
}
|
|
2122
|
-
function
|
|
2124
|
+
function No(e) {
|
|
2123
2125
|
let t, n;
|
|
2124
2126
|
return t = new an({
|
|
2125
2127
|
props: {
|
|
@@ -2137,7 +2139,7 @@ function Uo(e) {
|
|
|
2137
2139
|
),
|
|
2138
2140
|
$$slots: {
|
|
2139
2141
|
default: [
|
|
2140
|
-
|
|
2142
|
+
Ro,
|
|
2141
2143
|
({ grab: o }) => ({ 9: o }),
|
|
2142
2144
|
({ grab: o }) => o ? 512 : 0
|
|
2143
2145
|
]
|
|
@@ -2185,55 +2187,55 @@ function Uo(e) {
|
|
|
2185
2187
|
}
|
|
2186
2188
|
function Vo(e, t, n) {
|
|
2187
2189
|
let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
|
|
2188
|
-
const a = (h,
|
|
2189
|
-
const
|
|
2190
|
-
let [
|
|
2191
|
-
const [E, I] =
|
|
2192
|
-
if (
|
|
2193
|
-
|
|
2190
|
+
const a = (h, p, g) => {
|
|
2191
|
+
const _ = h.geometry.bounds;
|
|
2192
|
+
let [A, m] = [_.minX, _.minY], [y, w] = [_.maxX, _.maxY];
|
|
2193
|
+
const [E, I] = g;
|
|
2194
|
+
if (p === "SHAPE")
|
|
2195
|
+
A += E, y += E, m += I, w += I;
|
|
2194
2196
|
else {
|
|
2195
|
-
switch (
|
|
2197
|
+
switch (p) {
|
|
2196
2198
|
case "TOP":
|
|
2197
2199
|
case "TOP_LEFT":
|
|
2198
2200
|
case "TOP_RIGHT": {
|
|
2199
|
-
|
|
2201
|
+
m += I;
|
|
2200
2202
|
break;
|
|
2201
2203
|
}
|
|
2202
2204
|
case "BOTTOM":
|
|
2203
2205
|
case "BOTTOM_LEFT":
|
|
2204
2206
|
case "BOTTOM_RIGHT": {
|
|
2205
|
-
|
|
2207
|
+
w += I;
|
|
2206
2208
|
break;
|
|
2207
2209
|
}
|
|
2208
2210
|
}
|
|
2209
|
-
switch (
|
|
2211
|
+
switch (p) {
|
|
2210
2212
|
case "LEFT":
|
|
2211
2213
|
case "TOP_LEFT":
|
|
2212
2214
|
case "BOTTOM_LEFT": {
|
|
2213
|
-
|
|
2215
|
+
A += E;
|
|
2214
2216
|
break;
|
|
2215
2217
|
}
|
|
2216
2218
|
case "RIGHT":
|
|
2217
2219
|
case "TOP_RIGHT":
|
|
2218
2220
|
case "BOTTOM_RIGHT": {
|
|
2219
|
-
|
|
2221
|
+
y += E;
|
|
2220
2222
|
break;
|
|
2221
2223
|
}
|
|
2222
2224
|
}
|
|
2223
2225
|
}
|
|
2224
|
-
const
|
|
2226
|
+
const U = Math.min(A, y), N = Math.min(m, w), V = Math.abs(y - A), Z = Math.abs(w - m);
|
|
2225
2227
|
return {
|
|
2226
2228
|
...h,
|
|
2227
2229
|
geometry: {
|
|
2228
|
-
x:
|
|
2229
|
-
y:
|
|
2230
|
+
x: U,
|
|
2231
|
+
y: N,
|
|
2230
2232
|
w: V,
|
|
2231
2233
|
h: Z,
|
|
2232
2234
|
bounds: {
|
|
2233
|
-
minX:
|
|
2234
|
-
minY:
|
|
2235
|
-
maxX:
|
|
2236
|
-
maxY:
|
|
2235
|
+
minX: U,
|
|
2236
|
+
minY: N,
|
|
2237
|
+
maxX: U + V,
|
|
2238
|
+
maxY: N + Z
|
|
2237
2239
|
}
|
|
2238
2240
|
}
|
|
2239
2241
|
};
|
|
@@ -2266,7 +2268,7 @@ function Vo(e, t, n) {
|
|
|
2266
2268
|
}
|
|
2267
2269
|
class Go extends ne {
|
|
2268
2270
|
constructor(t) {
|
|
2269
|
-
super(), te(this, t, Vo,
|
|
2271
|
+
super(), te(this, t, Vo, No, Q, {
|
|
2270
2272
|
shape: 0,
|
|
2271
2273
|
computedStyle: 1,
|
|
2272
2274
|
transform: 2,
|
|
@@ -2277,7 +2279,7 @@ class Go extends ne {
|
|
|
2277
2279
|
const ln = /* @__PURE__ */ new Map([
|
|
2278
2280
|
[F.RECTANGLE, Go],
|
|
2279
2281
|
[F.POLYGON, Io]
|
|
2280
|
-
]), jo = (e) => ln.get(e.type), zo = (e, t) => ln.set(e, t), Ho = (e) => ({}),
|
|
2282
|
+
]), jo = (e) => ln.get(e.type), zo = (e, t) => ln.set(e, t), Ho = (e) => ({}), Ot = (e) => ({ grab: (
|
|
2281
2283
|
/*onGrab*/
|
|
2282
2284
|
e[0]
|
|
2283
2285
|
) });
|
|
@@ -2291,14 +2293,14 @@ function Fo(e) {
|
|
|
2291
2293
|
e,
|
|
2292
2294
|
/*$$scope*/
|
|
2293
2295
|
e[6],
|
|
2294
|
-
|
|
2296
|
+
Ot
|
|
2295
2297
|
);
|
|
2296
2298
|
return {
|
|
2297
2299
|
c() {
|
|
2298
2300
|
t = X("g"), r && r.c(), d(t, "class", "a9s-annotation selected");
|
|
2299
2301
|
},
|
|
2300
2302
|
m(l, a) {
|
|
2301
|
-
|
|
2303
|
+
O(l, t, a), r && r.m(t, null), n = !0, o || (i = [
|
|
2302
2304
|
H(
|
|
2303
2305
|
t,
|
|
2304
2306
|
"pointerup",
|
|
@@ -2331,7 +2333,7 @@ function Fo(e) {
|
|
|
2331
2333
|
/*$$scope*/
|
|
2332
2334
|
l[6]
|
|
2333
2335
|
),
|
|
2334
|
-
|
|
2336
|
+
Ot
|
|
2335
2337
|
);
|
|
2336
2338
|
},
|
|
2337
2339
|
i(l) {
|
|
@@ -2341,7 +2343,7 @@ function Fo(e) {
|
|
|
2341
2343
|
C(r, l), n = !1;
|
|
2342
2344
|
},
|
|
2343
2345
|
d(l) {
|
|
2344
|
-
l &&
|
|
2346
|
+
l && B(t), r && r.d(l), o = !1, ge(i);
|
|
2345
2347
|
}
|
|
2346
2348
|
};
|
|
2347
2349
|
}
|
|
@@ -2349,19 +2351,19 @@ function Wo(e, t, n) {
|
|
|
2349
2351
|
let { $$slots: o = {}, $$scope: i } = t;
|
|
2350
2352
|
const s = ke();
|
|
2351
2353
|
let { shape: r } = t, { editor: l } = t, { transform: a } = t, c, u, f;
|
|
2352
|
-
const h = (
|
|
2353
|
-
c =
|
|
2354
|
-
},
|
|
2354
|
+
const h = (_) => (A) => {
|
|
2355
|
+
c = _, u = a.elementToImage(A.offsetX, A.offsetY), f = r, A.target.setPointerCapture(A.pointerId), s("grab", A);
|
|
2356
|
+
}, p = (_) => {
|
|
2355
2357
|
if (c) {
|
|
2356
|
-
const [
|
|
2357
|
-
n(3, r = l(f, c,
|
|
2358
|
+
const [A, m] = a.elementToImage(_.offsetX, _.offsetY), y = [A - u[0], m - u[1]];
|
|
2359
|
+
n(3, r = l(f, c, y)), s("change", r);
|
|
2358
2360
|
}
|
|
2359
|
-
},
|
|
2360
|
-
|
|
2361
|
+
}, g = (_) => {
|
|
2362
|
+
_.target.releasePointerCapture(_.pointerId), c = void 0, f = r, s("release", _);
|
|
2361
2363
|
};
|
|
2362
|
-
return e.$$set = (
|
|
2363
|
-
"shape" in
|
|
2364
|
-
}, [h,
|
|
2364
|
+
return e.$$set = (_) => {
|
|
2365
|
+
"shape" in _ && n(3, r = _.shape), "editor" in _ && n(4, l = _.editor), "transform" in _ && n(5, a = _.transform), "$$scope" in _ && n(6, i = _.$$scope);
|
|
2366
|
+
}, [h, p, g, r, l, a, i, o];
|
|
2365
2367
|
}
|
|
2366
2368
|
class an extends ne {
|
|
2367
2369
|
constructor(t) {
|
|
@@ -2380,7 +2382,7 @@ function qo(e, t, n) {
|
|
|
2380
2382
|
let o;
|
|
2381
2383
|
const i = ke();
|
|
2382
2384
|
let { annotation: s } = t, { editor: r } = t, { style: l } = t, { target: a } = t, { transform: c } = t, { viewportScale: u } = t, f;
|
|
2383
|
-
return
|
|
2385
|
+
return Re(() => (n(6, f = new r({
|
|
2384
2386
|
target: a,
|
|
2385
2387
|
props: {
|
|
2386
2388
|
shape: s.target.selector,
|
|
@@ -2427,9 +2429,9 @@ class Ko extends ne {
|
|
|
2427
2429
|
function Jo(e, t, n) {
|
|
2428
2430
|
const o = ke();
|
|
2429
2431
|
let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: l } = t, { viewportScale: a } = t, c;
|
|
2430
|
-
return
|
|
2431
|
-
const u = s.closest("svg"), f = [], h = (
|
|
2432
|
-
u == null || u.addEventListener(
|
|
2432
|
+
return Re(() => {
|
|
2433
|
+
const u = s.closest("svg"), f = [], h = (p, g, _) => {
|
|
2434
|
+
u == null || u.addEventListener(p, g, _), f.push(() => u == null ? void 0 : u.removeEventListener(p, g, _));
|
|
2433
2435
|
};
|
|
2434
2436
|
return n(5, c = new r({
|
|
2435
2437
|
target: s,
|
|
@@ -2439,8 +2441,8 @@ function Jo(e, t, n) {
|
|
|
2439
2441
|
transform: l,
|
|
2440
2442
|
viewportScale: a
|
|
2441
2443
|
}
|
|
2442
|
-
})), c.$on("create", (
|
|
2443
|
-
f.forEach((
|
|
2444
|
+
})), c.$on("create", (p) => o("create", p.detail)), () => {
|
|
2445
|
+
f.forEach((p) => p()), c.$destroy();
|
|
2444
2446
|
};
|
|
2445
2447
|
}), e.$$set = (u) => {
|
|
2446
2448
|
"drawingMode" in u && n(0, i = u.drawingMode), "target" in u && n(1, s = u.target), "tool" in u && n(2, r = u.tool), "transform" in u && n(3, l = u.transform), "viewportScale" in u && n(4, a = u.viewportScale);
|
|
@@ -2508,7 +2510,7 @@ function Dt(e) {
|
|
|
2508
2510
|
);
|
|
2509
2511
|
},
|
|
2510
2512
|
m(o, i) {
|
|
2511
|
-
|
|
2513
|
+
O(o, t, i), O(o, n, i);
|
|
2512
2514
|
},
|
|
2513
2515
|
p(o, i) {
|
|
2514
2516
|
i & /*x*/
|
|
@@ -2562,7 +2564,7 @@ function Dt(e) {
|
|
|
2562
2564
|
);
|
|
2563
2565
|
},
|
|
2564
2566
|
d(o) {
|
|
2565
|
-
o && (
|
|
2567
|
+
o && (B(t), B(n));
|
|
2566
2568
|
}
|
|
2567
2569
|
};
|
|
2568
2570
|
}
|
|
@@ -2576,7 +2578,7 @@ function Zo(e) {
|
|
|
2576
2578
|
t = X("g"), n && n.c(), d(t, "class", "a9s-annotation a9s-rubberband");
|
|
2577
2579
|
},
|
|
2578
2580
|
m(o, i) {
|
|
2579
|
-
|
|
2581
|
+
O(o, t, i), n && n.m(t, null);
|
|
2580
2582
|
},
|
|
2581
2583
|
p(o, [i]) {
|
|
2582
2584
|
/*origin*/
|
|
@@ -2585,51 +2587,51 @@ function Zo(e) {
|
|
|
2585
2587
|
i: j,
|
|
2586
2588
|
o: j,
|
|
2587
2589
|
d(o) {
|
|
2588
|
-
o &&
|
|
2590
|
+
o && B(t), n && n.d();
|
|
2589
2591
|
}
|
|
2590
2592
|
};
|
|
2591
2593
|
}
|
|
2592
2594
|
function xo(e, t, n) {
|
|
2593
2595
|
const o = ke();
|
|
2594
|
-
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, l, a, c, u, f, h,
|
|
2595
|
-
const
|
|
2596
|
-
const
|
|
2597
|
-
l = performance.now(), s === "drag" && (n(0, a = r.elementToImage(
|
|
2598
|
-
},
|
|
2599
|
-
const
|
|
2600
|
-
a && (c = r.elementToImage(
|
|
2601
|
-
},
|
|
2602
|
-
const
|
|
2596
|
+
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, l, a, c, u, f, h, p;
|
|
2597
|
+
const g = (y) => {
|
|
2598
|
+
const w = y;
|
|
2599
|
+
l = performance.now(), s === "drag" && (n(0, a = r.elementToImage(w.offsetX, w.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, h = 1), n(4, p = 1));
|
|
2600
|
+
}, _ = (y) => {
|
|
2601
|
+
const w = y;
|
|
2602
|
+
a && (c = r.elementToImage(w.offsetX, w.offsetY), n(1, u = Math.min(c[0], a[0])), n(2, f = Math.min(c[1], a[1])), n(3, h = Math.abs(c[0] - a[0])), n(4, p = Math.abs(c[1] - a[1])));
|
|
2603
|
+
}, A = (y) => {
|
|
2604
|
+
const w = y, E = performance.now() - l;
|
|
2603
2605
|
if (s === "click") {
|
|
2604
2606
|
if (E > 300) return;
|
|
2605
|
-
a ?
|
|
2606
|
-
} else a && (E > 300 || h *
|
|
2607
|
-
},
|
|
2608
|
-
if (h *
|
|
2609
|
-
const
|
|
2607
|
+
a ? m() : (n(0, a = r.elementToImage(w.offsetX, w.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, h = 1), n(4, p = 1));
|
|
2608
|
+
} else a && (E > 300 || h * p > 100 ? (w.stopPropagation(), m()) : (n(0, a = void 0), c = void 0));
|
|
2609
|
+
}, m = () => {
|
|
2610
|
+
if (h * p > 15) {
|
|
2611
|
+
const y = {
|
|
2610
2612
|
type: F.RECTANGLE,
|
|
2611
2613
|
geometry: {
|
|
2612
2614
|
bounds: {
|
|
2613
2615
|
minX: u,
|
|
2614
2616
|
minY: f,
|
|
2615
2617
|
maxX: u + h,
|
|
2616
|
-
maxY: f +
|
|
2618
|
+
maxY: f + p
|
|
2617
2619
|
},
|
|
2618
2620
|
x: u,
|
|
2619
2621
|
y: f,
|
|
2620
2622
|
w: h,
|
|
2621
|
-
h:
|
|
2623
|
+
h: p
|
|
2622
2624
|
}
|
|
2623
2625
|
};
|
|
2624
|
-
o("create",
|
|
2626
|
+
o("create", y);
|
|
2625
2627
|
}
|
|
2626
2628
|
n(0, a = void 0), c = void 0;
|
|
2627
2629
|
};
|
|
2628
|
-
return
|
|
2629
|
-
i("pointerdown",
|
|
2630
|
-
}), e.$$set = (
|
|
2631
|
-
"addEventListener" in
|
|
2632
|
-
}, [a, u, f, h,
|
|
2630
|
+
return Re(() => {
|
|
2631
|
+
i("pointerdown", g), i("pointermove", _), i("pointerup", A, !0);
|
|
2632
|
+
}), e.$$set = (y) => {
|
|
2633
|
+
"addEventListener" in y && n(5, i = y.addEventListener), "drawingMode" in y && n(6, s = y.drawingMode), "transform" in y && n(7, r = y.transform);
|
|
2634
|
+
}, [a, u, f, h, p, i, s, r];
|
|
2633
2635
|
}
|
|
2634
2636
|
class $o extends ne {
|
|
2635
2637
|
constructor(t) {
|
|
@@ -2667,7 +2669,7 @@ function Yt(e) {
|
|
|
2667
2669
|
e[16]);
|
|
2668
2670
|
},
|
|
2669
2671
|
m(l, a) {
|
|
2670
|
-
|
|
2672
|
+
O(l, t, a), O(l, o, a), r && r.m(l, a), O(l, s, a);
|
|
2671
2673
|
},
|
|
2672
2674
|
p(l, a) {
|
|
2673
2675
|
a & /*isClosable, points, cursor*/
|
|
@@ -2678,7 +2680,7 @@ function Yt(e) {
|
|
|
2678
2680
|
l[2] ? r ? r.p(l, a) : (r = Pt(l), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
|
|
2679
2681
|
},
|
|
2680
2682
|
d(l) {
|
|
2681
|
-
l && (
|
|
2683
|
+
l && (B(t), B(o), B(s)), r && r.d(l);
|
|
2682
2684
|
}
|
|
2683
2685
|
};
|
|
2684
2686
|
}
|
|
@@ -2703,7 +2705,7 @@ function Pt(e) {
|
|
|
2703
2705
|
);
|
|
2704
2706
|
},
|
|
2705
2707
|
m(i, s) {
|
|
2706
|
-
|
|
2708
|
+
O(i, t, s);
|
|
2707
2709
|
},
|
|
2708
2710
|
p(i, s) {
|
|
2709
2711
|
s & /*points, handleSize*/
|
|
@@ -2727,7 +2729,7 @@ function Pt(e) {
|
|
|
2727
2729
|
);
|
|
2728
2730
|
},
|
|
2729
2731
|
d(i) {
|
|
2730
|
-
i &&
|
|
2732
|
+
i && B(t);
|
|
2731
2733
|
}
|
|
2732
2734
|
};
|
|
2733
2735
|
}
|
|
@@ -2741,7 +2743,7 @@ function ei(e) {
|
|
|
2741
2743
|
t = X("g"), n && n.c(), d(t, "class", "a9s-annotation a9s-rubberband");
|
|
2742
2744
|
},
|
|
2743
2745
|
m(o, i) {
|
|
2744
|
-
|
|
2746
|
+
O(o, t, i), n && n.m(t, null);
|
|
2745
2747
|
},
|
|
2746
2748
|
p(o, [i]) {
|
|
2747
2749
|
/*cursor*/
|
|
@@ -2750,7 +2752,7 @@ function ei(e) {
|
|
|
2750
2752
|
i: j,
|
|
2751
2753
|
o: j,
|
|
2752
2754
|
d(o) {
|
|
2753
|
-
o &&
|
|
2755
|
+
o && B(t), n && n.d();
|
|
2754
2756
|
}
|
|
2755
2757
|
};
|
|
2756
2758
|
}
|
|
@@ -2758,37 +2760,37 @@ const ti = 20, ni = 1500;
|
|
|
2758
2760
|
function oi(e, t, n) {
|
|
2759
2761
|
let o;
|
|
2760
2762
|
const i = ke();
|
|
2761
|
-
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: l } = t, { viewportScale: a = 1 } = t, c, u = [], f, h,
|
|
2762
|
-
const
|
|
2763
|
-
const E =
|
|
2764
|
-
if (c = { timeStamp: I, offsetX:
|
|
2763
|
+
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: l } = t, { viewportScale: a = 1 } = t, c, u = [], f, h, p = !1;
|
|
2764
|
+
const g = (w) => {
|
|
2765
|
+
const E = w, { timeStamp: I, offsetX: U, offsetY: N } = E;
|
|
2766
|
+
if (c = { timeStamp: I, offsetX: U, offsetY: N }, r === "drag" && u.length === 0) {
|
|
2765
2767
|
const V = l.elementToImage(E.offsetX, E.offsetY);
|
|
2766
2768
|
u.push(V), n(1, f = V);
|
|
2767
2769
|
}
|
|
2768
|
-
},
|
|
2769
|
-
const E =
|
|
2770
|
+
}, _ = (w) => {
|
|
2771
|
+
const E = w;
|
|
2770
2772
|
if (h && clearTimeout(h), u.length > 0) {
|
|
2771
2773
|
if (n(1, f = l.elementToImage(E.offsetX, E.offsetY)), u.length > 2) {
|
|
2772
2774
|
const I = st(f, u[0]) * a;
|
|
2773
|
-
n(2,
|
|
2775
|
+
n(2, p = I < ti);
|
|
2774
2776
|
}
|
|
2775
2777
|
E.pointerType === "touch" && (h = setTimeout(
|
|
2776
2778
|
() => {
|
|
2777
|
-
|
|
2779
|
+
m();
|
|
2778
2780
|
},
|
|
2779
2781
|
ni
|
|
2780
2782
|
));
|
|
2781
2783
|
}
|
|
2782
|
-
},
|
|
2783
|
-
const E =
|
|
2784
|
+
}, A = (w) => {
|
|
2785
|
+
const E = w;
|
|
2784
2786
|
if (h && clearTimeout(h), r === "click") {
|
|
2785
|
-
const I = E.timeStamp - c.timeStamp,
|
|
2786
|
-
if (I > 300 ||
|
|
2787
|
-
if (
|
|
2788
|
-
|
|
2787
|
+
const I = E.timeStamp - c.timeStamp, U = st([c.offsetX, c.offsetY], [E.offsetX, E.offsetY]);
|
|
2788
|
+
if (I > 300 || U > 15) return;
|
|
2789
|
+
if (p)
|
|
2790
|
+
y();
|
|
2789
2791
|
else if (u.length === 0) {
|
|
2790
|
-
const
|
|
2791
|
-
u.push(
|
|
2792
|
+
const N = l.elementToImage(E.offsetX, E.offsetY);
|
|
2793
|
+
u.push(N), n(1, f = N);
|
|
2792
2794
|
} else
|
|
2793
2795
|
u.push(f);
|
|
2794
2796
|
} else {
|
|
@@ -2796,36 +2798,36 @@ function oi(e, t, n) {
|
|
|
2796
2798
|
n(0, u = []), n(1, f = void 0);
|
|
2797
2799
|
return;
|
|
2798
2800
|
}
|
|
2799
|
-
E.stopImmediatePropagation(),
|
|
2801
|
+
E.stopImmediatePropagation(), p ? y() : u.push(f);
|
|
2800
2802
|
}
|
|
2801
|
-
},
|
|
2803
|
+
}, m = () => {
|
|
2802
2804
|
if (!f) return;
|
|
2803
|
-
const
|
|
2805
|
+
const w = [...u, f], E = {
|
|
2804
2806
|
type: F.POLYGON,
|
|
2805
|
-
geometry: { bounds: Ke(
|
|
2807
|
+
geometry: { bounds: Ke(w), points: w }
|
|
2806
2808
|
};
|
|
2807
2809
|
ht(E) > 4 && (n(0, u = []), n(1, f = void 0), i("create", E));
|
|
2808
|
-
},
|
|
2809
|
-
const
|
|
2810
|
+
}, y = () => {
|
|
2811
|
+
const w = {
|
|
2810
2812
|
type: F.POLYGON,
|
|
2811
2813
|
geometry: {
|
|
2812
2814
|
bounds: Ke(u),
|
|
2813
2815
|
points: [...u]
|
|
2814
2816
|
}
|
|
2815
2817
|
};
|
|
2816
|
-
n(0, u = []), n(1, f = void 0), i("create",
|
|
2818
|
+
n(0, u = []), n(1, f = void 0), i("create", w);
|
|
2817
2819
|
};
|
|
2818
|
-
return
|
|
2819
|
-
s("pointerdown",
|
|
2820
|
-
}), e.$$set = (
|
|
2821
|
-
"addEventListener" in
|
|
2820
|
+
return Re(() => {
|
|
2821
|
+
s("pointerdown", g, !0), s("pointermove", _), s("pointerup", A, !0), s("dblclick", m, !0);
|
|
2822
|
+
}), e.$$set = (w) => {
|
|
2823
|
+
"addEventListener" in w && n(4, s = w.addEventListener), "drawingMode" in w && n(5, r = w.drawingMode), "transform" in w && n(6, l = w.transform), "viewportScale" in w && n(7, a = w.viewportScale);
|
|
2822
2824
|
}, e.$$.update = () => {
|
|
2823
2825
|
e.$$.dirty & /*viewportScale*/
|
|
2824
2826
|
128 && n(3, o = 10 / a);
|
|
2825
2827
|
}, [
|
|
2826
2828
|
u,
|
|
2827
2829
|
f,
|
|
2828
|
-
|
|
2830
|
+
p,
|
|
2829
2831
|
o,
|
|
2830
2832
|
s,
|
|
2831
2833
|
r,
|
|
@@ -2901,7 +2903,7 @@ function ri(e) {
|
|
|
2901
2903
|
e[0].id);
|
|
2902
2904
|
},
|
|
2903
2905
|
m(r, l) {
|
|
2904
|
-
|
|
2906
|
+
O(r, t, l), he(t, n), he(t, i);
|
|
2905
2907
|
},
|
|
2906
2908
|
p(r, [l]) {
|
|
2907
2909
|
l & /*computedStyle*/
|
|
@@ -2919,7 +2921,7 @@ function ri(e) {
|
|
|
2919
2921
|
i: j,
|
|
2920
2922
|
o: j,
|
|
2921
2923
|
d(r) {
|
|
2922
|
-
r &&
|
|
2924
|
+
r && B(t);
|
|
2923
2925
|
}
|
|
2924
2926
|
};
|
|
2925
2927
|
}
|
|
@@ -2962,7 +2964,7 @@ function ci(e) {
|
|
|
2962
2964
|
e[0].id);
|
|
2963
2965
|
},
|
|
2964
2966
|
m(r, l) {
|
|
2965
|
-
|
|
2967
|
+
O(r, t, l), he(t, n), he(t, i);
|
|
2966
2968
|
},
|
|
2967
2969
|
p(r, [l]) {
|
|
2968
2970
|
l & /*computedStyle*/
|
|
@@ -2980,7 +2982,7 @@ function ci(e) {
|
|
|
2980
2982
|
i: j,
|
|
2981
2983
|
o: j,
|
|
2982
2984
|
d(r) {
|
|
2983
|
-
r &&
|
|
2985
|
+
r && B(t);
|
|
2984
2986
|
}
|
|
2985
2987
|
};
|
|
2986
2988
|
}
|
|
@@ -3054,7 +3056,7 @@ function gi(e) {
|
|
|
3054
3056
|
e[0].id);
|
|
3055
3057
|
},
|
|
3056
3058
|
m(r, l) {
|
|
3057
|
-
|
|
3059
|
+
O(r, t, l), he(t, n), he(t, i);
|
|
3058
3060
|
},
|
|
3059
3061
|
p(r, [l]) {
|
|
3060
3062
|
l & /*computedStyle*/
|
|
@@ -3120,7 +3122,7 @@ function gi(e) {
|
|
|
3120
3122
|
i: j,
|
|
3121
3123
|
o: j,
|
|
3122
3124
|
d(r) {
|
|
3123
|
-
r &&
|
|
3125
|
+
r && B(t);
|
|
3124
3126
|
}
|
|
3125
3127
|
};
|
|
3126
3128
|
}
|
|
@@ -3184,22 +3186,22 @@ function lt(e) {
|
|
|
3184
3186
|
);
|
|
3185
3187
|
return t[44] = n, t;
|
|
3186
3188
|
}
|
|
3187
|
-
function
|
|
3189
|
+
function Ut(e) {
|
|
3188
3190
|
let t = (
|
|
3189
3191
|
/*annotation*/
|
|
3190
3192
|
e[41].id
|
|
3191
|
-
), n, o, i =
|
|
3193
|
+
), n, o, i = Rt(e);
|
|
3192
3194
|
return {
|
|
3193
3195
|
c() {
|
|
3194
3196
|
i.c(), n = le();
|
|
3195
3197
|
},
|
|
3196
3198
|
m(s, r) {
|
|
3197
|
-
i.m(s, r),
|
|
3199
|
+
i.m(s, r), O(s, n, r), o = !0;
|
|
3198
3200
|
},
|
|
3199
3201
|
p(s, r) {
|
|
3200
3202
|
r[0] & /*$store*/
|
|
3201
3203
|
32768 && Q(t, t = /*annotation*/
|
|
3202
|
-
s[41].id) ? (se(), C(i, 1, 1, j), re(), i =
|
|
3204
|
+
s[41].id) ? (se(), C(i, 1, 1, j), re(), i = Rt(s), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
3203
3205
|
},
|
|
3204
3206
|
i(s) {
|
|
3205
3207
|
o || (Y(i), o = !0);
|
|
@@ -3208,7 +3210,7 @@ function Rt(e) {
|
|
|
3208
3210
|
C(i), o = !1;
|
|
3209
3211
|
},
|
|
3210
3212
|
d(s) {
|
|
3211
|
-
s &&
|
|
3213
|
+
s && B(n), i.d(s);
|
|
3212
3214
|
}
|
|
3213
3215
|
};
|
|
3214
3216
|
}
|
|
@@ -3349,7 +3351,7 @@ function Ai(e) {
|
|
|
3349
3351
|
}
|
|
3350
3352
|
};
|
|
3351
3353
|
}
|
|
3352
|
-
function
|
|
3354
|
+
function Rt(e) {
|
|
3353
3355
|
let t, n, o, i;
|
|
3354
3356
|
const s = [Ai, Ei, bi], r = [];
|
|
3355
3357
|
function l(a, c) {
|
|
@@ -3370,7 +3372,7 @@ function Nt(e) {
|
|
|
3370
3372
|
n && n.c(), o = le();
|
|
3371
3373
|
},
|
|
3372
3374
|
m(a, c) {
|
|
3373
|
-
~t && r[t].m(a, c),
|
|
3375
|
+
~t && r[t].m(a, c), O(a, o, c), i = !0;
|
|
3374
3376
|
},
|
|
3375
3377
|
p(a, c) {
|
|
3376
3378
|
let u = t;
|
|
@@ -3385,11 +3387,11 @@ function Nt(e) {
|
|
|
3385
3387
|
C(n), i = !1;
|
|
3386
3388
|
},
|
|
3387
3389
|
d(a) {
|
|
3388
|
-
a &&
|
|
3390
|
+
a && B(o), ~t && r[t].d(a);
|
|
3389
3391
|
}
|
|
3390
3392
|
};
|
|
3391
3393
|
}
|
|
3392
|
-
function
|
|
3394
|
+
function Nt(e) {
|
|
3393
3395
|
let t = Je(
|
|
3394
3396
|
/*annotation*/
|
|
3395
3397
|
e[41]
|
|
@@ -3397,13 +3399,13 @@ function Ut(e) {
|
|
|
3397
3399
|
e[8](
|
|
3398
3400
|
/*annotation*/
|
|
3399
3401
|
e[41]
|
|
3400
|
-
), n, o, i = t &&
|
|
3402
|
+
), n, o, i = t && Ut(lt(e));
|
|
3401
3403
|
return {
|
|
3402
3404
|
c() {
|
|
3403
3405
|
i && i.c(), n = le();
|
|
3404
3406
|
},
|
|
3405
3407
|
m(s, r) {
|
|
3406
|
-
i && i.m(s, r),
|
|
3408
|
+
i && i.m(s, r), O(s, n, r), o = !0;
|
|
3407
3409
|
},
|
|
3408
3410
|
p(s, r) {
|
|
3409
3411
|
r[0] & /*$store, isEditable*/
|
|
@@ -3415,7 +3417,7 @@ function Ut(e) {
|
|
|
3415
3417
|
/*annotation*/
|
|
3416
3418
|
s[41]
|
|
3417
3419
|
)), t ? i ? (i.p(lt(s), r), r[0] & /*$store, isEditable*/
|
|
3418
|
-
33024 && Y(i, 1)) : (i =
|
|
3420
|
+
33024 && Y(i, 1)) : (i = Ut(lt(s)), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i && (se(), C(i, 1, 1, () => {
|
|
3419
3421
|
i = null;
|
|
3420
3422
|
}), re());
|
|
3421
3423
|
},
|
|
@@ -3426,7 +3428,7 @@ function Ut(e) {
|
|
|
3426
3428
|
C(i), o = !1;
|
|
3427
3429
|
},
|
|
3428
3430
|
d(s) {
|
|
3429
|
-
s &&
|
|
3431
|
+
s && B(n), i && i.d(s);
|
|
3430
3432
|
}
|
|
3431
3433
|
};
|
|
3432
3434
|
}
|
|
@@ -3448,7 +3450,7 @@ function Vt(e) {
|
|
|
3448
3450
|
n && n.c(), o = le();
|
|
3449
3451
|
},
|
|
3450
3452
|
m(a, c) {
|
|
3451
|
-
~t && r[t].m(a, c),
|
|
3453
|
+
~t && r[t].m(a, c), O(a, o, c), i = !0;
|
|
3452
3454
|
},
|
|
3453
3455
|
p(a, c) {
|
|
3454
3456
|
let u = t;
|
|
@@ -3463,7 +3465,7 @@ function Vt(e) {
|
|
|
3463
3465
|
C(n), i = !1;
|
|
3464
3466
|
},
|
|
3465
3467
|
d(a) {
|
|
3466
|
-
a &&
|
|
3468
|
+
a && B(o), ~t && r[t].d(a);
|
|
3467
3469
|
}
|
|
3468
3470
|
};
|
|
3469
3471
|
}
|
|
@@ -3477,7 +3479,7 @@ function Si(e) {
|
|
|
3477
3479
|
i.c(), n = le();
|
|
3478
3480
|
},
|
|
3479
3481
|
m(s, r) {
|
|
3480
|
-
i.m(s, r),
|
|
3482
|
+
i.m(s, r), O(s, n, r), o = !0;
|
|
3481
3483
|
},
|
|
3482
3484
|
p(s, r) {
|
|
3483
3485
|
r[0] & /*toolName*/
|
|
@@ -3491,7 +3493,7 @@ function Si(e) {
|
|
|
3491
3493
|
C(i), o = !1;
|
|
3492
3494
|
},
|
|
3493
3495
|
d(s) {
|
|
3494
|
-
s &&
|
|
3496
|
+
s && B(n), i.d(s);
|
|
3495
3497
|
}
|
|
3496
3498
|
};
|
|
3497
3499
|
}
|
|
@@ -3514,7 +3516,7 @@ function Ti(e) {
|
|
|
3514
3516
|
m(r, l) {
|
|
3515
3517
|
for (let a = 0; a < i.length; a += 1)
|
|
3516
3518
|
i[a] && i[a].m(r, l);
|
|
3517
|
-
|
|
3519
|
+
O(r, t, l), n = !0;
|
|
3518
3520
|
},
|
|
3519
3521
|
p(r, l) {
|
|
3520
3522
|
if (l[0] & /*editableAnnotations, drawingEl, getEditor, style, transform, $scale, onChangeSelected*/
|
|
@@ -3547,7 +3549,7 @@ function Ti(e) {
|
|
|
3547
3549
|
n = !1;
|
|
3548
3550
|
},
|
|
3549
3551
|
d(r) {
|
|
3550
|
-
r &&
|
|
3552
|
+
r && B(t), gt(i, r);
|
|
3551
3553
|
}
|
|
3552
3554
|
};
|
|
3553
3555
|
}
|
|
@@ -3622,7 +3624,7 @@ function jt(e) {
|
|
|
3622
3624
|
i.c(), n = le();
|
|
3623
3625
|
},
|
|
3624
3626
|
m(s, r) {
|
|
3625
|
-
i.m(s, r),
|
|
3627
|
+
i.m(s, r), O(s, n, r), o = !0;
|
|
3626
3628
|
},
|
|
3627
3629
|
p(s, r) {
|
|
3628
3630
|
r[0] & /*editableAnnotations*/
|
|
@@ -3636,7 +3638,7 @@ function jt(e) {
|
|
|
3636
3638
|
C(i), o = !1;
|
|
3637
3639
|
},
|
|
3638
3640
|
d(s) {
|
|
3639
|
-
s &&
|
|
3641
|
+
s && B(n), i.d(s);
|
|
3640
3642
|
}
|
|
3641
3643
|
};
|
|
3642
3644
|
}
|
|
@@ -3731,7 +3733,7 @@ function Ht(e) {
|
|
|
3731
3733
|
o && o.c(), t = le();
|
|
3732
3734
|
},
|
|
3733
3735
|
m(i, s) {
|
|
3734
|
-
o && o.m(i, s),
|
|
3736
|
+
o && o.m(i, s), O(i, t, s), n = !0;
|
|
3735
3737
|
},
|
|
3736
3738
|
p(i, s) {
|
|
3737
3739
|
/*editor*/
|
|
@@ -3747,11 +3749,11 @@ function Ht(e) {
|
|
|
3747
3749
|
C(o), n = !1;
|
|
3748
3750
|
},
|
|
3749
3751
|
d(i) {
|
|
3750
|
-
i &&
|
|
3752
|
+
i && B(t), o && o.d(i);
|
|
3751
3753
|
}
|
|
3752
3754
|
};
|
|
3753
3755
|
}
|
|
3754
|
-
function
|
|
3756
|
+
function Mi(e) {
|
|
3755
3757
|
let t, n, o, i, s, r, l = Le(
|
|
3756
3758
|
/*$store*/
|
|
3757
3759
|
e[15].filter(
|
|
@@ -3760,7 +3762,7 @@ function vi(e) {
|
|
|
3760
3762
|
)
|
|
3761
3763
|
), a = [];
|
|
3762
3764
|
for (let f = 0; f < l.length; f += 1)
|
|
3763
|
-
a[f] =
|
|
3765
|
+
a[f] = Nt(Xt(e, l, f));
|
|
3764
3766
|
const c = (f) => C(a[f], 1, 1, () => {
|
|
3765
3767
|
a[f] = null;
|
|
3766
3768
|
});
|
|
@@ -3787,9 +3789,9 @@ function vi(e) {
|
|
|
3787
3789
|
);
|
|
3788
3790
|
},
|
|
3789
3791
|
m(f, h) {
|
|
3790
|
-
|
|
3791
|
-
for (let
|
|
3792
|
-
a[
|
|
3792
|
+
O(f, t, h), he(t, n);
|
|
3793
|
+
for (let p = 0; p < a.length; p += 1)
|
|
3794
|
+
a[p] && a[p].m(n, null);
|
|
3793
3795
|
he(t, o), u && u.m(o, null), e[33](o), e[34](t), i = !0, s || (r = [
|
|
3794
3796
|
H(t, "pointerup", function() {
|
|
3795
3797
|
W(
|
|
@@ -3821,13 +3823,13 @@ function vi(e) {
|
|
|
3821
3823
|
e[32]
|
|
3822
3824
|
)
|
|
3823
3825
|
);
|
|
3824
|
-
let
|
|
3825
|
-
for (
|
|
3826
|
-
const
|
|
3827
|
-
a[
|
|
3826
|
+
let p;
|
|
3827
|
+
for (p = 0; p < l.length; p += 1) {
|
|
3828
|
+
const g = Xt(e, l, p);
|
|
3829
|
+
a[p] ? (a[p].p(g, h), Y(a[p], 1)) : (a[p] = Nt(g), a[p].c(), Y(a[p], 1), a[p].m(n, null));
|
|
3828
3830
|
}
|
|
3829
|
-
for (se(),
|
|
3830
|
-
c(
|
|
3831
|
+
for (se(), p = l.length; p < a.length; p += 1)
|
|
3832
|
+
c(p);
|
|
3831
3833
|
re();
|
|
3832
3834
|
}
|
|
3833
3835
|
/*drawingEl*/
|
|
@@ -3864,26 +3866,26 @@ function vi(e) {
|
|
|
3864
3866
|
C(u), i = !1;
|
|
3865
3867
|
},
|
|
3866
3868
|
d(f) {
|
|
3867
|
-
f &&
|
|
3869
|
+
f && B(t), gt(a, f), u && u.d(), e[33](null), e[34](null), s = !1, ge(r);
|
|
3868
3870
|
}
|
|
3869
3871
|
};
|
|
3870
3872
|
}
|
|
3871
|
-
function
|
|
3872
|
-
let o, i, s, r, l, a, c, u, f, h,
|
|
3873
|
-
e.$$.on_destroy.push(() =>
|
|
3874
|
-
let { drawingEnabled:
|
|
3875
|
-
const V = () => I, Z = () =>
|
|
3876
|
-
let
|
|
3877
|
-
|
|
3878
|
-
const { hover:
|
|
3879
|
-
xe(e,
|
|
3873
|
+
function vi(e, t, n) {
|
|
3874
|
+
let o, i, s, r, l, a, c, u, f, h, p, g = j, _ = () => (g(), g = Jt(b, (k) => n(16, p = k)), b);
|
|
3875
|
+
e.$$.on_destroy.push(() => g());
|
|
3876
|
+
let { drawingEnabled: A } = t, { image: m } = t, { preferredDrawingMode: y } = t, { state: w } = t, { style: E = void 0 } = t, { toolName: I = cn()[0] } = t, { user: U } = t, { visible: N = !0 } = t;
|
|
3877
|
+
const V = () => I, Z = () => A;
|
|
3878
|
+
let S, T, b;
|
|
3879
|
+
Re(() => _(n(6, b = Do(m, T))));
|
|
3880
|
+
const { hover: M, selection: P, store: D } = w;
|
|
3881
|
+
xe(e, M, (k) => n(14, u = k)), xe(e, P, (k) => n(31, f = k)), xe(e, D, (k) => n(15, h = k));
|
|
3880
3882
|
let z, oe;
|
|
3881
3883
|
const ae = (k) => {
|
|
3882
3884
|
z && D.unobserve(z);
|
|
3883
3885
|
const J = k.filter(({ editable: L }) => L).map(({ id: L }) => L);
|
|
3884
3886
|
J.length > 0 ? (n(7, oe = J.map((L) => D.getAnnotation(L)).filter((L) => L && Je(L))), z = (L) => {
|
|
3885
|
-
const { updated:
|
|
3886
|
-
n(7, oe =
|
|
3887
|
+
const { updated: v } = L.changes;
|
|
3888
|
+
n(7, oe = v == null ? void 0 : v.map((de) => de.newValue));
|
|
3887
3889
|
}, D.observe(z, { annotations: J })) : n(7, oe = void 0);
|
|
3888
3890
|
}, Ie = (k) => {
|
|
3889
3891
|
const J = tn(), L = {
|
|
@@ -3892,52 +3894,52 @@ function Mi(e, t, n) {
|
|
|
3892
3894
|
target: {
|
|
3893
3895
|
annotation: J,
|
|
3894
3896
|
selector: k.detail,
|
|
3895
|
-
creator:
|
|
3897
|
+
creator: U,
|
|
3896
3898
|
created: /* @__PURE__ */ new Date()
|
|
3897
3899
|
}
|
|
3898
3900
|
};
|
|
3899
3901
|
D.addAnnotation(L), P.setSelected(L.id);
|
|
3900
3902
|
}, ce = (k) => (J) => {
|
|
3901
3903
|
var _e;
|
|
3902
|
-
const { target: L } = k,
|
|
3904
|
+
const { target: L } = k, v = 10 * 60 * 1e3, de = ((_e = L.creator) == null ? void 0 : _e.id) !== U.id || !L.created || (/* @__PURE__ */ new Date()).getTime() - L.created.getTime() > v;
|
|
3903
3905
|
D.updateTarget({
|
|
3904
3906
|
...L,
|
|
3905
3907
|
selector: J.detail,
|
|
3906
3908
|
created: de ? L.created : /* @__PURE__ */ new Date(),
|
|
3907
3909
|
updated: de ? /* @__PURE__ */ new Date() : void 0,
|
|
3908
|
-
updatedBy: de ?
|
|
3910
|
+
updatedBy: de ? U : void 0
|
|
3909
3911
|
});
|
|
3910
|
-
},
|
|
3911
|
-
const { x: J, y: L } = un(k,
|
|
3912
|
-
|
|
3913
|
-
}, fe = (k) => jo(k),
|
|
3912
|
+
}, Be = (k) => {
|
|
3913
|
+
const { x: J, y: L } = un(k, T), v = D.getAt(J, L);
|
|
3914
|
+
v ? u !== v.id && M.set(v.id) : M.set(void 0);
|
|
3915
|
+
}, fe = (k) => jo(k), Oe = (k) => Je(k);
|
|
3914
3916
|
function ue(k) {
|
|
3915
3917
|
qe[k ? "unshift" : "push"](() => {
|
|
3916
|
-
|
|
3918
|
+
S = k, n(5, S);
|
|
3917
3919
|
});
|
|
3918
3920
|
}
|
|
3919
|
-
function
|
|
3921
|
+
function R(k) {
|
|
3920
3922
|
qe[k ? "unshift" : "push"](() => {
|
|
3921
|
-
|
|
3923
|
+
T = k, n(4, T);
|
|
3922
3924
|
});
|
|
3923
3925
|
}
|
|
3924
3926
|
return e.$$set = (k) => {
|
|
3925
|
-
"drawingEnabled" in k && n(0,
|
|
3927
|
+
"drawingEnabled" in k && n(0, A = k.drawingEnabled), "image" in k && n(24, m = k.image), "preferredDrawingMode" in k && n(25, y = k.preferredDrawingMode), "state" in k && n(26, w = k.state), "style" in k && n(1, E = k.style), "toolName" in k && n(2, I = k.toolName), "user" in k && n(27, U = k.user), "visible" in k && n(3, N = k.visible);
|
|
3926
3928
|
}, e.$$.update = () => {
|
|
3927
3929
|
e.$$.dirty[0] & /*toolName*/
|
|
3928
3930
|
4 && n(13, { tool: o, opts: i } = fn(I) || { tool: void 0, opts: void 0 }, o, (n(30, i), n(2, I))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
|
|
3929
|
-
1107296256 && n(12, s = (i == null ? void 0 : i.drawingMode) ||
|
|
3930
|
-
16 && n(11, r = yi(
|
|
3931
|
-
16 && n(10, { onPointerDown: l, onPointerUp: a } = wi(
|
|
3931
|
+
1107296256 && n(12, s = (i == null ? void 0 : i.drawingMode) || y), e.$$.dirty[0] & /*svgEl*/
|
|
3932
|
+
16 && n(11, r = yi(T)), e.$$.dirty[0] & /*svgEl*/
|
|
3933
|
+
16 && n(10, { onPointerDown: l, onPointerUp: a } = wi(T, D), l, (n(9, a), n(4, T))), e.$$.dirty[1] & /*$selection*/
|
|
3932
3934
|
1 && n(8, c = (k) => f.selected.find((J) => J.id === k.id && J.editable)), e.$$.dirty[1] & /*$selection*/
|
|
3933
3935
|
1 && ae(f.selected);
|
|
3934
3936
|
}, [
|
|
3935
|
-
|
|
3937
|
+
A,
|
|
3936
3938
|
E,
|
|
3937
3939
|
I,
|
|
3938
|
-
|
|
3940
|
+
N,
|
|
3941
|
+
T,
|
|
3939
3942
|
S,
|
|
3940
|
-
A,
|
|
3941
3943
|
b,
|
|
3942
3944
|
oe,
|
|
3943
3945
|
c,
|
|
@@ -3948,25 +3950,25 @@ function Mi(e, t, n) {
|
|
|
3948
3950
|
o,
|
|
3949
3951
|
u,
|
|
3950
3952
|
h,
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
+
p,
|
|
3954
|
+
M,
|
|
3953
3955
|
P,
|
|
3954
3956
|
D,
|
|
3955
3957
|
Ie,
|
|
3956
3958
|
ce,
|
|
3957
|
-
|
|
3959
|
+
Be,
|
|
3958
3960
|
fe,
|
|
3961
|
+
m,
|
|
3959
3962
|
y,
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
R,
|
|
3963
|
+
w,
|
|
3964
|
+
U,
|
|
3963
3965
|
V,
|
|
3964
3966
|
Z,
|
|
3965
3967
|
i,
|
|
3966
3968
|
f,
|
|
3967
|
-
|
|
3969
|
+
Oe,
|
|
3968
3970
|
ue,
|
|
3969
|
-
|
|
3971
|
+
R
|
|
3970
3972
|
];
|
|
3971
3973
|
}
|
|
3972
3974
|
class Li extends ne {
|
|
@@ -3974,8 +3976,8 @@ class Li extends ne {
|
|
|
3974
3976
|
super(), te(
|
|
3975
3977
|
this,
|
|
3976
3978
|
t,
|
|
3977
|
-
Mi,
|
|
3978
3979
|
vi,
|
|
3980
|
+
Mi,
|
|
3979
3981
|
Q,
|
|
3980
3982
|
{
|
|
3981
3983
|
drawingEnabled: 0,
|
|
@@ -4003,8 +4005,8 @@ class Li extends ne {
|
|
|
4003
4005
|
function dn(e, t, n = 0, o = e.length - 1, i = ki) {
|
|
4004
4006
|
for (; o > n; ) {
|
|
4005
4007
|
if (o - n > 600) {
|
|
4006
|
-
const a = o - n + 1, c = t - n + 1, u = Math.log(a), f = 0.5 * Math.exp(2 * u / 3), h = 0.5 * Math.sqrt(u * f * (a - f) / a) * (c - a / 2 < 0 ? -1 : 1),
|
|
4007
|
-
dn(e, t,
|
|
4008
|
+
const a = o - n + 1, c = t - n + 1, u = Math.log(a), f = 0.5 * Math.exp(2 * u / 3), h = 0.5 * Math.sqrt(u * f * (a - f) / a) * (c - a / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(t - c * f / a + h)), g = Math.min(o, Math.floor(t + (a - c) * f / a + h));
|
|
4009
|
+
dn(e, t, p, g, i);
|
|
4008
4010
|
}
|
|
4009
4011
|
const s = e[t];
|
|
4010
4012
|
let r = n, l = o;
|
|
@@ -4084,7 +4086,7 @@ class Ii {
|
|
|
4084
4086
|
return t && this._insert(t, this.data.height - 1), this;
|
|
4085
4087
|
}
|
|
4086
4088
|
clear() {
|
|
4087
|
-
return this.data =
|
|
4089
|
+
return this.data = Me([]), this;
|
|
4088
4090
|
}
|
|
4089
4091
|
remove(t, n) {
|
|
4090
4092
|
if (!t) return this;
|
|
@@ -4093,7 +4095,7 @@ class Ii {
|
|
|
4093
4095
|
let l, a, c;
|
|
4094
4096
|
for (; o || s.length; ) {
|
|
4095
4097
|
if (o || (o = s.pop(), a = s[s.length - 1], l = r.pop(), c = !0), o.leaf) {
|
|
4096
|
-
const u =
|
|
4098
|
+
const u = Bi(t, o.children, n);
|
|
4097
4099
|
if (u !== -1)
|
|
4098
4100
|
return o.children.splice(u, 1), s.push(o), this._condense(s), this;
|
|
4099
4101
|
}
|
|
@@ -4126,16 +4128,16 @@ class Ii {
|
|
|
4126
4128
|
const s = o - n + 1;
|
|
4127
4129
|
let r = this._maxEntries, l;
|
|
4128
4130
|
if (s <= r)
|
|
4129
|
-
return l =
|
|
4130
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), l =
|
|
4131
|
+
return l = Me(t.slice(n, o + 1)), Se(l, this.toBBox), l;
|
|
4132
|
+
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), l = Me([]), l.leaf = !1, l.height = i;
|
|
4131
4133
|
const a = Math.ceil(s / r), c = a * Math.ceil(Math.sqrt(r));
|
|
4132
4134
|
Ft(t, n, o, c, this.compareMinX);
|
|
4133
4135
|
for (let u = n; u <= o; u += c) {
|
|
4134
4136
|
const f = Math.min(u + c - 1, o);
|
|
4135
4137
|
Ft(t, u, f, a, this.compareMinY);
|
|
4136
4138
|
for (let h = u; h <= f; h += a) {
|
|
4137
|
-
const
|
|
4138
|
-
l.children.push(this._build(t, h,
|
|
4139
|
+
const p = Math.min(h + a - 1, f);
|
|
4140
|
+
l.children.push(this._build(t, h, p, i - 1));
|
|
4139
4141
|
}
|
|
4140
4142
|
}
|
|
4141
4143
|
return Se(l, this.toBBox), l;
|
|
@@ -4161,11 +4163,11 @@ class Ii {
|
|
|
4161
4163
|
_split(t, n) {
|
|
4162
4164
|
const o = t[n], i = o.children.length, s = this._minEntries;
|
|
4163
4165
|
this._chooseSplitAxis(o, s, i);
|
|
4164
|
-
const r = this._chooseSplitIndex(o, s, i), l =
|
|
4166
|
+
const r = this._chooseSplitIndex(o, s, i), l = Me(o.children.splice(r, o.children.length - r));
|
|
4165
4167
|
l.height = o.height, l.leaf = o.leaf, Se(o, this.toBBox), Se(l, this.toBBox), n ? t[n - 1].children.push(l) : this._splitRoot(o, l);
|
|
4166
4168
|
}
|
|
4167
4169
|
_splitRoot(t, n) {
|
|
4168
|
-
this.data =
|
|
4170
|
+
this.data = Me([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, Se(this.data, this.toBBox);
|
|
4169
4171
|
}
|
|
4170
4172
|
_chooseSplitIndex(t, n, o) {
|
|
4171
4173
|
let i, s = 1 / 0, r = 1 / 0;
|
|
@@ -4177,7 +4179,7 @@ class Ii {
|
|
|
4177
4179
|
}
|
|
4178
4180
|
// sorts node children by the best axis for split
|
|
4179
4181
|
_chooseSplitAxis(t, n, o) {
|
|
4180
|
-
const i = t.leaf ? this.compareMinX :
|
|
4182
|
+
const i = t.leaf ? this.compareMinX : Oi, s = t.leaf ? this.compareMinY : Di, r = this._allDistMargin(t, n, o, i), l = this._allDistMargin(t, n, o, s);
|
|
4181
4183
|
r < l && t.children.sort(i);
|
|
4182
4184
|
}
|
|
4183
4185
|
// total margin of all possible split distributions where each node is at least m full
|
|
@@ -4204,7 +4206,7 @@ class Ii {
|
|
|
4204
4206
|
t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : Se(t[n], this.toBBox);
|
|
4205
4207
|
}
|
|
4206
4208
|
}
|
|
4207
|
-
function
|
|
4209
|
+
function Bi(e, t, n) {
|
|
4208
4210
|
if (!n) return t.indexOf(e);
|
|
4209
4211
|
for (let o = 0; o < t.length; o++)
|
|
4210
4212
|
if (n(e, t[o])) return o;
|
|
@@ -4214,7 +4216,7 @@ function Se(e, t) {
|
|
|
4214
4216
|
Pe(e, 0, e.children.length, t, e);
|
|
4215
4217
|
}
|
|
4216
4218
|
function Pe(e, t, n, o, i) {
|
|
4217
|
-
i || (i =
|
|
4219
|
+
i || (i = Me(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
4218
4220
|
for (let s = t; s < n; s++) {
|
|
4219
4221
|
const r = e.children[s];
|
|
4220
4222
|
Ce(i, e.leaf ? o(r) : r);
|
|
@@ -4224,7 +4226,7 @@ function Pe(e, t, n, o, i) {
|
|
|
4224
4226
|
function Ce(e, t) {
|
|
4225
4227
|
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;
|
|
4226
4228
|
}
|
|
4227
|
-
function
|
|
4229
|
+
function Oi(e, t) {
|
|
4228
4230
|
return e.minX - t.minX;
|
|
4229
4231
|
}
|
|
4230
4232
|
function Di(e, t) {
|
|
@@ -4249,7 +4251,7 @@ function ct(e, t) {
|
|
|
4249
4251
|
function ze(e, t) {
|
|
4250
4252
|
return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
|
|
4251
4253
|
}
|
|
4252
|
-
function
|
|
4254
|
+
function Me(e) {
|
|
4253
4255
|
return {
|
|
4254
4256
|
children: e,
|
|
4255
4257
|
height: 1,
|
|
@@ -4273,8 +4275,8 @@ const Ci = () => {
|
|
|
4273
4275
|
e.clear(), t.clear();
|
|
4274
4276
|
}, i = (f) => {
|
|
4275
4277
|
if (!Fe(f)) return;
|
|
4276
|
-
const { minX: h, minY:
|
|
4277
|
-
e.insert(
|
|
4278
|
+
const { minX: h, minY: p, maxX: g, maxY: _ } = f.selector.geometry.bounds, A = { minX: h, minY: p, maxX: g, maxY: _, target: f };
|
|
4279
|
+
e.insert(A), t.set(f.annotation, A);
|
|
4278
4280
|
}, s = (f) => {
|
|
4279
4281
|
if (!Fe(f)) return;
|
|
4280
4282
|
const h = t.get(f.annotation);
|
|
@@ -4284,33 +4286,33 @@ const Ci = () => {
|
|
|
4284
4286
|
all: n,
|
|
4285
4287
|
clear: o,
|
|
4286
4288
|
getAt: (f, h) => {
|
|
4287
|
-
const
|
|
4289
|
+
const g = e.search({
|
|
4288
4290
|
minX: f,
|
|
4289
4291
|
minY: h,
|
|
4290
4292
|
maxX: f,
|
|
4291
4293
|
maxY: h
|
|
4292
|
-
}).map((
|
|
4293
|
-
if (
|
|
4294
|
-
return
|
|
4294
|
+
}).map((_) => _.target).filter((_) => _.selector.type === F.RECTANGLE || kn(_.selector, f, h));
|
|
4295
|
+
if (g.length > 0)
|
|
4296
|
+
return g.sort((_, A) => ht(_.selector) - ht(A.selector)), g[0];
|
|
4295
4297
|
},
|
|
4296
|
-
getIntersecting: (f, h,
|
|
4298
|
+
getIntersecting: (f, h, p, g) => e.search({
|
|
4297
4299
|
minX: f,
|
|
4298
4300
|
minY: h,
|
|
4299
|
-
maxX: f +
|
|
4300
|
-
maxY: h +
|
|
4301
|
-
}).map((
|
|
4301
|
+
maxX: f + p,
|
|
4302
|
+
maxY: h + g
|
|
4303
|
+
}).map((_) => _.target),
|
|
4302
4304
|
insert: i,
|
|
4303
4305
|
remove: s,
|
|
4304
4306
|
set: (f, h = !0) => {
|
|
4305
4307
|
h && o();
|
|
4306
|
-
const
|
|
4307
|
-
if (Fe(
|
|
4308
|
-
const { minX:
|
|
4309
|
-
return [...
|
|
4308
|
+
const p = f.reduce((g, _) => {
|
|
4309
|
+
if (Fe(_)) {
|
|
4310
|
+
const { minX: A, minY: m, maxX: y, maxY: w } = _.selector.geometry.bounds;
|
|
4311
|
+
return [...g, { minX: A, minY: m, maxX: y, maxY: w, target: _ }];
|
|
4310
4312
|
} else
|
|
4311
|
-
return
|
|
4313
|
+
return g;
|
|
4312
4314
|
}, []);
|
|
4313
|
-
|
|
4315
|
+
p.forEach((g) => t.set(g.target.annotation, g)), e.load(p);
|
|
4314
4316
|
},
|
|
4315
4317
|
size: () => e.all().length,
|
|
4316
4318
|
update: (f, h) => {
|
|
@@ -4334,13 +4336,13 @@ const Ci = () => {
|
|
|
4334
4336
|
hover: i,
|
|
4335
4337
|
viewport: s
|
|
4336
4338
|
};
|
|
4337
|
-
},
|
|
4339
|
+
}, Ui = (e) => {
|
|
4338
4340
|
const t = Xi(e);
|
|
4339
4341
|
return {
|
|
4340
4342
|
...t,
|
|
4341
4343
|
store: so(t.store)
|
|
4342
4344
|
};
|
|
4343
|
-
},
|
|
4345
|
+
}, Ri = (e) => {
|
|
4344
4346
|
let t, n;
|
|
4345
4347
|
if (e.nodeName === "CANVAS")
|
|
4346
4348
|
t = e, n = t.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -4355,10 +4357,10 @@ const Ci = () => {
|
|
|
4355
4357
|
o += c;
|
|
4356
4358
|
}
|
|
4357
4359
|
return o / 81;
|
|
4358
|
-
},
|
|
4359
|
-
const t =
|
|
4360
|
+
}, Ni = (e) => {
|
|
4361
|
+
const t = Ri(e), n = t > 0.6 ? "dark" : "light";
|
|
4360
4362
|
return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${n} theme.`), n;
|
|
4361
|
-
}, Wt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ?
|
|
4363
|
+
}, Wt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? Ni(e) : n), Vi = (e, t) => ({
|
|
4362
4364
|
...e,
|
|
4363
4365
|
drawingEnabled: e.drawingEnabled === void 0 ? t.drawingEnabled : e.drawingEnabled,
|
|
4364
4366
|
drawingMode: e.drawingMode || t.drawingMode,
|
|
@@ -4385,7 +4387,7 @@ const Ci = () => {
|
|
|
4385
4387
|
drawingMode: "drag",
|
|
4386
4388
|
userSelectAction: nn.EDIT,
|
|
4387
4389
|
theme: "light"
|
|
4388
|
-
}), i =
|
|
4390
|
+
}), i = Ui(o), { selection: s, store: r } = i, l = ao(r), a = fo(
|
|
4389
4391
|
i,
|
|
4390
4392
|
l,
|
|
4391
4393
|
o.adapter,
|
|
@@ -4407,44 +4409,44 @@ const Ci = () => {
|
|
|
4407
4409
|
}
|
|
4408
4410
|
});
|
|
4409
4411
|
h.$on("click", (b) => {
|
|
4410
|
-
const { originalEvent:
|
|
4411
|
-
P ? s.userSelect(P.id,
|
|
4412
|
+
const { originalEvent: M, annotation: P } = b.detail;
|
|
4413
|
+
P ? s.userSelect(P.id, M) : s.isEmpty() || s.clear();
|
|
4412
4414
|
});
|
|
4413
|
-
const
|
|
4415
|
+
const p = ho(i, l, o.adapter), g = () => {
|
|
4414
4416
|
h.$set({ drawingEnabled: !1 }), setTimeout(() => h.$set({ drawingEnabled: !0 }), 1);
|
|
4415
|
-
},
|
|
4417
|
+
}, _ = () => {
|
|
4416
4418
|
h.$destroy(), c.parentNode.insertBefore(n, c), c.parentNode.removeChild(c), u.destroy(), l.destroy();
|
|
4417
|
-
},
|
|
4419
|
+
}, A = () => h.getDrawingTool(), m = () => f, y = () => h.isDrawingEnabled(), w = (b, M, P) => si(b, M, P), E = (b, M) => zo(b, M), I = (b) => {
|
|
4418
4420
|
if (!fn(b))
|
|
4419
4421
|
throw `No drawing tool named ${b}`;
|
|
4420
4422
|
h.$set({ toolName: b });
|
|
4421
|
-
},
|
|
4423
|
+
}, U = (b) => h.$set({ drawingEnabled: b }), N = (b) => {
|
|
4422
4424
|
console.warn("Filter not implemented yet");
|
|
4423
|
-
}, V = (b) => h.$set({ style: b }), Z = (b) => Wt(n, c, b),
|
|
4425
|
+
}, V = (b) => h.$set({ style: b }), Z = (b) => Wt(n, c, b), S = (b) => {
|
|
4424
4426
|
f = b, h.$set({ user: b });
|
|
4425
|
-
},
|
|
4427
|
+
}, T = (b) => (
|
|
4426
4428
|
// @ts-ignore
|
|
4427
4429
|
h.$set({ visible: b })
|
|
4428
4430
|
);
|
|
4429
4431
|
return {
|
|
4430
|
-
...
|
|
4431
|
-
cancelDrawing:
|
|
4432
|
-
destroy:
|
|
4433
|
-
getDrawingTool:
|
|
4434
|
-
getUser:
|
|
4435
|
-
isDrawingEnabled:
|
|
4432
|
+
...p,
|
|
4433
|
+
cancelDrawing: g,
|
|
4434
|
+
destroy: _,
|
|
4435
|
+
getDrawingTool: A,
|
|
4436
|
+
getUser: m,
|
|
4437
|
+
isDrawingEnabled: y,
|
|
4436
4438
|
listDrawingTools: cn,
|
|
4437
4439
|
on: a.on,
|
|
4438
4440
|
off: a.off,
|
|
4439
|
-
registerDrawingTool:
|
|
4441
|
+
registerDrawingTool: w,
|
|
4440
4442
|
registerShapeEditor: E,
|
|
4441
|
-
setDrawingEnabled:
|
|
4443
|
+
setDrawingEnabled: U,
|
|
4442
4444
|
setDrawingTool: I,
|
|
4443
|
-
setFilter:
|
|
4445
|
+
setFilter: N,
|
|
4444
4446
|
setStyle: V,
|
|
4445
4447
|
setTheme: Z,
|
|
4446
|
-
setUser:
|
|
4447
|
-
setVisible:
|
|
4448
|
+
setUser: S,
|
|
4449
|
+
setVisible: T,
|
|
4448
4450
|
element: c,
|
|
4449
4451
|
state: i
|
|
4450
4452
|
};
|
|
@@ -4456,7 +4458,7 @@ export {
|
|
|
4456
4458
|
Ki as IdentityTransform,
|
|
4457
4459
|
Io as PolygonEditor,
|
|
4458
4460
|
Go as RectangleEditor,
|
|
4459
|
-
|
|
4461
|
+
On as RectangleUtil,
|
|
4460
4462
|
$o as RubberbandRectangle,
|
|
4461
4463
|
Li as SVGAnnotationLayer,
|
|
4462
4464
|
F as ShapeType,
|
|
@@ -4472,9 +4474,9 @@ export {
|
|
|
4472
4474
|
Ji as createImageAnnotator,
|
|
4473
4475
|
Xi as createImageAnnotatorState,
|
|
4474
4476
|
yi as createSVGTransform,
|
|
4475
|
-
|
|
4477
|
+
Ui as createSvelteImageAnnotatorState,
|
|
4476
4478
|
Wi as defaultColorProvider,
|
|
4477
|
-
|
|
4479
|
+
Ni as detectTheme,
|
|
4478
4480
|
st as distance,
|
|
4479
4481
|
Do as enableResponsive,
|
|
4480
4482
|
Vi as fillDefaults,
|
|
@@ -4489,15 +4491,15 @@ export {
|
|
|
4489
4491
|
Yo as isTouch,
|
|
4490
4492
|
cn as listDrawingTools,
|
|
4491
4493
|
Dn as parseFragmentSelector,
|
|
4492
|
-
|
|
4494
|
+
Rn as parseSVGSelector,
|
|
4493
4495
|
To as parseW3CImageAnnotation,
|
|
4494
4496
|
zo as registerEditor,
|
|
4495
4497
|
pt as registerShapeUtil,
|
|
4496
4498
|
si as registerTool,
|
|
4497
|
-
|
|
4499
|
+
Ri as sampleBrightness,
|
|
4498
4500
|
Yn as serializeFragmentSelector,
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
+
Nn as serializeSVGSelector,
|
|
4502
|
+
Mo as serializeW3CImageAnnotation,
|
|
4501
4503
|
Wt as setTheme
|
|
4502
4504
|
};
|
|
4503
4505
|
//# sourceMappingURL=annotorious.es.js.map
|