@orchidui/dashboard 0.8.0 → 1.0.0

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.
Files changed (27) hide show
  1. package/dist/Dashboard/Card/OcCard.js +1 -1
  2. package/dist/Dashboard/Charts/PieChart/OcPieChart.js +1 -1
  3. package/dist/Dashboard/TextEditor/QuillEditor.js +1 -1
  4. package/dist/{OcCard-CfotNHx8.js → OcCard-w0EuBfr4.js} +1 -1
  5. package/dist/{OcPieChart-B6eV6nlg.js → OcPieChart-Kn-CkXip.js} +1 -1
  6. package/dist/{QuillEditor-CTgEQ0_O.js → QuillEditor-Bm3QXhLB.js} +80 -77
  7. package/dist/index.js +71 -71
  8. package/package.json +2 -2
  9. package/dist/OcComplexCalendar-Boa7mNFU-BOc2Ou_B.js +0 -5863
  10. package/dist/OcComplexDatePicker-BydI4VSR-WtcGs_4g.js +0 -92
  11. package/dist/OcCropper-7E2i6ayU-D2MlvrOQ.js +0 -1602
  12. package/dist/OcDataTable-CsCGrRx7-BQ4BTMoM.js +0 -580
  13. package/dist/OcDraggable-CA_BCbpl-5qLRNtse.js +0 -34
  14. package/dist/OcDraggableList-BUu5SgoA-CFkaqmpK.js +0 -157
  15. package/dist/OcEmojiPicker-DYYK7OB3-bcz9JkU1.js +0 -1170
  16. package/dist/OcFilterForm-7ehuJUMp-D7aE0HSM.js +0 -83
  17. package/dist/OcFilterSearch-B4AZsLBn-C9rTBQa6.js +0 -69
  18. package/dist/OcFilterSearchFor-DfwJG-5N-BzJe6fhu.js +0 -67
  19. package/dist/OcModalCropper-Z4jlnFc5-CtKIW0ED.js +0 -46
  20. package/dist/OcTimePicker-D9fPU8_m-DXvgZvEY.js +0 -98
  21. package/dist/OcTimePopup-CXGhaOev-Bh4cnZdX.js +0 -130
  22. package/dist/SubPlanCard-DHj4RHJZ-BXLF6lxf.js +0 -79
  23. package/dist/ThumbnailSection-CJBS0QXp-CzVwtuYN.js +0 -41
  24. package/dist/ThumbnailTheme-hey6se0g-jbmLdCu-.js +0 -118
  25. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -8
  26. package/dist/index-DyVteXE3-BhWmKQss.js +0 -7340
  27. package/dist/vue-draggable-next.esm-bundler-Ci24Fze9.js +0 -1543
@@ -1,1602 +0,0 @@
1
- import { openBlock as b, createBlock as z, renderSlot as q, resolveComponent as F, createVNode as M, withCtx as I, Fragment as zt, renderList as Pt, resolveDynamicComponent as ct, withDirectives as Gt, vShow as Qt, mergeProps as Kt, withModifiers as fe, createCommentVNode as j, ref as N, watch as jt, nextTick as ve, createElementBlock as mt, createElementVNode as Z, unref as W } from "vue";
2
- import { G as tt, y as pt, T as kt, m as be, l as we, g as ye } from "./index-DyVteXE3-BhWmKQss.js";
3
- function Bt(t, e) {
4
- var i = Object.keys(t);
5
- if (Object.getOwnPropertySymbols) {
6
- var o = Object.getOwnPropertySymbols(t);
7
- e && (o = o.filter(function(s) {
8
- return Object.getOwnPropertyDescriptor(t, s).enumerable;
9
- })), i.push.apply(i, o);
10
- }
11
- return i;
12
- }
13
- function w(t) {
14
- for (var e = 1; e < arguments.length; e++) {
15
- var i = arguments[e] != null ? arguments[e] : {};
16
- e % 2 ? Bt(Object(i), !0).forEach(function(o) {
17
- H(t, o, i[o]);
18
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : Bt(Object(i)).forEach(function(o) {
19
- Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(i, o));
20
- });
21
- }
22
- return t;
23
- }
24
- function H(t, e, i) {
25
- return e in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
26
- }
27
- function ze(t, e) {
28
- if (t == null) return {};
29
- var i, o, s = function(a, h) {
30
- if (a == null) return {};
31
- var r, c, l = {}, u = Object.keys(a);
32
- for (c = 0; c < u.length; c++) r = u[c], h.indexOf(r) >= 0 || (l[r] = a[r]);
33
- return l;
34
- }(t, e);
35
- if (Object.getOwnPropertySymbols) {
36
- var n = Object.getOwnPropertySymbols(t);
37
- for (o = 0; o < n.length; o++) i = n[o], e.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (s[i] = t[i]);
38
- }
39
- return s;
40
- }
41
- function _(t) {
42
- return function(e) {
43
- if (Array.isArray(e)) return gt(e);
44
- }(t) || function(e) {
45
- if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e);
46
- }(t) || function(e, i) {
47
- if (e) {
48
- if (typeof e == "string") return gt(e, i);
49
- var o = Object.prototype.toString.call(e).slice(8, -1);
50
- if (o === "Object" && e.constructor && (o = e.constructor.name), o === "Map" || o === "Set") return Array.from(e);
51
- if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return gt(e, i);
52
- }
53
- }(t) || function() {
54
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
55
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
56
- }();
57
- }
58
- function gt(t, e) {
59
- (e == null || e > t.length) && (e = t.length);
60
- for (var i = 0, o = new Array(e); i < e; i++) o[i] = t[i];
61
- return o;
62
- }
63
- var Ut, Re, nt, x = (Ut = function(t) {
64
- /*!
65
- Copyright (c) 2018 Jed Watson.
66
- Licensed under the MIT License (MIT), see
67
- http://jedwatson.github.io/classnames
68
- */
69
- (function() {
70
- var e = {}.hasOwnProperty;
71
- function i() {
72
- for (var o = [], s = 0; s < arguments.length; s++) {
73
- var n = arguments[s];
74
- if (n) {
75
- var a = typeof n;
76
- if (a === "string" || a === "number") o.push(n);
77
- else if (Array.isArray(n)) {
78
- if (n.length) {
79
- var h = i.apply(null, n);
80
- h && o.push(h);
81
- }
82
- } else if (a === "object") if (n.toString === Object.prototype.toString) for (var r in n) e.call(n, r) && n[r] && o.push(r);
83
- else o.push(n.toString());
84
- }
85
- }
86
- return o.join(" ");
87
- }
88
- t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
89
- })();
90
- }, Ut(nt = { path: Re, exports: {}, require: function(t, e) {
91
- return function() {
92
- throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
93
- }(e == null && nt.path);
94
- } }, nt.exports), nt.exports), P = function(t) {
95
- return function(e, i) {
96
- if (!e) return t;
97
- var o;
98
- typeof e == "string" ? o = e : i = e;
99
- var s = t;
100
- return o && (s += "__" + o), s + (i ? Object.keys(i).reduce(function(n, a) {
101
- var h = i[a];
102
- return h && (n += " " + (typeof h == "boolean" ? s + "--" + a : s + "--" + a + "_" + h)), n;
103
- }, "") : "");
104
- };
105
- };
106
- function Rt(t, e, i) {
107
- var o, s, n, a, h;
108
- function r() {
109
- var l = Date.now() - a;
110
- l < e && l >= 0 ? o = setTimeout(r, e - l) : (o = null, i || (h = t.apply(n, s), n = s = null));
111
- }
112
- e == null && (e = 100);
113
- var c = function() {
114
- n = this, s = arguments, a = Date.now();
115
- var l = i && !o;
116
- return o || (o = setTimeout(r, e)), l && (h = t.apply(n, s), n = s = null), h;
117
- };
118
- return c.clear = function() {
119
- o && (clearTimeout(o), o = null);
120
- }, c.flush = function() {
121
- o && (h = t.apply(n, s), n = s = null, clearTimeout(o), o = null);
122
- }, c;
123
- }
124
- Rt.debounce = Rt;
125
- var At = Rt, p = function() {
126
- return p = Object.assign || function(t) {
127
- for (var e, i = 1, o = arguments.length; i < o; i++) for (var s in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
128
- return t;
129
- }, p.apply(this, arguments);
130
- };
131
- /*! *****************************************************************************
132
- Copyright (c) Microsoft Corporation.
133
-
134
- Permission to use, copy, modify, and/or distribute this software for any
135
- purpose with or without fee is hereby granted.
136
-
137
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
138
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
139
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
140
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
141
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
142
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
143
- PERFORMANCE OF THIS SOFTWARE.
144
- ***************************************************************************** */
145
- function Jt(t, e) {
146
- var i, o;
147
- return t && e ? (i = "" + t + e[0].toUpperCase() + e.slice(1), o = t + "-" + e) : (i = t || e, o = t || e), { name: i, classname: o };
148
- }
149
- function te(t) {
150
- return /^blob:/.test(t);
151
- }
152
- function Xt(t) {
153
- return te(t) || function(e) {
154
- return /^data:/.test(e);
155
- }(t);
156
- }
157
- function G(t) {
158
- return !!(t && t.constructor && t.call && t.apply);
159
- }
160
- function E(t) {
161
- return t === void 0;
162
- }
163
- function ht(t) {
164
- return typeof t == "object" && t !== null;
165
- }
166
- function Mt(t, e, i) {
167
- var o = {};
168
- return ht(t) ? (Object.keys(e).forEach(function(s) {
169
- E(t[s]) ? o[s] = e[s] : ht(e[s]) ? ht(t[s]) ? o[s] = Mt(t[s], e[s], i[s]) : o[s] = t[s] ? e[s] : i[s] : e[s] === !0 || e[s] === !1 ? o[s] = !!t[s] : o[s] = t[s];
170
- }), o) : t ? e : i;
171
- }
172
- function ot(t) {
173
- var e = Number(t);
174
- return Number.isNaN(e) ? t : e;
175
- }
176
- function Yt(t) {
177
- return typeof (t == "number" || /* @__PURE__ */ function(e) {
178
- return typeof e == "object" && e !== null;
179
- }(t) && toString.call(t) == "[object Number]") && !ee(t);
180
- }
181
- function ee(t) {
182
- return t != t;
183
- }
184
- function ie(t, e) {
185
- return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2));
186
- }
187
- var et = function(t, e) {
188
- t === void 0 && (t = {}), e === void 0 && (e = {}), this.type = "manipulateImage", this.move = t, this.scale = e;
189
- }, Ae = function(t, e) {
190
- e === void 0 && (e = {}), this.type = "resize", this.directions = t, this.params = e;
191
- }, Ct = function(t) {
192
- this.type = "move", this.directions = t;
193
- }, Me = function() {
194
- function t(e, i, o, s, n) {
195
- this.type = "drag", this.nativeEvent = e, this.position = o, this.previousPosition = s, this.element = i, this.anchor = n;
196
- }
197
- return t.prototype.shift = function() {
198
- var e = this, i = e.element, o = e.anchor, s = e.position;
199
- if (i) {
200
- var n = i.getBoundingClientRect(), a = n.left, h = n.top;
201
- return { left: s.left - a - o.left, top: s.top - h - o.top };
202
- }
203
- return { left: 0, top: 0 };
204
- }, t;
205
- }(), Tt = { name: "DraggableElement", props: { classname: { type: String } }, beforeMount: function() {
206
- window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
207
- }, beforeUnmount: function() {
208
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
209
- }, mounted: function() {
210
- if (!this.$refs.draggable) throw new Error('You should add ref "draggable" to your root element to use draggable mixin');
211
- this.touches = [], this.hovered = !1;
212
- }, methods: { onMouseOver: function() {
213
- this.hovered || (this.hovered = !0, this.$emit("enter"));
214
- }, onMouseLeave: function() {
215
- this.hovered && !this.touches.length && (this.hovered = !1, this.$emit("leave"));
216
- }, onTouchStart: function(t) {
217
- t.cancelable && !this.disabled && t.touches.length === 1 && (this.touches = _(t.touches), this.hovered || (this.$emit("enter"), this.hovered = !0), t.touches.length && this.initAnchor(this.touches.reduce(function(e, i) {
218
- return { clientX: e.clientX + i.clientX / t.touches.length, clientY: e.clientY + i.clientY / t.touches.length };
219
- }, { clientX: 0, clientY: 0 })), t.preventDefault && t.preventDefault(), t.stopPropagation());
220
- }, onTouchEnd: function() {
221
- this.processEnd();
222
- }, onTouchMove: function(t) {
223
- this.touches.length && (this.processMove(t, t.touches), t.preventDefault && t.preventDefault(), t.stopPropagation && t.stopPropagation());
224
- }, onMouseDown: function(t) {
225
- if (!this.disabled) {
226
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
227
- this.touches = [e], this.initAnchor(e), t.stopPropagation();
228
- }
229
- }, onMouseMove: function(t) {
230
- this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.preventDefault());
231
- }, onMouseUp: function() {
232
- this.processEnd();
233
- }, initAnchor: function(t) {
234
- var e = this.$refs.draggable.getBoundingClientRect(), i = e.left, o = e.right, s = e.bottom, n = e.top;
235
- this.anchor = { left: t.clientX - i, top: t.clientY - n, bottom: s - t.clientY, right: o - t.clientX };
236
- }, processMove: function(t, e) {
237
- var i = _(e);
238
- if (this.touches.length) {
239
- if (this.touches.length === 1 && i.length === 1) {
240
- var o = this.$refs.draggable;
241
- this.$emit("drag", new Me(t, o, { left: i[0].clientX, top: i[0].clientY }, { left: this.touches[0].clientX, top: this.touches[0].clientY }, this.anchor));
242
- }
243
- this.touches = i;
244
- }
245
- }, processEnd: function() {
246
- this.touches.length && this.$emit("drag-end"), this.hovered && (this.$emit("leave"), this.hovered = !1), this.touches = [];
247
- } }, emits: ["drag", "drag-end", "leave", "enter"] };
248
- Tt.render = function(t, e, i, o, s, n) {
249
- return b(), z("div", { ref: "draggable", class: i.classname, onTouchstart: e[1] || (e[1] = function() {
250
- return n.onTouchStart && n.onTouchStart.apply(n, arguments);
251
- }), onMousedown: e[2] || (e[2] = function() {
252
- return n.onMouseDown && n.onMouseDown.apply(n, arguments);
253
- }), onMouseover: e[3] || (e[3] = function() {
254
- return n.onMouseOver && n.onMouseOver.apply(n, arguments);
255
- }), onMouseleave: e[4] || (e[4] = function() {
256
- return n.onMouseLeave && n.onMouseLeave.apply(n, arguments);
257
- }) }, [q(t.$slots, "default")], 34);
258
- };
259
- var ft = P("vue-handler-wrapper"), ne = { name: "HandlerWrapper", components: { DraggableElement: Tt }, props: { horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, computed: { classes: function() {
260
- var t;
261
- if (this.horizontalPosition || this.verticalPosition) {
262
- var e, i = Jt(this.horizontalPosition, this.verticalPosition);
263
- t = ft((H(e = {}, i.classname, !0), H(e, "disabled", this.disabled), e));
264
- } else t = ft({ disabled: this.disabled });
265
- return { root: t, draggable: ft("draggable") };
266
- } }, emits: ["leave", "enter", "drag", "drag-end"] };
267
- ne.render = function(t, e, i, o, s, n) {
268
- var a = F("DraggableElement");
269
- return b(), z("div", { class: n.classes.root }, [M(a, { class: n.classes.draggable, onDrag: e[1] || (e[1] = function(h) {
270
- return t.$emit("drag", h);
271
- }), onDragEnd: e[2] || (e[2] = function(h) {
272
- return t.$emit("drag-end");
273
- }), onLeave: e[3] || (e[3] = function(h) {
274
- return t.$emit("leave");
275
- }), onEnter: e[4] || (e[4] = function(h) {
276
- return t.$emit("enter");
277
- }) }, { default: I(function() {
278
- return [q(t.$slots, "default")];
279
- }), _: 3 }, 8, ["class"])], 2);
280
- };
281
- var xe = P("vue-line-wrapper"), oe = { name: "LineWrapper", components: { DraggableElement: Tt }, props: { position: { type: String, required: !0 }, disabled: { type: Boolean, default: !1 } }, computed: { classname: function() {
282
- var t;
283
- return xe((H(t = {}, this.position, !0), H(t, "disabled", this.disabled), t));
284
- } }, emits: ["leave", "enter", "drag", "drag-end"] };
285
- oe.render = function(t, e, i, o, s, n) {
286
- var a = F("DraggableElement");
287
- return b(), z(a, { class: n.classname, onDrag: e[1] || (e[1] = function(h) {
288
- return t.$emit("drag", h);
289
- }), onDragEnd: e[2] || (e[2] = function(h) {
290
- return t.$emit("drag-end");
291
- }), onLeave: e[3] || (e[3] = function(h) {
292
- return t.$emit("leave");
293
- }), onEnter: e[4] || (e[4] = function(h) {
294
- return t.$emit("enter");
295
- }) }, { default: I(function() {
296
- return [q(t.$slots, "default")];
297
- }), _: 3 }, 8, ["class"]);
298
- };
299
- var B = ["left", "right", "top", "bottom"], Se = ["left", "right"], Ee = ["top", "bottom"], Ce = ["left", "top"], Te = ["fill-area", "fit-area", "stencil", "none"], Ft = { left: 0, top: 0, width: 0, height: 0 };
300
- function Vt(t, e, i) {
301
- return !(i = i || ["width", "height", "left", "top"]).some(function(o) {
302
- return t[o] !== e[o];
303
- });
304
- }
305
- function U(t) {
306
- return { left: t.left, top: t.top, right: t.left + t.width, bottom: t.top + t.height };
307
- }
308
- function Q(t, e) {
309
- return { left: t.left - e.left, top: t.top - e.top };
310
- }
311
- function C(t) {
312
- return { left: t.left + t.width / 2, top: t.top + t.height / 2 };
313
- }
314
- function it(t, e) {
315
- var i = { left: 0, top: 0, right: 0, bottom: 0 };
316
- return B.forEach(function(o) {
317
- var s = e[o], n = U(t)[o];
318
- i[o] = s !== void 0 && n !== void 0 ? o === "left" || o === "top" ? Math.max(0, s - n) : Math.max(0, n - s) : 0;
319
- }), i;
320
- }
321
- function k(t, e) {
322
- return { left: t.left - e.left, top: t.top - e.top, width: t.width + e.left + e.right, height: t.height + e.top + e.bottom };
323
- }
324
- function lt(t) {
325
- return { left: -t.left, top: -t.top };
326
- }
327
- function O(t, e) {
328
- return p(p({}, t), { left: t.left + e.left, top: t.top + e.top });
329
- }
330
- function L(t, e, i, o) {
331
- if (e !== 1) {
332
- if (i) {
333
- var s = C(t);
334
- return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2 + (i.left - s.left) * (1 - e), top: t.top + t.height * (1 - e) / 2 + (i.top - s.top) * (1 - e) };
335
- }
336
- return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2, top: t.top + t.height * (1 - e) / 2 };
337
- }
338
- return t;
339
- }
340
- function y(t) {
341
- return t.width / t.height;
342
- }
343
- function K(t, e) {
344
- return Math.min(e.right !== void 0 && e.left !== void 0 ? (e.right - e.left) / t.width : 1 / 0, e.bottom !== void 0 && e.top !== void 0 ? (e.bottom - e.top) / t.height : 1 / 0);
345
- }
346
- function J(t, e) {
347
- var i = { left: 0, top: 0 }, o = it(t, e);
348
- return o.left && o.left > 0 ? i.left = o.left : o.right && o.right > 0 && (i.left = -o.right), o.top && o.top > 0 ? i.top = o.top : o.bottom && o.bottom > 0 && (i.top = -o.bottom), i;
349
- }
350
- function vt(t, e) {
351
- var i;
352
- return e.minimum && t < e.minimum ? i = e.minimum : e.maximum && t > e.maximum && (i = e.maximum), i;
353
- }
354
- function se(t, e) {
355
- var i = y(t), o = y(e);
356
- return e.width < 1 / 0 && e.height < 1 / 0 ? i > o ? { width: e.width, height: e.width / i } : { width: e.height * i, height: e.height } : e.width < 1 / 0 ? { width: e.width, height: e.width / i } : e.height < 1 / 0 ? { width: e.height * i, height: e.height } : t;
357
- }
358
- function re(t, e) {
359
- var i = e * Math.PI / 180;
360
- return { width: Math.abs(t.width * Math.cos(i)) + Math.abs(t.height * Math.sin(i)), height: Math.abs(t.width * Math.sin(i)) + Math.abs(t.height * Math.cos(i)) };
361
- }
362
- function V(t, e) {
363
- var i = e * Math.PI / 180;
364
- return { left: t.left * Math.cos(i) - t.top * Math.sin(i), top: t.left * Math.sin(i) + t.top * Math.cos(i) };
365
- }
366
- function ut(t, e) {
367
- var i = it(T(t, e), e);
368
- return i.left + i.right + i.top + i.bottom ? i.left + i.right > i.top + i.bottom ? Math.min((t.width + i.left + i.right) / t.width, K(t, e)) : Math.min((t.height + i.top + i.bottom) / t.height, K(t, e)) : 1;
369
- }
370
- function T(t, e, i) {
371
- i === void 0 && (i = !1);
372
- var o = J(t, e);
373
- return O(t, i ? lt(o) : o);
374
- }
375
- function xt(t) {
376
- return { width: t.right !== void 0 && t.left !== void 0 ? t.right - t.left : 1 / 0, height: t.bottom !== void 0 && t.top !== void 0 ? t.bottom - t.top : 1 / 0 };
377
- }
378
- function We(t, e) {
379
- return p(p({}, t), { minWidth: Math.min(e.width, t.minWidth), minHeight: Math.min(e.height, t.minHeight), maxWidth: Math.min(e.width, t.maxWidth), maxHeight: Math.min(e.height, t.maxHeight) });
380
- }
381
- function ae(t, e, i) {
382
- i === void 0 && (i = !0);
383
- var o = {};
384
- return B.forEach(function(s) {
385
- var n = t[s], a = e[s];
386
- n !== void 0 && a !== void 0 ? o[s] = s === "left" || s === "top" ? i ? Math.max(n, a) : Math.min(n, a) : i ? Math.min(n, a) : Math.max(n, a) : a !== void 0 ? o[s] = a : n !== void 0 && (o[s] = n);
387
- }), o;
388
- }
389
- function dt(t, e) {
390
- return ae(t, e, !0);
391
- }
392
- function Nt(t) {
393
- var e = t.size, i = t.aspectRatio, o = t.ignoreMinimum, s = t.sizeRestrictions;
394
- return !!((e.correctRatio || y(e) >= i.minimum && y(e) <= i.maximum) && e.height <= s.maxHeight && e.width <= s.maxWidth && e.width && e.height && (o || e.height >= s.minHeight && e.width >= s.minWidth));
395
- }
396
- function _t(t, e) {
397
- return Math.pow(t.width - e.width, 2) + Math.pow(t.height - e.height, 2);
398
- }
399
- function Y(t) {
400
- var e = t.width, i = t.height, o = t.sizeRestrictions, s = { minimum: t.aspectRatio && t.aspectRatio.minimum || 0, maximum: t.aspectRatio && t.aspectRatio.maximum || 1 / 0 }, n = { width: Math.max(o.minWidth, Math.min(o.maxWidth, e)), height: Math.max(o.minHeight, Math.min(o.maxHeight, i)) };
401
- function a(c, l) {
402
- return l === void 0 && (l = !1), c.reduce(function(u, d) {
403
- return Nt({ size: d, aspectRatio: s, sizeRestrictions: o, ignoreMinimum: l }) && (!u || _t(d, { width: e, height: i }) < _t(u, { width: e, height: i })) ? d : u;
404
- }, null);
405
- }
406
- var h = [];
407
- s && [s.minimum, s.maximum].forEach(function(c) {
408
- c && h.push({ width: n.width, height: n.width / c, correctRatio: !0 }, { width: n.height * c, height: n.height, correctRatio: !0 });
409
- }), Nt({ size: n, aspectRatio: s, sizeRestrictions: o }) && h.push(n);
410
- var r = a(h) || a(h, !0);
411
- return r && { width: r.width, height: r.height };
412
- }
413
- function St(t) {
414
- var e = t.event, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = O(i, e.directions);
415
- return O(n, J(n, s));
416
- }
417
- function Oe(t) {
418
- var e = t.coordinates, i = t.transform, o = t.imageSize, s = t.sizeRestrictions, n = t.positionRestrictions, a = t.aspectRatio, h = t.visibleArea, r = function(l, u) {
419
- return St({ coordinates: l, positionRestrictions: n, event: new Ct({ left: u.left - l.left, top: u.top - l.top }) });
420
- }, c = p({}, e);
421
- return (Array.isArray(i) ? i : [i]).forEach(function(l) {
422
- var u = {};
423
- E((u = typeof l == "function" ? l({ coordinates: c, imageSize: o, visibleArea: h }) : l).width) && E(u.height) || (c = function(d, m) {
424
- var v = p(p(p({}, d), Y({ width: m.width, height: m.height, sizeRestrictions: s, aspectRatio: a })), { left: 0, top: 0 });
425
- return r(v, { left: d.left, top: d.top });
426
- }(c, p(p({}, c), u))), E(u.left) && E(u.top) || (c = r(c, p(p({}, c), u)));
427
- }), c;
428
- }
429
- function De(t) {
430
- t.event;
431
- var e = t.getAreaRestrictions, i = t.boundaries, o = t.coordinates, s = t.visibleArea;
432
- t.aspectRatio;
433
- var n = t.stencilSize, a = t.sizeRestrictions, h = t.positionRestrictions;
434
- t.stencilReference;
435
- var r, c, l, u = p({}, o), d = p({}, s), m = p({}, n);
436
- r = y(m), c = y(u), l === void 0 && (l = 1e-3), (r === 0 || c === 0 ? Math.abs(c - r) < l : Math.abs(c / r) < 1 + l && Math.abs(c / r) > 1 - l) || (u = p(p({}, u), Y({ sizeRestrictions: a, width: u.width, height: u.height, aspectRatio: { minimum: y(m), maximum: y(m) } })));
437
- var v = ut(d = L(d, u.width * i.width / (d.width * m.width)), e({ visibleArea: d, type: "resize" }));
438
- return v !== 1 && (d = L(d, v), u = L(u, v)), d = T(d = O(d, Q(C(u), C(d))), e({ visibleArea: d, type: "move" })), { coordinates: u = T(u, dt(U(d), h)), visibleArea: d };
439
- }
440
- function He(t) {
441
- var e = t.event, i = t.getAreaRestrictions, o = t.boundaries, s = t.coordinates, n = t.visibleArea;
442
- t.aspectRatio, t.stencilSize, t.sizeRestrictions;
443
- var a = t.positionRestrictions;
444
- t.stencilReference;
445
- var h = p({}, s), r = p({}, n);
446
- if (s && n && e.type !== "manipulateImage") {
447
- var c = { width: 0, height: 0 };
448
- r.width, o.width, y(o) > y(h) ? (c.height = 0.8 * o.height, c.width = c.height * y(h)) : (c.width = 0.8 * o.width, c.height = c.width * y(h));
449
- var l = ut(r = L(r, h.width * o.width / (r.width * c.width)), i({ visibleArea: r, type: "resize" }));
450
- r = L(r, l), l !== 1 && (c.height /= l, c.width /= l), r = T(r = O(r, Q(C(h), C(r))), i({ visibleArea: r, type: "move" })), h = T(h, dt(U(r), a));
451
- }
452
- return { coordinates: h, visibleArea: r };
453
- }
454
- function Le(t) {
455
- var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.getAreaRestrictions, n = p({}, o), a = p({}, i);
456
- if (e.type === "setCoordinates") {
457
- var h = Math.max(0, a.width - n.width), r = Math.max(0, a.height - n.height);
458
- h > r ? n = L(n, Math.min(a.width / n.width, K(n, s({ visibleArea: n, type: "resize" })))) : r > h && (n = L(n, Math.min(a.height / n.height, K(n, s({ visibleArea: n, type: "resize" }))))), n = T(n = O(n, lt(J(a, U(n)))), s({ visibleArea: n, type: "move" }));
459
- }
460
- return { visibleArea: n, coordinates: a };
461
- }
462
- function $e(t) {
463
- var e = t.imageSize, i = t.visibleArea, o = t.coordinates, s = i || e;
464
- return { left: (i ? i.left : 0) + s.width / 2 - o.width / 2, top: (i ? i.top : 0) + s.height / 2 - o.height / 2 };
465
- }
466
- function Ie(t) {
467
- var e = t.imageSize, i = t.visibleArea, o = t.aspectRatio, s = t.sizeRestrictions, n = i || e, a = Math.min(o.maximum || 1 / 0, Math.max(o.minimum || 0, y(n))), h = n.width < n.height ? { width: 0.8 * n.width, height: 0.8 * n.width / a } : { height: 0.8 * n.height, width: 0.8 * n.height * a };
468
- return Y(p(p({}, h), { aspectRatio: o, sizeRestrictions: s }));
469
- }
470
- function Pe(t) {
471
- var e, i, o = t.imageSize, s = t.visibleArea, n = t.boundaries, a = t.aspectRatio, h = t.sizeRestrictions, r = t.stencilSize, c = s || o;
472
- return y(c) > y(n) ? i = (e = r.height * c.height / n.height) * y(r) : e = (i = r.width * c.width / n.width) / y(r), Y({ width: i, height: e, aspectRatio: a, sizeRestrictions: h });
473
- }
474
- function je(t) {
475
- var e = t.getAreaRestrictions, i = t.coordinates, o = t.imageSize, s = y(t.boundaries);
476
- if (i) {
477
- var n = { height: Math.max(i.height, o.height), width: Math.max(i.width, o.width) }, a = se({ width: y(n) > s ? n.width : n.height * s, height: y(n) > s ? n.width / s : n.height }, xt(e())), h = { left: i.left + i.width / 2 - a.width / 2, top: i.top + i.height / 2 - a.height / 2, width: a.width, height: a.height }, r = it(i, U(p({ left: 0, top: 0 }, o))), c = {};
478
- return !r.left && !r.right && h.width <= o.width && (c.left = 0, c.right = o.width), !r.top && !r.bottom && h.height <= o.height && (c.top = 0, c.bottom = o.height), T(h, c);
479
- }
480
- var l = y(o);
481
- return a = { height: l > s ? o.height : o.width / s, width: l > s ? o.height * s : o.width }, { left: o.width / 2 - a.width / 2, top: o.height / 2 - a.height / 2, width: a.width, height: a.height };
482
- }
483
- function st(t, e) {
484
- return ae(t, U(e));
485
- }
486
- function ke(t) {
487
- var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.sizeRestrictions, n = t.getAreaRestrictions, a = t.positionRestrictions, h = t.adjustStencil, r = e.scale, c = e.move, l = p({}, o), u = p({}, i), d = 1, m = 1, v = r.factor && Math.abs(r.factor - 1) > 1e-3;
488
- l = O(l, { left: c.left || 0, top: c.top || 0 });
489
- var f = { stencil: { minimum: Math.max(s.minWidth ? s.minWidth / u.width : 0, s.minHeight ? s.minHeight / u.height : 0), maximum: Math.min(s.maxWidth ? s.maxWidth / u.width : 1 / 0, s.maxHeight ? s.maxHeight / u.height : 1 / 0, K(u, a)) }, area: { maximum: K(l, n({ visibleArea: l, type: "resize" })) } };
490
- r.factor && v && (r.factor < 1 ? (m = Math.max(r.factor, f.stencil.minimum)) > 1 && (m = 1) : r.factor > 1 && (m = Math.min(r.factor, Math.min(f.area.maximum, f.stencil.maximum))) < 1 && (m = 1)), m && (l = L(l, m, r.center));
491
- var S = i.left - o.left, D = o.width + o.left - (i.width + i.left), R = i.top - o.top, g = o.height + o.top - (i.height + i.top);
492
- return l = T(l = O(l, J(l, { left: a.left !== void 0 ? a.left - S * m : void 0, top: a.top !== void 0 ? a.top - R * m : void 0, bottom: a.bottom !== void 0 ? a.bottom + g * m : void 0, right: a.right !== void 0 ? a.right + D * m : void 0 })), n({ visibleArea: l, type: "move" })), u.width = u.width * m, u.height = u.height * m, u.left = l.left + S * m, u.top = l.top + R * m, u = T(u, dt(U(l), a)), r.factor && v && h && (r.factor > 1 ? d = Math.min(f.area.maximum, r.factor) / m : r.factor < 1 && (d = Math.max(u.height / l.height, u.width / l.width, r.factor / m)), d !== 1 && (l = O(l = T(l = L(l, d, r.factor > 1 ? r.center : C(u)), n({ visibleArea: l, type: "move" })), lt(J(u, U(l)))))), { coordinates: u, visibleArea: l };
493
- }
494
- function Be(t) {
495
- var e = t.aspectRatio, i = t.getAreaRestrictions, o = t.coordinates, s = t.visibleArea, n = t.sizeRestrictions, a = t.positionRestrictions, h = t.imageSize, r = t.previousImageSize, c = t.angle, l = p({}, o), u = p({}, s), d = V(C(p({ left: 0, top: 0 }, r)), c);
496
- return (l = p(p({}, Y({ sizeRestrictions: n, aspectRatio: e, width: l.width, height: l.height })), V(C(l), c))).left -= d.left - h.width / 2 + l.width / 2, l.top -= d.top - h.height / 2 + l.height / 2, u = L(u, ut(u, i({ visibleArea: u, type: "resize" }))), { coordinates: l = T(l, a), visibleArea: u = T(u = O(u, Q(C(l), C(o))), i({ visibleArea: u, type: "move" })) };
497
- }
498
- function Ue(t) {
499
- var e = t.flip, i = t.previousFlip, o = t.rotate, s = t.getAreaRestrictions, n = t.coordinates, a = t.visibleArea, h = t.imageSize, r = p({}, n), c = p({}, a), l = i.horizontal !== e.horizontal, u = i.vertical !== e.vertical;
500
- if (l || u) {
501
- var d = V({ left: h.width / 2, top: h.height / 2 }, -o), m = V(C(r), -o), v = V({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o);
502
- r = O(r, Q(v, C(r))), m = V(C(c), -o), c = T(c = O(c, Q(v = V({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o), C(c))), s({ visibleArea: c, type: "move" }));
503
- }
504
- return { coordinates: r, visibleArea: c };
505
- }
506
- function qt(t) {
507
- var e = t.directions, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = t.sizeRestrictions, a = t.preserveRatio, h = t.compensate, r = p({}, e), c = k(i, r).width, l = k(i, r).height;
508
- c < 0 && (r.left < 0 && r.right < 0 ? (r.left = -(i.width - n.minWidth) / (r.left / r.right), r.right = -(i.width - n.minWidth) / (r.right / r.left)) : r.left < 0 ? r.left = -(i.width - n.minWidth) : r.right < 0 && (r.right = -(i.width - n.minWidth))), l < 0 && (r.top < 0 && r.bottom < 0 ? (r.top = -(i.height - n.minHeight) / (r.top / r.bottom), r.bottom = -(i.height - n.minHeight) / (r.bottom / r.top)) : r.top < 0 ? r.top = -(i.height - n.minHeight) : r.bottom < 0 && (r.bottom = -(i.height - n.minHeight)));
509
- var u = it(k(i, r), s);
510
- h && (u.left && u.left > 0 && u.right === 0 ? (r.right += u.left, r.left -= u.left) : u.right && u.right > 0 && u.left === 0 && (r.left += u.right, r.right -= u.right), u.top && u.top > 0 && u.bottom === 0 ? (r.bottom += u.top, r.top -= u.top) : u.bottom && u.bottom > 0 && u.top === 0 && (r.top += u.bottom, r.bottom -= u.bottom), u = it(k(i, r), s));
511
- var d = { width: 1 / 0, height: 1 / 0, left: 1 / 0, right: 1 / 0, top: 1 / 0, bottom: 1 / 0 };
512
- if (B.forEach(function(f) {
513
- var S = u[f];
514
- S && r[f] && (d[f] = Math.max(0, 1 - S / r[f]));
515
- }), a) {
516
- var m = Math.min.apply(null, B.map(function(f) {
517
- return d[f];
518
- }));
519
- m !== 1 / 0 && B.forEach(function(f) {
520
- r[f] *= m;
521
- });
522
- } else B.forEach(function(f) {
523
- d[f] !== 1 / 0 && (r[f] *= d[f]);
524
- });
525
- if (c = k(i, r).width, l = k(i, r).height, r.right + r.left && (c > n.maxWidth ? d.width = (n.maxWidth - i.width) / (r.right + r.left) : c < n.minWidth && (d.width = (n.minWidth - i.width) / (r.right + r.left))), r.bottom + r.top && (l > n.maxHeight ? d.height = (n.maxHeight - i.height) / (r.bottom + r.top) : l < n.minHeight && (d.height = (n.minHeight - i.height) / (r.bottom + r.top))), a) {
526
- var v = Math.min(d.width, d.height);
527
- v !== 1 / 0 && B.forEach(function(f) {
528
- r[f] *= v;
529
- });
530
- } else d.width !== 1 / 0 && Se.forEach(function(f) {
531
- r[f] *= d.width;
532
- }), d.height !== 1 / 0 && Ee.forEach(function(f) {
533
- r[f] *= d.height;
534
- });
535
- return r;
536
- }
537
- function rt(t, e, i) {
538
- return e == 0 && i == 0 ? t / 2 : e == 0 ? 0 : i == 0 ? t : t * Math.abs(e / (e + i));
539
- }
540
- var Xe = P("vue-simple-handler"), Ye = P("vue-simple-handler-wrapper"), Wt = { name: "SimpleHandler", components: { HandlerWrapper: ne }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
541
- return { hover: !1 };
542
- }, computed: { classes: function() {
543
- var t, e = (H(t = {}, this.horizontalPosition, !!this.horizontalPosition), H(t, this.verticalPosition, !!this.verticalPosition), H(t, "".concat(this.horizontalPosition, "-").concat(this.verticalPosition), !!(this.verticalPosition && this.horizontalPosition)), H(t, "hover", this.hover), t);
544
- return { default: x(Xe(e), this.defaultClass, this.hover && this.hoverClass), wrapper: x(Ye(e), this.wrapperClass) };
545
- } }, methods: { onDrag: function(t) {
546
- this.$emit("drag", t);
547
- }, onEnter: function() {
548
- this.hover = !0;
549
- }, onLeave: function() {
550
- this.hover = !1;
551
- }, onDragEnd: function() {
552
- this.$emit("drag-end");
553
- } }, emits: ["drag", "drag-end"] };
554
- Wt.render = function(t, e, i, o, s, n) {
555
- var a = F("HandlerWrapper");
556
- return b(), z(a, { class: n.classes.wrapper, "vertical-position": i.verticalPosition, "horizontal-position": i.horizontalPosition, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: I(function() {
557
- return [M("div", { class: n.classes.default }, null, 2)];
558
- }), _: 1 }, 8, ["class", "vertical-position", "horizontal-position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
559
- };
560
- var Fe = P("vue-simple-line"), Ve = P("vue-simple-line-wrapper"), Ot = { name: "SimpleLine", components: { LineWrapper: oe }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, position: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
561
- return { hover: !1 };
562
- }, computed: { classes: function() {
563
- return { root: x(Fe(H({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass), wrapper: x(Ve(H({}, this.position, !0)), this.wrapperClass) };
564
- } }, methods: { onDrag: function(t) {
565
- this.$emit("drag", t);
566
- }, onEnter: function() {
567
- this.hover = !0;
568
- }, onLeave: function() {
569
- this.hover = !1;
570
- }, onDragEnd: function() {
571
- this.$emit("drag-end");
572
- } }, emits: ["drag", "drag-end"] };
573
- Ot.render = function(t, e, i, o, s, n) {
574
- var a = F("LineWrapper");
575
- return b(), z(a, { class: n.classes.wrapper, position: i.position, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: I(function() {
576
- return [M("div", { class: n.classes.root }, null, 2)];
577
- }), _: 1 }, 8, ["class", "position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
578
- };
579
- var bt = P("vue-bounding-box"), Ne = ["east", "west", null], _e = ["south", "north", null], he = { name: "BoundingBox", props: { width: { type: Number }, height: { type: Number }, transitions: { type: Object }, handlers: { type: Object, default: function() {
580
- return { eastNorth: !0, north: !0, westNorth: !0, west: !0, westSouth: !0, south: !0, eastSouth: !0, east: !0 };
581
- } }, handlersComponent: { type: [Object, String], default: function() {
582
- return Wt;
583
- } }, handlersClasses: { type: Object, default: function() {
584
- return {};
585
- } }, handlersWrappersClasses: { type: Object, default: function() {
586
- return {};
587
- } }, lines: { type: Object, default: function() {
588
- return { west: !0, north: !0, east: !0, south: !0 };
589
- } }, linesComponent: { type: [Object, String], default: function() {
590
- return Ot;
591
- } }, linesClasses: { type: Object, default: function() {
592
- return {};
593
- } }, linesWrappersClasses: { type: Object, default: function() {
594
- return {};
595
- } }, resizable: { type: Boolean, default: !0 } }, data: function() {
596
- var t = [];
597
- return Ne.forEach(function(e) {
598
- _e.forEach(function(i) {
599
- if (e !== i) {
600
- var o = Jt(e, i), s = o.name, n = o.classname;
601
- t.push({ name: s, classname: n, verticalDirection: i, horizontalDirection: e });
602
- }
603
- });
604
- }), { points: t };
605
- }, computed: { style: function() {
606
- var t = {};
607
- return this.width && this.height && (t.width = "".concat(this.width, "px"), t.height = "".concat(this.height, "px"), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction))), t;
608
- }, classes: function() {
609
- var t = this.handlersClasses, e = this.handlersWrappersClasses, i = this.linesClasses, o = this.linesWrappersClasses;
610
- return { root: bt(), handlers: t, handlersWrappers: e, lines: i, linesWrappers: o };
611
- }, lineNodes: function() {
612
- var t = this, e = [];
613
- return this.points.forEach(function(i) {
614
- i.horizontalDirection && i.verticalDirection || !t.lines[i.name] || e.push({ name: i.name, component: t.linesComponent, class: x(t.classes.lines.default, t.classes.lines[i.name], !t.resizable && t.classes.lines.disabled), wrapperClass: x(t.classes.linesWrappers.default, t.classes.linesWrappers[i.name], !t.resizable && t.classes.linesWrappers.disabled), hoverClass: t.classes.lines.hover, verticalDirection: i.verticalDirection, horizontalDirection: i.horizontalDirection, disabled: !t.resizable });
615
- }), e;
616
- }, handlerNodes: function() {
617
- var t = this, e = [], i = this.width, o = this.height;
618
- return this.points.forEach(function(s) {
619
- if (t.handlers[s.name]) {
620
- var n = { name: s.name, component: t.handlersComponent, class: x(t.classes.handlers.default, t.classes.handlers[s.name]), wrapperClass: x(t.classes.handlersWrappers.default, t.classes.handlersWrappers[s.name]), hoverClass: t.classes.handlers.hover, verticalDirection: s.verticalDirection, horizontalDirection: s.horizontalDirection, disabled: !t.resizable };
621
- if (i && o) {
622
- var a = s.horizontalDirection, h = s.verticalDirection, r = a === "east" ? i : a === "west" ? 0 : i / 2, c = h === "south" ? o : h === "north" ? 0 : o / 2;
623
- n.wrapperClass = bt("handler"), n.wrapperStyle = { transform: "translate(".concat(r, "px, ").concat(c, "px)") }, t.transitions && t.transitions.enabled && (n.wrapperStyle.transition = "".concat(t.transitions.time, "ms ").concat(t.transitions.timingFunction));
624
- } else n.wrapperClass = bt("handler", H({}, s.classname, !0));
625
- e.push(n);
626
- }
627
- }), e;
628
- } }, beforeMount: function() {
629
- window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
630
- }, beforeUnmount: function() {
631
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
632
- }, mounted: function() {
633
- this.touches = [];
634
- }, methods: { onEnd: function() {
635
- this.$emit("resize-end");
636
- }, onHandlerDrag: function(t, e, i) {
637
- var o, s = t.shift(), n = s.left, a = s.top, h = { left: 0, right: 0, top: 0, bottom: 0 };
638
- e === "west" ? h.left -= n : e === "east" && (h.right += n), i === "north" ? h.top -= a : i === "south" && (h.bottom += a), !i && e ? o = "width" : i && !e && (o = "height"), this.resizable && this.$emit("resize", new Ae(h, { allowedDirections: { left: e === "west" || !e, right: e === "east" || !e, bottom: i === "south" || !i, top: i === "north" || !i }, preserveAspectRatio: t.nativeEvent && t.nativeEvent.shiftKey, respectDirection: o }));
639
- } }, emits: ["resize", "resize-end"] };
640
- he.render = function(t, e, i, o, s, n) {
641
- return b(), z("div", { ref: "box", class: n.classes.root, style: n.style }, [q(t.$slots, "default"), M("div", null, [(b(!0), z(zt, null, Pt(n.lineNodes, function(a) {
642
- return b(), z(ct(a.component), { key: a.name, "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, position: a.name, disabled: a.disabled, onDrag: function(h) {
643
- return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
644
- }, onDragEnd: e[1] || (e[1] = function(h) {
645
- return n.onEnd();
646
- }) }, null, 8, ["default-class", "hover-class", "wrapper-class", "position", "disabled", "onDrag"]);
647
- }), 128))]), (b(!0), z(zt, null, Pt(n.handlerNodes, function(a) {
648
- return b(), z("div", { key: a.name, style: a.wrapperStyle, class: a.wrapperClass }, [(b(), z(ct(a.component), { "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, "horizontal-position": a.horizontalDirection, "vertical-position": a.verticalDirection, disabled: a.disabled, onDrag: function(h) {
649
- return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
650
- }, onDragEnd: e[2] || (e[2] = function(h) {
651
- return n.onEnd();
652
- }) }, null, 8, ["default-class", "hover-class", "wrapper-class", "horizontal-position", "vertical-position", "disabled", "onDrag"]))], 6);
653
- }), 128))], 6);
654
- };
655
- var qe = P("vue-draggable-area"), ce = { name: "DraggableArea", props: { movable: { type: Boolean, default: !0 }, activationDistance: { type: Number, default: 20 } }, computed: { classnames: function() {
656
- return { default: qe() };
657
- } }, beforeMount: function() {
658
- window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
659
- }, beforeUnmount: function() {
660
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
661
- }, mounted: function() {
662
- this.touches = [], this.touchStarted = !1;
663
- }, methods: { onTouchStart: function(t) {
664
- if (t.cancelable) {
665
- var e = this.movable && t.touches.length === 1;
666
- e && (this.touches = _(t.touches)), (this.touchStarted || e) && (t.preventDefault(), t.stopPropagation());
667
- }
668
- }, onTouchEnd: function() {
669
- this.touchStarted = !1, this.processEnd();
670
- }, onTouchMove: function(t) {
671
- this.touches.length >= 1 && (this.touchStarted ? (this.processMove(t, t.touches), t.preventDefault(), t.stopPropagation()) : ie({ x: this.touches[0].clientX, y: this.touches[0].clientY }, { x: t.touches[0].clientX, y: t.touches[0].clientY }) > this.activationDistance && (this.initAnchor({ clientX: t.touches[0].clientX, clientY: t.touches[0].clientY }), this.touchStarted = !0));
672
- }, onMouseDown: function(t) {
673
- if (this.movable && t.button === 0) {
674
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
675
- this.touches = [e], this.initAnchor(e), t.stopPropagation();
676
- }
677
- }, onMouseMove: function(t) {
678
- this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.cancelable && t.preventDefault(), t.stopPropagation());
679
- }, onMouseUp: function() {
680
- this.processEnd();
681
- }, initAnchor: function(t) {
682
- var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top;
683
- this.anchor = { x: t.clientX - i, y: t.clientY - o };
684
- }, processMove: function(t, e) {
685
- var i = _(e);
686
- if (this.touches.length) {
687
- var o = this.$refs.container.getBoundingClientRect(), s = o.left, n = o.top;
688
- this.touches.length === 1 && i.length === 1 && this.$emit("move", new Ct({ left: i[0].clientX - (s + this.anchor.x), top: i[0].clientY - (n + this.anchor.y) }));
689
- }
690
- }, processEnd: function() {
691
- this.touches.length && this.$emit("move-end"), this.touches = [];
692
- } }, emits: ["move", "move-end"] };
693
- ce.render = function(t, e, i, o, s, n) {
694
- return b(), z("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
695
- return n.onTouchStart && n.onTouchStart.apply(n, arguments);
696
- }), onMousedown: e[2] || (e[2] = function() {
697
- return n.onMouseDown && n.onMouseDown.apply(n, arguments);
698
- }) }, [q(t.$slots, "default")], 544);
699
- };
700
- function wt(t) {
701
- var e, i;
702
- return { rotate: t.rotate || 0, flip: { horizontal: ((e = t == null ? void 0 : t.flip) === null || e === void 0 ? void 0 : e.horizontal) || !1, vertical: ((i = t == null ? void 0 : t.flip) === null || i === void 0 ? void 0 : i.vertical) || !1 } };
703
- }
704
- function Ze(t) {
705
- return new Promise(function(e, i) {
706
- try {
707
- if (t) if (/^data:/i.test(t)) e(function(r) {
708
- r = r.replace(/^data:([^;]+);base64,/gim, "");
709
- for (var c = atob(r), l = c.length, u = new ArrayBuffer(l), d = new Uint8Array(u), m = 0; m < l; m++) d[m] = c.charCodeAt(m);
710
- return u;
711
- }(t));
712
- else if (/^blob:/i.test(t)) {
713
- var o = new FileReader();
714
- o.onload = function(r) {
715
- e(r.target.result);
716
- }, n = t, a = function(r) {
717
- o.readAsArrayBuffer(r);
718
- }, (h = new XMLHttpRequest()).open("GET", n, !0), h.responseType = "blob", h.onload = function() {
719
- this.status != 200 && this.status !== 0 || a(this.response);
720
- }, h.send();
721
- } else {
722
- var s = new XMLHttpRequest();
723
- s.onreadystatechange = function() {
724
- s.readyState === 4 && (s.status === 200 || s.status === 0 ? e(s.response) : i("Warning: could not load an image to parse its orientation"), s = null);
725
- }, s.onprogress = function() {
726
- s.getResponseHeader("content-type") !== "image/jpeg" && s.abort();
727
- }, s.withCredentials = !1, s.open("GET", t, !0), s.responseType = "arraybuffer", s.send(null);
728
- }
729
- else i("Error: the image is empty");
730
- } catch (r) {
731
- i(r);
732
- }
733
- var n, a, h;
734
- });
735
- }
736
- function le(t) {
737
- var e = t.rotate, i = t.flip, o = t.scaleX, s = t.scaleY, n = "";
738
- return n += " rotate(" + e + "deg) ", n += " scaleX(" + o * (i.horizontal ? -1 : 1) + ") ", n += " scaleY(" + s * (i.vertical ? -1 : 1) + ") ";
739
- }
740
- function Ge(t) {
741
- try {
742
- var e, i = new DataView(t), o = void 0, s = void 0, n = void 0, a = void 0;
743
- if (i.getUint8(0) === 255 && i.getUint8(1) === 216) for (var h = i.byteLength, r = 2; r + 1 < h; ) {
744
- if (i.getUint8(r) === 255 && i.getUint8(r + 1) === 225) {
745
- n = r;
746
- break;
747
- }
748
- r++;
749
- }
750
- if (n && (o = n + 10, function(m, v, f) {
751
- var S, D = "";
752
- for (S = v, f += v; S < f; S++) D += String.fromCharCode(m.getUint8(S));
753
- return D;
754
- }(i, n + 4, 4) === "Exif")) {
755
- var c = i.getUint16(o);
756
- if (((s = c === 18761) || c === 19789) && i.getUint16(o + 2, s) === 42) {
757
- var l = i.getUint32(o + 4, s);
758
- l >= 8 && (a = o + l);
759
- }
760
- }
761
- if (a) {
762
- for (var u = i.getUint16(a, s), d = 0; d < u; d++)
763
- if (r = a + 12 * d + 2, i.getUint16(r, s) === 274) {
764
- r += 8, e = i.getUint16(r, s), i.setUint16(r, 1, s);
765
- break;
766
- }
767
- }
768
- return e;
769
- } catch {
770
- return null;
771
- }
772
- }
773
- function Zt(t, e) {
774
- var i = e.getBoundingClientRect(), o = i.left, s = i.top, n = { left: 0, top: 0 }, a = 0;
775
- return t.forEach(function(h) {
776
- n.left += (h.clientX - o) / t.length, n.top += (h.clientY - s) / t.length;
777
- }), t.forEach(function(h) {
778
- a += ie({ x: n.left, y: n.top }, { x: h.clientX - o, y: h.clientY - s });
779
- }), { centerMass: n, spread: a, count: t.length };
780
- }
781
- var ue = { props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 }, eventsFilter: { type: Function, required: !1 } }, beforeMount: function() {
782
- window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
783
- }, beforeUnmount: function() {
784
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
785
- }, created: function() {
786
- this.transforming = !1, this.debouncedProcessEnd = At(this.processEnd), this.touches = [];
787
- }, methods: { processMove: function(t, e) {
788
- if (this.touches.length) {
789
- if (this.touches.length === 1 && e.length === 1) this.$emit("move", new et({ left: this.touches[0].clientX - e[0].clientX, top: this.touches[0].clientY - e[0].clientY }));
790
- else if (this.touches.length > 1 && this.touchResize) {
791
- var i = Zt(e, this.$refs.container), o = this.oldGeometricProperties;
792
- o.count === i.count && o.count > 1 && this.$emit("resize", new et({ left: o.centerMass.left - i.centerMass.left, top: o.centerMass.top - i.centerMass.top }, { factor: o.spread / i.spread, center: i.centerMass })), this.oldGeometricProperties = i;
793
- }
794
- this.touches = e;
795
- }
796
- }, processEnd: function() {
797
- this.transforming && (this.transforming = !1, this.$emit("transform-end"));
798
- }, processStart: function() {
799
- this.transforming = !0, this.debouncedProcessEnd.clear();
800
- }, processEvent: function(t) {
801
- return this.eventsFilter ? this.eventsFilter(t, this.transforming) !== !1 : (t.preventDefault(), t.stopPropagation(), !0);
802
- }, onTouchStart: function(t) {
803
- if (t.cancelable && (this.touchMove || this.touchResize && t.touches.length > 1) && this.processEvent(t)) {
804
- var e = this.$refs.container, i = e.getBoundingClientRect(), o = i.left, s = i.top, n = i.bottom, a = i.right;
805
- this.touches = _(t.touches).filter(function(h) {
806
- return h.clientX > o && h.clientX < a && h.clientY > s && h.clientY < n;
807
- }), this.oldGeometricProperties = Zt(this.touches, e);
808
- }
809
- }, onTouchEnd: function(t) {
810
- t.touches.length === 0 && (this.touches = [], this.processEnd());
811
- }, onTouchMove: function(t) {
812
- var e = this;
813
- if (this.touches.length) {
814
- var i = _(t.touches).filter(function(o) {
815
- return !o.identifier || e.touches.find(function(s) {
816
- return s.identifier === o.identifier;
817
- });
818
- });
819
- this.processEvent(t) && (this.processMove(t, i), this.processStart());
820
- }
821
- }, onMouseDown: function(t) {
822
- if (this.mouseMove && "buttons" in t && t.buttons === 1 && this.processEvent(t)) {
823
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
824
- this.touches = [e], this.processStart();
825
- }
826
- }, onMouseMove: function(t) {
827
- this.touches.length && this.processEvent(t) && this.processMove(t, [{ clientX: t.clientX, clientY: t.clientY }]);
828
- }, onMouseUp: function() {
829
- this.touches = [], this.processEnd();
830
- }, onWheel: function(t) {
831
- if (this.wheelResize && this.processEvent(t)) {
832
- var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top, s = 1 + this.wheelResize.ratio * (a = t.deltaY || t.detail || t.wheelDelta, (h = +a) == 0 || ee(h) ? h : h > 0 ? 1 : -1), n = { left: t.clientX - i, top: t.clientY - o };
833
- this.$emit("resize", new et({}, { factor: s, center: n })), this.touches.length || this.debouncedProcessEnd();
834
- }
835
- var a, h;
836
- } }, emits: ["resize", "move", "transform-end"] };
837
- ue.render = function(t, e, i, o, s, n) {
838
- return b(), z("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
839
- return n.onTouchStart && n.onTouchStart.apply(n, arguments);
840
- }), onMousedown: e[2] || (e[2] = function() {
841
- return n.onMouseDown && n.onMouseDown.apply(n, arguments);
842
- }), onWheel: e[3] || (e[3] = function() {
843
- return n.onWheel && n.onWheel.apply(n, arguments);
844
- }) }, [q(t.$slots, "default")], 544);
845
- };
846
- var Et = { components: { TransformableImage: ue }, props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 } }, emits: ["resize", "move"] };
847
- Et.render = function(t, e, i, o, s, n) {
848
- var a = F("transformable-image");
849
- return b(), z(a, { "touch-move": i.touchMove, "touch-resize": i.touchResize, "mouse-move": i.mouseMove, "wheel-resize": i.wheelResize, onMove: e[1] || (e[1] = function(h) {
850
- return t.$emit("move", h);
851
- }), onResize: e[2] || (e[2] = function(h) {
852
- return t.$emit("resize", h);
853
- }) }, { default: I(function() {
854
- return [q(t.$slots, "default")];
855
- }), _: 3 }, 8, ["touch-move", "touch-resize", "mouse-move", "wheel-resize"]);
856
- };
857
- var at = P("vue-preview"), de = { props: { coordinates: { type: Object }, transitions: { type: Object }, image: { type: Object, default: function() {
858
- return {};
859
- } }, imageClass: { type: String }, width: { type: Number }, height: { type: Number }, fill: { type: Boolean } }, data: function() {
860
- return { calculatedImageSize: { width: 0, height: 0 }, calculatedSize: { width: 0, height: 0 } };
861
- }, computed: { classes: function() {
862
- return { root: at({ fill: this.fill }), wrapper: at("wrapper"), imageWrapper: at("image-wrapper"), image: x(at("image"), this.imageClass) };
863
- }, style: function() {
864
- if (this.fill) return {};
865
- var t = {};
866
- return this.width && (t.width = "".concat(this.size.width, "px")), this.height && (t.height = "".concat(this.size.height, "px")), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
867
- }, wrapperStyle: function() {
868
- var t = { width: "".concat(this.size.width, "px"), height: "".concat(this.size.height, "px"), left: "calc(50% - ".concat(this.size.width / 2, "px)"), top: "calc(50% - ".concat(this.size.height / 2, "px)") };
869
- return this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
870
- }, imageStyle: function() {
871
- if (this.coordinates && this.image) {
872
- var t = this.coordinates.width / this.size.width, e = w(w({ rotate: 0, flip: { horizontal: !1, vertical: !1 } }, this.image.transforms), {}, { scaleX: 1 / t, scaleY: 1 / t }), i = this.imageSize.width, o = this.imageSize.height, s = re({ width: i, height: o }, e.rotate), n = { width: "".concat(i, "px"), height: "".concat(o, "px"), left: "0px", top: "0px" }, a = { rotate: { left: (i - s.width) * e.scaleX / 2, top: (o - s.height) * e.scaleY / 2 }, scale: { left: (1 - e.scaleX) * i / 2, top: (1 - e.scaleY) * o / 2 } };
873
- return n.transform = `translate(
874
- `.concat(-this.coordinates.left / t - a.rotate.left - a.scale.left, "px,").concat(-this.coordinates.top / t - a.rotate.top - a.scale.top, "px) ") + le(e), this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
875
- }
876
- return {};
877
- }, size: function() {
878
- return { width: this.width || this.calculatedSize.width, height: this.height || this.calculatedSize.height };
879
- }, imageSize: function() {
880
- return { width: this.image.width || this.calculatedImageSize.width, height: this.image.height || this.calculatedImageSize.height };
881
- } }, watch: { image: function(t) {
882
- (t.width || t.height) && this.onChangeImage();
883
- } }, mounted: function() {
884
- var t = this;
885
- this.onChangeImage(), this.$refs.image.addEventListener("load", function() {
886
- t.refreshImage();
887
- }), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
888
- }, unmounted: function() {
889
- window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh);
890
- }, methods: { refreshImage: function() {
891
- var t = this.$refs.image;
892
- this.calculatedImageSize.height = t.naturalHeight, this.calculatedImageSize.width = t.naturalWidth;
893
- }, refresh: function() {
894
- var t = this.$refs.root;
895
- this.width || (this.calculatedSize.width = t.clientWidth), this.height || (this.calculatedSize.height = t.clientHeight);
896
- }, onChangeImage: function() {
897
- var t = this.$refs.image;
898
- t && t.complete && this.refreshImage(), this.refresh();
899
- } } };
900
- de.render = function(t, e, i, o, s, n) {
901
- return b(), z("div", { ref: "root", class: n.classes.root, style: n.style }, [M("div", { ref: "wrapper", class: n.classes.wrapper, style: n.wrapperStyle }, [Gt(M("img", { ref: "image", src: i.image && i.image.src, class: n.classes.image, style: n.imageStyle }, null, 14, ["src"]), [[Qt, i.image && i.image.src]])], 6)], 6);
902
- };
903
- var me = { components: { Preview: de }, inheritAttrs: !1 };
904
- me.render = function(t, e, i, o, s, n) {
905
- var a = F("preview");
906
- return b(), z(a, Kt(t.$attrs, { fill: !0 }), null, 16);
907
- };
908
- var yt = P("vue-rectangle-stencil"), pe = { name: "RectangleStencil", components: { StencilPreview: me, BoundingBox: he, DraggableArea: ce }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object }, handlersComponent: { type: [Object, String], default: function() {
909
- return Wt;
910
- } }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
911
- return Ot;
912
- } }, aspectRatio: { type: [Number, String] }, minAspectRatio: { type: [Number, String] }, maxAspectRatio: { type: [Number, String] }, movable: { type: Boolean, default: !0 }, resizable: { type: Boolean, default: !0 }, transitions: { type: Object }, movingClass: { type: String }, resizingClass: { type: String }, previewClass: { type: String }, boundingBoxClass: { type: String }, linesClasses: { type: Object, default: function() {
913
- return {};
914
- } }, linesWrappersClasses: { type: Object, default: function() {
915
- return {};
916
- } }, handlersClasses: { type: Object, default: function() {
917
- return {};
918
- } }, handlersWrappersClasses: { type: Object, default: function() {
919
- return {};
920
- } } }, data: function() {
921
- return { moving: !1, resizing: !1 };
922
- }, computed: { classes: function() {
923
- return { stencil: x(yt({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: x(yt("preview"), this.previewClass), boundingBox: x(yt("bounding-box"), this.boundingBoxClass) };
924
- }, style: function() {
925
- var t = this.stencilCoordinates, e = t.height, i = t.width, o = t.left, s = t.top, n = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(o, "px, ").concat(s, "px)") };
926
- return this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
927
- } }, methods: { onMove: function(t) {
928
- this.$emit("move", t), this.moving = !0;
929
- }, onMoveEnd: function() {
930
- this.$emit("move-end"), this.moving = !1;
931
- }, onResize: function(t) {
932
- this.$emit("resize", t), this.resizing = !0;
933
- }, onResizeEnd: function() {
934
- this.$emit("resize-end"), this.resizing = !1;
935
- }, aspectRatios: function() {
936
- return { minimum: this.aspectRatio || this.minAspectRatio, maximum: this.aspectRatio || this.maxAspectRatio };
937
- } }, emits: ["resize", "resize-end", "move", "move-end"] };
938
- pe.render = function(t, e, i, o, s, n) {
939
- var a = F("stencil-preview"), h = F("draggable-area"), r = F("bounding-box");
940
- return b(), z("div", { class: n.classes.stencil, style: n.style }, [M(r, { width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, transitions: i.transitions, class: n.classes.boundingBox, handlers: i.handlers, "handlers-component": i.handlersComponent, "handlers-classes": i.handlersClasses, "handlers-wrappers-classes": i.handlersWrappersClasses, lines: i.lines, "lines-component": i.linesComponent, "lines-classes": i.linesClasses, "lines-wrappers-classes": i.linesWrappersClasses, resizable: i.resizable, onResize: n.onResize, onResizeEnd: n.onResizeEnd }, { default: I(function() {
941
- return [M(h, { movable: i.movable, onMove: n.onMove, onMoveEnd: n.onMoveEnd }, { default: I(function() {
942
- return [M(a, { image: i.image, coordinates: i.coordinates, width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, class: n.classes.preview, transitions: i.transitions }, null, 8, ["image", "coordinates", "width", "height", "class", "transitions"])];
943
- }), _: 1 }, 8, ["movable", "onMove", "onMoveEnd"])];
944
- }), _: 1 }, 8, ["width", "height", "transitions", "class", "handlers", "handlers-component", "handlers-classes", "handlers-wrappers-classes", "lines", "lines-component", "lines-classes", "lines-wrappers-classes", "resizable", "onResize", "onResizeEnd"])], 6);
945
- };
946
- var Qe = ["transitions"], X = P("vue-advanced-cropper"), ge = { name: "Cropper", components: { BackgroundWrapper: Et }, props: { src: { type: String, default: null }, stencilComponent: { type: [Object, String], default: function() {
947
- return pe;
948
- } }, backgroundWrapperComponent: { type: [Object, String], default: function() {
949
- return Et;
950
- } }, stencilProps: { type: Object, default: function() {
951
- return {};
952
- } }, autoZoom: { type: Boolean, default: !1 }, imageClass: { type: String }, boundariesClass: { type: String }, backgroundClass: { type: String }, foregroundClass: { type: String }, minWidth: { type: [Number, String] }, minHeight: { type: [Number, String] }, maxWidth: { type: [Number, String] }, maxHeight: { type: [Number, String] }, debounce: { type: [Boolean, Number], default: 500 }, transitions: { type: Boolean, default: !0 }, checkOrientation: { type: Boolean, default: !0 }, canvas: { type: [Object, Boolean], default: !0 }, crossOrigin: { type: [Boolean, String], default: void 0 }, transitionTime: { type: Number, default: 300 }, imageRestriction: { type: String, default: "fit-area", validator: function(t) {
953
- return Te.indexOf(t) !== -1;
954
- } }, roundResult: { type: Boolean, default: !0 }, defaultSize: { type: [Function, Object] }, defaultPosition: { type: [Function, Object] }, defaultVisibleArea: { type: [Function, Object] }, defaultTransforms: { type: [Function, Object] }, defaultBoundaries: { type: [Function, String], validator: function(t) {
955
- return !(typeof t == "string" && t !== "fill" && t !== "fit");
956
- } }, priority: { type: String, default: "coordinates" }, stencilSize: { type: [Object, Function] }, resizeImage: { type: [Boolean, Object], default: !0 }, moveImage: { type: [Boolean, Object], default: !0 }, autoZoomAlgorithm: { type: Function }, resizeAlgorithm: { type: Function, default: function(t) {
957
- var e = t.event, i = t.coordinates, o = t.aspectRatio, s = t.positionRestrictions, n = t.sizeRestrictions, a = p(p({}, i), { right: i.left + i.width, bottom: i.top + i.height }), h = e.params || {}, r = p({}, e.directions), c = h.allowedDirections || { left: !0, right: !0, bottom: !0, top: !0 };
958
- n.widthFrozen && (r.left = 0, r.right = 0), n.heightFrozen && (r.top = 0, r.bottom = 0), B.forEach(function($) {
959
- c[$] || (r[$] = 0);
960
- });
961
- var l = k(a, r = qt({ coordinates: a, directions: r, sizeRestrictions: n, positionRestrictions: s })).width, u = k(a, r).height, d = h.preserveRatio ? y(a) : vt(l / u, o);
962
- if (d) {
963
- var m = h.respectDirection;
964
- if (m || (m = a.width >= a.height || d === 1 ? "width" : "height"), m === "width") {
965
- var v = l / d - a.height;
966
- if (c.top && c.bottom) {
967
- var f = r.top, S = r.bottom;
968
- r.bottom = rt(v, S, f), r.top = rt(v, f, S);
969
- } else c.bottom ? r.bottom = v : c.top ? r.top = v : c.right ? r.right = 0 : c.left && (r.left = 0);
970
- } else if (m === "height") {
971
- var D = a.width - u * d;
972
- if (c.left && c.right) {
973
- var R = r.left, g = r.right;
974
- r.left = -rt(D, R, g), r.right = -rt(D, g, R);
975
- } else c.left ? r.left = -D : c.right ? r.right = -D : c.top ? r.top = 0 : c.bottom && (r.bottom = 0);
976
- }
977
- r = qt({ directions: r, coordinates: a, sizeRestrictions: n, positionRestrictions: s, preserveRatio: !0, compensate: h.compensate });
978
- }
979
- return l = k(a, r).width, u = k(a, r).height, (d = h.preserveRatio ? y(a) : vt(l / u, o)) && Math.abs(d - l / u) > 1e-3 && B.forEach(function($) {
980
- c[$] || (r[$] = 0);
981
- }), St({ event: new Ct({ left: -r.left, top: -r.top }), coordinates: { width: i.width + r.right + r.left, height: i.height + r.top + r.bottom, left: i.left, top: i.top }, positionRestrictions: s });
982
- } }, moveAlgorithm: { type: Function, default: St }, initStretcher: { type: Function, default: function(t) {
983
- var e = t.stretcher, i = t.imageSize, o = y(i);
984
- e.style.width = i.width + "px", e.style.height = e.clientWidth / o + "px", e.style.width = e.clientWidth + "px";
985
- } }, fitCoordinates: { type: Function, default: function(t) {
986
- var e = t.visibleArea, i = t.coordinates, o = t.aspectRatio, s = t.sizeRestrictions, n = t.positionRestrictions, a = p(p({}, i), Y({ width: i.width, height: i.height, aspectRatio: o, sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minHeight: Math.min(e.height, s.minHeight), minWidth: Math.min(e.width, s.minWidth) } }));
987
- return a = T(a = O(a, Q(C(i), C(a))), dt(U(e), n));
988
- } }, fitVisibleArea: { type: Function, default: function(t) {
989
- var e = t.visibleArea, i = t.boundaries, o = t.getAreaRestrictions, s = t.coordinates, n = p({}, e);
990
- n.height = n.width / y(i), n.top += (e.height - n.height) / 2, (s.height - n.height > 0 || s.width - n.width > 0) && (n = L(n, Math.max(s.height / n.height, s.width / n.width)));
991
- var a = lt(J(s, U(n = L(n, ut(n, o({ visibleArea: n, type: "resize" }))))));
992
- return n.width < s.width && (a.left = 0), n.height < s.height && (a.top = 0), n = T(n = O(n, a), o({ visibleArea: n, type: "move" }));
993
- } }, areaRestrictionsAlgorithm: { type: Function, default: function(t) {
994
- var e = t.visibleArea, i = t.boundaries, o = t.imageSize, s = t.imageRestriction, n = t.type, a = {};
995
- return s === "fill-area" ? a = { left: 0, top: 0, right: o.width, bottom: o.height } : s === "fit-area" && (y(i) > y(o) ? (a = { top: 0, bottom: o.height }, e && n === "move" && (e.width > o.width ? (a.left = -(e.width - o.width) / 2, a.right = o.width - a.left) : (a.left = 0, a.right = o.width))) : (a = { left: 0, right: o.width }, e && n === "move" && (e.height > o.height ? (a.top = -(e.height - o.height) / 2, a.bottom = o.height - a.top) : (a.top = 0, a.bottom = o.height)))), a;
996
- } }, sizeRestrictionsAlgorithm: { type: Function, default: function(t) {
997
- return { minWidth: t.minWidth, minHeight: t.minHeight, maxWidth: t.maxWidth, maxHeight: t.maxHeight };
998
- } }, positionRestrictionsAlgorithm: { type: Function, default: function(t) {
999
- var e = t.imageSize, i = {};
1000
- return t.imageRestriction !== "none" && (i = { left: 0, top: 0, right: e.width, bottom: e.height }), i;
1001
- } } }, data: function() {
1002
- return { transitionsActive: !1, imageLoaded: !1, imageAttributes: { width: null, height: null, crossOrigin: null, src: null }, defaultImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, appliedImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, boundaries: { width: 0, height: 0 }, visibleArea: null, coordinates: w({}, Ft) };
1003
- }, computed: { image: function() {
1004
- return { src: this.imageAttributes.src, width: this.imageAttributes.width, height: this.imageAttributes.height, transforms: this.imageTransforms };
1005
- }, imageTransforms: function() {
1006
- return { rotate: this.appliedImageTransforms.rotate, flip: { horizontal: this.appliedImageTransforms.flip.horizontal, vertical: this.appliedImageTransforms.flip.vertical }, translateX: this.visibleArea ? this.visibleArea.left / this.coefficient : 0, translateY: this.visibleArea ? this.visibleArea.top / this.coefficient : 0, scaleX: 1 / this.coefficient, scaleY: 1 / this.coefficient };
1007
- }, imageSize: function() {
1008
- var t = function(e) {
1009
- return e * Math.PI / 180;
1010
- }(this.imageTransforms.rotate);
1011
- return { width: Math.abs(this.imageAttributes.width * Math.cos(t)) + Math.abs(this.imageAttributes.height * Math.sin(t)), height: Math.abs(this.imageAttributes.width * Math.sin(t)) + Math.abs(this.imageAttributes.height * Math.cos(t)) };
1012
- }, initialized: function() {
1013
- return !!(this.visibleArea && this.imageLoaded);
1014
- }, settings: function() {
1015
- var t = Mt(this.resizeImage, { touch: !0, wheel: { ratio: 0.1 }, adjustStencil: !0 }, { touch: !1, wheel: !1, adjustStencil: !1 });
1016
- return { moveImage: Mt(this.moveImage, { touch: !0, mouse: !0 }, { touch: !1, mouse: !1 }), resizeImage: t };
1017
- }, coefficient: function() {
1018
- return this.visibleArea ? this.visibleArea.width / this.boundaries.width : 0;
1019
- }, areaRestrictions: function() {
1020
- return this.imageLoaded ? this.areaRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction, boundaries: this.boundaries }) : {};
1021
- }, transitionsOptions: function() {
1022
- return { enabled: this.transitionsActive, timingFunction: "ease-in-out", time: 350 };
1023
- }, sizeRestrictions: function() {
1024
- if (this.boundaries.width && this.boundaries.height && this.imageSize.width && this.imageSize.height) {
1025
- var t = this.sizeRestrictionsAlgorithm({ imageSize: this.imageSize, minWidth: E(this.minWidth) ? 0 : ot(this.minWidth), minHeight: E(this.minHeight) ? 0 : ot(this.minHeight), maxWidth: E(this.maxWidth) ? 1 / 0 : ot(this.maxWidth), maxHeight: E(this.maxHeight) ? 1 / 0 : ot(this.maxHeight) });
1026
- if (t = function(o) {
1027
- var s = o.areaRestrictions, n = o.sizeRestrictions, a = o.boundaries, h = o.positionRestrictions, r = p(p({}, n), { minWidth: n.minWidth !== void 0 ? n.minWidth : 0, minHeight: n.minHeight !== void 0 ? n.minHeight : 0, maxWidth: n.maxWidth !== void 0 ? n.maxWidth : 1 / 0, maxHeight: n.maxHeight !== void 0 ? n.maxHeight : 1 / 0 });
1028
- h.left !== void 0 && h.right !== void 0 && (r.maxWidth = Math.min(r.maxWidth, h.right - h.left)), h.bottom !== void 0 && h.top !== void 0 && (r.maxHeight = Math.min(r.maxHeight, h.bottom - h.top));
1029
- var c = xt(s), l = se(a, c);
1030
- return c.width < 1 / 0 && (!r.maxWidth || r.maxWidth > l.width) && (r.maxWidth = Math.min(r.maxWidth, l.width)), c.height < 1 / 0 && (!r.maxHeight || r.maxHeight > l.height) && (r.maxHeight = Math.min(r.maxHeight, l.height)), r.minWidth > r.maxWidth && (r.minWidth = r.maxWidth, r.widthFrozen = !0), r.minHeight > r.maxHeight && (r.minHeight = r.maxHeight, r.heightFrozen = !0), r;
1031
- }({ sizeRestrictions: t, areaRestrictions: this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }), imageSize: this.imageSize, boundaries: this.boundaries, positionRestrictions: this.positionRestrictions, imageRestriction: this.imageRestriction, visibleArea: this.visibleArea, stencilSize: this.getStencilSize() }), this.visibleArea && this.stencilSize) {
1032
- var e = this.getStencilSize(), i = xt(this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }));
1033
- t.maxWidth = Math.min(t.maxWidth, i.width * e.width / this.boundaries.width), t.maxHeight = Math.min(t.maxHeight, i.height * e.height / this.boundaries.height), t.maxWidth < t.minWidth && (t.minWidth = t.maxWidth), t.maxHeight < t.minHeight && (t.minHeight = t.maxHeight);
1034
- }
1035
- return t;
1036
- }
1037
- return { minWidth: 0, minHeight: 0, maxWidth: 0, maxHeight: 0 };
1038
- }, positionRestrictions: function() {
1039
- return this.positionRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction });
1040
- }, classes: function() {
1041
- return { cropper: X(), image: x(X("image"), this.imageClass), stencil: X("stencil"), boundaries: x(X("boundaries"), this.boundariesClass), stretcher: x(X("stretcher")), background: x(X("background"), this.backgroundClass), foreground: x(X("foreground"), this.foregroundClass), imageWrapper: x(X("image-wrapper")), cropperWrapper: x(X("cropper-wrapper")) };
1042
- }, stencilCoordinates: function() {
1043
- if (this.initialized) {
1044
- var t = this.coordinates, e = t.width, i = t.height, o = t.left, s = t.top;
1045
- return { width: e / this.coefficient, height: i / this.coefficient, left: (o - this.visibleArea.left) / this.coefficient, top: (s - this.visibleArea.top) / this.coefficient };
1046
- }
1047
- return this.defaultCoordinates();
1048
- }, boundariesStyle: function() {
1049
- var t = { width: this.boundaries.width ? "".concat(Math.round(this.boundaries.width), "px") : "auto", height: this.boundaries.height ? "".concat(Math.round(this.boundaries.height), "px") : "auto", transition: "opacity ".concat(this.transitionTime, "ms"), pointerEvents: this.imageLoaded ? "all" : "none" };
1050
- return this.imageLoaded || (t.opacity = "0"), t;
1051
- }, imageStyle: function() {
1052
- var t = this.imageAttributes.width > this.imageAttributes.height ? { width: Math.min(1024, this.imageAttributes.width), height: Math.min(1024, this.imageAttributes.width) / (this.imageAttributes.width / this.imageAttributes.height) } : { height: Math.min(1024, this.imageAttributes.height), width: Math.min(1024, this.imageAttributes.height) * (this.imageAttributes.width / this.imageAttributes.height) }, e = { left: (t.width - this.imageSize.width) / (2 * this.coefficient), top: (t.height - this.imageSize.height) / (2 * this.coefficient) }, i = { left: (1 - 1 / this.coefficient) * t.width / 2, top: (1 - 1 / this.coefficient) * t.height / 2 }, o = w(w({}, this.imageTransforms), {}, { scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / t.width), scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / t.height) }), s = { width: "".concat(t.width, "px"), height: "".concat(t.height, "px"), left: "0px", top: "0px", transform: "translate(".concat(-e.left - i.left - this.imageTransforms.translateX, "px, ").concat(-e.top - i.top - this.imageTransforms.translateY, "px)") + le(o) };
1053
- return this.transitionsOptions.enabled && (s.transition = "".concat(this.transitionsOptions.time, "ms ").concat(this.transitionsOptions.timingFunction)), s;
1054
- } }, watch: { src: function() {
1055
- this.onChangeImage();
1056
- }, stencilComponent: function() {
1057
- var t = this;
1058
- this.$nextTick(function() {
1059
- t.resetCoordinates(), t.runAutoZoom("setCoordinates"), t.onChange();
1060
- });
1061
- }, minWidth: function() {
1062
- this.onPropsChange();
1063
- }, maxWidth: function() {
1064
- this.onPropsChange();
1065
- }, minHeight: function() {
1066
- this.onPropsChange();
1067
- }, maxHeight: function() {
1068
- this.onPropsChange();
1069
- }, imageRestriction: function() {
1070
- this.reset();
1071
- }, stencilProps: function(t, e) {
1072
- ["aspectRatio", "minAspectRatio", "maxAspectRatio"].find(function(i) {
1073
- return t[i] !== e[i];
1074
- }) && this.$nextTick(this.onPropsChange);
1075
- } }, created: function() {
1076
- this.debouncedUpdate = At(this.update, this.debounce), this.debouncedDisableTransitions = At(this.disableTransitions, this.transitionsOptions.time), this.awaiting = !1;
1077
- }, mounted: function() {
1078
- this.$refs.image.addEventListener("load", this.onSuccessLoadImage), this.$refs.image.addEventListener("error", this.onFailLoadImage), this.onChangeImage(), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
1079
- }, unmounted: function() {
1080
- window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh), this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.debouncedUpdate.clear(), this.debouncedDisableTransitions.clear();
1081
- }, methods: { getResult: function() {
1082
- var t = this.initialized ? this.prepareResult(w({}, this.coordinates)) : this.defaultCoordinates(), e = { rotate: this.imageTransforms.rotate % 360, flip: w({}, this.imageTransforms.flip) };
1083
- if (this.src && this.imageLoaded) {
1084
- var i = this;
1085
- return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? w({}, this.visibleArea) : null, imageTransforms: e, get canvas() {
1086
- return i.canvas ? i.getCanvas() : void 0;
1087
- } };
1088
- }
1089
- return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? w({}, this.visibleArea) : null, canvas: void 0, imageTransforms: e };
1090
- }, zoom: function(t, e) {
1091
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1092
- this.onManipulateImage(new et({}, { factor: 1 / t, center: e }), { normalize: !1, transitions: s });
1093
- }, move: function(t, e) {
1094
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1095
- this.onManipulateImage(new et({ left: t || 0, top: e || 0 }), { normalize: !1, transitions: s });
1096
- }, setCoordinates: function(t) {
1097
- var e = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = i.autoZoom, s = o === void 0 || o, n = i.transitions, a = n === void 0 || n;
1098
- this.$nextTick(function() {
1099
- e.imageLoaded ? (e.transitionsActive || (a && e.enableTransitions(), e.coordinates = e.applyTransform(t), s && e.runAutoZoom("setCoordinates"), a && e.debouncedDisableTransitions()), e.onChange()) : e.delayedTransforms = t;
1100
- });
1101
- }, refresh: function() {
1102
- var t = this, e = this.$refs.image;
1103
- if (this.src && e) return this.initialized ? this.updateVisibleArea().then(function() {
1104
- t.onChange();
1105
- }) : this.resetVisibleArea().then(function() {
1106
- t.onChange();
1107
- });
1108
- }, reset: function() {
1109
- var t = this;
1110
- return this.resetVisibleArea().then(function() {
1111
- t.onChange(!1);
1112
- });
1113
- }, awaitRender: function(t) {
1114
- var e = this;
1115
- this.awaiting || (this.awaiting = !0, this.$nextTick(function() {
1116
- t(), e.awaiting = !1;
1117
- }));
1118
- }, prepareResult: function(t) {
1119
- return this.roundResult ? function(e) {
1120
- var i = e.coordinates, o = e.sizeRestrictions, s = e.positionRestrictions, n = { width: Math.round(i.width), height: Math.round(i.height), left: Math.round(i.left), top: Math.round(i.top) };
1121
- return n.width > o.maxWidth ? n.width = Math.floor(i.width) : n.width < o.minWidth && (n.width = Math.ceil(i.width)), n.height > o.maxHeight ? n.height = Math.floor(i.height) : n.height < o.minHeight && (n.height = Math.ceil(i.height)), T(n, s);
1122
- }(w(w({}, this.getPublicProperties()), {}, { positionRestrictions: st(this.positionRestrictions, this.visibleArea), coordinates: t })) : t;
1123
- }, processAutoZoom: function(t, e, i, o) {
1124
- var s = this.autoZoomAlgorithm;
1125
- s || (s = this.stencilSize ? De : this.autoZoom ? He : Le);
1126
- var n = s({ event: { type: t, params: o }, visibleArea: e, coordinates: i, boundaries: this.boundaries, aspectRatio: this.getAspectRatio(), positionRestrictions: this.positionRestrictions, getAreaRestrictions: this.getAreaRestrictions, sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize() });
1127
- return w(w({}, n), {}, { changed: !Vt(n.visibleArea, e) || !Vt(n.coordinates, i) });
1128
- }, runAutoZoom: function(t) {
1129
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i !== void 0 && i, s = ze(e, Qe), n = this.processAutoZoom(t, this.visibleArea, this.coordinates, s), a = n.visibleArea, h = n.coordinates, r = n.changed;
1130
- o && r && this.enableTransitions(), this.visibleArea = a, this.coordinates = h, o && r && this.debouncedDisableTransitions();
1131
- }, normalizeEvent: function(t) {
1132
- return function(e) {
1133
- var i = e.event, o = e.visibleArea, s = e.coefficient;
1134
- if (i.type === "manipulateImage") return p(p({}, i), { move: { left: i.move && i.move.left ? s * i.move.left : 0, top: i.move && i.move.top ? s * i.move.top : 0 }, scale: { factor: i.scale && i.scale.factor ? i.scale.factor : 1, center: i.scale && i.scale.center ? { left: i.scale.center.left * s + o.left, top: i.scale.center.top * s + o.top } : null } });
1135
- if (i.type === "resize") {
1136
- var n = p(p({}, i), { directions: p({}, i.directions) });
1137
- return B.forEach(function(h) {
1138
- n.directions[h] *= s;
1139
- }), n;
1140
- }
1141
- if (i.type === "move") {
1142
- var a = p(p({}, i), { directions: p({}, i.directions) });
1143
- return Ce.forEach(function(h) {
1144
- a.directions[h] *= s;
1145
- }), a;
1146
- }
1147
- return i;
1148
- }(w(w({}, this.getPublicProperties()), {}, { event: t }));
1149
- }, getCanvas: function() {
1150
- if (this.$refs.canvas) {
1151
- var t = this.$refs.canvas, e = this.$refs.image, i = this.imageTransforms.rotate !== 0 || this.imageTransforms.flip.horizontal || this.imageTransforms.flip.vertical ? function(h, r, c) {
1152
- var l = c.rotate, u = c.flip, d = { width: r.naturalWidth, height: r.naturalHeight }, m = re(d, l), v = h.getContext("2d");
1153
- h.height = m.height, h.width = m.width, v.save();
1154
- var f = V(C(p({ left: 0, top: 0 }, d)), l);
1155
- return v.translate(-(f.left - m.width / 2), -(f.top - m.height / 2)), v.rotate(l * Math.PI / 180), v.translate(u.horizontal ? d.width : 0, u.vertical ? d.height : 0), v.scale(u.horizontal ? -1 : 1, u.vertical ? -1 : 1), v.drawImage(r, 0, 0, d.width, d.height), v.restore(), h;
1156
- }(this.$refs.sourceCanvas, e, this.imageTransforms) : e, o = w({ minWidth: 0, minHeight: 0, maxWidth: 1 / 0, maxHeight: 1 / 0, maxArea: this.maxCanvasSize, imageSmoothingEnabled: !0, imageSmoothingQuality: "high", fillColor: "transparent" }, this.canvas), s = function(h) {
1157
- return h.find(function(r) {
1158
- return c = r, !Number.isNaN(parseFloat(c)) && isFinite(c);
1159
- var c;
1160
- });
1161
- }, n = Y({ sizeRestrictions: { minWidth: s([o.width, o.minWidth]) || 0, minHeight: s([o.height, o.minHeight]) || 0, maxWidth: s([o.width, o.maxWidth]) || 1 / 0, maxHeight: s([o.height, o.maxHeight]) || 1 / 0 }, width: this.coordinates.width, height: this.coordinates.height, aspectRatio: { minimum: this.coordinates.width / this.coordinates.height, maximum: this.coordinates.width / this.coordinates.height } });
1162
- if (o.maxArea && n.width * n.height > o.maxArea) {
1163
- var a = Math.sqrt(o.maxArea / (n.width * n.height));
1164
- n = { width: Math.round(a * n.width), height: Math.round(a * n.height) };
1165
- }
1166
- return function(h, r, c, l, u) {
1167
- h.width = l ? l.width : c.width, h.height = l ? l.height : c.height;
1168
- var d = h.getContext("2d");
1169
- d.clearRect(0, 0, h.width, h.height), u && (u.imageSmoothingEnabled && (d.imageSmoothingEnabled = u.imageSmoothingEnabled), u.imageSmoothingQuality && (d.imageSmoothingQuality = u.imageSmoothingQuality), u.fillColor && (d.fillStyle = u.fillColor, d.fillRect(0, 0, h.width, h.height), d.save()));
1170
- var m = c.left < 0 ? -c.left : 0, v = c.top < 0 ? -c.top : 0;
1171
- d.drawImage(r, c.left + m, c.top + v, c.width, c.height, m * (h.width / c.width), v * (h.height / c.height), h.width, h.height);
1172
- }(t, i, this.coordinates, n, o), t;
1173
- }
1174
- }, update: function() {
1175
- this.$emit("change", this.getResult());
1176
- }, applyTransform: function(t) {
1177
- var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.visibleArea && e ? We(this.sizeRestrictions, this.visibleArea) : this.sizeRestrictions, o = this.visibleArea && e ? st(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
1178
- return Oe({ transform: t, coordinates: this.coordinates, imageSize: this.imageSize, sizeRestrictions: i, positionRestrictions: o, aspectRatio: this.getAspectRatio(), visibleArea: this.visibleArea });
1179
- }, resetCoordinates: function() {
1180
- var t = this;
1181
- if (this.$refs.image) {
1182
- this.$refs.cropper, this.$refs.image;
1183
- var e = this.defaultSize;
1184
- e || (e = this.stencilSize ? Pe : Ie);
1185
- var i = this.sizeRestrictions;
1186
- i.minWidth, i.minHeight, i.maxWidth, i.maxHeight;
1187
- var o = G(e) ? e({ boundaries: this.boundaries, imageSize: this.imageSize, aspectRatio: this.getAspectRatio(), sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize(), visibleArea: this.visibleArea }) : e, s = this.defaultPosition || $e, n = [o, function(a) {
1188
- var h = a.coordinates;
1189
- return w({}, G(s) ? s({ coordinates: h, imageSize: t.imageSize, visibleArea: t.visibleArea }) : t.defaultPosition);
1190
- }];
1191
- this.delayedTransforms && n.push.apply(n, _(Array.isArray(this.delayedTransforms) ? this.delayedTransforms : [this.delayedTransforms])), this.coordinates = this.applyTransform(n, !0), this.delayedTransforms = null;
1192
- }
1193
- }, clearImage: function() {
1194
- var t = this;
1195
- this.imageLoaded = !1, setTimeout(function() {
1196
- var e = t.$refs.stretcher;
1197
- e && (e.style.height = "auto", e.style.width = "auto"), t.coordinates = t.defaultCoordinates(), t.boundaries = { width: 0, height: 0 };
1198
- }, this.transitionTime);
1199
- }, enableTransitions: function() {
1200
- this.transitions && (this.transitionsActive = !0);
1201
- }, disableTransitions: function() {
1202
- this.transitionsActive = !1;
1203
- }, updateBoundaries: function() {
1204
- var t = this, e = this.$refs.stretcher, i = this.$refs.cropper;
1205
- return this.initStretcher({ cropper: i, stretcher: e, imageSize: this.imageSize }), this.$nextTick().then(function() {
1206
- var o = { cropper: i, imageSize: t.imageSize };
1207
- if (G(t.defaultBoundaries) ? t.boundaries = t.defaultBoundaries(o) : t.defaultBoundaries === "fit" ? t.boundaries = function(s) {
1208
- var n = s.cropper, a = s.imageSize, h = n.clientHeight, r = n.clientWidth, c = h, l = a.width * h / a.height;
1209
- return l > r && (l = r, c = a.height * r / a.width), { width: l, height: c };
1210
- }(o) : t.boundaries = function(s) {
1211
- var n = s.cropper;
1212
- return { width: n.clientWidth, height: n.clientHeight };
1213
- }(o), !t.boundaries.width || !t.boundaries.height) throw new Error("It's impossible to fit the cropper in the current container");
1214
- });
1215
- }, resetVisibleArea: function() {
1216
- var t = this;
1217
- return this.appliedImageTransforms = w(w({}, this.defaultImageTransforms), {}, { flip: w({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then(function() {
1218
- t.priority !== "visible-area" && (t.visibleArea = null, t.resetCoordinates());
1219
- var e, i, o, s, n, a, h = t.defaultVisibleArea || je;
1220
- t.visibleArea = G(h) ? h({ imageSize: t.imageSize, boundaries: t.boundaries, coordinates: t.priority !== "visible-area" ? t.coordinates : null, getAreaRestrictions: t.getAreaRestrictions, stencilSize: t.getStencilSize() }) : t.defaultVisibleArea, t.visibleArea = (e = { visibleArea: t.visibleArea, boundaries: t.boundaries, getAreaRestrictions: t.getAreaRestrictions }, i = e.visibleArea, o = e.boundaries, s = e.getAreaRestrictions, n = p({}, i), a = y(o), n.width / n.height !== a && (n.height = n.width / a), T(n, s({ visibleArea: n, type: "move" }))), t.priority === "visible-area" ? t.resetCoordinates() : t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("resetVisibleArea");
1221
- }).catch(function() {
1222
- t.visibleArea = null;
1223
- });
1224
- }, updateVisibleArea: function() {
1225
- var t = this;
1226
- return this.updateBoundaries().then(function() {
1227
- t.visibleArea = t.fitVisibleArea({ imageSize: t.imageSize, boundaries: t.boundaries, visibleArea: t.visibleArea, coordinates: t.coordinates, getAreaRestrictions: t.getAreaRestrictions }), t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("updateVisibleArea");
1228
- }).catch(function() {
1229
- t.visibleArea = null;
1230
- });
1231
- }, onChange: function() {
1232
- var t = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0];
1233
- t && this.debounce ? this.debouncedUpdate() : this.update();
1234
- }, onChangeImage: function() {
1235
- var t, e = this;
1236
- if (this.imageLoaded = !1, this.delayedTransforms = null, this.src) {
1237
- if (function(s) {
1238
- if (Xt(s)) return !1;
1239
- var n = window.location, a = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(s) || [], h = { protocol: a[1] || "", host: a[2] || "", port: a[3] || "" }, r = function(c) {
1240
- return c.port || ((c.protocol || n.protocol) === "http" ? 80 : 433);
1241
- };
1242
- return !(!h.protocol && !h.host && !h.port || h.protocol && h.protocol == n.protocol && h.host && h.host == n.host && h.host && r(h) == r(n));
1243
- }(this.src)) {
1244
- var i = E(this.crossOrigin) ? this.canvas : this.crossOrigin;
1245
- i === !0 && (i = "anonymous"), this.imageAttributes.crossOrigin = i || null;
1246
- }
1247
- if (this.checkOrientation) {
1248
- var o = (t = this.src, new Promise(function(s) {
1249
- Ze(t).then(function(n) {
1250
- var a = Ge(n);
1251
- s(n ? { source: t, arrayBuffer: n, orientation: a } : { source: t, arrayBuffer: null, orientation: null });
1252
- }).catch(function(n) {
1253
- console.warn(n), s({ source: t, arrayBuffer: null, orientation: null });
1254
- });
1255
- }));
1256
- setTimeout(function() {
1257
- o.then(e.onParseImage);
1258
- }, this.transitionTime);
1259
- } else setTimeout(function() {
1260
- e.onParseImage({ source: e.src });
1261
- }, this.transitionTime);
1262
- } else this.clearImage();
1263
- }, onFailLoadImage: function() {
1264
- this.imageAttributes.src && (this.clearImage(), this.$emit("error"));
1265
- }, onSuccessLoadImage: function() {
1266
- var t = this, e = this.$refs.image;
1267
- e && !this.imageLoaded && (this.imageAttributes.height = e.naturalHeight, this.imageAttributes.width = e.naturalWidth, this.imageLoaded = !0, this.resetVisibleArea().then(function() {
1268
- t.$emit("ready"), t.onChange(!1);
1269
- }));
1270
- }, onParseImage: function(t) {
1271
- var e = this, i = t.source, o = t.arrayBuffer, s = t.orientation;
1272
- this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, o && s && s > 1 ? te(i) || !Xt(i) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([o])), this.imageAttributes.revoke = !0) : this.imageAttributes.src = function(n) {
1273
- for (var a = [], h = new Uint8Array(n); h.length > 0; ) {
1274
- var r = h.subarray(0, 8192);
1275
- a.push(String.fromCharCode.apply(null, Array.from ? Array.from(r) : r.slice())), h = h.subarray(8192);
1276
- }
1277
- return "data:image/jpeg;base64," + btoa(a.join(""));
1278
- }(o) : this.imageAttributes.src = i, G(this.defaultTransforms) ? this.appliedImageTransforms = wt(this.defaultTransforms()) : ht(this.defaultTransforms) ? this.appliedImageTransforms = wt(this.defaultTransforms) : this.appliedImageTransforms = function(n) {
1279
- var a = wt({});
1280
- if (n) switch (n) {
1281
- case 2:
1282
- a.flip.horizontal = !0;
1283
- break;
1284
- case 3:
1285
- a.rotate = -180;
1286
- break;
1287
- case 4:
1288
- a.flip.vertical = !0;
1289
- break;
1290
- case 5:
1291
- a.rotate = 90, a.flip.vertical = !0;
1292
- break;
1293
- case 6:
1294
- a.rotate = 90;
1295
- break;
1296
- case 7:
1297
- a.rotate = 90, a.flip.horizontal = !0;
1298
- break;
1299
- case 8:
1300
- a.rotate = -90;
1301
- }
1302
- return a;
1303
- }(s), this.defaultImageTransforms = w(w({}, this.appliedImageTransforms), {}, { flip: w({}, this.appliedImageTransforms.flip) }), this.$nextTick(function() {
1304
- var n = e.$refs.image;
1305
- n && n.complete && (function(a) {
1306
- return !!a.naturalWidth;
1307
- }(n) ? e.onSuccessLoadImage() : e.onFailLoadImage());
1308
- });
1309
- }, onResizeEnd: function() {
1310
- this.runAutoZoom("resize", { transitions: !0 });
1311
- }, onMoveEnd: function() {
1312
- this.runAutoZoom("move", { transitions: !0 });
1313
- }, onMove: function(t) {
1314
- var e = this;
1315
- this.transitionsOptions.enabled || this.awaitRender(function() {
1316
- e.coordinates = e.moveAlgorithm(w(w({}, e.getPublicProperties()), {}, { positionRestrictions: st(e.positionRestrictions, e.visibleArea), coordinates: e.coordinates, event: e.normalizeEvent(t) })), e.onChange();
1317
- });
1318
- }, onResize: function(t) {
1319
- var e = this;
1320
- this.transitionsOptions.enabled || this.stencilSize && !this.autoZoom || this.awaitRender(function() {
1321
- var i = e.sizeRestrictions, o = Math.min(e.coordinates.width, e.coordinates.height, 20 * e.coefficient);
1322
- e.coordinates = e.resizeAlgorithm(w(w({}, e.getPublicProperties()), {}, { positionRestrictions: st(e.positionRestrictions, e.visibleArea), sizeRestrictions: { maxWidth: Math.min(i.maxWidth, e.visibleArea.width), maxHeight: Math.min(i.maxHeight, e.visibleArea.height), minWidth: Math.max(i.minWidth, o), minHeight: Math.max(i.minHeight, o) }, event: e.normalizeEvent(t) })), e.onChange(), e.ticking = !1;
1323
- });
1324
- }, onManipulateImage: function(t) {
1325
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1326
- if (!this.transitionsOptions.enabled) {
1327
- var i = e.transitions, o = i !== void 0 && i, s = e.normalize, n = s === void 0 || s;
1328
- o && this.enableTransitions();
1329
- var a = ke(w(w({}, this.getPublicProperties()), {}, { event: n ? this.normalizeEvent(t) : t, getAreaRestrictions: this.getAreaRestrictions, imageRestriction: this.imageRestriction, adjustStencil: !this.stencilSize && this.settings.resizeImage.adjustStencil })), h = a.visibleArea, r = a.coordinates;
1330
- this.visibleArea = h, this.coordinates = r, this.runAutoZoom("manipulateImage"), this.onChange(), o && this.debouncedDisableTransitions();
1331
- }
1332
- }, onPropsChange: function() {
1333
- this.coordinates = this.applyTransform(this.coordinates, !0), this.onChange(!1);
1334
- }, getAreaRestrictions: function() {
1335
- var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.visibleArea, i = t.type, o = i === void 0 ? "move" : i;
1336
- return this.areaRestrictionsAlgorithm({ boundaries: this.boundaries, imageSize: this.imageSize, imageRestriction: this.imageRestriction, visibleArea: e, type: o });
1337
- }, getAspectRatio: function(t) {
1338
- var e, i, o = this.stencilProps, s = o.aspectRatio, n = o.minAspectRatio, a = o.maxAspectRatio;
1339
- if (this.$refs.stencil && this.$refs.stencil.aspectRatios) {
1340
- var h = this.$refs.stencil.aspectRatios();
1341
- e = h.minimum, i = h.maximum;
1342
- }
1343
- if (E(e) && (e = E(s) ? n : s), E(i) && (i = E(s) ? a : s), !t && (E(e) || E(i))) {
1344
- var r = this.getStencilSize(), c = r ? y(r) : null;
1345
- E(e) && (e = Yt(c) ? c : void 0), E(i) && (i = Yt(c) ? c : void 0);
1346
- }
1347
- return { minimum: e, maximum: i };
1348
- }, getStencilSize: function() {
1349
- if (this.stencilSize) return t = { currentStencilSize: { width: this.stencilCoordinates.width, height: this.stencilCoordinates.height }, stencilSize: this.stencilSize, boundaries: this.boundaries, coefficient: this.coefficient, coordinates: this.coordinates, aspectRatio: this.getAspectRatio(!0) }, e = t.boundaries, i = t.stencilSize, o = t.aspectRatio, vt(y(s = G(i) ? i({ boundaries: e, aspectRatio: o }) : i), o) && (s = Y({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: o.minimum, maximum: o.maximum } })), (s.width > e.width || s.height > e.height) && (s = Y({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: y(s), maximum: y(s) } })), s;
1350
- var t, e, i, o, s;
1351
- }, getPublicProperties: function() {
1352
- return { coefficient: this.coefficient, visibleArea: this.visibleArea, coordinates: this.coordinates, boundaries: this.boundaries, sizeRestrictions: this.sizeRestrictions, positionRestrictions: this.positionRestrictions, aspectRatio: this.getAspectRatio(), imageRestriction: this.imageRestriction };
1353
- }, defaultCoordinates: function() {
1354
- return w({}, Ft);
1355
- }, flip: function(t, e) {
1356
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1357
- if (!this.transitionsActive) {
1358
- s && this.enableTransitions();
1359
- var n = w({}, this.imageTransforms.flip), a = Ue({ flip: { horizontal: t ? !n.horizontal : n.horizontal, vertical: e ? !n.vertical : n.vertical }, previousFlip: n, rotate: this.imageTransforms.rotate, visibleArea: this.visibleArea, coordinates: this.coordinates, imageSize: this.imageSize, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), h = a.visibleArea, r = a.coordinates;
1360
- t && (this.appliedImageTransforms.flip.horizontal = !this.appliedImageTransforms.flip.horizontal), e && (this.appliedImageTransforms.flip.vertical = !this.appliedImageTransforms.flip.vertical), this.visibleArea = h, this.coordinates = r, this.onChange(), s && this.debouncedDisableTransitions();
1361
- }
1362
- }, rotate: function(t) {
1363
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i === void 0 || i;
1364
- if (!this.transitionsActive) {
1365
- o && this.enableTransitions();
1366
- var s = w({}, this.imageSize);
1367
- this.appliedImageTransforms.rotate += t;
1368
- var n = Be({ visibleArea: this.visibleArea, coordinates: this.coordinates, previousImageSize: s, imageSize: this.imageSize, angle: t, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), a = n.visibleArea, h = n.coordinates, r = this.processAutoZoom("rotateImage", a, h);
1369
- a = r.visibleArea, h = r.coordinates, this.visibleArea = a, this.coordinates = h, this.onChange(), o && this.debouncedDisableTransitions();
1370
- }
1371
- } }, emits: ["change", "error", "ready"] }, Ke = { key: 0, ref: "canvas", style: { display: "none" } }, Je = { key: 1, ref: "sourceCanvas", style: { display: "none" } };
1372
- ge.render = function(t, e, i, o, s, n) {
1373
- return b(), z("div", { ref: "cropper", class: n.classes.cropper }, [M("div", { ref: "stretcher", class: n.classes.stretcher }, null, 2), M("div", { class: n.classes.boundaries, style: n.boundariesStyle }, [(b(), z(ct(i.backgroundWrapperComponent), { class: n.classes.cropperWrapper, "wheel-resize": n.settings.resizeImage.wheel, "touch-resize": n.settings.resizeImage.touch, "touch-move": n.settings.moveImage.touch, "mouse-move": n.settings.moveImage.mouse, onMove: n.onManipulateImage, onResize: n.onManipulateImage }, { default: I(function() {
1374
- return [M("div", { class: n.classes.background, style: n.boundariesStyle }, null, 6), M("div", { class: n.classes.imageWrapper }, [M("img", { ref: "image", crossorigin: s.imageAttributes.crossOrigin, src: s.imageAttributes.src, class: n.classes.image, style: n.imageStyle, onMousedown: e[1] || (e[1] = fe(function() {
1375
- }, ["prevent"])) }, null, 46, ["crossorigin", "src"])], 2), M("div", { class: n.classes.foreground, style: n.boundariesStyle }, null, 6), Gt((b(), z(ct(i.stencilComponent), Kt({ ref: "stencil", image: n.image, coordinates: s.coordinates, "stencil-coordinates": n.stencilCoordinates, transitions: n.transitionsOptions }, i.stencilProps, { onResize: n.onResize, onResizeEnd: n.onResizeEnd, onMove: n.onMove, onMoveEnd: n.onMoveEnd }), null, 16, ["image", "coordinates", "stencil-coordinates", "transitions", "onResize", "onResizeEnd", "onMove", "onMoveEnd"])), [[Qt, s.imageLoaded]]), i.canvas ? (b(), z("canvas", Ke, null, 512)) : j("", !0), i.canvas ? (b(), z("canvas", Je, null, 512)) : j("", !0)];
1376
- }), _: 1 }, 8, ["class", "wheel-resize", "touch-resize", "touch-move", "mouse-move", "onMove", "onResize"]))], 6)], 2);
1377
- };
1378
- const ti = { class: "flex flex-col gap-y-5" }, ei = ["src"], ii = { class: "flex gap-x-1 justify-center relative" }, ni = { class: "grid grid-cols-2 gap-4" }, ri = {
1379
- __name: "OcCropper",
1380
- props: {
1381
- inputOptions: Array,
1382
- inputOptionValues: Object,
1383
- img: String,
1384
- maxSize: [String, Number],
1385
- isReplaceImage: {
1386
- type: Boolean,
1387
- default: !0
1388
- }
1389
- },
1390
- emits: ["changeImage", "update:input-options"],
1391
- setup(t, { emit: e }) {
1392
- const i = t, o = e, s = N(), n = N(), a = N(""), h = N(!1), r = N(i.inputOptionValues ?? {});
1393
- jt(
1394
- () => i.inputOptionValues,
1395
- () => {
1396
- r.value = i.inputOptionValues;
1397
- },
1398
- {
1399
- deep: !0
1400
- }
1401
- ), jt(
1402
- () => i.img,
1403
- (R) => {
1404
- R && ve(() => {
1405
- try {
1406
- const g = new URL(R);
1407
- g.protocol === "http:" || g.protocol === "https:" ? a.value = `${R}?${Date.now()}` : a.value = R;
1408
- } catch {
1409
- a.value = R;
1410
- }
1411
- });
1412
- },
1413
- { immediate: !0 }
1414
- );
1415
- const c = () => {
1416
- if (a.value && h.value) {
1417
- const { canvas: R } = s.value.getResult();
1418
- o("changeImage", R.toDataURL());
1419
- }
1420
- h.value = !0;
1421
- }, l = (R) => {
1422
- var g;
1423
- return (g = s.value) == null ? void 0 : g.rotate(R);
1424
- }, u = (R) => {
1425
- var g;
1426
- return (g = s.value) == null ? void 0 : g.zoom(R);
1427
- }, d = () => {
1428
- n.value.click();
1429
- }, m = (R) => {
1430
- if (R.target.files[0] / (1024 * 1024) > +i.maxSize)
1431
- return R.preventDefault(), !1;
1432
- a.value = URL.createObjectURL(R.target.files[0]);
1433
- }, v = ({ imageSize: R, visibleArea: g }) => ({
1434
- width: (g || R).width,
1435
- height: (g || R).height
1436
- }), f = (R, g) => {
1437
- let $ = r.value;
1438
- $[R] = g, o("update:input-options", $);
1439
- }, S = N(!!r.value.caption), D = N(!!r.value.lightbox);
1440
- return (R, g) => {
1441
- var $, Dt, Ht, Lt, $t, It;
1442
- return b(), mt("div", ti, [
1443
- Z("input", {
1444
- id: "cropper-file-input",
1445
- ref_key: "fileUploadEl",
1446
- ref: n,
1447
- accept: "image/*",
1448
- type: "file",
1449
- class: "hidden",
1450
- onChange: m
1451
- }, null, 544),
1452
- a.value ? (b(), z(W(ge), {
1453
- key: 0,
1454
- ref_key: "cropper",
1455
- ref: s,
1456
- class: "w-full h-[300px]",
1457
- src: a.value,
1458
- "resize-image": { wheel: !1 },
1459
- "background-class": "cropper-background",
1460
- "default-size": v,
1461
- onChange: c
1462
- }, null, 8, ["src"])) : (b(), mt("img", {
1463
- key: 1,
1464
- class: "w-full",
1465
- src: t.img
1466
- }, null, 8, ei)),
1467
- Z("div", ii, [
1468
- a.value ? (b(), mt(zt, { key: 0 }, [
1469
- M(W(tt), {
1470
- variant: "secondary",
1471
- size: "small",
1472
- "left-icon": "backward",
1473
- onClick: g[0] || (g[0] = (A) => l(-90))
1474
- }),
1475
- M(W(tt), {
1476
- variant: "secondary",
1477
- size: "small",
1478
- "left-icon": "zoom-out",
1479
- onClick: g[1] || (g[1] = (A) => u(0.8))
1480
- }),
1481
- M(W(tt), {
1482
- variant: "secondary",
1483
- size: "small",
1484
- "left-icon": "zoom-in",
1485
- onClick: g[2] || (g[2] = (A) => u(1.2))
1486
- }),
1487
- M(W(tt), {
1488
- variant: "secondary",
1489
- size: "small",
1490
- "left-icon": "forward",
1491
- onClick: g[3] || (g[3] = (A) => l(90))
1492
- })
1493
- ], 64)) : j("", !0),
1494
- t.isReplaceImage ? (b(), z(W(tt), {
1495
- key: 1,
1496
- class: "absolute right-0",
1497
- variant: "secondary",
1498
- size: "small",
1499
- label: "Replace image",
1500
- "left-icon": "refresh",
1501
- onClick: d
1502
- })) : j("", !0)
1503
- ]),
1504
- Z("div", ni, [
1505
- ($ = t.inputOptions) != null && $.includes("description") ? (b(), z(W(pt), {
1506
- key: 0,
1507
- modelValue: r.value.description,
1508
- "onUpdate:modelValue": [
1509
- g[4] || (g[4] = (A) => r.value.description = A),
1510
- g[5] || (g[5] = (A) => f("description", A))
1511
- ],
1512
- label: "Describe Image",
1513
- placeholder: ""
1514
- }, null, 8, ["modelValue"])) : j("", !0),
1515
- (Dt = t.inputOptions) != null && Dt.includes("link") ? (b(), z(W(pt), {
1516
- key: 1,
1517
- modelValue: r.value.link,
1518
- "onUpdate:modelValue": [
1519
- g[6] || (g[6] = (A) => r.value.link = A),
1520
- g[7] || (g[7] = (A) => f("link", A))
1521
- ],
1522
- placeholder: "https://hitpayapp.com",
1523
- label: "Link to"
1524
- }, null, 8, ["modelValue"])) : j("", !0),
1525
- Z("div", null, [
1526
- (Ht = t.inputOptions) != null && Ht.includes("caption") ? (b(), z(W(kt), {
1527
- key: 0,
1528
- modelValue: S.value,
1529
- "onUpdate:modelValue": g[8] || (g[8] = (A) => S.value = A),
1530
- label: "Caption",
1531
- class: "mb-4"
1532
- }, null, 8, ["modelValue"])) : j("", !0),
1533
- (Lt = t.inputOptions) != null && Lt.includes("caption") && S.value ? (b(), z(W(pt), {
1534
- key: 1,
1535
- modelValue: r.value.caption,
1536
- "onUpdate:modelValue": [
1537
- g[9] || (g[9] = (A) => r.value.caption = A),
1538
- g[10] || (g[10] = (A) => f("caption", A))
1539
- ],
1540
- class: "mb-4",
1541
- placeholder: ""
1542
- }, null, 8, ["modelValue"])) : j("", !0),
1543
- ($t = t.inputOptions) != null && $t.includes("caption") && S.value ? (b(), z(W(be), {
1544
- key: 2,
1545
- "model-value": r.value.caption_variant,
1546
- "group-name": "caption_variant",
1547
- alignment: "horizontal",
1548
- radio: [
1549
- {
1550
- value: "hover",
1551
- label: "Show on hover"
1552
- },
1553
- {
1554
- value: "bottom",
1555
- label: "Show on bottom"
1556
- }
1557
- ],
1558
- label: "Caption position",
1559
- "onUpdate:modelValue": g[11] || (g[11] = (A) => f("caption_variant", A))
1560
- }, null, 8, ["model-value"])) : j("", !0)
1561
- ]),
1562
- Z("div", null, [
1563
- (It = t.inputOptions) != null && It.includes("lightbox") ? (b(), z(W(kt), {
1564
- key: 0,
1565
- modelValue: D.value,
1566
- "onUpdate:modelValue": [
1567
- g[12] || (g[12] = (A) => D.value = A),
1568
- g[13] || (g[13] = (A) => f("lightbox", A))
1569
- ],
1570
- label: "Lightbox"
1571
- }, {
1572
- after: I(() => [
1573
- M(W(we), {
1574
- position: "bottom",
1575
- distance: 10,
1576
- "popper-class": "bg-oc-bg-light min-w-[125px]"
1577
- }, {
1578
- popper: I(() => g[14] || (g[14] = [
1579
- Z("div", { class: "text-oc-text-400 text-sm px-3 py-2 font-medium text-center" }, " Show lightbox when click the image ", -1)
1580
- ])),
1581
- default: I(() => [
1582
- M(W(ye), {
1583
- name: "question-mark",
1584
- width: "16",
1585
- height: "16",
1586
- class: "text-oc-accent-1-500"
1587
- })
1588
- ]),
1589
- _: 1
1590
- })
1591
- ]),
1592
- _: 1
1593
- }, 8, ["modelValue"])) : j("", !0)
1594
- ])
1595
- ])
1596
- ]);
1597
- };
1598
- }
1599
- };
1600
- export {
1601
- ri as default
1602
- };