vue-cropperjs2 0.0.1 → 0.0.2
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/index.d.ts +10 -17
- package/dist/index.js +170 -181
- package/dist/index.umd.cjs +1 -1
- package/dist/user-5.png +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
3
|
import { ComponentProvideOptions } from 'vue';
|
|
4
|
-
import { CropperCanvas as CropperCanvas_2 } from 'cropperjs';
|
|
5
4
|
import { DefineComponent } from 'vue';
|
|
6
5
|
import { PublicProps } from 'vue';
|
|
7
6
|
|
|
8
|
-
declare const __VLS_component: DefineComponent<CropperCanvasProps, {
|
|
9
|
-
$setAction: ((action: string) => CropperCanvas_2) | undefined;
|
|
10
|
-
$toCanvas: ((options?: {
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
beforeDraw?: (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void;
|
|
14
|
-
}) => Promise<HTMLCanvasElement>) | undefined;
|
|
15
|
-
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CropperCanvasProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const __VLS_component: DefineComponent<CropperCanvasProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CropperCanvasProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
16
8
|
|
|
17
|
-
declare const __VLS_component_2: DefineComponent<SelectionProperty, {
|
|
9
|
+
declare const __VLS_component_2: DefineComponent<SelectionProperty, {
|
|
10
|
+
selection: any;
|
|
11
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<SelectionProperty> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
12
|
+
sel: unknown;
|
|
13
|
+
}, any>;
|
|
18
14
|
|
|
19
15
|
declare type __VLS_Props = {
|
|
20
16
|
resize?: "both" | "horizontal" | "vertical" | "none";
|
|
@@ -26,9 +22,7 @@ declare function __VLS_template(): {
|
|
|
26
22
|
slots: {
|
|
27
23
|
default?(_: {}): any;
|
|
28
24
|
};
|
|
29
|
-
refs: {
|
|
30
|
-
canvasRef: unknown;
|
|
31
|
-
};
|
|
25
|
+
refs: {};
|
|
32
26
|
rootEl: any;
|
|
33
27
|
};
|
|
34
28
|
|
|
@@ -37,7 +31,9 @@ declare function __VLS_template_2(): {
|
|
|
37
31
|
slots: {
|
|
38
32
|
default?(_: {}): any;
|
|
39
33
|
};
|
|
40
|
-
refs: {
|
|
34
|
+
refs: {
|
|
35
|
+
sel: unknown;
|
|
36
|
+
};
|
|
41
37
|
rootEl: any;
|
|
42
38
|
};
|
|
43
39
|
|
|
@@ -72,9 +68,6 @@ export declare const CropperCanvas: __VLS_WithTemplateSlots<typeof __VLS_compone
|
|
|
72
68
|
|
|
73
69
|
declare type CropperCanvasProps = {
|
|
74
70
|
background?: boolean;
|
|
75
|
-
disabled?: boolean;
|
|
76
|
-
scaleStep?: number;
|
|
77
|
-
themeColor?: string;
|
|
78
71
|
};
|
|
79
72
|
|
|
80
73
|
export declare const CropperCrosshair: DefineComponent<CropperCrosshairProperty, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CropperCrosshairProperty> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const at = typeof window < "u" && typeof window.document < "u",
|
|
1
|
+
import { defineComponent as _, h as D, openBlock as W, createBlock as X, resolveDynamicComponent as H, unref as Y, withCtx as Ft, renderSlot as qt, useTemplateRef as ie } from "vue";
|
|
2
|
+
const at = typeof window < "u" && typeof window.document < "u", I = at ? window : {}, bt = at ? "ontouchstart" in I.document.documentElement : !1, Ct = at ? "PointerEvent" in I : !1, B = "cropper", J = `${B}-canvas`, ne = `${B}-crosshair`, ae = `${B}-grid`, oe = `${B}-handle`, ot = `${B}-image`, z = `${B}-selection`, re = `${B}-shade`, he = `${B}-viewer`, st = "select", Vt = "move", Z = "scale", mt = "rotate", it = "transform", P = "none", yt = "n-resize", Et = "e-resize", wt = "s-resize", St = "w-resize", G = "ne-resize", F = "nw-resize", q = "se-resize", V = "sw-resize", ce = "action", le = bt ? "touchend touchcancel" : "mouseup", de = bt ? "touchmove" : "mousemove", ue = bt ? "touchstart" : "mousedown", At = Ct ? "pointerdown" : ue, Tt = Ct ? "pointermove" : de, kt = Ct ? "pointerup pointercancel" : le, xt = "error", Ot = "keydown", j = "load", Nt = "wheel", K = "action", L = "actionend", fe = "actionmove", U = "actionstart", M = "change", pt = "transform";
|
|
3
3
|
function $e(o) {
|
|
4
4
|
return typeof o == "string";
|
|
5
5
|
}
|
|
6
|
-
const Jt = Number.isNaN ||
|
|
6
|
+
const Jt = Number.isNaN || I.isNaN;
|
|
7
7
|
function f(o) {
|
|
8
8
|
return typeof o == "number" && !Jt(o);
|
|
9
9
|
}
|
|
@@ -34,11 +34,11 @@ function te(o) {
|
|
|
34
34
|
return typeof o == "object" && o !== null && o.nodeType === 1;
|
|
35
35
|
}
|
|
36
36
|
const pe = /([a-z\d])([A-Z])/g;
|
|
37
|
-
function
|
|
37
|
+
function It(o) {
|
|
38
38
|
return String(o).replace(pe, "$1-$2").toLowerCase();
|
|
39
39
|
}
|
|
40
40
|
const be = /-[A-z\d]/g;
|
|
41
|
-
function
|
|
41
|
+
function Rt(o) {
|
|
42
42
|
return o.replace(be, (t) => t.slice(1).toUpperCase());
|
|
43
43
|
}
|
|
44
44
|
const ee = /\s\s*/;
|
|
@@ -70,8 +70,8 @@ function ye(o, t) {
|
|
|
70
70
|
function Mt(o) {
|
|
71
71
|
const { documentElement: t } = o.ownerDocument, e = o.getBoundingClientRect();
|
|
72
72
|
return {
|
|
73
|
-
left: e.left + (
|
|
74
|
-
top: e.top + (
|
|
73
|
+
left: e.left + (I.pageXOffset - t.clientLeft),
|
|
74
|
+
top: e.top + (I.pageYOffset - t.clientTop)
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
const Ee = /deg|g?rad|turn$/i;
|
|
@@ -90,15 +90,15 @@ function gt(o) {
|
|
|
90
90
|
}
|
|
91
91
|
return t;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
function et(o, t =
|
|
93
|
+
const _t = "contain", we = "cover";
|
|
94
|
+
function et(o, t = _t) {
|
|
95
95
|
const { aspectRatio: e } = o;
|
|
96
96
|
let { width: s, height: i } = o;
|
|
97
|
-
const n = T(s),
|
|
98
|
-
if (n &&
|
|
97
|
+
const n = T(s), h = T(i);
|
|
98
|
+
if (n && h) {
|
|
99
99
|
const a = i * e;
|
|
100
|
-
t ===
|
|
101
|
-
} else n ? i = s / e :
|
|
100
|
+
t === _t && a > s || t === we && a < s ? i = s / e : s = i * e;
|
|
101
|
+
} else n ? i = s / e : h && (s = i * e);
|
|
102
102
|
return {
|
|
103
103
|
width: s,
|
|
104
104
|
height: i
|
|
@@ -107,25 +107,25 @@ function et(o, t = Dt) {
|
|
|
107
107
|
function se(o, ...t) {
|
|
108
108
|
if (t.length === 0)
|
|
109
109
|
return o;
|
|
110
|
-
const [e, s, i, n,
|
|
110
|
+
const [e, s, i, n, h, a] = o, [l, c, r, u, $, g] = t[0];
|
|
111
111
|
return o = [
|
|
112
112
|
e * l + i * c,
|
|
113
113
|
s * l + n * c,
|
|
114
|
-
e *
|
|
115
|
-
s *
|
|
116
|
-
e * $ + i * g +
|
|
114
|
+
e * r + i * u,
|
|
115
|
+
s * r + n * u,
|
|
116
|
+
e * $ + i * g + h,
|
|
117
117
|
s * $ + n * g + a
|
|
118
118
|
], se(o, ...t.slice(1));
|
|
119
119
|
}
|
|
120
120
|
var Se = ":host([hidden]){display:none!important}";
|
|
121
|
-
const Ae = /left|top|width|height/i,
|
|
122
|
-
class
|
|
121
|
+
const Ae = /left|top|width|height/i, Dt = "open", Q = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new Map(), Xt = I.document && Array.isArray(I.document.adoptedStyleSheets) && "replaceSync" in I.CSSStyleSheet.prototype;
|
|
122
|
+
class R extends HTMLElement {
|
|
123
123
|
get $sharedStyle() {
|
|
124
124
|
return `${this.themeColor ? `:host{--theme-color: ${this.themeColor};}` : ""}${Se}`;
|
|
125
125
|
}
|
|
126
126
|
constructor() {
|
|
127
127
|
var t, e;
|
|
128
|
-
super(), this.shadowRootMode =
|
|
128
|
+
super(), this.shadowRootMode = Dt, this.slottable = !0;
|
|
129
129
|
const s = (e = (t = Object.getPrototypeOf(this)) === null || t === void 0 ? void 0 : t.constructor) === null || e === void 0 ? void 0 : e.$name;
|
|
130
130
|
s && Wt.set(s, this.tagName.toLowerCase());
|
|
131
131
|
}
|
|
@@ -140,17 +140,17 @@ class I extends HTMLElement {
|
|
|
140
140
|
attributeChangedCallback(t, e, s) {
|
|
141
141
|
if (Object.is(s, e))
|
|
142
142
|
return;
|
|
143
|
-
const i =
|
|
144
|
-
let
|
|
143
|
+
const i = Rt(t), n = this[i];
|
|
144
|
+
let h = s;
|
|
145
145
|
switch (typeof n) {
|
|
146
146
|
case "boolean":
|
|
147
|
-
|
|
147
|
+
h = s !== null && s !== "false";
|
|
148
148
|
break;
|
|
149
149
|
case "number":
|
|
150
|
-
|
|
150
|
+
h = Number(s);
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
|
-
switch (this[i] =
|
|
153
|
+
switch (this[i] = h, t) {
|
|
154
154
|
case "theme-color": {
|
|
155
155
|
const a = tt.get(this), l = this.$sharedStyle;
|
|
156
156
|
a && l && (Xt ? a.replaceSync(l) : a.textContent = l);
|
|
@@ -161,7 +161,7 @@ class I extends HTMLElement {
|
|
|
161
161
|
// Convert property to attribute
|
|
162
162
|
$propertyChangedCallback(t, e, s) {
|
|
163
163
|
if (!Object.is(s, e))
|
|
164
|
-
switch (t =
|
|
164
|
+
switch (t = It(t), typeof s) {
|
|
165
165
|
case "boolean":
|
|
166
166
|
s === !0 ? this.hasAttribute(t) || this.setAttribute(t, "") : this.removeAttribute(t);
|
|
167
167
|
break;
|
|
@@ -176,7 +176,7 @@ class I extends HTMLElement {
|
|
|
176
176
|
}
|
|
177
177
|
connectedCallback() {
|
|
178
178
|
Object.getPrototypeOf(this).constructor.observedAttributes.forEach((e) => {
|
|
179
|
-
const s =
|
|
179
|
+
const s = Rt(e);
|
|
180
180
|
let i = this[s];
|
|
181
181
|
ge(i) || this.$propertyChangedCallback(s, void 0, i), Object.defineProperty(this, s, {
|
|
182
182
|
enumerable: !0,
|
|
@@ -185,13 +185,13 @@ class I extends HTMLElement {
|
|
|
185
185
|
return i;
|
|
186
186
|
},
|
|
187
187
|
set(n) {
|
|
188
|
-
const
|
|
189
|
-
i = n, this.$propertyChangedCallback(s,
|
|
188
|
+
const h = i;
|
|
189
|
+
i = n, this.$propertyChangedCallback(s, h, n);
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
});
|
|
193
193
|
const t = this.attachShadow({
|
|
194
|
-
mode: this.shadowRootMode ||
|
|
194
|
+
mode: this.shadowRootMode || Dt
|
|
195
195
|
});
|
|
196
196
|
if (this.shadowRoot || Q.set(this, t), tt.set(this, this.$addStyles(this.$sharedStyle)), this.$style && this.$addStyles(this.$style), this.$template) {
|
|
197
197
|
const e = document.createElement("template");
|
|
@@ -258,12 +258,12 @@ class I extends HTMLElement {
|
|
|
258
258
|
* @param {object} [options] The element definition options.
|
|
259
259
|
*/
|
|
260
260
|
static $define(t, e) {
|
|
261
|
-
Qt(t) && (e = t, t = ""), t || (t = this.$name || this.name), t =
|
|
261
|
+
Qt(t) && (e = t, t = ""), t || (t = this.$name || this.name), t = It(t), at && I.customElements && !I.customElements.get(t) && customElements.define(t, this, e);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
R.$version = "2.0.0-rc.2";
|
|
265
265
|
var Te = ':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}';
|
|
266
|
-
class rt extends
|
|
266
|
+
class rt extends R {
|
|
267
267
|
constructor() {
|
|
268
268
|
super(...arguments), this.$onPointerDown = null, this.$onPointerMove = null, this.$onPointerUp = null, this.$onWheel = null, this.$wheeling = !1, this.$pointers = /* @__PURE__ */ new Map(), this.$style = Te, this.$action = P, this.background = !1, this.disabled = !1, this.scaleStep = 0.1, this.themeColor = "#39f";
|
|
269
269
|
}
|
|
@@ -306,7 +306,7 @@ class rt extends I {
|
|
|
306
306
|
(f(e) && e !== 1 || f(s) && s !== 0 || t.ctrlKey))
|
|
307
307
|
return;
|
|
308
308
|
const { $pointers: n } = this;
|
|
309
|
-
let
|
|
309
|
+
let h = "";
|
|
310
310
|
if (t.changedTouches)
|
|
311
311
|
Array.from(t.changedTouches).forEach(({ identifier: a, pageX: l, pageY: c }) => {
|
|
312
312
|
n.set(a, {
|
|
@@ -325,10 +325,10 @@ class rt extends I {
|
|
|
325
325
|
endY: c
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
n.size > 1 ?
|
|
329
|
-
action:
|
|
328
|
+
n.size > 1 ? h = it : te(t.target) && (h = t.target.action || t.target.getAttribute(ce) || ""), this.$emit(U, {
|
|
329
|
+
action: h,
|
|
330
330
|
relatedEvent: t
|
|
331
|
-
}) !== !1 && (t.preventDefault(), this.$action =
|
|
331
|
+
}) !== !1 && (t.preventDefault(), this.$action = h, this.style.willChange = "transform");
|
|
332
332
|
}
|
|
333
333
|
$handlePointerMove(t) {
|
|
334
334
|
const { $action: e, $pointers: s } = this;
|
|
@@ -338,17 +338,17 @@ class rt extends I {
|
|
|
338
338
|
}) === !1)
|
|
339
339
|
return;
|
|
340
340
|
if (t.preventDefault(), t.changedTouches)
|
|
341
|
-
Array.from(t.changedTouches).forEach(({ identifier: n, pageX:
|
|
341
|
+
Array.from(t.changedTouches).forEach(({ identifier: n, pageX: h, pageY: a }) => {
|
|
342
342
|
const l = s.get(n);
|
|
343
343
|
l && Object.assign(l, {
|
|
344
|
-
endX:
|
|
344
|
+
endX: h,
|
|
345
345
|
endY: a
|
|
346
346
|
});
|
|
347
347
|
});
|
|
348
348
|
else {
|
|
349
|
-
const { pointerId: n = 0, pageX:
|
|
349
|
+
const { pointerId: n = 0, pageX: h, pageY: a } = t, l = s.get(n);
|
|
350
350
|
l && Object.assign(l, {
|
|
351
|
-
endX:
|
|
351
|
+
endX: h,
|
|
352
352
|
endY: a
|
|
353
353
|
});
|
|
354
354
|
}
|
|
@@ -358,22 +358,22 @@ class rt extends I {
|
|
|
358
358
|
};
|
|
359
359
|
if (e === it) {
|
|
360
360
|
const n = new Map(s);
|
|
361
|
-
let
|
|
361
|
+
let h = 0, a = 0, l = 0, c = 0, r = t.pageX, u = t.pageY;
|
|
362
362
|
s.forEach((d, S) => {
|
|
363
363
|
n.delete(S), n.forEach((E) => {
|
|
364
364
|
let m = E.startX - d.startX, C = E.startY - d.startY, p = E.endX - d.endX, b = E.endY - d.endY, w = 0, A = 0, k = 0, x = 0;
|
|
365
365
|
if (m === 0 ? C < 0 ? k = Math.PI * 2 : C > 0 && (k = Math.PI) : m > 0 ? k = Math.PI / 2 + Math.atan(C / m) : m < 0 && (k = Math.PI * 1.5 + Math.atan(C / m)), p === 0 ? b < 0 ? x = Math.PI * 2 : b > 0 && (x = Math.PI) : p > 0 ? x = Math.PI / 2 + Math.atan(b / p) : p < 0 && (x = Math.PI * 1.5 + Math.atan(b / p)), x > 0 || k > 0) {
|
|
366
366
|
const O = x - k, N = Math.abs(O);
|
|
367
|
-
N >
|
|
367
|
+
N > h && (h = N, l = O, r = (d.startX + E.startX) / 2, u = (d.startY + E.startY) / 2);
|
|
368
368
|
}
|
|
369
369
|
if (m = Math.abs(m), C = Math.abs(C), p = Math.abs(p), b = Math.abs(b), m > 0 && C > 0 ? w = Math.sqrt(m * m + C * C) : m > 0 ? w = m : C > 0 && (w = C), p > 0 && b > 0 ? A = Math.sqrt(p * p + b * b) : p > 0 ? A = p : b > 0 && (A = b), w > 0 && A > 0) {
|
|
370
370
|
const O = (A - w) / w, N = Math.abs(O);
|
|
371
|
-
N > a && (a = N, c = O,
|
|
371
|
+
N > a && (a = N, c = O, r = (d.startX + E.startX) / 2, u = (d.startY + E.startY) / 2);
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
});
|
|
375
|
-
const $ =
|
|
376
|
-
$ && g ? (i.rotate = l, i.scale = c, i.centerX =
|
|
375
|
+
const $ = h > 0, g = a > 0;
|
|
376
|
+
$ && g ? (i.rotate = l, i.scale = c, i.centerX = r, i.centerY = u) : $ ? (i.action = mt, i.rotate = l, i.centerX = r, i.centerY = u) : g ? (i.action = Z, i.scale = c, i.centerX = r, i.centerY = u) : i.action = P;
|
|
377
377
|
} else {
|
|
378
378
|
const [n] = Array.from(s.values());
|
|
379
379
|
Object.assign(i, n);
|
|
@@ -439,25 +439,25 @@ class rt extends I {
|
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
441
|
const i = document.createElement("canvas");
|
|
442
|
-
let n = this.offsetWidth,
|
|
443
|
-
nt(t) && (T(t.width) || T(t.height)) && ({ width: n, height:
|
|
444
|
-
aspectRatio: n /
|
|
442
|
+
let n = this.offsetWidth, h = this.offsetHeight, a = 1;
|
|
443
|
+
nt(t) && (T(t.width) || T(t.height)) && ({ width: n, height: h } = et({
|
|
444
|
+
aspectRatio: n / h,
|
|
445
445
|
width: t.width,
|
|
446
446
|
height: t.height
|
|
447
|
-
}), a = n / this.offsetWidth), i.width = n, i.height =
|
|
447
|
+
}), a = n / this.offsetWidth), i.width = n, i.height = h;
|
|
448
448
|
const l = this.querySelector(this.$getTagNameOf(ot));
|
|
449
449
|
if (!l) {
|
|
450
450
|
e(i);
|
|
451
451
|
return;
|
|
452
452
|
}
|
|
453
453
|
l.$ready().then((c) => {
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
454
|
+
const r = i.getContext("2d");
|
|
455
|
+
if (r) {
|
|
456
456
|
const [u, $, g, d, S, E] = l.$getTransform();
|
|
457
457
|
let m = S, C = E, p = c.naturalWidth, b = c.naturalHeight;
|
|
458
458
|
a !== 1 && (m *= a, C *= a, p *= a, b *= a);
|
|
459
459
|
const w = p / 2, A = b / 2;
|
|
460
|
-
|
|
460
|
+
r.fillStyle = "transparent", r.fillRect(0, 0, n, h), nt(t) && vt(t.beforeDraw) && t.beforeDraw.call(this, r, i), r.save(), r.translate(w, A), r.transform(u, $, g, d, m, C), r.translate(-w, -A), r.drawImage(c, 0, 0, p, b), r.restore();
|
|
461
461
|
}
|
|
462
462
|
e(i);
|
|
463
463
|
}).catch(s);
|
|
@@ -478,7 +478,7 @@ const Ht = /* @__PURE__ */ new WeakMap(), Yt = [
|
|
|
478
478
|
"src",
|
|
479
479
|
"srcset"
|
|
480
480
|
];
|
|
481
|
-
class ht extends
|
|
481
|
+
class ht extends R {
|
|
482
482
|
constructor() {
|
|
483
483
|
super(...arguments), this.$matrix = [1, 0, 0, 1, 0, 0], this.$onLoad = null, this.$onCanvasAction = null, this.$onCanvasActionEnd = null, this.$onCanvasActionStart = null, this.$actionStartTarget = null, this.$style = ke, this.$image = new Image(), this.initialCenterSize = "contain", this.rotatable = !1, this.scalable = !1, this.skewable = !1, this.slottable = !1, this.translatable = !1;
|
|
484
484
|
}
|
|
@@ -545,23 +545,23 @@ class ht extends I {
|
|
|
545
545
|
switch (n === it && (!this.rotatable || !this.scalable) && (this.rotatable ? n = mt : this.scalable ? n = Z : n = P), n) {
|
|
546
546
|
case Vt:
|
|
547
547
|
if (this.translatable) {
|
|
548
|
-
let
|
|
549
|
-
i && (
|
|
548
|
+
let h = null;
|
|
549
|
+
i && (h = i.target.closest(this.$getTagNameOf(z))), h || (h = e.querySelector(this.$getTagNameOf(z))), h && h.multiple && !h.active && (h = e.querySelector(`${this.$getTagNameOf(z)}[active]`)), (!h || h.hidden || !h.movable || h.dynamic || !(this.$actionStartTarget && h.contains(this.$actionStartTarget))) && this.$move(s.endX - s.startX, s.endY - s.startY);
|
|
550
550
|
}
|
|
551
551
|
break;
|
|
552
552
|
case mt:
|
|
553
553
|
if (this.rotatable)
|
|
554
554
|
if (i) {
|
|
555
|
-
const { x:
|
|
556
|
-
this.$rotate(s.rotate, i.clientX -
|
|
555
|
+
const { x: h, y: a } = this.getBoundingClientRect();
|
|
556
|
+
this.$rotate(s.rotate, i.clientX - h, i.clientY - a);
|
|
557
557
|
} else
|
|
558
558
|
this.$rotate(s.rotate);
|
|
559
559
|
break;
|
|
560
560
|
case Z:
|
|
561
561
|
if (this.scalable)
|
|
562
562
|
if (i) {
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
563
|
+
const h = i.target.closest(this.$getTagNameOf(z));
|
|
564
|
+
if (!h || !h.zoomable || h.zoomable && h.dynamic) {
|
|
565
565
|
const { x: a, y: l } = this.getBoundingClientRect();
|
|
566
566
|
this.$zoom(s.scale, i.clientX - a, i.clientY - l);
|
|
567
567
|
}
|
|
@@ -570,10 +570,10 @@ class ht extends I {
|
|
|
570
570
|
break;
|
|
571
571
|
case it:
|
|
572
572
|
if (this.rotatable && this.scalable) {
|
|
573
|
-
const { rotate:
|
|
573
|
+
const { rotate: h } = s;
|
|
574
574
|
let { scale: a } = s;
|
|
575
575
|
a < 0 ? a = 1 / (1 - a) : a += 1;
|
|
576
|
-
const l = Math.cos(
|
|
576
|
+
const l = Math.cos(h), c = Math.sin(h), [r, u, $, g] = [
|
|
577
577
|
l * a,
|
|
578
578
|
c * a,
|
|
579
579
|
-c * a,
|
|
@@ -581,9 +581,9 @@ class ht extends I {
|
|
|
581
581
|
];
|
|
582
582
|
if (i) {
|
|
583
583
|
const d = this.getBoundingClientRect(), S = i.clientX - d.x, E = i.clientY - d.y, [m, C, p, b] = this.$matrix, w = d.width / 2, A = d.height / 2, k = S - w, x = E - A, O = (k * b - p * x) / (m * b - p * C), N = (x * m - C * k) / (m * b - p * C);
|
|
584
|
-
this.$transform(
|
|
584
|
+
this.$transform(r, u, $, g, O * (1 - r) + N * $, N * (1 - g) + O * u);
|
|
585
585
|
} else
|
|
586
|
-
this.$transform(
|
|
586
|
+
this.$transform(r, u, $, g, 0, 0);
|
|
587
587
|
}
|
|
588
588
|
break;
|
|
589
589
|
}
|
|
@@ -596,14 +596,14 @@ class ht extends I {
|
|
|
596
596
|
*/
|
|
597
597
|
$ready(t) {
|
|
598
598
|
const { $image: e } = this, s = new Promise((i, n) => {
|
|
599
|
-
const
|
|
599
|
+
const h = new Error("Failed to load the image source");
|
|
600
600
|
if (e.complete)
|
|
601
|
-
e.naturalWidth > 0 && e.naturalHeight > 0 ? i(e) : n(
|
|
601
|
+
e.naturalWidth > 0 && e.naturalHeight > 0 ? i(e) : n(h);
|
|
602
602
|
else {
|
|
603
603
|
const a = () => {
|
|
604
604
|
v(e, xt, l), i(e);
|
|
605
605
|
}, l = () => {
|
|
606
|
-
v(e, j, a), n(
|
|
606
|
+
v(e, j, a), n(h);
|
|
607
607
|
};
|
|
608
608
|
Pt(e, j, a), Pt(e, xt, l);
|
|
609
609
|
}
|
|
@@ -619,8 +619,8 @@ class ht extends I {
|
|
|
619
619
|
const { parentElement: e } = this;
|
|
620
620
|
if (!e)
|
|
621
621
|
return this;
|
|
622
|
-
const s = e.getBoundingClientRect(), i = s.width, n = s.height, { x:
|
|
623
|
-
if (this.$move($ -
|
|
622
|
+
const s = e.getBoundingClientRect(), i = s.width, n = s.height, { x: h, y: a, width: l, height: c } = this.getBoundingClientRect(), r = h + l / 2, u = a + c / 2, $ = s.x + i / 2, g = s.y + n / 2;
|
|
623
|
+
if (this.$move($ - r, g - u), t && (l !== i || c !== n)) {
|
|
624
624
|
const d = i / l, S = n / c;
|
|
625
625
|
switch (t) {
|
|
626
626
|
case "cover":
|
|
@@ -641,7 +641,7 @@ class ht extends I {
|
|
|
641
641
|
*/
|
|
642
642
|
$move(t, e = t) {
|
|
643
643
|
if (this.translatable && f(t) && f(e)) {
|
|
644
|
-
const [s, i, n,
|
|
644
|
+
const [s, i, n, h] = this.$matrix, a = (t * h - n * e) / (s * h - n * i), l = (e * s - i * t) / (s * h - n * i);
|
|
645
645
|
this.$translate(a, l);
|
|
646
646
|
}
|
|
647
647
|
return this;
|
|
@@ -654,8 +654,8 @@ class ht extends I {
|
|
|
654
654
|
*/
|
|
655
655
|
$moveTo(t, e = t) {
|
|
656
656
|
if (this.translatable && f(t) && f(e)) {
|
|
657
|
-
const [s, i, n,
|
|
658
|
-
this.$setTransform(s, i, n,
|
|
657
|
+
const [s, i, n, h] = this.$matrix, a = (t * h - n * e) / (s * h - n * i), l = (e * s - i * t) / (s * h - n * i);
|
|
658
|
+
this.$setTransform(s, i, n, h, a, l);
|
|
659
659
|
}
|
|
660
660
|
return this;
|
|
661
661
|
}
|
|
@@ -670,12 +670,12 @@ class ht extends I {
|
|
|
670
670
|
*/
|
|
671
671
|
$rotate(t, e, s) {
|
|
672
672
|
if (this.rotatable) {
|
|
673
|
-
const i = gt(t), n = Math.cos(i),
|
|
673
|
+
const i = gt(t), n = Math.cos(i), h = Math.sin(i), [a, l, c, r] = [n, h, -h, n];
|
|
674
674
|
if (f(e) && f(s)) {
|
|
675
675
|
const [u, $, g, d] = this.$matrix, { width: S, height: E } = this.getBoundingClientRect(), m = S / 2, C = E / 2, p = e - m, b = s - C, w = (p * d - g * b) / (u * d - g * $), A = (b * u - $ * p) / (u * d - g * $);
|
|
676
|
-
this.$transform(a, l, c,
|
|
676
|
+
this.$transform(a, l, c, r, w * (1 - a) - A * c, A * (1 - r) - w * l);
|
|
677
677
|
} else
|
|
678
|
-
this.$transform(a, l, c,
|
|
678
|
+
this.$transform(a, l, c, r, 0, 0);
|
|
679
679
|
}
|
|
680
680
|
return this;
|
|
681
681
|
}
|
|
@@ -690,7 +690,7 @@ class ht extends I {
|
|
|
690
690
|
if (!this.scalable || t === 0)
|
|
691
691
|
return this;
|
|
692
692
|
if (t < 0 ? t = 1 / (1 - t) : t += 1, f(e) && f(s)) {
|
|
693
|
-
const [i, n,
|
|
693
|
+
const [i, n, h, a] = this.$matrix, { width: l, height: c } = this.getBoundingClientRect(), r = l / 2, u = c / 2, $ = e - r, g = s - u, d = ($ * a - h * g) / (i * a - h * n), S = (g * i - n * $) / (i * a - h * n);
|
|
694
694
|
this.$transform(t, 0, 0, t, d * (1 - t), S * (1 - t));
|
|
695
695
|
} else
|
|
696
696
|
this.$scale(t);
|
|
@@ -745,8 +745,8 @@ class ht extends I {
|
|
|
745
745
|
* @param {number} f The translating distance in the vertical direction.
|
|
746
746
|
* @returns {CropperImage} Returns `this` for chaining.
|
|
747
747
|
*/
|
|
748
|
-
$transform(t, e, s, i, n,
|
|
749
|
-
return f(t) && f(e) && f(s) && f(i) && f(n) && f(
|
|
748
|
+
$transform(t, e, s, i, n, h) {
|
|
749
|
+
return f(t) && f(e) && f(s) && f(i) && f(n) && f(h) ? this.$setTransform(se(this.$matrix, [t, e, s, i, n, h])) : this;
|
|
750
750
|
}
|
|
751
751
|
/**
|
|
752
752
|
* Resets (overrides) the current transform to the specific identity matrix.
|
|
@@ -759,9 +759,9 @@ class ht extends I {
|
|
|
759
759
|
* @param {number} f The translating distance in the vertical direction.
|
|
760
760
|
* @returns {CropperImage} Returns `this` for chaining.
|
|
761
761
|
*/
|
|
762
|
-
$setTransform(t, e, s, i, n,
|
|
763
|
-
if ((this.rotatable || this.scalable || this.skewable || this.translatable) && (Array.isArray(t) && ([t, e, s, i, n,
|
|
764
|
-
const a = [...this.$matrix], l = [t, e, s, i, n,
|
|
762
|
+
$setTransform(t, e, s, i, n, h) {
|
|
763
|
+
if ((this.rotatable || this.scalable || this.skewable || this.translatable) && (Array.isArray(t) && ([t, e, s, i, n, h] = t), f(t) && f(e) && f(s) && f(i) && f(n) && f(h))) {
|
|
764
|
+
const a = [...this.$matrix], l = [t, e, s, i, n, h];
|
|
765
765
|
if (this.$emit(pt, {
|
|
766
766
|
matrix: l,
|
|
767
767
|
oldMatrix: a
|
|
@@ -792,7 +792,7 @@ ht.$name = ot;
|
|
|
792
792
|
ht.$version = "2.0.0-rc.2";
|
|
793
793
|
var xe = ":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}";
|
|
794
794
|
const Bt = /* @__PURE__ */ new WeakMap();
|
|
795
|
-
class ct extends
|
|
795
|
+
class ct extends R {
|
|
796
796
|
constructor() {
|
|
797
797
|
super(...arguments), this.$onCanvasChange = null, this.$onCanvasActionEnd = null, this.$onCanvasActionStart = null, this.$style = xe, this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.slottable = !1, this.themeColor = "rgba(0, 0, 0, 0.65)";
|
|
798
798
|
}
|
|
@@ -821,8 +821,8 @@ class ct extends I {
|
|
|
821
821
|
}, this.$onCanvasActionEnd = (s) => {
|
|
822
822
|
e.hidden && s.detail.action === st && (this.hidden = !0);
|
|
823
823
|
}, this.$onCanvasChange = (s) => {
|
|
824
|
-
const { x: i, y: n, width:
|
|
825
|
-
this.$change(i, n,
|
|
824
|
+
const { x: i, y: n, width: h, height: a } = s.detail;
|
|
825
|
+
this.$change(i, n, h, a), (e.hidden || i === 0 && n === 0 && h === 0 && a === 0) && (this.hidden = !0);
|
|
826
826
|
}, y(t, U, this.$onCanvasActionStart), y(t, L, this.$onCanvasActionEnd), y(t, M, this.$onCanvasChange));
|
|
827
827
|
}
|
|
828
828
|
this.$render();
|
|
@@ -858,14 +858,14 @@ class ct extends I {
|
|
|
858
858
|
transform: `translate(${this.x}px, ${this.y}px)`,
|
|
859
859
|
width: this.width,
|
|
860
860
|
height: this.height,
|
|
861
|
-
outlineWidth:
|
|
861
|
+
outlineWidth: I.innerWidth
|
|
862
862
|
});
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
ct.$name = re;
|
|
866
866
|
ct.$version = "2.0.0-rc.2";
|
|
867
867
|
var Oe = ':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}';
|
|
868
|
-
class lt extends
|
|
868
|
+
class lt extends R {
|
|
869
869
|
constructor() {
|
|
870
870
|
super(...arguments), this.$onCanvasCropEnd = null, this.$onCanvasCropStart = null, this.$style = Oe, this.action = P, this.plain = !1, this.slottable = !1, this.themeColor = "rgba(51, 153, 255, 0.5)";
|
|
871
871
|
}
|
|
@@ -880,7 +880,7 @@ lt.$name = oe;
|
|
|
880
880
|
lt.$version = "2.0.0-rc.2";
|
|
881
881
|
var Ne = ':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}';
|
|
882
882
|
const Lt = /* @__PURE__ */ new WeakMap();
|
|
883
|
-
class dt extends
|
|
883
|
+
class dt extends R {
|
|
884
884
|
constructor() {
|
|
885
885
|
super(...arguments), this.$onCanvasAction = null, this.$onCanvasActionStart = null, this.$onCanvasActionEnd = null, this.$onDocumentKeyDown = null, this.$action = "", this.$actionStartTarget = null, this.$changing = !1, this.$style = Ne, this.$initialSelection = {
|
|
886
886
|
x: 0,
|
|
@@ -991,8 +991,8 @@ class dt extends I {
|
|
|
991
991
|
const { initialCoverage: s, parentElement: i } = this;
|
|
992
992
|
if (T(s) && i) {
|
|
993
993
|
const n = this.aspectRatio || this.initialAspectRatio;
|
|
994
|
-
let
|
|
995
|
-
T(n) && ({ width:
|
|
994
|
+
let h = (e ? 0 : this.width) || i.offsetWidth * s, a = (e ? 0 : this.height) || i.offsetHeight * s;
|
|
995
|
+
T(n) && ({ width: h, height: a } = et({ aspectRatio: n, width: h, height: a })), this.$change(this.x, this.y, h, a), t && this.$center(), this.$initialSelection = {
|
|
996
996
|
x: this.x,
|
|
997
997
|
y: this.y,
|
|
998
998
|
width: this.width,
|
|
@@ -1039,17 +1039,17 @@ class dt extends I {
|
|
|
1039
1039
|
let { action: n } = s;
|
|
1040
1040
|
if (!n && this.multiple && (n = this.$action || (i == null ? void 0 : i.target.action), this.$action = n), !n || this.hidden && n !== st || this.multiple && !this.active && n !== Z)
|
|
1041
1041
|
return;
|
|
1042
|
-
const
|
|
1043
|
-
let { aspectRatio:
|
|
1044
|
-
switch (!T(
|
|
1042
|
+
const h = s.endX - s.startX, a = s.endY - s.startY, { width: l, height: c } = this;
|
|
1043
|
+
let { aspectRatio: r } = this;
|
|
1044
|
+
switch (!T(r) && i.shiftKey && (r = T(l) && T(c) ? l / c : 1), n) {
|
|
1045
1045
|
case st:
|
|
1046
|
-
if (
|
|
1046
|
+
if (h !== 0 && a !== 0) {
|
|
1047
1047
|
const { $canvas: u } = this, $ = Mt(e);
|
|
1048
|
-
(this.multiple && !this.hidden ? this.$createSelection() : this).$change(s.startX - $.left, s.startY - $.top, Math.abs(
|
|
1048
|
+
(this.multiple && !this.hidden ? this.$createSelection() : this).$change(s.startX - $.left, s.startY - $.top, Math.abs(h), Math.abs(a), r), h < 0 ? a < 0 ? n = F : a > 0 && (n = V) : h > 0 && (a < 0 ? n = G : a > 0 && (n = q)), u && (u.$action = n);
|
|
1049
1049
|
}
|
|
1050
1050
|
break;
|
|
1051
1051
|
case Vt:
|
|
1052
|
-
this.movable && (this.dynamic || this.$actionStartTarget && this.contains(this.$actionStartTarget)) && this.$move(
|
|
1052
|
+
this.movable && (this.dynamic || this.$actionStartTarget && this.contains(this.$actionStartTarget)) && this.$move(h, a);
|
|
1053
1053
|
break;
|
|
1054
1054
|
case Z:
|
|
1055
1055
|
if (i && this.zoomable && (this.dynamic || this.contains(i.target))) {
|
|
@@ -1058,7 +1058,7 @@ class dt extends I {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
break;
|
|
1060
1060
|
default:
|
|
1061
|
-
this.$resize(n,
|
|
1061
|
+
this.$resize(n, h, a, r);
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
$handleActionEnd() {
|
|
@@ -1140,35 +1140,35 @@ class dt extends I {
|
|
|
1140
1140
|
$resize(t, e = 0, s = 0, i = this.aspectRatio) {
|
|
1141
1141
|
if (!this.resizable)
|
|
1142
1142
|
return this;
|
|
1143
|
-
const n = T(i), { $canvas:
|
|
1144
|
-
let { x: a, y: l, width: c, height:
|
|
1143
|
+
const n = T(i), { $canvas: h } = this;
|
|
1144
|
+
let { x: a, y: l, width: c, height: r } = this;
|
|
1145
1145
|
switch (t) {
|
|
1146
1146
|
case yt:
|
|
1147
|
-
l += s,
|
|
1147
|
+
l += s, r -= s, r < 0 && (t = wt, r = -r, l -= r), n && (e = s * i, a += e / 2, c -= e, c < 0 && (c = -c, a -= c));
|
|
1148
1148
|
break;
|
|
1149
1149
|
case Et:
|
|
1150
|
-
c += e, c < 0 && (t = St, c = -c, a -= c), n && (s = e / i, l -= s / 2,
|
|
1150
|
+
c += e, c < 0 && (t = St, c = -c, a -= c), n && (s = e / i, l -= s / 2, r += s, r < 0 && (r = -r, l -= r));
|
|
1151
1151
|
break;
|
|
1152
1152
|
case wt:
|
|
1153
|
-
|
|
1153
|
+
r += s, r < 0 && (t = yt, r = -r, l -= r), n && (e = s * i, a -= e / 2, c += e, c < 0 && (c = -c, a -= c));
|
|
1154
1154
|
break;
|
|
1155
1155
|
case St:
|
|
1156
|
-
a += e, c -= e, c < 0 && (t = Et, c = -c, a -= c), n && (s = e / i, l += s / 2,
|
|
1156
|
+
a += e, c -= e, c < 0 && (t = Et, c = -c, a -= c), n && (s = e / i, l += s / 2, r -= s, r < 0 && (r = -r, l -= r));
|
|
1157
1157
|
break;
|
|
1158
1158
|
case G:
|
|
1159
|
-
n && (s = -e / i), l += s,
|
|
1159
|
+
n && (s = -e / i), l += s, r -= s, c += e, c < 0 && r < 0 ? (t = V, c = -c, r = -r, a -= c, l -= r) : c < 0 ? (t = F, c = -c, a -= c) : r < 0 && (t = q, r = -r, l -= r);
|
|
1160
1160
|
break;
|
|
1161
1161
|
case F:
|
|
1162
|
-
n && (s = e / i), a += e, l += s, c -= e,
|
|
1162
|
+
n && (s = e / i), a += e, l += s, c -= e, r -= s, c < 0 && r < 0 ? (t = q, c = -c, r = -r, a -= c, l -= r) : c < 0 ? (t = G, c = -c, a -= c) : r < 0 && (t = V, r = -r, l -= r);
|
|
1163
1163
|
break;
|
|
1164
1164
|
case q:
|
|
1165
|
-
n && (s = e / i), c += e,
|
|
1165
|
+
n && (s = e / i), c += e, r += s, c < 0 && r < 0 ? (t = F, c = -c, r = -r, a -= c, l -= r) : c < 0 ? (t = V, c = -c, a -= c) : r < 0 && (t = G, r = -r, l -= r);
|
|
1166
1166
|
break;
|
|
1167
1167
|
case V:
|
|
1168
|
-
n && (s = -e / i), a += e, c -= e,
|
|
1168
|
+
n && (s = -e / i), a += e, c -= e, r += s, c < 0 && r < 0 ? (t = G, c = -c, r = -r, a -= c, l -= r) : c < 0 ? (t = q, c = -c, a -= c) : r < 0 && (t = F, r = -r, l -= r);
|
|
1169
1169
|
break;
|
|
1170
1170
|
}
|
|
1171
|
-
return
|
|
1171
|
+
return h && h.$setAction(t), this.$change(a, l, c, r);
|
|
1172
1172
|
}
|
|
1173
1173
|
/**
|
|
1174
1174
|
* Zooms the selection.
|
|
@@ -1181,9 +1181,9 @@ class dt extends I {
|
|
|
1181
1181
|
if (!this.zoomable || t === 0)
|
|
1182
1182
|
return this;
|
|
1183
1183
|
t < 0 ? t = 1 / (1 - t) : t += 1;
|
|
1184
|
-
const { width: i, height: n } = this,
|
|
1184
|
+
const { width: i, height: n } = this, h = i * t, a = n * t;
|
|
1185
1185
|
let l = this.x, c = this.y;
|
|
1186
|
-
return f(e) && f(s) ? (l -= (
|
|
1186
|
+
return f(e) && f(s) ? (l -= (h - i) * ((e - this.x) / i), c -= (a - n) * ((s - this.y) / n)) : (l -= (h - i) / 2, c -= (a - n) / 2), this.$change(l, c, h, a);
|
|
1187
1187
|
}
|
|
1188
1188
|
/**
|
|
1189
1189
|
* Changes the position and/or size of the selection.
|
|
@@ -1195,8 +1195,8 @@ class dt extends I {
|
|
|
1195
1195
|
* @param {number} [_force] Force change.
|
|
1196
1196
|
* @returns {CropperSelection} Returns `this` for chaining.
|
|
1197
1197
|
*/
|
|
1198
|
-
$change(t, e, s = this.width, i = this.height, n = this.aspectRatio,
|
|
1199
|
-
return this.$changing || !f(t) || !f(e) || !f(s) || !f(i) || s < 0 || i < 0 ? this : (T(n) && ({ width: s, height: i } = et({ aspectRatio: n, width: s, height: i }, "cover")), this.precise || (t = Math.round(t), e = Math.round(e), s = Math.round(s), i = Math.round(i)), t === this.x && e === this.y && s === this.width && i === this.height && Object.is(n, this.aspectRatio) && !
|
|
1198
|
+
$change(t, e, s = this.width, i = this.height, n = this.aspectRatio, h = !1) {
|
|
1199
|
+
return this.$changing || !f(t) || !f(e) || !f(s) || !f(i) || s < 0 || i < 0 ? this : (T(n) && ({ width: s, height: i } = et({ aspectRatio: n, width: s, height: i }, "cover")), this.precise || (t = Math.round(t), e = Math.round(e), s = Math.round(s), i = Math.round(i)), t === this.x && e === this.y && s === this.width && i === this.height && Object.is(n, this.aspectRatio) && !h ? this : (this.hidden && (this.hidden = !1), this.$emit(M, {
|
|
1200
1200
|
x: t,
|
|
1201
1201
|
y: e,
|
|
1202
1202
|
width: s,
|
|
@@ -1244,12 +1244,12 @@ class dt extends I {
|
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
1246
|
const i = document.createElement("canvas");
|
|
1247
|
-
let { width: n, height:
|
|
1248
|
-
if (nt(t) && (T(t.width) || T(t.height)) && ({ width: n, height:
|
|
1249
|
-
aspectRatio: n /
|
|
1247
|
+
let { width: n, height: h } = this, a = 1;
|
|
1248
|
+
if (nt(t) && (T(t.width) || T(t.height)) && ({ width: n, height: h } = et({
|
|
1249
|
+
aspectRatio: n / h,
|
|
1250
1250
|
width: t.width,
|
|
1251
1251
|
height: t.height
|
|
1252
|
-
}), a = n / this.width), i.width = n, i.height =
|
|
1252
|
+
}), a = n / this.width), i.width = n, i.height = h, !this.$canvas) {
|
|
1253
1253
|
e(i);
|
|
1254
1254
|
return;
|
|
1255
1255
|
}
|
|
@@ -1259,13 +1259,13 @@ class dt extends I {
|
|
|
1259
1259
|
return;
|
|
1260
1260
|
}
|
|
1261
1261
|
l.$ready().then((c) => {
|
|
1262
|
-
const
|
|
1263
|
-
if (
|
|
1262
|
+
const r = i.getContext("2d");
|
|
1263
|
+
if (r) {
|
|
1264
1264
|
const [u, $, g, d, S, E] = l.$getTransform(), m = -this.x, C = -this.y, p = (m * d - g * C) / (u * d - g * $), b = (C * u - $ * m) / (u * d - g * $);
|
|
1265
1265
|
let w = u * p + g * b + S, A = $ * p + d * b + E, k = c.naturalWidth, x = c.naturalHeight;
|
|
1266
1266
|
a !== 1 && (w *= a, A *= a, k *= a, x *= a);
|
|
1267
1267
|
const O = k / 2, N = x / 2;
|
|
1268
|
-
|
|
1268
|
+
r.fillStyle = "transparent", r.fillRect(0, 0, n, h), nt(t) && vt(t.beforeDraw) && t.beforeDraw.call(this, r, i), r.save(), r.translate(O, N), r.transform(u, $, g, d, w, A), r.translate(-O, -N), r.drawImage(c, 0, 0, k, x), r.restore();
|
|
1269
1269
|
}
|
|
1270
1270
|
e(i);
|
|
1271
1271
|
}).catch(s);
|
|
@@ -1274,10 +1274,10 @@ class dt extends I {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
dt.$name = z;
|
|
1276
1276
|
dt.$version = "2.0.0-rc.2";
|
|
1277
|
-
var
|
|
1278
|
-
class ut extends
|
|
1277
|
+
var Ie = ":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}";
|
|
1278
|
+
class ut extends R {
|
|
1279
1279
|
constructor() {
|
|
1280
|
-
super(...arguments), this.$style =
|
|
1280
|
+
super(...arguments), this.$style = Ie, this.bordered = !1, this.columns = 3, this.covered = !1, this.rows = 3, this.slottable = !1, this.themeColor = "rgba(238, 238, 238, 0.5)";
|
|
1281
1281
|
}
|
|
1282
1282
|
static get observedAttributes() {
|
|
1283
1283
|
return super.observedAttributes.concat([
|
|
@@ -1301,8 +1301,8 @@ class ut extends I {
|
|
|
1301
1301
|
const i = document.createElement("span");
|
|
1302
1302
|
i.setAttribute("role", "row");
|
|
1303
1303
|
for (let n = 0; n < this.columns; n += 1) {
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1304
|
+
const h = document.createElement("span");
|
|
1305
|
+
h.setAttribute("role", "gridcell"), i.appendChild(h);
|
|
1306
1306
|
}
|
|
1307
1307
|
e.appendChild(i);
|
|
1308
1308
|
}
|
|
@@ -1311,10 +1311,10 @@ class ut extends I {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
ut.$name = ae;
|
|
1313
1313
|
ut.$version = "2.0.0-rc.2";
|
|
1314
|
-
var
|
|
1315
|
-
class ft extends
|
|
1314
|
+
var Re = ':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}';
|
|
1315
|
+
class ft extends R {
|
|
1316
1316
|
constructor() {
|
|
1317
|
-
super(...arguments), this.$style =
|
|
1317
|
+
super(...arguments), this.$style = Re, this.centered = !1, this.slottable = !1, this.themeColor = "rgba(238, 238, 238, 0.5)";
|
|
1318
1318
|
}
|
|
1319
1319
|
static get observedAttributes() {
|
|
1320
1320
|
return super.observedAttributes.concat([
|
|
@@ -1325,8 +1325,8 @@ class ft extends I {
|
|
|
1325
1325
|
ft.$name = ne;
|
|
1326
1326
|
ft.$version = "2.0.0-rc.2";
|
|
1327
1327
|
var Pe = ":host{display:block;height:100%;overflow:hidden;position:relative;width:100%}";
|
|
1328
|
-
const Ut = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), ze = "both", Me = "horizontal", Gt = "vertical",
|
|
1329
|
-
class $t extends
|
|
1328
|
+
const Ut = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), ze = "both", Me = "horizontal", Gt = "vertical", _e = "none";
|
|
1329
|
+
class $t extends R {
|
|
1330
1330
|
constructor() {
|
|
1331
1331
|
super(...arguments), this.$onSelectionChange = null, this.$onSourceImageLoad = null, this.$onSourceImageTransform = null, this.$scale = 1, this.$style = Pe, this.resize = Gt, this.selection = "", this.slottable = !1;
|
|
1332
1332
|
}
|
|
@@ -1400,8 +1400,8 @@ class $t extends I {
|
|
|
1400
1400
|
width: s.offsetWidth,
|
|
1401
1401
|
height: s.offsetHeight
|
|
1402
1402
|
});
|
|
1403
|
-
const { x: n, y:
|
|
1404
|
-
let $ =
|
|
1403
|
+
const { x: n, y: h, width: a, height: l } = t, c = {}, { clientWidth: r, clientHeight: u } = this;
|
|
1404
|
+
let $ = r, g = u, d = NaN;
|
|
1405
1405
|
switch (this.resize) {
|
|
1406
1406
|
case ze:
|
|
1407
1407
|
d = 1, $ = a, g = l, c.width = a, c.height = l;
|
|
@@ -1410,24 +1410,24 @@ class $t extends I {
|
|
|
1410
1410
|
d = l > 0 ? u / l : 0, $ = a * d, c.width = $;
|
|
1411
1411
|
break;
|
|
1412
1412
|
case Gt:
|
|
1413
|
-
d = a > 0 ?
|
|
1413
|
+
d = a > 0 ? r / a : 0, g = l * d, c.height = g;
|
|
1414
1414
|
break;
|
|
1415
|
-
case
|
|
1415
|
+
case _e:
|
|
1416
1416
|
default:
|
|
1417
|
-
|
|
1417
|
+
r > 0 ? d = a > 0 ? r / a : 0 : u > 0 && (d = l > 0 ? u / l : 0);
|
|
1418
1418
|
}
|
|
1419
|
-
this.$scale = d, this.$setStyles(c), this.$sourceImage && this.$transformImageByOffset(e ?? this.$sourceImage.$getTransform(), -n, -
|
|
1419
|
+
this.$scale = d, this.$setStyles(c), this.$sourceImage && this.$transformImageByOffset(e ?? this.$sourceImage.$getTransform(), -n, -h);
|
|
1420
1420
|
}
|
|
1421
1421
|
$transformImageByOffset(t, e, s) {
|
|
1422
|
-
const { $image: i, $scale: n, $sourceImage:
|
|
1423
|
-
if (
|
|
1424
|
-
const [a, l, c,
|
|
1422
|
+
const { $image: i, $scale: n, $sourceImage: h } = this;
|
|
1423
|
+
if (h && i && n >= 0) {
|
|
1424
|
+
const [a, l, c, r, u, $] = t, g = (e * r - c * s) / (a * r - c * l), d = (s * a - l * e) / (a * r - c * l), S = a * g + c * d + u, E = l * g + r * d + $;
|
|
1425
1425
|
i.$ready((m) => {
|
|
1426
1426
|
this.$setStyles.call(i, {
|
|
1427
1427
|
width: m.naturalWidth * n,
|
|
1428
1428
|
height: m.naturalHeight * n
|
|
1429
1429
|
});
|
|
1430
|
-
}), i.$setTransform(a, l, c,
|
|
1430
|
+
}), i.$setTransform(a, l, c, r, S * n, E * n);
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
@@ -1442,39 +1442,28 @@ ht.$define();
|
|
|
1442
1442
|
dt.$define();
|
|
1443
1443
|
ct.$define();
|
|
1444
1444
|
$t.$define();
|
|
1445
|
-
const
|
|
1445
|
+
const De = /* @__PURE__ */ _({
|
|
1446
1446
|
__name: "CropperCanvas",
|
|
1447
1447
|
props: {
|
|
1448
|
-
background: { type: Boolean, default: !1 }
|
|
1449
|
-
disabled: { type: Boolean, default: !1 },
|
|
1450
|
-
scaleStep: { default: 0.1 },
|
|
1451
|
-
themeColor: { default: "#39f" }
|
|
1448
|
+
background: { type: Boolean, default: !1 }
|
|
1452
1449
|
},
|
|
1453
|
-
setup(o
|
|
1454
|
-
var r, a;
|
|
1455
|
-
const e = ie("canvasRef");
|
|
1450
|
+
setup(o) {
|
|
1456
1451
|
rt.$define();
|
|
1457
|
-
const
|
|
1452
|
+
const t = D("cropper-canvas", {
|
|
1458
1453
|
background: o.background,
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1454
|
+
// disabled,
|
|
1455
|
+
// scaleStep,
|
|
1456
|
+
// themeColor,
|
|
1462
1457
|
style: "height: 500px"
|
|
1463
|
-
})
|
|
1464
|
-
return t
|
|
1465
|
-
$setAction: i,
|
|
1466
|
-
$toCanvas: n
|
|
1467
|
-
}), (l, c) => (W(), X(H(Y(s)), {
|
|
1468
|
-
ref_key: "canvasRef",
|
|
1469
|
-
ref: e
|
|
1470
|
-
}, {
|
|
1458
|
+
});
|
|
1459
|
+
return (e, s) => (W(), X(H(Y(t)), null, {
|
|
1471
1460
|
default: Ft(() => [
|
|
1472
|
-
qt(
|
|
1461
|
+
qt(e.$slots, "default")
|
|
1473
1462
|
]),
|
|
1474
1463
|
_: 3
|
|
1475
|
-
}
|
|
1464
|
+
}));
|
|
1476
1465
|
}
|
|
1477
|
-
}), We = /* @__PURE__ */
|
|
1466
|
+
}), We = /* @__PURE__ */ _({
|
|
1478
1467
|
__name: "CropperImage",
|
|
1479
1468
|
props: {
|
|
1480
1469
|
src: {},
|
|
@@ -1488,7 +1477,7 @@ const _e = /* @__PURE__ */ D({
|
|
|
1488
1477
|
},
|
|
1489
1478
|
setup(o) {
|
|
1490
1479
|
ht.$define();
|
|
1491
|
-
const t =
|
|
1480
|
+
const t = D("cropper-image", {
|
|
1492
1481
|
src: o.src,
|
|
1493
1482
|
alt: o.alt,
|
|
1494
1483
|
initialCenterSize: o.initialCenterSize,
|
|
@@ -1500,7 +1489,7 @@ const _e = /* @__PURE__ */ D({
|
|
|
1500
1489
|
});
|
|
1501
1490
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1502
1491
|
}
|
|
1503
|
-
}), Xe = /* @__PURE__ */
|
|
1492
|
+
}), Xe = /* @__PURE__ */ _({
|
|
1504
1493
|
__name: "CropperShade",
|
|
1505
1494
|
props: {
|
|
1506
1495
|
x: { default: 0 },
|
|
@@ -1513,7 +1502,7 @@ const _e = /* @__PURE__ */ D({
|
|
|
1513
1502
|
},
|
|
1514
1503
|
setup(o) {
|
|
1515
1504
|
ct.$define();
|
|
1516
|
-
const t =
|
|
1505
|
+
const t = D("cropper-shade", {
|
|
1517
1506
|
x: o.x,
|
|
1518
1507
|
y: o.y,
|
|
1519
1508
|
width: o.width,
|
|
@@ -1524,7 +1513,7 @@ const _e = /* @__PURE__ */ D({
|
|
|
1524
1513
|
});
|
|
1525
1514
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1526
1515
|
}
|
|
1527
|
-
}), He = /* @__PURE__ */
|
|
1516
|
+
}), He = /* @__PURE__ */ _({
|
|
1528
1517
|
__name: "CropperHandle",
|
|
1529
1518
|
props: {
|
|
1530
1519
|
action: { default: "none" },
|
|
@@ -1534,10 +1523,10 @@ const _e = /* @__PURE__ */ D({
|
|
|
1534
1523
|
},
|
|
1535
1524
|
setup(o) {
|
|
1536
1525
|
lt.$define();
|
|
1537
|
-
const t =
|
|
1526
|
+
const t = D("cropper-handle", { action: o.action, plain: o.plain, slottable: o.slottable, themeColor: o.themeColor });
|
|
1538
1527
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1539
1528
|
}
|
|
1540
|
-
}), Ye = /* @__PURE__ */
|
|
1529
|
+
}), Ye = /* @__PURE__ */ _({
|
|
1541
1530
|
__name: "CropperSelection",
|
|
1542
1531
|
props: {
|
|
1543
1532
|
x: { default: 0 },
|
|
@@ -1556,9 +1545,9 @@ const _e = /* @__PURE__ */ D({
|
|
|
1556
1545
|
outlined: { type: Boolean, default: !1 },
|
|
1557
1546
|
precise: { type: Boolean, default: !1 }
|
|
1558
1547
|
},
|
|
1559
|
-
setup(o) {
|
|
1548
|
+
setup(o, { expose: t }) {
|
|
1560
1549
|
dt.$define();
|
|
1561
|
-
const
|
|
1550
|
+
const e = D("cropper-selection", {
|
|
1562
1551
|
x: o.x,
|
|
1563
1552
|
y: o.y,
|
|
1564
1553
|
width: o.width,
|
|
@@ -1575,25 +1564,25 @@ const _e = /* @__PURE__ */ D({
|
|
|
1575
1564
|
outlined: o.outlined,
|
|
1576
1565
|
precise: o.precise
|
|
1577
1566
|
//
|
|
1578
|
-
});
|
|
1579
|
-
return (
|
|
1567
|
+
}), s = ie("sel");
|
|
1568
|
+
return t({ selection: s }), (i, n) => (W(), X(H(Y(e)), { ref: "sel" }, {
|
|
1580
1569
|
default: Ft(() => [
|
|
1581
|
-
qt(
|
|
1570
|
+
qt(i.$slots, "default")
|
|
1582
1571
|
]),
|
|
1583
1572
|
_: 3
|
|
1584
|
-
}));
|
|
1573
|
+
}, 512));
|
|
1585
1574
|
}
|
|
1586
|
-
}), Be = /* @__PURE__ */
|
|
1575
|
+
}), Be = /* @__PURE__ */ _({
|
|
1587
1576
|
__name: "CropperCrosshair",
|
|
1588
1577
|
props: {
|
|
1589
1578
|
centered: { type: Boolean, default: !1 }
|
|
1590
1579
|
},
|
|
1591
1580
|
setup(o) {
|
|
1592
1581
|
ft.$define();
|
|
1593
|
-
const t =
|
|
1582
|
+
const t = D("cropper-crosshair", { centered: o.centered });
|
|
1594
1583
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1595
1584
|
}
|
|
1596
|
-
}), Le = /* @__PURE__ */
|
|
1585
|
+
}), Le = /* @__PURE__ */ _({
|
|
1597
1586
|
__name: "CropperGrid",
|
|
1598
1587
|
props: {
|
|
1599
1588
|
role: { default: "grid" },
|
|
@@ -1601,10 +1590,10 @@ const _e = /* @__PURE__ */ D({
|
|
|
1601
1590
|
},
|
|
1602
1591
|
setup(o) {
|
|
1603
1592
|
ut.$define();
|
|
1604
|
-
const t =
|
|
1593
|
+
const t = D("cropper-grid", { role: o.role, covered: o.covered });
|
|
1605
1594
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1606
1595
|
}
|
|
1607
|
-
}), Ue = /* @__PURE__ */
|
|
1596
|
+
}), Ue = /* @__PURE__ */ _({
|
|
1608
1597
|
__name: "CropperViewer",
|
|
1609
1598
|
props: {
|
|
1610
1599
|
resize: { default: "vertical" },
|
|
@@ -1612,16 +1601,16 @@ const _e = /* @__PURE__ */ D({
|
|
|
1612
1601
|
},
|
|
1613
1602
|
setup(o) {
|
|
1614
1603
|
$t.$define();
|
|
1615
|
-
const t =
|
|
1604
|
+
const t = D("cropper-viewer", { resize: o.resize, selection: o.selection });
|
|
1616
1605
|
return (e, s) => (W(), X(H(Y(t))));
|
|
1617
1606
|
}
|
|
1618
1607
|
}), Ze = {
|
|
1619
1608
|
install: (o) => {
|
|
1620
|
-
o.component("CropperCanvas",
|
|
1609
|
+
o.component("CropperCanvas", De), o.component("CropperImage", We), o.component("CropperShade", Xe), o.component("CropperHandle", He), o.component("CropperSelection", Ye), o.component("CropperCrosshair", Be), o.component("CropperGrid", Le), o.component("CropperViewer", Ue);
|
|
1621
1610
|
}
|
|
1622
1611
|
};
|
|
1623
1612
|
export {
|
|
1624
|
-
|
|
1613
|
+
De as CropperCanvas,
|
|
1625
1614
|
Be as CropperCrosshair,
|
|
1626
1615
|
Le as CropperGrid,
|
|
1627
1616
|
He as CropperHandle,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(T,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],d):(T=typeof globalThis<"u"?globalThis:T||self,d(T["vue-cropperjs2"]={},T.Vue))})(this,function(T,d){"use strict";const F=typeof window<"u"&&typeof window.document<"u",R=F?window:{},dt=F?"ontouchstart"in R.document.documentElement:!1,ft=F?"PointerEvent"in R:!1,z="cropper",j=`${z}-canvas`,ae=`${z}-crosshair`,oe=`${z}-grid`,re=`${z}-handle`,q=`${z}-image`,D=`${z}-selection`,ce=`${z}-shade`,he=`${z}-viewer`,V="select",gt="move",H="scale",ut="rotate",J="transform",_="none",bt="n-resize",Ct="e-resize",vt="s-resize",yt="w-resize",U="ne-resize",Z="nw-resize",K="se-resize",G="sw-resize",le="action",de=dt?"touchend touchcancel":"mouseup",fe=dt?"touchmove":"mousemove",Et=ft?"pointerdown":dt?"touchstart":"mousedown",wt=ft?"pointermove":fe,St=ft?"pointerup pointercancel":de,At="error",kt="keydown",Y="load",Tt="wheel",L="action",W="actionend",ue="actionmove",X="actionstart",B="change",$t="transform";function $e(o){return typeof o=="string"}const xt=Number.isNaN||R.isNaN;function $(o){return typeof o=="number"&&!xt(o)}function x(o){return $(o)&&o>0&&o<1/0}function me(o){return typeof o>"u"}function Ot(o){return typeof o=="object"&&o!==null}const{hasOwnProperty:pe}=Object.prototype;function Q(o){if(!Ot(o))return!1;try{const{constructor:t}=o,{prototype:e}=t;return t&&e&&pe.call(e,"isPrototypeOf")}catch{return!1}}function mt(o){return typeof o=="function"}function Nt(o){return typeof o=="object"&&o!==null&&o.nodeType===1}const ge=/([a-z\d])([A-Z])/g;function Rt(o){return String(o).replace(ge,"$1-$2").toLowerCase()}const be=/-[A-z\d]/g;function It(o){return o.replace(be,t=>t.slice(1).toUpperCase())}const Pt=/\s\s*/;function y(o,t,e,i){t.trim().split(Pt).forEach(s=>{o.removeEventListener(s,e,i)})}function E(o,t,e,i){t.trim().split(Pt).forEach(s=>{o.addEventListener(s,e,i)})}function Mt(o,t,e,i){E(o,t,e,Object.assign(Object.assign({},i),{once:!0}))}const Ce={bubbles:!0,cancelable:!0,composed:!0};function ve(o,t,e,i){return o.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},Ce),{detail:e}),i)))}const zt=Promise.resolve();function ye(o,t){return t?zt.then(o?t.bind(o):t):zt}function Dt(o){const{documentElement:t}=o.ownerDocument,e=o.getBoundingClientRect();return{left:e.left+(R.pageXOffset-t.clientLeft),top:e.top+(R.pageYOffset-t.clientTop)}}const Ee=/deg|g?rad|turn$/i;function pt(o){const t=parseFloat(o)||0;if(t!==0){const[e="rad"]=String(o).match(Ee)||[];switch(e.toLowerCase()){case"deg":return t/360*(Math.PI*2);case"grad":return t/400*(Math.PI*2);case"turn":return t*(Math.PI*2)}}return t}const _t="contain",we="cover";function tt(o,t=_t){const{aspectRatio:e}=o;let{width:i,height:s}=o;const n=x(i),r=x(s);if(n&&r){const a=s*e;t===_t&&a>i||t===we&&a<i?s=i/e:i=s*e}else n?s=i/e:r&&(i=s*e);return{width:i,height:s}}function Bt(o,...t){if(t.length===0)return o;const[e,i,s,n,r,a]=o,[l,h,c,u,m,p]=t[0];return o=[e*l+s*h,i*l+n*h,e*c+s*u,i*c+n*u,e*m+s*p+r,i*m+n*p+a],Bt(o,...t.slice(1))}var Se=":host([hidden]){display:none!important}";const Ae=/left|top|width|height/i,Wt="open",et=new WeakMap,it=new WeakMap,Xt=new Map,Ht=R.document&&Array.isArray(R.document.adoptedStyleSheets)&&"replaceSync"in R.CSSStyleSheet.prototype;class M extends HTMLElement{get $sharedStyle(){return`${this.themeColor?`:host{--theme-color: ${this.themeColor};}`:""}${Se}`}constructor(){var t,e;super(),this.shadowRootMode=Wt,this.slottable=!0;const i=(e=(t=Object.getPrototypeOf(this))===null||t===void 0?void 0:t.constructor)===null||e===void 0?void 0:e.$name;i&&Xt.set(i,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,i){if(Object.is(i,e))return;const s=It(t),n=this[s];let r=i;switch(typeof n){case"boolean":r=i!==null&&i!=="false";break;case"number":r=Number(i);break}switch(this[s]=r,t){case"theme-color":{const a=it.get(this),l=this.$sharedStyle;a&&l&&(Ht?a.replaceSync(l):a.textContent=l);break}}}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(t=Rt(t),typeof i){case"boolean":i===!0?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":xt(i)?i="":i=String(i);default:i?this.getAttribute(t)!==i&&this.setAttribute(t,i):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const i=It(e);let s=this[i];me(s)||this.$propertyChangedCallback(i,void 0,s),Object.defineProperty(this,i,{enumerable:!0,configurable:!0,get(){return s},set(n){const r=s;s=n,this.$propertyChangedCallback(i,r,n)}})});const t=this.attachShadow({mode:this.shadowRootMode||Wt});if(this.shadowRoot||et.set(this,t),it.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){it.has(this)&&it.delete(this),et.has(this)&&et.delete(this)}$getTagNameOf(t){var e;return(e=Xt.get(t))!==null&&e!==void 0?e:t}$setStyles(t){return Object.keys(t).forEach(e=>{let i=t[e];$(i)&&(i!==0&&Ae.test(e)?i=`${i}px`:i=String(i)),this.style[e]=i}),this}$getShadowRoot(){return this.shadowRoot||et.get(this)}$addStyles(t){let e;const i=this.$getShadowRoot();return Ht?(e=new CSSStyleSheet,e.replaceSync(t),i.adoptedStyleSheets=i.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,i.appendChild(e)),e}$emit(t,e,i){return ve(this,t,e,i)}$nextTick(t){return ye(this,t)}static $define(t,e){Ot(t)&&(e=t,t=""),t||(t=this.$name||this.name),t=Rt(t),F&&R.customElements&&!R.customElements.get(t)&&customElements.define(t,this,e)}}M.$version="2.0.0-rc.2";var ke=':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}';class st extends M{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=new Map,this.$style=ke,this.$action=_,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"disabled":i?this.$unbind():this.$bind();break}}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),E(this,Et,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),E(this.ownerDocument,wt,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),E(this.ownerDocument,St,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),E(this,Tt,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(y(this,Et,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(y(this.ownerDocument,wt,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(y(this.ownerDocument,St,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(y(this,Tt,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(t){const{buttons:e,button:i,type:s}=t;if(this.disabled||(s==="pointerdown"&&t.pointerType==="mouse"||s==="mousedown")&&($(e)&&e!==1||$(i)&&i!==0||t.ctrlKey))return;const{$pointers:n}=this;let r="";if(t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:a,pageX:l,pageY:h})=>{n.set(a,{startX:l,startY:h,endX:l,endY:h})});else{const{pointerId:a=0,pageX:l,pageY:h}=t;n.set(a,{startX:l,startY:h,endX:l,endY:h})}n.size>1?r=J:Nt(t.target)&&(r=t.target.action||t.target.getAttribute(le)||""),this.$emit(X,{action:r,relatedEvent:t})!==!1&&(t.preventDefault(),this.$action=r,this.style.willChange="transform")}$handlePointerMove(t){const{$action:e,$pointers:i}=this;if(this.disabled||e===_||i.size===0||this.$emit(ue,{action:e,relatedEvent:t})===!1)return;if(t.preventDefault(),t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:n,pageX:r,pageY:a})=>{const l=i.get(n);l&&Object.assign(l,{endX:r,endY:a})});else{const{pointerId:n=0,pageX:r,pageY:a}=t,l=i.get(n);l&&Object.assign(l,{endX:r,endY:a})}const s={action:e,relatedEvent:t};if(e===J){const n=new Map(i);let r=0,a=0,l=0,h=0,c=t.pageX,u=t.pageY;i.forEach((f,A)=>{n.delete(A),n.forEach(w=>{let g=w.startX-f.startX,v=w.startY-f.startY,b=w.endX-f.endX,C=w.endY-f.endY,S=0,k=0,O=0,N=0;if(g===0?v<0?O=Math.PI*2:v>0&&(O=Math.PI):g>0?O=Math.PI/2+Math.atan(v/g):g<0&&(O=Math.PI*1.5+Math.atan(v/g)),b===0?C<0?N=Math.PI*2:C>0&&(N=Math.PI):b>0?N=Math.PI/2+Math.atan(C/b):b<0&&(N=Math.PI*1.5+Math.atan(C/b)),N>0||O>0){const I=N-O,P=Math.abs(I);P>r&&(r=P,l=I,c=(f.startX+w.startX)/2,u=(f.startY+w.startY)/2)}if(g=Math.abs(g),v=Math.abs(v),b=Math.abs(b),C=Math.abs(C),g>0&&v>0?S=Math.sqrt(g*g+v*v):g>0?S=g:v>0&&(S=v),b>0&&C>0?k=Math.sqrt(b*b+C*C):b>0?k=b:C>0&&(k=C),S>0&&k>0){const I=(k-S)/S,P=Math.abs(I);P>a&&(a=P,h=I,c=(f.startX+w.startX)/2,u=(f.startY+w.startY)/2)}})});const m=r>0,p=a>0;m&&p?(s.rotate=l,s.scale=h,s.centerX=c,s.centerY=u):m?(s.action=ut,s.rotate=l,s.centerX=c,s.centerY=u):p?(s.action=H,s.scale=h,s.centerX=c,s.centerY=u):s.action=_}else{const[n]=Array.from(i.values());Object.assign(s,n)}i.forEach(n=>{n.startX=n.endX,n.startY=n.endY}),s.action!==_&&this.$emit(L,s,{cancelable:!1})}$handlePointerUp(t){const{$action:e,$pointers:i}=this;if(!(this.disabled||e===_)&&this.$emit(W,{action:e,relatedEvent:t})!==!1){if(t.preventDefault(),t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:s})=>{i.delete(s)});else{const{pointerId:s=0}=t;i.delete(s)}i.size===0&&(this.style.willChange="",this.$action=_)}}$handleWheel(t){if(this.disabled||(t.preventDefault(),this.$wheeling))return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const i=(t.deltaY>0?-1:1)*this.scaleStep;this.$emit(L,{action:H,scale:i,relatedEvent:t},{cancelable:!1})}$setAction(t){return $e(t)&&(this.$action=t),this}$toCanvas(t){return new Promise((e,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const s=document.createElement("canvas");let n=this.offsetWidth,r=this.offsetHeight,a=1;Q(t)&&(x(t.width)||x(t.height))&&({width:n,height:r}=tt({aspectRatio:n/r,width:t.width,height:t.height}),a=n/this.offsetWidth),s.width=n,s.height=r;const l=this.querySelector(this.$getTagNameOf(q));if(!l){e(s);return}l.$ready().then(h=>{const c=s.getContext("2d");if(c){const[u,m,p,f,A,w]=l.$getTransform();let g=A,v=w,b=h.naturalWidth,C=h.naturalHeight;a!==1&&(g*=a,v*=a,b*=a,C*=a);const S=b/2,k=C/2;c.fillStyle="transparent",c.fillRect(0,0,n,r),Q(t)&&mt(t.beforeDraw)&&t.beforeDraw.call(this,c,s),c.save(),c.translate(S,k),c.transform(u,m,p,f,g,v),c.translate(-S,-k),c.drawImage(h,0,0,b,C),c.restore()}e(s)}).catch(i)})}}st.$name=j,st.$version="2.0.0-rc.2";var Te=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}";const Yt=new WeakMap,Lt=["alt","crossorigin","decoding","importance","loading","referrerpolicy","sizes","src","srcset"];class nt extends M{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=Te,this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1}set $canvas(t){Yt.set(this,t)}get $canvas(){return Yt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Lt,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(t,e,i){Object.is(i,e)||(super.attributeChangedCallback(t,e,i),Lt.includes(t)&&this.$image.setAttribute(t,i))}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"initialCenterSize":this.$nextTick(()=>{this.$center(i)});break}}connectedCallback(){super.connectedCallback();const{$image:t}=this,e=this.closest(this.$getTagNameOf(j));e&&(this.$canvas=e,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=i=>{var s,n;this.$actionStartTarget=(n=(s=i.detail)===null||s===void 0?void 0:s.relatedEvent)===null||n===void 0?void 0:n.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),E(e,X,this.$onCanvasActionStart),E(e,W,this.$onCanvasActionEnd),E(e,L,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),E(t,Y,this.$onLoad),this.$getShadowRoot().appendChild(t)}disconnectedCallback(){const{$image:t,$canvas:e}=this;e&&(this.$onCanvasActionStart&&(y(e,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(e,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(y(e,L,this.$onCanvasAction),this.$onCanvasAction=null)),t&&this.$onLoad&&(y(t,Y,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(t),super.disconnectedCallback()}$handleLoad(){const{$image:t}=this;this.$setStyles({width:t.naturalWidth,height:t.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(t){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:e}=this,{detail:i}=t;if(i){const{relatedEvent:s}=i;let{action:n}=i;switch(n===J&&(!this.rotatable||!this.scalable)&&(this.rotatable?n=ut:this.scalable?n=H:n=_),n){case gt:if(this.translatable){let r=null;s&&(r=s.target.closest(this.$getTagNameOf(D))),r||(r=e.querySelector(this.$getTagNameOf(D))),r&&r.multiple&&!r.active&&(r=e.querySelector(`${this.$getTagNameOf(D)}[active]`)),(!r||r.hidden||!r.movable||r.dynamic||!(this.$actionStartTarget&&r.contains(this.$actionStartTarget)))&&this.$move(i.endX-i.startX,i.endY-i.startY)}break;case ut:if(this.rotatable)if(s){const{x:r,y:a}=this.getBoundingClientRect();this.$rotate(i.rotate,s.clientX-r,s.clientY-a)}else this.$rotate(i.rotate);break;case H:if(this.scalable)if(s){const r=s.target.closest(this.$getTagNameOf(D));if(!r||!r.zoomable||r.zoomable&&r.dynamic){const{x:a,y:l}=this.getBoundingClientRect();this.$zoom(i.scale,s.clientX-a,s.clientY-l)}}else this.$zoom(i.scale);break;case J:if(this.rotatable&&this.scalable){const{rotate:r}=i;let{scale:a}=i;a<0?a=1/(1-a):a+=1;const l=Math.cos(r),h=Math.sin(r),[c,u,m,p]=[l*a,h*a,-h*a,l*a];if(s){const f=this.getBoundingClientRect(),A=s.clientX-f.x,w=s.clientY-f.y,[g,v,b,C]=this.$matrix,S=f.width/2,k=f.height/2,O=A-S,N=w-k,I=(O*C-b*N)/(g*C-b*v),P=(N*g-v*O)/(g*C-b*v);this.$transform(c,u,m,p,I*(1-c)+P*m,P*(1-p)+I*u)}else this.$transform(c,u,m,p,0,0)}break}}}$ready(t){const{$image:e}=this,i=new Promise((s,n)=>{const r=new Error("Failed to load the image source");if(e.complete)e.naturalWidth>0&&e.naturalHeight>0?s(e):n(r);else{const a=()=>{y(e,At,l),s(e)},l=()=>{y(e,Y,a),n(r)};Mt(e,Y,a),Mt(e,At,l)}});return mt(t)&&i.then(s=>(t(s),s)),i}$center(t){const{parentElement:e}=this;if(!e)return this;const i=e.getBoundingClientRect(),s=i.width,n=i.height,{x:r,y:a,width:l,height:h}=this.getBoundingClientRect(),c=r+l/2,u=a+h/2,m=i.x+s/2,p=i.y+n/2;if(this.$move(m-c,p-u),t&&(l!==s||h!==n)){const f=s/l,A=n/h;switch(t){case"cover":this.$scale(Math.max(f,A));break;case"contain":this.$scale(Math.min(f,A));break}}return this}$move(t,e=t){if(this.translatable&&$(t)&&$(e)){const[i,s,n,r]=this.$matrix,a=(t*r-n*e)/(i*r-n*s),l=(e*i-s*t)/(i*r-n*s);this.$translate(a,l)}return this}$moveTo(t,e=t){if(this.translatable&&$(t)&&$(e)){const[i,s,n,r]=this.$matrix,a=(t*r-n*e)/(i*r-n*s),l=(e*i-s*t)/(i*r-n*s);this.$setTransform(i,s,n,r,a,l)}return this}$rotate(t,e,i){if(this.rotatable){const s=pt(t),n=Math.cos(s),r=Math.sin(s),[a,l,h,c]=[n,r,-r,n];if($(e)&&$(i)){const[u,m,p,f]=this.$matrix,{width:A,height:w}=this.getBoundingClientRect(),g=A/2,v=w/2,b=e-g,C=i-v,S=(b*f-p*C)/(u*f-p*m),k=(C*u-m*b)/(u*f-p*m);this.$transform(a,l,h,c,S*(1-a)-k*h,k*(1-c)-S*l)}else this.$transform(a,l,h,c,0,0)}return this}$zoom(t,e,i){if(!this.scalable||t===0)return this;if(t<0?t=1/(1-t):t+=1,$(e)&&$(i)){const[s,n,r,a]=this.$matrix,{width:l,height:h}=this.getBoundingClientRect(),c=l/2,u=h/2,m=e-c,p=i-u,f=(m*a-r*p)/(s*a-r*n),A=(p*s-n*m)/(s*a-r*n);this.$transform(t,0,0,t,f*(1-t),A*(1-t))}else this.$scale(t);return this}$scale(t,e=t){return this.scalable&&this.$transform(t,0,0,e,0,0),this}$skew(t,e=0){if(this.skewable){const i=pt(t),s=pt(e);this.$transform(1,Math.tan(s),Math.tan(i),1,0,0)}return this}$translate(t,e=t){return this.translatable&&$(t)&&$(e)&&this.$transform(1,0,0,1,t,e),this}$transform(t,e,i,s,n,r){return $(t)&&$(e)&&$(i)&&$(s)&&$(n)&&$(r)?this.$setTransform(Bt(this.$matrix,[t,e,i,s,n,r])):this}$setTransform(t,e,i,s,n,r){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(t)&&([t,e,i,s,n,r]=t),$(t)&&$(e)&&$(i)&&$(s)&&$(n)&&$(r))){const a=[...this.$matrix],l=[t,e,i,s,n,r];if(this.$emit($t,{matrix:l,oldMatrix:a})===!1)return this;this.$matrix=l,this.style.transform=`matrix(${l.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}nt.$name=q,nt.$version="2.0.0-rc.2";var xe=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}";const jt=new WeakMap;class at extends M{constructor(){super(...arguments),this.$onCanvasChange=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$style=xe,this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(t){jt.set(this,t)}get $canvas(){return jt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(j));if(t){this.$canvas=t,this.style.position="absolute";const e=t.querySelector(this.$getTagNameOf(D));e&&(this.$onCanvasActionStart=i=>{e.hidden&&i.detail.action===V&&(this.hidden=!1)},this.$onCanvasActionEnd=i=>{e.hidden&&i.detail.action===V&&(this.hidden=!0)},this.$onCanvasChange=i=>{const{x:s,y:n,width:r,height:a}=i.detail;this.$change(s,n,r,a),(e.hidden||s===0&&n===0&&r===0&&a===0)&&(this.hidden=!0)},E(t,X,this.$onCanvasActionStart),E(t,W,this.$onCanvasActionEnd),E(t,B,this.$onCanvasChange))}this.$render()}disconnectedCallback(){const{$canvas:t}=this;t&&(this.$onCanvasActionStart&&(y(t,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(t,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasChange&&(y(t,B,this.$onCanvasChange),this.$onCanvasChange=null)),super.disconnectedCallback()}$change(t,e,i=this.width,s=this.height){return!$(t)||!$(e)||!$(i)||!$(s)||t===this.x&&e===this.y&&i===this.width&&s===this.height?this:(this.hidden&&(this.hidden=!1),this.x=t,this.y=e,this.width=i,this.height=s,this.$render())}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:R.innerWidth})}}at.$name=ce,at.$version="2.0.0-rc.2";var Oe=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}';class ot extends M{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=Oe,this.action=_,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}ot.$name=re,ot.$version="2.0.0-rc.2";var Ne=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}';const Ut=new WeakMap;class rt extends M{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=Ne,this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(t){Ut.set(this,t)}get $canvas(){return Ut.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{x(i)&&i<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(i?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),E(this.ownerDocument,kt,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(y(this.ownerDocument,kt,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const s=this.$getSelections();i?(s.forEach(n=>{n.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,s.slice(1).forEach(n=>{this.$removeSelection(n)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":i&&(this.dynamic=!0);break}}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(j));t?(this.$canvas=t,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),E(t,X,this.$onCanvasActionStart),E(t,W,this.$onCanvasActionEnd),E(t,L,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:t}=this;t&&(this.$onCanvasActionStart&&(y(t,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(t,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(y(t,L,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let t=[];return this.parentElement&&(t=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(D)))),t}$initSelection(t=!1,e=!1){const{initialCoverage:i,parentElement:s}=this;if(x(i)&&s){const n=this.aspectRatio||this.initialAspectRatio;let r=(e?0:this.width)||s.offsetWidth*i,a=(e?0:this.height)||s.offsetHeight*i;x(n)&&({width:r,height:a}=tt({aspectRatio:n,width:r,height:a})),this.$change(this.x,this.y,r,a),t&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const t=this.cloneNode(!0);return this.hasAttribute("id")&&t.removeAttribute("id"),t.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(t,this.nextSibling),t}$removeSelection(t=this){if(this.parentElement){const e=this.$getSelections();if(e.length>1){const i=e.indexOf(t),s=e[i+1]||e[i-1];s&&(t.active=!1,this.parentElement.removeChild(t),s.active=!0,s.$emit(B,{x:s.x,y:s.y,width:s.width,height:s.height}))}else this.$clear()}}$handleActionStart(t){var e,i;const s=(i=(e=t.detail)===null||e===void 0?void 0:e.relatedEvent)===null||i===void 0?void 0:i.target;this.$action="",this.$actionStartTarget=s,!this.hidden&&this.multiple&&!this.active&&s===this&&this.parentElement&&(this.$getSelections().forEach(n=>{n.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(t){const{currentTarget:e,detail:i}=t;if(!e||!i)return;const{relatedEvent:s}=i;let{action:n}=i;if(!n&&this.multiple&&(n=this.$action||(s==null?void 0:s.target.action),this.$action=n),!n||this.hidden&&n!==V||this.multiple&&!this.active&&n!==H)return;const r=i.endX-i.startX,a=i.endY-i.startY,{width:l,height:h}=this;let{aspectRatio:c}=this;switch(!x(c)&&s.shiftKey&&(c=x(l)&&x(h)?l/h:1),n){case V:if(r!==0&&a!==0){const{$canvas:u}=this,m=Dt(e);(this.multiple&&!this.hidden?this.$createSelection():this).$change(i.startX-m.left,i.startY-m.top,Math.abs(r),Math.abs(a),c),r<0?a<0?n=Z:a>0&&(n=G):r>0&&(a<0?n=U:a>0&&(n=K)),u&&(u.$action=n)}break;case gt:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(r,a);break;case H:if(s&&this.zoomable&&(this.dynamic||this.contains(s.target))){const u=Dt(e);this.$zoom(i.scale,s.pageX-u.left,s.pageY-u.top)}break;default:this.$resize(n,r,a,c)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(t){if(this.hidden||!this.keyboard||this.multiple&&!this.active||t.defaultPrevented)return;const{activeElement:e}=document;if(!(e&&(["INPUT","TEXTAREA"].includes(e.tagName)||["true","plaintext-only"].includes(e.contentEditable))))switch(t.key){case"Backspace":t.metaKey&&(t.preventDefault(),this.$removeSelection());break;case"Delete":t.preventDefault(),this.$removeSelection();break;case"ArrowLeft":t.preventDefault(),this.$move(-1,0);break;case"ArrowRight":t.preventDefault(),this.$move(1,0);break;case"ArrowUp":t.preventDefault(),this.$move(0,-1);break;case"ArrowDown":t.preventDefault(),this.$move(0,1);break;case"+":t.preventDefault(),this.$zoom(.1);break;case"-":t.preventDefault(),this.$zoom(-.1);break}}$center(){const{parentElement:t}=this;if(!t)return this;const e=(t.offsetWidth-this.width)/2,i=(t.offsetHeight-this.height)/2;return this.$change(e,i)}$move(t,e=t){return this.$moveTo(this.x+t,this.y+e)}$moveTo(t,e=t){return this.movable?this.$change(t,e):this}$resize(t,e=0,i=0,s=this.aspectRatio){if(!this.resizable)return this;const n=x(s),{$canvas:r}=this;let{x:a,y:l,width:h,height:c}=this;switch(t){case bt:l+=i,c-=i,c<0&&(t=vt,c=-c,l-=c),n&&(e=i*s,a+=e/2,h-=e,h<0&&(h=-h,a-=h));break;case Ct:h+=e,h<0&&(t=yt,h=-h,a-=h),n&&(i=e/s,l-=i/2,c+=i,c<0&&(c=-c,l-=c));break;case vt:c+=i,c<0&&(t=bt,c=-c,l-=c),n&&(e=i*s,a-=e/2,h+=e,h<0&&(h=-h,a-=h));break;case yt:a+=e,h-=e,h<0&&(t=Ct,h=-h,a-=h),n&&(i=e/s,l+=i/2,c-=i,c<0&&(c=-c,l-=c));break;case U:n&&(i=-e/s),l+=i,c-=i,h+=e,h<0&&c<0?(t=G,h=-h,c=-c,a-=h,l-=c):h<0?(t=Z,h=-h,a-=h):c<0&&(t=K,c=-c,l-=c);break;case Z:n&&(i=e/s),a+=e,l+=i,h-=e,c-=i,h<0&&c<0?(t=K,h=-h,c=-c,a-=h,l-=c):h<0?(t=U,h=-h,a-=h):c<0&&(t=G,c=-c,l-=c);break;case K:n&&(i=e/s),h+=e,c+=i,h<0&&c<0?(t=Z,h=-h,c=-c,a-=h,l-=c):h<0?(t=G,h=-h,a-=h):c<0&&(t=U,c=-c,l-=c);break;case G:n&&(i=-e/s),a+=e,h-=e,c+=i,h<0&&c<0?(t=U,h=-h,c=-c,a-=h,l-=c):h<0?(t=K,h=-h,a-=h):c<0&&(t=Z,c=-c,l-=c);break}return r&&r.$setAction(t),this.$change(a,l,h,c)}$zoom(t,e,i){if(!this.zoomable||t===0)return this;t<0?t=1/(1-t):t+=1;const{width:s,height:n}=this,r=s*t,a=n*t;let l=this.x,h=this.y;return $(e)&&$(i)?(l-=(r-s)*((e-this.x)/s),h-=(a-n)*((i-this.y)/n)):(l-=(r-s)/2,h-=(a-n)/2),this.$change(l,h,r,a)}$change(t,e,i=this.width,s=this.height,n=this.aspectRatio,r=!1){return this.$changing||!$(t)||!$(e)||!$(i)||!$(s)||i<0||s<0?this:(x(n)&&({width:i,height:s}=tt({aspectRatio:n,width:i,height:s},"cover")),this.precise||(t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s)),t===this.x&&e===this.y&&i===this.width&&s===this.height&&Object.is(n,this.aspectRatio)&&!r?this:(this.hidden&&(this.hidden=!1),this.$emit(B,{x:t,y:e,width:i,height:s})===!1?this:(this.$changing=!0,this.x=t,this.y=e,this.width=i,this.height=s,this.$changing=!1,this.$render())))}$reset(){const{x:t,y:e,width:i,height:s}=this.$initialSelection;return this.$change(t,e,i,s)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(t){return new Promise((e,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const s=document.createElement("canvas");let{width:n,height:r}=this,a=1;if(Q(t)&&(x(t.width)||x(t.height))&&({width:n,height:r}=tt({aspectRatio:n/r,width:t.width,height:t.height}),a=n/this.width),s.width=n,s.height=r,!this.$canvas){e(s);return}const l=this.$canvas.querySelector(this.$getTagNameOf(q));if(!l){e(s);return}l.$ready().then(h=>{const c=s.getContext("2d");if(c){const[u,m,p,f,A,w]=l.$getTransform(),g=-this.x,v=-this.y,b=(g*f-p*v)/(u*f-p*m),C=(v*u-m*g)/(u*f-p*m);let S=u*b+p*C+A,k=m*b+f*C+w,O=h.naturalWidth,N=h.naturalHeight;a!==1&&(S*=a,k*=a,O*=a,N*=a);const I=O/2,P=N/2;c.fillStyle="transparent",c.fillRect(0,0,n,r),Q(t)&&mt(t.beforeDraw)&&t.beforeDraw.call(this,c,s),c.save(),c.translate(I,P),c.transform(u,m,p,f,S,k),c.translate(-I,-P),c.drawImage(h,0,0,O,N),c.restore()}e(s)}).catch(i)})}}rt.$name=D,rt.$version="2.0.0-rc.2";var Re=":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}";class ct extends M{constructor(){super(...arguments),this.$style=Re,this.bordered=!1,this.columns=3,this.covered=!1,this.rows=3,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(t,e,i){Object.is(i,e)||(super.$propertyChangedCallback(t,e,i),(t==="rows"||t==="columns")&&this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const t=this.$getShadowRoot(),e=document.createDocumentFragment();for(let i=0;i<this.rows;i+=1){const s=document.createElement("span");s.setAttribute("role","row");for(let n=0;n<this.columns;n+=1){const r=document.createElement("span");r.setAttribute("role","gridcell"),s.appendChild(r)}e.appendChild(s)}t&&(t.innerHTML="",t.appendChild(e))}}ct.$name=oe,ct.$version="2.0.0-rc.2";var Ie=':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}';class ht extends M{constructor(){super(...arguments),this.$style=Ie,this.centered=!1,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}ht.$name=ae,ht.$version="2.0.0-rc.2";var Pe=":host{display:block;height:100%;overflow:hidden;position:relative;width:100%}";const Zt=new WeakMap,Kt=new WeakMap,Gt=new WeakMap,Ft=new WeakMap,Me="both",ze="horizontal",qt="vertical",De="none";class lt extends M{constructor(){super(...arguments),this.$onSelectionChange=null,this.$onSourceImageLoad=null,this.$onSourceImageTransform=null,this.$scale=1,this.$style=Pe,this.resize=qt,this.selection="",this.slottable=!1}set $image(t){Kt.set(this,t)}get $image(){return Kt.get(this)}set $sourceImage(t){Ft.set(this,t)}get $sourceImage(){return Ft.get(this)}set $canvas(t){Zt.set(this,t)}get $canvas(){return Zt.get(this)}set $selection(t){Gt.set(this,t)}get $selection(){return Gt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){super.connectedCallback();let t=null;if(this.selection?t=this.ownerDocument.querySelector(this.selection):t=this.closest(this.$getTagNameOf(D)),Nt(t)){this.$selection=t,this.$onSelectionChange=this.$handleSelectionChange.bind(this),E(t,B,this.$onSelectionChange);const e=t.closest(this.$getTagNameOf(j));if(e){this.$canvas=e;const i=e.querySelector(this.$getTagNameOf(q));i&&(this.$sourceImage=i,this.$image=i.cloneNode(!0),this.$getShadowRoot().appendChild(this.$image),this.$onSourceImageLoad=this.$handleSourceImageLoad.bind(this),this.$onSourceImageTransform=this.$handleSourceImageTransform.bind(this),E(i.$image,Y,this.$onSourceImageLoad),E(i,$t,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:t,$sourceImage:e}=this;t&&this.$onSelectionChange&&(y(t,B,this.$onSelectionChange),this.$onSelectionChange=null),e&&this.$onSourceImageLoad&&(y(e.$image,Y,this.$onSourceImageLoad),this.$onSourceImageLoad=null),e&&this.$onSourceImageTransform&&(y(e,$t,this.$onSourceImageTransform),this.$onSourceImageTransform=null),super.disconnectedCallback()}$handleSelectionChange(t){this.$render(t.detail)}$handleSourceImageLoad(){const{$image:t,$sourceImage:e}=this,i=t.getAttribute("src"),s=e.getAttribute("src");s&&s!==i&&(t.setAttribute("src",s),t.$ready(()=>{setTimeout(()=>{this.$render()},50)}))}$handleSourceImageTransform(t){this.$render(void 0,t.detail.matrix)}$render(t,e){const{$canvas:i,$selection:s}=this;!t&&!s.hidden&&(t=s),(!t||t.x===0&&t.y===0&&t.width===0&&t.height===0)&&(t={x:0,y:0,width:i.offsetWidth,height:i.offsetHeight});const{x:n,y:r,width:a,height:l}=t,h={},{clientWidth:c,clientHeight:u}=this;let m=c,p=u,f=NaN;switch(this.resize){case Me:f=1,m=a,p=l,h.width=a,h.height=l;break;case ze:f=l>0?u/l:0,m=a*f,h.width=m;break;case qt:f=a>0?c/a:0,p=l*f,h.height=p;break;case De:default:c>0?f=a>0?c/a:0:u>0&&(f=l>0?u/l:0)}this.$scale=f,this.$setStyles(h),this.$sourceImage&&this.$transformImageByOffset(e??this.$sourceImage.$getTransform(),-n,-r)}$transformImageByOffset(t,e,i){const{$image:s,$scale:n,$sourceImage:r}=this;if(r&&s&&n>=0){const[a,l,h,c,u,m]=t,p=(e*c-h*i)/(a*c-h*l),f=(i*a-l*e)/(a*c-h*l),A=a*p+h*f+u,w=l*p+c*f+m;s.$ready(g=>{this.$setStyles.call(s,{width:g.naturalWidth*n,height:g.naturalHeight*n})}),s.$setTransform(a,l,h,c,A*n,w*n)}}}lt.$name=he,lt.$version="2.0.0-rc.2";/*! Cropper.js v2.0.0-rc.2 | (c) 2015-present Chen Fengyuan | MIT */st.$define(),ht.$define(),ct.$define(),ot.$define(),nt.$define(),rt.$define(),at.$define(),lt.$define();const Vt=d.defineComponent({__name:"CropperCanvas",props:{background:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},scaleStep:{default:.1},themeColor:{default:"#39f"}},setup(o,{expose:t}){var r,a;const e=d.useTemplateRef("canvasRef");st.$define();const i=d.h("cropper-canvas",{background:o.background,disabled:o.disabled,scaleStep:o.scaleStep,themeColor:o.themeColor,style:"height: 500px"}),s=(r=e.value)==null?void 0:r.$setAction,n=(a=e.value)==null?void 0:a.$toCanvas;return t({$setAction:s,$toCanvas:n}),(l,h)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(i)),{ref_key:"canvasRef",ref:e},{default:d.withCtx(()=>[d.renderSlot(l.$slots,"default")]),_:3},512))}}),Jt=d.defineComponent({__name:"CropperImage",props:{src:{},alt:{},initialCenterSize:{default:"contain"},rotatable:{type:Boolean,default:!1},scalable:{type:Boolean,default:!1},skewable:{type:Boolean,default:!1},slottable:{type:Boolean,default:!1},translatable:{type:Boolean,default:!1}},setup(o){nt.$define();const t=d.h("cropper-image",{src:o.src,alt:o.alt,initialCenterSize:o.initialCenterSize,rotatable:o.rotatable,scalable:o.scalable,skewable:o.skewable,slottable:o.slottable,translatable:o.translatable});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),Qt=d.defineComponent({__name:"CropperShade",props:{x:{default:0},y:{default:0},width:{default:0},height:{default:0},slottable:{type:Boolean,default:!1},themeColor:{default:"rgba(0, 0, 0, 0.65)"},hidden:{type:Boolean,default:!1}},setup(o){at.$define();const t=d.h("cropper-shade",{x:o.x,y:o.y,width:o.width,height:o.height,slottable:o.slottable,themeColor:o.themeColor,hidden:o.hidden});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),te=d.defineComponent({__name:"CropperHandle",props:{action:{default:"none"},plain:{type:Boolean,default:!1},slottable:{type:Boolean,default:!1},themeColor:{default:"rgba(51, 153, 255, 0.5)"}},setup(o){ot.$define();const t=d.h("cropper-handle",{action:o.action,plain:o.plain,slottable:o.slottable,themeColor:o.themeColor});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),ee=d.defineComponent({__name:"CropperSelection",props:{x:{default:0},y:{default:0},width:{default:0},height:{default:0},aspectRatio:{},initialAspectRatio:{},initialCoverage:{},dynamic:{type:Boolean,default:!1},movable:{type:Boolean,default:!1},resizable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},keyboard:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},precise:{type:Boolean,default:!1}},setup(o){rt.$define();const t=d.h("cropper-selection",{x:o.x,y:o.y,width:o.width,height:o.height,aspectRatio:o.aspectRatio,initialAspectRatio:o.initialAspectRatio,initialCoverage:o.initialCoverage,dynamic:o.dynamic,movable:o.movable,resizable:o.resizable,zoomable:o.zoomable,multiple:o.multiple,keyboard:o.keyboard,outlined:o.outlined,precise:o.precise});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t)),null,{default:d.withCtx(()=>[d.renderSlot(e.$slots,"default")]),_:3}))}}),ie=d.defineComponent({__name:"CropperCrosshair",props:{centered:{type:Boolean,default:!1}},setup(o){ht.$define();const t=d.h("cropper-crosshair",{centered:o.centered});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),se=d.defineComponent({__name:"CropperGrid",props:{role:{default:"grid"},covered:{type:Boolean,default:!1}},setup(o){ct.$define();const t=d.h("cropper-grid",{role:o.role,covered:o.covered});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),ne=d.defineComponent({__name:"CropperViewer",props:{resize:{default:"vertical"},selection:{default:""}},setup(o){lt.$define();const t=d.h("cropper-viewer",{resize:o.resize,selection:o.selection});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),_e={install:o=>{o.component("CropperCanvas",Vt),o.component("CropperImage",Jt),o.component("CropperShade",Qt),o.component("CropperHandle",te),o.component("CropperSelection",ee),o.component("CropperCrosshair",ie),o.component("CropperGrid",se),o.component("CropperViewer",ne)}};T.CropperCanvas=Vt,T.CropperCrosshair=ie,T.CropperGrid=se,T.CropperHandle=te,T.CropperImage=Jt,T.CropperSelection=ee,T.CropperShade=Qt,T.CropperViewer=ne,T.default=_e,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(k,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],d):(k=typeof globalThis<"u"?globalThis:k||self,d(k["vue-cropperjs2"]={},k.Vue))})(this,function(k,d){"use strict";const F=typeof window<"u"&&typeof window.document<"u",R=F?window:{},dt=F?"ontouchstart"in R.document.documentElement:!1,ft=F?"PointerEvent"in R:!1,z="cropper",j=`${z}-canvas`,ae=`${z}-crosshair`,oe=`${z}-grid`,re=`${z}-handle`,q=`${z}-image`,_=`${z}-selection`,he=`${z}-shade`,ce=`${z}-viewer`,V="select",gt="move",H="scale",ut="rotate",J="transform",D="none",bt="n-resize",Ct="e-resize",vt="s-resize",yt="w-resize",U="ne-resize",Z="nw-resize",K="se-resize",G="sw-resize",le="action",de=dt?"touchend touchcancel":"mouseup",fe=dt?"touchmove":"mousemove",Et=ft?"pointerdown":dt?"touchstart":"mousedown",wt=ft?"pointermove":fe,St=ft?"pointerup pointercancel":de,At="error",Tt="keydown",Y="load",kt="wheel",L="action",W="actionend",ue="actionmove",X="actionstart",B="change",$t="transform";function $e(o){return typeof o=="string"}const xt=Number.isNaN||R.isNaN;function $(o){return typeof o=="number"&&!xt(o)}function x(o){return $(o)&&o>0&&o<1/0}function me(o){return typeof o>"u"}function Ot(o){return typeof o=="object"&&o!==null}const{hasOwnProperty:pe}=Object.prototype;function Q(o){if(!Ot(o))return!1;try{const{constructor:t}=o,{prototype:e}=t;return t&&e&&pe.call(e,"isPrototypeOf")}catch{return!1}}function mt(o){return typeof o=="function"}function Nt(o){return typeof o=="object"&&o!==null&&o.nodeType===1}const ge=/([a-z\d])([A-Z])/g;function Rt(o){return String(o).replace(ge,"$1-$2").toLowerCase()}const be=/-[A-z\d]/g;function It(o){return o.replace(be,t=>t.slice(1).toUpperCase())}const Pt=/\s\s*/;function y(o,t,e,i){t.trim().split(Pt).forEach(s=>{o.removeEventListener(s,e,i)})}function E(o,t,e,i){t.trim().split(Pt).forEach(s=>{o.addEventListener(s,e,i)})}function Mt(o,t,e,i){E(o,t,e,Object.assign(Object.assign({},i),{once:!0}))}const Ce={bubbles:!0,cancelable:!0,composed:!0};function ve(o,t,e,i){return o.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},Ce),{detail:e}),i)))}const zt=Promise.resolve();function ye(o,t){return t?zt.then(o?t.bind(o):t):zt}function _t(o){const{documentElement:t}=o.ownerDocument,e=o.getBoundingClientRect();return{left:e.left+(R.pageXOffset-t.clientLeft),top:e.top+(R.pageYOffset-t.clientTop)}}const Ee=/deg|g?rad|turn$/i;function pt(o){const t=parseFloat(o)||0;if(t!==0){const[e="rad"]=String(o).match(Ee)||[];switch(e.toLowerCase()){case"deg":return t/360*(Math.PI*2);case"grad":return t/400*(Math.PI*2);case"turn":return t*(Math.PI*2)}}return t}const Dt="contain",we="cover";function tt(o,t=Dt){const{aspectRatio:e}=o;let{width:i,height:s}=o;const n=x(i),h=x(s);if(n&&h){const a=s*e;t===Dt&&a>i||t===we&&a<i?s=i/e:i=s*e}else n?s=i/e:h&&(i=s*e);return{width:i,height:s}}function Bt(o,...t){if(t.length===0)return o;const[e,i,s,n,h,a]=o,[l,c,r,u,m,p]=t[0];return o=[e*l+s*c,i*l+n*c,e*r+s*u,i*r+n*u,e*m+s*p+h,i*m+n*p+a],Bt(o,...t.slice(1))}var Se=":host([hidden]){display:none!important}";const Ae=/left|top|width|height/i,Wt="open",et=new WeakMap,it=new WeakMap,Xt=new Map,Ht=R.document&&Array.isArray(R.document.adoptedStyleSheets)&&"replaceSync"in R.CSSStyleSheet.prototype;class M extends HTMLElement{get $sharedStyle(){return`${this.themeColor?`:host{--theme-color: ${this.themeColor};}`:""}${Se}`}constructor(){var t,e;super(),this.shadowRootMode=Wt,this.slottable=!0;const i=(e=(t=Object.getPrototypeOf(this))===null||t===void 0?void 0:t.constructor)===null||e===void 0?void 0:e.$name;i&&Xt.set(i,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,i){if(Object.is(i,e))return;const s=It(t),n=this[s];let h=i;switch(typeof n){case"boolean":h=i!==null&&i!=="false";break;case"number":h=Number(i);break}switch(this[s]=h,t){case"theme-color":{const a=it.get(this),l=this.$sharedStyle;a&&l&&(Ht?a.replaceSync(l):a.textContent=l);break}}}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(t=Rt(t),typeof i){case"boolean":i===!0?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":xt(i)?i="":i=String(i);default:i?this.getAttribute(t)!==i&&this.setAttribute(t,i):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const i=It(e);let s=this[i];me(s)||this.$propertyChangedCallback(i,void 0,s),Object.defineProperty(this,i,{enumerable:!0,configurable:!0,get(){return s},set(n){const h=s;s=n,this.$propertyChangedCallback(i,h,n)}})});const t=this.attachShadow({mode:this.shadowRootMode||Wt});if(this.shadowRoot||et.set(this,t),it.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){it.has(this)&&it.delete(this),et.has(this)&&et.delete(this)}$getTagNameOf(t){var e;return(e=Xt.get(t))!==null&&e!==void 0?e:t}$setStyles(t){return Object.keys(t).forEach(e=>{let i=t[e];$(i)&&(i!==0&&Ae.test(e)?i=`${i}px`:i=String(i)),this.style[e]=i}),this}$getShadowRoot(){return this.shadowRoot||et.get(this)}$addStyles(t){let e;const i=this.$getShadowRoot();return Ht?(e=new CSSStyleSheet,e.replaceSync(t),i.adoptedStyleSheets=i.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,i.appendChild(e)),e}$emit(t,e,i){return ve(this,t,e,i)}$nextTick(t){return ye(this,t)}static $define(t,e){Ot(t)&&(e=t,t=""),t||(t=this.$name||this.name),t=Rt(t),F&&R.customElements&&!R.customElements.get(t)&&customElements.define(t,this,e)}}M.$version="2.0.0-rc.2";var Te=':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}';class st extends M{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=new Map,this.$style=Te,this.$action=D,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"disabled":i?this.$unbind():this.$bind();break}}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),E(this,Et,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),E(this.ownerDocument,wt,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),E(this.ownerDocument,St,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),E(this,kt,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(y(this,Et,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(y(this.ownerDocument,wt,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(y(this.ownerDocument,St,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(y(this,kt,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(t){const{buttons:e,button:i,type:s}=t;if(this.disabled||(s==="pointerdown"&&t.pointerType==="mouse"||s==="mousedown")&&($(e)&&e!==1||$(i)&&i!==0||t.ctrlKey))return;const{$pointers:n}=this;let h="";if(t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:a,pageX:l,pageY:c})=>{n.set(a,{startX:l,startY:c,endX:l,endY:c})});else{const{pointerId:a=0,pageX:l,pageY:c}=t;n.set(a,{startX:l,startY:c,endX:l,endY:c})}n.size>1?h=J:Nt(t.target)&&(h=t.target.action||t.target.getAttribute(le)||""),this.$emit(X,{action:h,relatedEvent:t})!==!1&&(t.preventDefault(),this.$action=h,this.style.willChange="transform")}$handlePointerMove(t){const{$action:e,$pointers:i}=this;if(this.disabled||e===D||i.size===0||this.$emit(ue,{action:e,relatedEvent:t})===!1)return;if(t.preventDefault(),t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:n,pageX:h,pageY:a})=>{const l=i.get(n);l&&Object.assign(l,{endX:h,endY:a})});else{const{pointerId:n=0,pageX:h,pageY:a}=t,l=i.get(n);l&&Object.assign(l,{endX:h,endY:a})}const s={action:e,relatedEvent:t};if(e===J){const n=new Map(i);let h=0,a=0,l=0,c=0,r=t.pageX,u=t.pageY;i.forEach((f,A)=>{n.delete(A),n.forEach(w=>{let g=w.startX-f.startX,v=w.startY-f.startY,b=w.endX-f.endX,C=w.endY-f.endY,S=0,T=0,O=0,N=0;if(g===0?v<0?O=Math.PI*2:v>0&&(O=Math.PI):g>0?O=Math.PI/2+Math.atan(v/g):g<0&&(O=Math.PI*1.5+Math.atan(v/g)),b===0?C<0?N=Math.PI*2:C>0&&(N=Math.PI):b>0?N=Math.PI/2+Math.atan(C/b):b<0&&(N=Math.PI*1.5+Math.atan(C/b)),N>0||O>0){const I=N-O,P=Math.abs(I);P>h&&(h=P,l=I,r=(f.startX+w.startX)/2,u=(f.startY+w.startY)/2)}if(g=Math.abs(g),v=Math.abs(v),b=Math.abs(b),C=Math.abs(C),g>0&&v>0?S=Math.sqrt(g*g+v*v):g>0?S=g:v>0&&(S=v),b>0&&C>0?T=Math.sqrt(b*b+C*C):b>0?T=b:C>0&&(T=C),S>0&&T>0){const I=(T-S)/S,P=Math.abs(I);P>a&&(a=P,c=I,r=(f.startX+w.startX)/2,u=(f.startY+w.startY)/2)}})});const m=h>0,p=a>0;m&&p?(s.rotate=l,s.scale=c,s.centerX=r,s.centerY=u):m?(s.action=ut,s.rotate=l,s.centerX=r,s.centerY=u):p?(s.action=H,s.scale=c,s.centerX=r,s.centerY=u):s.action=D}else{const[n]=Array.from(i.values());Object.assign(s,n)}i.forEach(n=>{n.startX=n.endX,n.startY=n.endY}),s.action!==D&&this.$emit(L,s,{cancelable:!1})}$handlePointerUp(t){const{$action:e,$pointers:i}=this;if(!(this.disabled||e===D)&&this.$emit(W,{action:e,relatedEvent:t})!==!1){if(t.preventDefault(),t.changedTouches)Array.from(t.changedTouches).forEach(({identifier:s})=>{i.delete(s)});else{const{pointerId:s=0}=t;i.delete(s)}i.size===0&&(this.style.willChange="",this.$action=D)}}$handleWheel(t){if(this.disabled||(t.preventDefault(),this.$wheeling))return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const i=(t.deltaY>0?-1:1)*this.scaleStep;this.$emit(L,{action:H,scale:i,relatedEvent:t},{cancelable:!1})}$setAction(t){return $e(t)&&(this.$action=t),this}$toCanvas(t){return new Promise((e,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const s=document.createElement("canvas");let n=this.offsetWidth,h=this.offsetHeight,a=1;Q(t)&&(x(t.width)||x(t.height))&&({width:n,height:h}=tt({aspectRatio:n/h,width:t.width,height:t.height}),a=n/this.offsetWidth),s.width=n,s.height=h;const l=this.querySelector(this.$getTagNameOf(q));if(!l){e(s);return}l.$ready().then(c=>{const r=s.getContext("2d");if(r){const[u,m,p,f,A,w]=l.$getTransform();let g=A,v=w,b=c.naturalWidth,C=c.naturalHeight;a!==1&&(g*=a,v*=a,b*=a,C*=a);const S=b/2,T=C/2;r.fillStyle="transparent",r.fillRect(0,0,n,h),Q(t)&&mt(t.beforeDraw)&&t.beforeDraw.call(this,r,s),r.save(),r.translate(S,T),r.transform(u,m,p,f,g,v),r.translate(-S,-T),r.drawImage(c,0,0,b,C),r.restore()}e(s)}).catch(i)})}}st.$name=j,st.$version="2.0.0-rc.2";var ke=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}";const Yt=new WeakMap,Lt=["alt","crossorigin","decoding","importance","loading","referrerpolicy","sizes","src","srcset"];class nt extends M{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=ke,this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1}set $canvas(t){Yt.set(this,t)}get $canvas(){return Yt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Lt,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(t,e,i){Object.is(i,e)||(super.attributeChangedCallback(t,e,i),Lt.includes(t)&&this.$image.setAttribute(t,i))}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"initialCenterSize":this.$nextTick(()=>{this.$center(i)});break}}connectedCallback(){super.connectedCallback();const{$image:t}=this,e=this.closest(this.$getTagNameOf(j));e&&(this.$canvas=e,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=i=>{var s,n;this.$actionStartTarget=(n=(s=i.detail)===null||s===void 0?void 0:s.relatedEvent)===null||n===void 0?void 0:n.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),E(e,X,this.$onCanvasActionStart),E(e,W,this.$onCanvasActionEnd),E(e,L,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),E(t,Y,this.$onLoad),this.$getShadowRoot().appendChild(t)}disconnectedCallback(){const{$image:t,$canvas:e}=this;e&&(this.$onCanvasActionStart&&(y(e,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(e,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(y(e,L,this.$onCanvasAction),this.$onCanvasAction=null)),t&&this.$onLoad&&(y(t,Y,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(t),super.disconnectedCallback()}$handleLoad(){const{$image:t}=this;this.$setStyles({width:t.naturalWidth,height:t.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(t){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:e}=this,{detail:i}=t;if(i){const{relatedEvent:s}=i;let{action:n}=i;switch(n===J&&(!this.rotatable||!this.scalable)&&(this.rotatable?n=ut:this.scalable?n=H:n=D),n){case gt:if(this.translatable){let h=null;s&&(h=s.target.closest(this.$getTagNameOf(_))),h||(h=e.querySelector(this.$getTagNameOf(_))),h&&h.multiple&&!h.active&&(h=e.querySelector(`${this.$getTagNameOf(_)}[active]`)),(!h||h.hidden||!h.movable||h.dynamic||!(this.$actionStartTarget&&h.contains(this.$actionStartTarget)))&&this.$move(i.endX-i.startX,i.endY-i.startY)}break;case ut:if(this.rotatable)if(s){const{x:h,y:a}=this.getBoundingClientRect();this.$rotate(i.rotate,s.clientX-h,s.clientY-a)}else this.$rotate(i.rotate);break;case H:if(this.scalable)if(s){const h=s.target.closest(this.$getTagNameOf(_));if(!h||!h.zoomable||h.zoomable&&h.dynamic){const{x:a,y:l}=this.getBoundingClientRect();this.$zoom(i.scale,s.clientX-a,s.clientY-l)}}else this.$zoom(i.scale);break;case J:if(this.rotatable&&this.scalable){const{rotate:h}=i;let{scale:a}=i;a<0?a=1/(1-a):a+=1;const l=Math.cos(h),c=Math.sin(h),[r,u,m,p]=[l*a,c*a,-c*a,l*a];if(s){const f=this.getBoundingClientRect(),A=s.clientX-f.x,w=s.clientY-f.y,[g,v,b,C]=this.$matrix,S=f.width/2,T=f.height/2,O=A-S,N=w-T,I=(O*C-b*N)/(g*C-b*v),P=(N*g-v*O)/(g*C-b*v);this.$transform(r,u,m,p,I*(1-r)+P*m,P*(1-p)+I*u)}else this.$transform(r,u,m,p,0,0)}break}}}$ready(t){const{$image:e}=this,i=new Promise((s,n)=>{const h=new Error("Failed to load the image source");if(e.complete)e.naturalWidth>0&&e.naturalHeight>0?s(e):n(h);else{const a=()=>{y(e,At,l),s(e)},l=()=>{y(e,Y,a),n(h)};Mt(e,Y,a),Mt(e,At,l)}});return mt(t)&&i.then(s=>(t(s),s)),i}$center(t){const{parentElement:e}=this;if(!e)return this;const i=e.getBoundingClientRect(),s=i.width,n=i.height,{x:h,y:a,width:l,height:c}=this.getBoundingClientRect(),r=h+l/2,u=a+c/2,m=i.x+s/2,p=i.y+n/2;if(this.$move(m-r,p-u),t&&(l!==s||c!==n)){const f=s/l,A=n/c;switch(t){case"cover":this.$scale(Math.max(f,A));break;case"contain":this.$scale(Math.min(f,A));break}}return this}$move(t,e=t){if(this.translatable&&$(t)&&$(e)){const[i,s,n,h]=this.$matrix,a=(t*h-n*e)/(i*h-n*s),l=(e*i-s*t)/(i*h-n*s);this.$translate(a,l)}return this}$moveTo(t,e=t){if(this.translatable&&$(t)&&$(e)){const[i,s,n,h]=this.$matrix,a=(t*h-n*e)/(i*h-n*s),l=(e*i-s*t)/(i*h-n*s);this.$setTransform(i,s,n,h,a,l)}return this}$rotate(t,e,i){if(this.rotatable){const s=pt(t),n=Math.cos(s),h=Math.sin(s),[a,l,c,r]=[n,h,-h,n];if($(e)&&$(i)){const[u,m,p,f]=this.$matrix,{width:A,height:w}=this.getBoundingClientRect(),g=A/2,v=w/2,b=e-g,C=i-v,S=(b*f-p*C)/(u*f-p*m),T=(C*u-m*b)/(u*f-p*m);this.$transform(a,l,c,r,S*(1-a)-T*c,T*(1-r)-S*l)}else this.$transform(a,l,c,r,0,0)}return this}$zoom(t,e,i){if(!this.scalable||t===0)return this;if(t<0?t=1/(1-t):t+=1,$(e)&&$(i)){const[s,n,h,a]=this.$matrix,{width:l,height:c}=this.getBoundingClientRect(),r=l/2,u=c/2,m=e-r,p=i-u,f=(m*a-h*p)/(s*a-h*n),A=(p*s-n*m)/(s*a-h*n);this.$transform(t,0,0,t,f*(1-t),A*(1-t))}else this.$scale(t);return this}$scale(t,e=t){return this.scalable&&this.$transform(t,0,0,e,0,0),this}$skew(t,e=0){if(this.skewable){const i=pt(t),s=pt(e);this.$transform(1,Math.tan(s),Math.tan(i),1,0,0)}return this}$translate(t,e=t){return this.translatable&&$(t)&&$(e)&&this.$transform(1,0,0,1,t,e),this}$transform(t,e,i,s,n,h){return $(t)&&$(e)&&$(i)&&$(s)&&$(n)&&$(h)?this.$setTransform(Bt(this.$matrix,[t,e,i,s,n,h])):this}$setTransform(t,e,i,s,n,h){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(t)&&([t,e,i,s,n,h]=t),$(t)&&$(e)&&$(i)&&$(s)&&$(n)&&$(h))){const a=[...this.$matrix],l=[t,e,i,s,n,h];if(this.$emit($t,{matrix:l,oldMatrix:a})===!1)return this;this.$matrix=l,this.style.transform=`matrix(${l.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}nt.$name=q,nt.$version="2.0.0-rc.2";var xe=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}";const jt=new WeakMap;class at extends M{constructor(){super(...arguments),this.$onCanvasChange=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$style=xe,this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(t){jt.set(this,t)}get $canvas(){return jt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(j));if(t){this.$canvas=t,this.style.position="absolute";const e=t.querySelector(this.$getTagNameOf(_));e&&(this.$onCanvasActionStart=i=>{e.hidden&&i.detail.action===V&&(this.hidden=!1)},this.$onCanvasActionEnd=i=>{e.hidden&&i.detail.action===V&&(this.hidden=!0)},this.$onCanvasChange=i=>{const{x:s,y:n,width:h,height:a}=i.detail;this.$change(s,n,h,a),(e.hidden||s===0&&n===0&&h===0&&a===0)&&(this.hidden=!0)},E(t,X,this.$onCanvasActionStart),E(t,W,this.$onCanvasActionEnd),E(t,B,this.$onCanvasChange))}this.$render()}disconnectedCallback(){const{$canvas:t}=this;t&&(this.$onCanvasActionStart&&(y(t,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(t,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasChange&&(y(t,B,this.$onCanvasChange),this.$onCanvasChange=null)),super.disconnectedCallback()}$change(t,e,i=this.width,s=this.height){return!$(t)||!$(e)||!$(i)||!$(s)||t===this.x&&e===this.y&&i===this.width&&s===this.height?this:(this.hidden&&(this.hidden=!1),this.x=t,this.y=e,this.width=i,this.height=s,this.$render())}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:R.innerWidth})}}at.$name=he,at.$version="2.0.0-rc.2";var Oe=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}';class ot extends M{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=Oe,this.action=D,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}ot.$name=re,ot.$version="2.0.0-rc.2";var Ne=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}';const Ut=new WeakMap;class rt extends M{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=Ne,this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(t){Ut.set(this,t)}get $canvas(){return Ut.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(t,e,i){if(!Object.is(i,e))switch(super.$propertyChangedCallback(t,e,i),t){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{x(i)&&i<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(i?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),E(this.ownerDocument,Tt,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(y(this.ownerDocument,Tt,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const s=this.$getSelections();i?(s.forEach(n=>{n.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,s.slice(1).forEach(n=>{this.$removeSelection(n)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":i&&(this.dynamic=!0);break}}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(j));t?(this.$canvas=t,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),E(t,X,this.$onCanvasActionStart),E(t,W,this.$onCanvasActionEnd),E(t,L,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:t}=this;t&&(this.$onCanvasActionStart&&(y(t,X,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(y(t,W,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(y(t,L,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let t=[];return this.parentElement&&(t=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(_)))),t}$initSelection(t=!1,e=!1){const{initialCoverage:i,parentElement:s}=this;if(x(i)&&s){const n=this.aspectRatio||this.initialAspectRatio;let h=(e?0:this.width)||s.offsetWidth*i,a=(e?0:this.height)||s.offsetHeight*i;x(n)&&({width:h,height:a}=tt({aspectRatio:n,width:h,height:a})),this.$change(this.x,this.y,h,a),t&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const t=this.cloneNode(!0);return this.hasAttribute("id")&&t.removeAttribute("id"),t.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(t,this.nextSibling),t}$removeSelection(t=this){if(this.parentElement){const e=this.$getSelections();if(e.length>1){const i=e.indexOf(t),s=e[i+1]||e[i-1];s&&(t.active=!1,this.parentElement.removeChild(t),s.active=!0,s.$emit(B,{x:s.x,y:s.y,width:s.width,height:s.height}))}else this.$clear()}}$handleActionStart(t){var e,i;const s=(i=(e=t.detail)===null||e===void 0?void 0:e.relatedEvent)===null||i===void 0?void 0:i.target;this.$action="",this.$actionStartTarget=s,!this.hidden&&this.multiple&&!this.active&&s===this&&this.parentElement&&(this.$getSelections().forEach(n=>{n.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(t){const{currentTarget:e,detail:i}=t;if(!e||!i)return;const{relatedEvent:s}=i;let{action:n}=i;if(!n&&this.multiple&&(n=this.$action||(s==null?void 0:s.target.action),this.$action=n),!n||this.hidden&&n!==V||this.multiple&&!this.active&&n!==H)return;const h=i.endX-i.startX,a=i.endY-i.startY,{width:l,height:c}=this;let{aspectRatio:r}=this;switch(!x(r)&&s.shiftKey&&(r=x(l)&&x(c)?l/c:1),n){case V:if(h!==0&&a!==0){const{$canvas:u}=this,m=_t(e);(this.multiple&&!this.hidden?this.$createSelection():this).$change(i.startX-m.left,i.startY-m.top,Math.abs(h),Math.abs(a),r),h<0?a<0?n=Z:a>0&&(n=G):h>0&&(a<0?n=U:a>0&&(n=K)),u&&(u.$action=n)}break;case gt:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(h,a);break;case H:if(s&&this.zoomable&&(this.dynamic||this.contains(s.target))){const u=_t(e);this.$zoom(i.scale,s.pageX-u.left,s.pageY-u.top)}break;default:this.$resize(n,h,a,r)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(t){if(this.hidden||!this.keyboard||this.multiple&&!this.active||t.defaultPrevented)return;const{activeElement:e}=document;if(!(e&&(["INPUT","TEXTAREA"].includes(e.tagName)||["true","plaintext-only"].includes(e.contentEditable))))switch(t.key){case"Backspace":t.metaKey&&(t.preventDefault(),this.$removeSelection());break;case"Delete":t.preventDefault(),this.$removeSelection();break;case"ArrowLeft":t.preventDefault(),this.$move(-1,0);break;case"ArrowRight":t.preventDefault(),this.$move(1,0);break;case"ArrowUp":t.preventDefault(),this.$move(0,-1);break;case"ArrowDown":t.preventDefault(),this.$move(0,1);break;case"+":t.preventDefault(),this.$zoom(.1);break;case"-":t.preventDefault(),this.$zoom(-.1);break}}$center(){const{parentElement:t}=this;if(!t)return this;const e=(t.offsetWidth-this.width)/2,i=(t.offsetHeight-this.height)/2;return this.$change(e,i)}$move(t,e=t){return this.$moveTo(this.x+t,this.y+e)}$moveTo(t,e=t){return this.movable?this.$change(t,e):this}$resize(t,e=0,i=0,s=this.aspectRatio){if(!this.resizable)return this;const n=x(s),{$canvas:h}=this;let{x:a,y:l,width:c,height:r}=this;switch(t){case bt:l+=i,r-=i,r<0&&(t=vt,r=-r,l-=r),n&&(e=i*s,a+=e/2,c-=e,c<0&&(c=-c,a-=c));break;case Ct:c+=e,c<0&&(t=yt,c=-c,a-=c),n&&(i=e/s,l-=i/2,r+=i,r<0&&(r=-r,l-=r));break;case vt:r+=i,r<0&&(t=bt,r=-r,l-=r),n&&(e=i*s,a-=e/2,c+=e,c<0&&(c=-c,a-=c));break;case yt:a+=e,c-=e,c<0&&(t=Ct,c=-c,a-=c),n&&(i=e/s,l+=i/2,r-=i,r<0&&(r=-r,l-=r));break;case U:n&&(i=-e/s),l+=i,r-=i,c+=e,c<0&&r<0?(t=G,c=-c,r=-r,a-=c,l-=r):c<0?(t=Z,c=-c,a-=c):r<0&&(t=K,r=-r,l-=r);break;case Z:n&&(i=e/s),a+=e,l+=i,c-=e,r-=i,c<0&&r<0?(t=K,c=-c,r=-r,a-=c,l-=r):c<0?(t=U,c=-c,a-=c):r<0&&(t=G,r=-r,l-=r);break;case K:n&&(i=e/s),c+=e,r+=i,c<0&&r<0?(t=Z,c=-c,r=-r,a-=c,l-=r):c<0?(t=G,c=-c,a-=c):r<0&&(t=U,r=-r,l-=r);break;case G:n&&(i=-e/s),a+=e,c-=e,r+=i,c<0&&r<0?(t=U,c=-c,r=-r,a-=c,l-=r):c<0?(t=K,c=-c,a-=c):r<0&&(t=Z,r=-r,l-=r);break}return h&&h.$setAction(t),this.$change(a,l,c,r)}$zoom(t,e,i){if(!this.zoomable||t===0)return this;t<0?t=1/(1-t):t+=1;const{width:s,height:n}=this,h=s*t,a=n*t;let l=this.x,c=this.y;return $(e)&&$(i)?(l-=(h-s)*((e-this.x)/s),c-=(a-n)*((i-this.y)/n)):(l-=(h-s)/2,c-=(a-n)/2),this.$change(l,c,h,a)}$change(t,e,i=this.width,s=this.height,n=this.aspectRatio,h=!1){return this.$changing||!$(t)||!$(e)||!$(i)||!$(s)||i<0||s<0?this:(x(n)&&({width:i,height:s}=tt({aspectRatio:n,width:i,height:s},"cover")),this.precise||(t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s)),t===this.x&&e===this.y&&i===this.width&&s===this.height&&Object.is(n,this.aspectRatio)&&!h?this:(this.hidden&&(this.hidden=!1),this.$emit(B,{x:t,y:e,width:i,height:s})===!1?this:(this.$changing=!0,this.x=t,this.y=e,this.width=i,this.height=s,this.$changing=!1,this.$render())))}$reset(){const{x:t,y:e,width:i,height:s}=this.$initialSelection;return this.$change(t,e,i,s)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(t){return new Promise((e,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const s=document.createElement("canvas");let{width:n,height:h}=this,a=1;if(Q(t)&&(x(t.width)||x(t.height))&&({width:n,height:h}=tt({aspectRatio:n/h,width:t.width,height:t.height}),a=n/this.width),s.width=n,s.height=h,!this.$canvas){e(s);return}const l=this.$canvas.querySelector(this.$getTagNameOf(q));if(!l){e(s);return}l.$ready().then(c=>{const r=s.getContext("2d");if(r){const[u,m,p,f,A,w]=l.$getTransform(),g=-this.x,v=-this.y,b=(g*f-p*v)/(u*f-p*m),C=(v*u-m*g)/(u*f-p*m);let S=u*b+p*C+A,T=m*b+f*C+w,O=c.naturalWidth,N=c.naturalHeight;a!==1&&(S*=a,T*=a,O*=a,N*=a);const I=O/2,P=N/2;r.fillStyle="transparent",r.fillRect(0,0,n,h),Q(t)&&mt(t.beforeDraw)&&t.beforeDraw.call(this,r,s),r.save(),r.translate(I,P),r.transform(u,m,p,f,S,T),r.translate(-I,-P),r.drawImage(c,0,0,O,N),r.restore()}e(s)}).catch(i)})}}rt.$name=_,rt.$version="2.0.0-rc.2";var Re=":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}";class ht extends M{constructor(){super(...arguments),this.$style=Re,this.bordered=!1,this.columns=3,this.covered=!1,this.rows=3,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(t,e,i){Object.is(i,e)||(super.$propertyChangedCallback(t,e,i),(t==="rows"||t==="columns")&&this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const t=this.$getShadowRoot(),e=document.createDocumentFragment();for(let i=0;i<this.rows;i+=1){const s=document.createElement("span");s.setAttribute("role","row");for(let n=0;n<this.columns;n+=1){const h=document.createElement("span");h.setAttribute("role","gridcell"),s.appendChild(h)}e.appendChild(s)}t&&(t.innerHTML="",t.appendChild(e))}}ht.$name=oe,ht.$version="2.0.0-rc.2";var Ie=':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}';class ct extends M{constructor(){super(...arguments),this.$style=Ie,this.centered=!1,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}ct.$name=ae,ct.$version="2.0.0-rc.2";var Pe=":host{display:block;height:100%;overflow:hidden;position:relative;width:100%}";const Zt=new WeakMap,Kt=new WeakMap,Gt=new WeakMap,Ft=new WeakMap,Me="both",ze="horizontal",qt="vertical",_e="none";class lt extends M{constructor(){super(...arguments),this.$onSelectionChange=null,this.$onSourceImageLoad=null,this.$onSourceImageTransform=null,this.$scale=1,this.$style=Pe,this.resize=qt,this.selection="",this.slottable=!1}set $image(t){Kt.set(this,t)}get $image(){return Kt.get(this)}set $sourceImage(t){Ft.set(this,t)}get $sourceImage(){return Ft.get(this)}set $canvas(t){Zt.set(this,t)}get $canvas(){return Zt.get(this)}set $selection(t){Gt.set(this,t)}get $selection(){return Gt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){super.connectedCallback();let t=null;if(this.selection?t=this.ownerDocument.querySelector(this.selection):t=this.closest(this.$getTagNameOf(_)),Nt(t)){this.$selection=t,this.$onSelectionChange=this.$handleSelectionChange.bind(this),E(t,B,this.$onSelectionChange);const e=t.closest(this.$getTagNameOf(j));if(e){this.$canvas=e;const i=e.querySelector(this.$getTagNameOf(q));i&&(this.$sourceImage=i,this.$image=i.cloneNode(!0),this.$getShadowRoot().appendChild(this.$image),this.$onSourceImageLoad=this.$handleSourceImageLoad.bind(this),this.$onSourceImageTransform=this.$handleSourceImageTransform.bind(this),E(i.$image,Y,this.$onSourceImageLoad),E(i,$t,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:t,$sourceImage:e}=this;t&&this.$onSelectionChange&&(y(t,B,this.$onSelectionChange),this.$onSelectionChange=null),e&&this.$onSourceImageLoad&&(y(e.$image,Y,this.$onSourceImageLoad),this.$onSourceImageLoad=null),e&&this.$onSourceImageTransform&&(y(e,$t,this.$onSourceImageTransform),this.$onSourceImageTransform=null),super.disconnectedCallback()}$handleSelectionChange(t){this.$render(t.detail)}$handleSourceImageLoad(){const{$image:t,$sourceImage:e}=this,i=t.getAttribute("src"),s=e.getAttribute("src");s&&s!==i&&(t.setAttribute("src",s),t.$ready(()=>{setTimeout(()=>{this.$render()},50)}))}$handleSourceImageTransform(t){this.$render(void 0,t.detail.matrix)}$render(t,e){const{$canvas:i,$selection:s}=this;!t&&!s.hidden&&(t=s),(!t||t.x===0&&t.y===0&&t.width===0&&t.height===0)&&(t={x:0,y:0,width:i.offsetWidth,height:i.offsetHeight});const{x:n,y:h,width:a,height:l}=t,c={},{clientWidth:r,clientHeight:u}=this;let m=r,p=u,f=NaN;switch(this.resize){case Me:f=1,m=a,p=l,c.width=a,c.height=l;break;case ze:f=l>0?u/l:0,m=a*f,c.width=m;break;case qt:f=a>0?r/a:0,p=l*f,c.height=p;break;case _e:default:r>0?f=a>0?r/a:0:u>0&&(f=l>0?u/l:0)}this.$scale=f,this.$setStyles(c),this.$sourceImage&&this.$transformImageByOffset(e??this.$sourceImage.$getTransform(),-n,-h)}$transformImageByOffset(t,e,i){const{$image:s,$scale:n,$sourceImage:h}=this;if(h&&s&&n>=0){const[a,l,c,r,u,m]=t,p=(e*r-c*i)/(a*r-c*l),f=(i*a-l*e)/(a*r-c*l),A=a*p+c*f+u,w=l*p+r*f+m;s.$ready(g=>{this.$setStyles.call(s,{width:g.naturalWidth*n,height:g.naturalHeight*n})}),s.$setTransform(a,l,c,r,A*n,w*n)}}}lt.$name=ce,lt.$version="2.0.0-rc.2";/*! Cropper.js v2.0.0-rc.2 | (c) 2015-present Chen Fengyuan | MIT */st.$define(),ct.$define(),ht.$define(),ot.$define(),nt.$define(),rt.$define(),at.$define(),lt.$define();const Vt=d.defineComponent({__name:"CropperCanvas",props:{background:{type:Boolean,default:!1}},setup(o){st.$define();const t=d.h("cropper-canvas",{background:o.background,style:"height: 500px"});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t)),null,{default:d.withCtx(()=>[d.renderSlot(e.$slots,"default")]),_:3}))}}),Jt=d.defineComponent({__name:"CropperImage",props:{src:{},alt:{},initialCenterSize:{default:"contain"},rotatable:{type:Boolean,default:!1},scalable:{type:Boolean,default:!1},skewable:{type:Boolean,default:!1},slottable:{type:Boolean,default:!1},translatable:{type:Boolean,default:!1}},setup(o){nt.$define();const t=d.h("cropper-image",{src:o.src,alt:o.alt,initialCenterSize:o.initialCenterSize,rotatable:o.rotatable,scalable:o.scalable,skewable:o.skewable,slottable:o.slottable,translatable:o.translatable});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),Qt=d.defineComponent({__name:"CropperShade",props:{x:{default:0},y:{default:0},width:{default:0},height:{default:0},slottable:{type:Boolean,default:!1},themeColor:{default:"rgba(0, 0, 0, 0.65)"},hidden:{type:Boolean,default:!1}},setup(o){at.$define();const t=d.h("cropper-shade",{x:o.x,y:o.y,width:o.width,height:o.height,slottable:o.slottable,themeColor:o.themeColor,hidden:o.hidden});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),te=d.defineComponent({__name:"CropperHandle",props:{action:{default:"none"},plain:{type:Boolean,default:!1},slottable:{type:Boolean,default:!1},themeColor:{default:"rgba(51, 153, 255, 0.5)"}},setup(o){ot.$define();const t=d.h("cropper-handle",{action:o.action,plain:o.plain,slottable:o.slottable,themeColor:o.themeColor});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),ee=d.defineComponent({__name:"CropperSelection",props:{x:{default:0},y:{default:0},width:{default:0},height:{default:0},aspectRatio:{},initialAspectRatio:{},initialCoverage:{},dynamic:{type:Boolean,default:!1},movable:{type:Boolean,default:!1},resizable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},keyboard:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},precise:{type:Boolean,default:!1}},setup(o,{expose:t}){rt.$define();const e=d.h("cropper-selection",{x:o.x,y:o.y,width:o.width,height:o.height,aspectRatio:o.aspectRatio,initialAspectRatio:o.initialAspectRatio,initialCoverage:o.initialCoverage,dynamic:o.dynamic,movable:o.movable,resizable:o.resizable,zoomable:o.zoomable,multiple:o.multiple,keyboard:o.keyboard,outlined:o.outlined,precise:o.precise}),i=d.useTemplateRef("sel");return t({selection:i}),(s,n)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(e)),{ref:"sel"},{default:d.withCtx(()=>[d.renderSlot(s.$slots,"default")]),_:3},512))}}),ie=d.defineComponent({__name:"CropperCrosshair",props:{centered:{type:Boolean,default:!1}},setup(o){ct.$define();const t=d.h("cropper-crosshair",{centered:o.centered});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),se=d.defineComponent({__name:"CropperGrid",props:{role:{default:"grid"},covered:{type:Boolean,default:!1}},setup(o){ht.$define();const t=d.h("cropper-grid",{role:o.role,covered:o.covered});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),ne=d.defineComponent({__name:"CropperViewer",props:{resize:{default:"vertical"},selection:{default:""}},setup(o){lt.$define();const t=d.h("cropper-viewer",{resize:o.resize,selection:o.selection});return(e,i)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(d.unref(t))))}}),De={install:o=>{o.component("CropperCanvas",Vt),o.component("CropperImage",Jt),o.component("CropperShade",Qt),o.component("CropperHandle",te),o.component("CropperSelection",ee),o.component("CropperCrosshair",ie),o.component("CropperGrid",se),o.component("CropperViewer",ne)}};k.CropperCanvas=Vt,k.CropperCrosshair=ie,k.CropperGrid=se,k.CropperHandle=te,k.CropperImage=Jt,k.CropperSelection=ee,k.CropperShade=Qt,k.CropperViewer=ne,k.default=De,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/user-5.png
ADDED
|
Binary file
|