@cling-se/widget 0.17.3 → 0.18.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.
- package/CHANGELOG.md +7 -0
- package/dist/AddClientCallout-Bod9Eqx4.js +101 -0
- package/dist/AnswerModal-a2cyKFbt.js +3371 -0
- package/dist/AttachmentItem-DBUqckCS.js +171 -0
- package/dist/BaseUpload-DrWzuvbS.js +6503 -0
- package/dist/BlockMedia-DuE_K9hR.js +103 -0
- package/dist/CCallout-CM1VsH30.js +104 -0
- package/dist/{CCurrencyDropdown-CXXQu8th.js → CCurrencyDropdown-C_lAaq4P.js} +91 -53
- package/dist/CDropdownItem-DMUAJ90n.js +749 -0
- package/dist/CFormField.vue_vue_type_script_setup_true_lang-BqAyWe3T.js +292 -0
- package/dist/{CPhoneFormat-BtBGl8b4.js → CPhoneFormat-Dnn_cKk7.js} +13 -21
- package/dist/CPhoneInput-DuGkDiv-.js +207 -0
- package/dist/CPriceInput-B7DYzKcF.js +142 -0
- package/dist/CSelect-BZZDr27O.js +98 -0
- package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-D2jDhnYI.js +51 -0
- package/dist/ClientAutocomplete-DuaJ5zDf.js +532 -0
- package/dist/ClientModal-CaMSjLkD.js +1188 -0
- package/dist/ColorPicker-BISZPQ6j.js +1408 -0
- package/dist/CompanyModal-ClTcmU4Y.js +250 -0
- package/dist/ContentWrapper-Bj7jbWU0.js +265 -0
- package/dist/CoverBlockSettings-AXyiLxrF.js +861 -0
- package/dist/DocAnswer-Bu09V33D.js +33 -0
- package/dist/DocDetails-B6-2LKsO.js +452 -0
- package/dist/DocForm-CFN8LWSd.js +6772 -0
- package/dist/DocFormSend-D1CUhy4n.js +171 -0
- package/dist/DocLinks-CuliFqtN.js +36 -0
- package/dist/DocModalBase-BxKsnwN-.js +29 -0
- package/dist/DocPrint-B_HJ_RET.js +399 -0
- package/dist/DocReceipt-D-A1TaTI.js +341 -0
- package/dist/DocSendReminder-BKTJonzh.js +181 -0
- package/dist/{DocTextEditor-yD9Dt_um.js → DocTextEditor-CEPcJT2o.js} +7907 -5579
- package/dist/DocTimeline-CF9S4YDZ.js +537 -0
- package/dist/DocumentClient-7mbq2QA4.js +90 -0
- package/dist/DocumentLayout-DkFlHgW6.js +1434 -0
- package/dist/DocumentLogotype-BTYMdpNi.js +162 -0
- package/dist/DocumentVoided-CWr5WMUv.js +33 -0
- package/dist/EmbedInput-SevVEpwc.js +156 -0
- package/dist/EmbedSettings-YMbUmp1O.js +103 -0
- package/dist/ErrorCallout-CQo2iF9c.js +34 -0
- package/dist/FilePreviewModal-C0xBeoAz.js +202 -0
- package/dist/Flag-BObij6SN.js +41 -0
- package/dist/HeaderSettings-C77pR78n.js +720 -0
- package/dist/ImageSelectModal-DKdU-0uq.js +119 -0
- package/dist/ImageUploadWrapper-BGkS5Cll.js +1585 -0
- package/dist/Index-B3y-jq9s.js +1098 -0
- package/dist/Index-B41pUREi.js +47 -0
- package/dist/Index-BEyeS1OG.js +52 -0
- package/dist/Index-BG5j8ZFP.js +93 -0
- package/dist/Index-BOT65yQR.js +68 -0
- package/dist/Index-BQNl-cXP.js +28 -0
- package/dist/Index-BY6xsS7C.js +38 -0
- package/dist/Index-Bh0Xv5ry.js +163 -0
- package/dist/Index-Bn4FSQcx.js +228 -0
- package/dist/Index-BrRIAede.js +87 -0
- package/dist/Index-C-6um0kX.js +76 -0
- package/dist/{Index-C_aIQ908.js → Index-C-gHa5xk.js} +319 -214
- package/dist/Index-C0wcjKCH.js +629 -0
- package/dist/Index-C6BbUFYw.js +160 -0
- package/dist/Index-C8xwJ0m1.js +200 -0
- package/dist/Index-CKgFEJF4.js +140 -0
- package/dist/{Index-Dfq7egc1.js → Index-CQwmu4f1.js} +47 -60
- package/dist/Index-CXchTpBa.js +74 -0
- package/dist/{Index-Ch9r5yhG.js → Index-CYoRt8PA.js} +9 -17
- package/dist/Index-CZZNQ4q5.js +39 -0
- package/dist/Index-CkaAs5ms.js +136 -0
- package/dist/Index-CtpXaBz8.js +363 -0
- package/dist/Index-CxDsSGtZ.js +126 -0
- package/dist/Index-DFkTBm02.js +102 -0
- package/dist/Index-DP3ll8F-.js +70 -0
- package/dist/{Index-RWMPRDAE.js → Index-DPDzMKQa.js} +10 -18
- package/dist/Index-DvxSig3z.js +25 -0
- package/dist/Index-Dzrn3Y6p.js +16 -0
- package/dist/{Index-CRiATiQn.js → Index-LQb0omFE.js} +10 -18
- package/dist/Index-Mt4mSaNT.js +4 -0
- package/dist/Index-_xN_cczo.js +3477 -0
- package/dist/Index-gAz45qgR.js +21 -0
- package/dist/Index-xXLFalgR.js +49 -0
- package/dist/Index-zyZRPz3H.js +28 -0
- package/dist/Index.vue_vue_type_script_lang-Ddo1wo-D.js +671 -0
- package/dist/InputToggleRow-CokEYwm2.js +99 -0
- package/dist/ManualPopover-Dukly7GP.js +65 -0
- package/dist/MediaWrapper-B8msCrQm.js +18 -0
- package/dist/{NotBindingText-CC7TxUqg.js → NotBindingText-DcQd8Eej.js} +13 -17
- package/dist/PackageGroup-clUIUoik.js +1060 -0
- package/dist/PdfTerms-DpzMVRfN.js +34 -0
- package/dist/PdfViewer-CSf4Rtbj.js +392 -0
- package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6KSjjMA.js +17 -0
- package/dist/PriceHeader-Dyweu8aH.js +488 -0
- package/dist/{SearchApi-G2Hvp0Dd.js → SearchApi-Y1fDQn0u.js} +37 -49
- package/dist/SendForm-B9l24WwR.js +6689 -0
- package/dist/Setup-DyzbPFM4.js +47 -0
- package/dist/{SmartList-BynTuXtB.js → SmartList-CWGKoAJh.js} +16 -24
- package/dist/Sortable.vue_vue_type_script_setup_true_lang-C2Gwp6Q-.js +1349 -0
- package/dist/{TermsSettings-cA5YAO77.js → TermsSettings-BeQH307A.js} +169 -56
- package/dist/ThemeColorRow-DFIsPy55.js +105 -0
- package/dist/ToggleBinding-DlH4y1IM.js +44 -0
- package/dist/UploadModal-BZ0mPBBB.js +134 -0
- package/dist/VideoPlayerInput-DBxcTUb7.js +134 -0
- package/dist/VideoPlayerSettings-Dg1OxjOa.js +78 -0
- package/dist/VideoSelectModal-BhbanMix.js +217 -0
- package/dist/{anime.es-BrPTThYb.js → anime.es-4wvNItHq.js} +205 -201
- package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
- package/dist/{dom-Ds4ypDrd.js → dom-CkTGWrfu.js} +3 -6
- package/dist/{focusDrawerMixin-CximZA1J.js → focusDrawerMixin-BVbTYOGr.js} +1 -1
- package/dist/{formDrawerState-CkNGdxn5.js → formDrawerState-CogZ-GVm.js} +2 -2
- package/dist/helpers-B4GUxtdD.js +46 -0
- package/dist/index-BZDey7B-.js +268 -0
- package/dist/index-Bd8_ZHHq.js +188 -0
- package/dist/index-BvyoYp1e.js +508 -0
- package/dist/index-CJZoubA3.js +3525 -0
- package/dist/index-D7yQWP4d.js +125 -0
- package/dist/index-D8hGHka6.js +513 -0
- package/dist/index-Dxy4tf7x.js +149 -0
- package/dist/index.es.js +2 -5
- package/dist/index.umd.js +303 -1486
- package/dist/main-Bn5XkQPb.js +57570 -0
- package/dist/mapFormMixin-C7FJLnbO.js +1528 -0
- package/dist/omit-DrWpFvRJ.js +56 -0
- package/dist/{publicSenderState-CGEm9EYe.js → publicSenderState-tdtCFPMx.js} +4 -4
- package/dist/splitpanes-BApidgjj.js +342 -0
- package/dist/template-CHdf2K2I.js +1572 -0
- package/dist/tippy.esm-Co6FYzEM.js +1994 -0
- package/dist/useTermsModal-VDnO1Lro.js +87 -0
- package/dist/{utils-Dr4AcaE9.js → utils-DZkn0Q9c.js} +8 -11
- package/dist/validation-CqBkar3f.js +40 -0
- package/dist/widget.css +1 -0
- package/package.json +20 -25
- package/dist/AddClientCallout-Br6IhwGH.js +0 -48
- package/dist/AnswerModal-CsWltR6j.js +0 -3879
- package/dist/AttachmentItem-BG7FuSCD.js +0 -85
- package/dist/BaseDatePicker-PSNBtUIh.js +0 -3187
- package/dist/BaseUpload-BfEurAAV.js +0 -1977
- package/dist/BlockMedia-Bo3OfNSU.js +0 -76
- package/dist/CCallout-CAjM8-1X.js +0 -58
- package/dist/CDropdownItem-CN7gSfgY.js +0 -640
- package/dist/CFormField-Clvcf2Jh.js +0 -240
- package/dist/CPhoneInput-CEHXh5jM.js +0 -138
- package/dist/CPriceInput-D2c07SXp.js +0 -116
- package/dist/CSelect-Cz2IPzxS.js +0 -91
- package/dist/CSkeleton-AsnvnD-m.js +0 -55
- package/dist/ClientAutocomplete-CZ55-DKe.js +0 -438
- package/dist/ClientModal-CgUhWZ5L.js +0 -666
- package/dist/ColorPicker-IFGHqH-u.js +0 -2879
- package/dist/CompanyModal-TLSBFo3U.js +0 -147
- package/dist/ContentWrapper-HClxKPuT.js +0 -190
- package/dist/CoverBlockSettings-D99hAa6e.js +0 -659
- package/dist/DocAnswer-CTV_Bpt7.js +0 -36
- package/dist/DocDetails-CQe5htXj.js +0 -263
- package/dist/DocForm-6Efv5_oz.js +0 -5017
- package/dist/DocFormSend-DbXcklxU.js +0 -146
- package/dist/DocLinks-BO545zbL.js +0 -38
- package/dist/DocModalBase-DXHNJ-6i.js +0 -28
- package/dist/DocPrint-Bf2U4FQN.js +0 -240
- package/dist/DocReceipt-CWXvC7bY.js +0 -217
- package/dist/DocSendReminder-CRzBM2NJ.js +0 -140
- package/dist/DocTimeline-DGVOk8-2.js +0 -485
- package/dist/DocumentClient-Das9BaJ7.js +0 -136
- package/dist/DocumentLayout-4q8rmTVT.js +0 -4880
- package/dist/DocumentLogotype-DLncJJAB.js +0 -92
- package/dist/DocumentVoided-CcI9lX27.js +0 -25
- package/dist/EmbedInput-BPdy0lGS.js +0 -117
- package/dist/EmbedSettings-L2iwYLQK.js +0 -74
- package/dist/ErrorCallout-Ds_tBT02.js +0 -27
- package/dist/FilePreviewModal-hxUu330p.js +0 -81
- package/dist/Flag-1-HcT5Dz.js +0 -46
- package/dist/HeaderSettings-C27fMugK.js +0 -440
- package/dist/ImageSelectModal-BKDIyxF4.js +0 -86
- package/dist/ImageUploadWrapper-BiYzUQur.js +0 -1604
- package/dist/Index-5BOWxcPG.js +0 -26
- package/dist/Index-B1Odktov.js +0 -754
- package/dist/Index-B3d5BjEn.js +0 -25
- package/dist/Index-B3sSU_4X.js +0 -54
- package/dist/Index-B5Dqsh3K.js +0 -150
- package/dist/Index-B6aO1c_w.js +0 -62
- package/dist/Index-BGfICxJQ.js +0 -643
- package/dist/Index-BHopC0hv.js +0 -24
- package/dist/Index-BJXcSmp_.js +0 -55
- package/dist/Index-BQe6QjQZ.js +0 -25
- package/dist/Index-BmXx_x6t.js +0 -77
- package/dist/Index-C692qMTG.js +0 -294
- package/dist/Index-CEvbw-3i.js +0 -41
- package/dist/Index-CYSULnpn.js +0 -32
- package/dist/Index-CdtYzwAM.js +0 -107
- package/dist/Index-CetF2FW0.js +0 -230
- package/dist/Index-Cv6XLM20.js +0 -73
- package/dist/Index-Cwy8ff76.js +0 -154
- package/dist/Index-D34z4UEY.js +0 -84
- package/dist/Index-DNCei-lp.js +0 -56
- package/dist/Index-DUbxgIYB.js +0 -2445
- package/dist/Index-DVwn_LLf.js +0 -28
- package/dist/Index-Dla-mesV.js +0 -146
- package/dist/Index-KtUkOPI2.js +0 -58
- package/dist/Index-LjnOTVJk.js +0 -66
- package/dist/Index-ky1SRtfY.js +0 -94
- package/dist/Index-mceZW2NX.js +0 -41
- package/dist/Index-tD3hZjh8.js +0 -144
- package/dist/Index-vM5kDtC2.js +0 -33
- package/dist/InputToggleRow-BmDuSbE2.js +0 -57
- package/dist/ManualPopover-CQfjPvFe.js +0 -60
- package/dist/MediaWrapper-DDzcjR6V.js +0 -23
- package/dist/PackageGroup-mAGXfZDv.js +0 -704
- package/dist/PdfTerms-BH_Nwf2h.js +0 -31
- package/dist/PdfViewer-mBLxI8bA.js +0 -383
- package/dist/PlainHtml-B7gUNNZd.js +0 -27
- package/dist/PriceHeader-DClYMPcq.js +0 -338
- package/dist/SendForm-Cxv_m8Rq.js +0 -1023
- package/dist/Setup-B90VDZTG.js +0 -50
- package/dist/ThemeColorRow-D-Z7w4Wk.js +0 -69
- package/dist/ToggleBinding-DOeTcWzi.js +0 -42
- package/dist/UploadModal-DOPLVEpV.js +0 -95
- package/dist/VideoPlayerInput-1zG06elO.js +0 -97
- package/dist/VideoPlayerSettings-O-4rAYYh.js +0 -61
- package/dist/VideoSelectModal-DzqFrqCg.js +0 -104
- package/dist/answerDocumentMixin-HBiNWYCH.js +0 -51
- package/dist/debounce-Ch1d3526.js +0 -84
- package/dist/formValidationMixin-D_MzsHsR.js +0 -49
- package/dist/index-BNdbPq4J.js +0 -492
- package/dist/index-BXzugeJ6.js +0 -81
- package/dist/index-C5wcxrC6.js +0 -167
- package/dist/index-CgDOs7t4.js +0 -2700
- package/dist/index-Cj-_2coz.js +0 -351
- package/dist/index-DpqV5y0K.js +0 -102
- package/dist/main-BL_yzf2r.js +0 -57357
- package/dist/mapFormMixin-Cu_vkTP-.js +0 -3028
- package/dist/omit-Dfe_H1Ft.js +0 -31
- package/dist/simplebar.min-CRlLD1Oz.js +0 -71
- package/dist/splitpanes-BHUVsCZF.js +0 -382
- package/dist/style.css +0 -4
- package/dist/throttle-BX_w77tW.js +0 -18
- package/dist/tippy.esm-n4arfVzA.js +0 -1805
- package/dist/vuedraggable.umd-DW4PJoZ3.js +0 -3161
- package/dist/vuex.esm-DKGl8mcw.js +0 -467
|
@@ -0,0 +1,1585 @@
|
|
|
1
|
+
import re from "./BaseUpload-DrWzuvbS.js";
|
|
2
|
+
import { o as w, c as y, S as B, e as T, d as R, w as $, F as Et, k as Ct, ap as nt, E as Bt, G as Ut, $ as st, an as Rt, f as mt, _ as kt, b as Ft, s as pt, B as ae, v as he, az as ce } from "./main-Bn5XkQPb.js";
|
|
3
|
+
function Tt(t, e) {
|
|
4
|
+
var i = Object.keys(t);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var s = Object.getOwnPropertySymbols(t);
|
|
7
|
+
e && (s = s.filter(function(o) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(t, o).enumerable;
|
|
9
|
+
})), i.push.apply(i, s);
|
|
10
|
+
}
|
|
11
|
+
return i;
|
|
12
|
+
}
|
|
13
|
+
function v(t) {
|
|
14
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
15
|
+
var i = arguments[e] != null ? arguments[e] : {};
|
|
16
|
+
e % 2 ? Tt(Object(i), !0).forEach(function(s) {
|
|
17
|
+
C(t, s, i[s]);
|
|
18
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : Tt(Object(i)).forEach(function(s) {
|
|
19
|
+
Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(i, s));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
function C(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 le(t, e) {
|
|
28
|
+
if (t == null) return {};
|
|
29
|
+
var i, s, o = 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 (s = 0; s < n.length; s++) i = n[s], e.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (o[i] = t[i]);
|
|
38
|
+
}
|
|
39
|
+
return o;
|
|
40
|
+
}
|
|
41
|
+
function k(t) {
|
|
42
|
+
return function(e) {
|
|
43
|
+
if (Array.isArray(e)) return ht(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 ht(e, i);
|
|
49
|
+
var s = Object.prototype.toString.call(e).slice(8, -1);
|
|
50
|
+
if (s === "Object" && e.constructor && (s = e.constructor.name), s === "Map" || s === "Set") return Array.from(e);
|
|
51
|
+
if (s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)) return ht(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 ht(t, e) {
|
|
59
|
+
(e == null || e > t.length) && (e = t.length);
|
|
60
|
+
for (var i = 0, s = new Array(e); i < e; i++) s[i] = t[i];
|
|
61
|
+
return s;
|
|
62
|
+
}
|
|
63
|
+
var Wt, ue, Q, z = (Wt = 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 s = [], o = 0; o < arguments.length; o++) {
|
|
73
|
+
var n = arguments[o];
|
|
74
|
+
if (n) {
|
|
75
|
+
var a = typeof n;
|
|
76
|
+
if (a === "string" || a === "number") s.push(n);
|
|
77
|
+
else if (Array.isArray(n)) {
|
|
78
|
+
if (n.length) {
|
|
79
|
+
var h = i.apply(null, n);
|
|
80
|
+
h && s.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] && s.push(r);
|
|
83
|
+
else s.push(n.toString());
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return s.join(" ");
|
|
87
|
+
}
|
|
88
|
+
t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
|
|
89
|
+
})();
|
|
90
|
+
}, Wt(Q = { path: ue, 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 && Q.path);
|
|
94
|
+
} }, Q.exports), Q.exports), O = function(t) {
|
|
95
|
+
return function(e, i) {
|
|
96
|
+
if (!e) return t;
|
|
97
|
+
var s;
|
|
98
|
+
typeof e == "string" ? s = e : i = e;
|
|
99
|
+
var o = t;
|
|
100
|
+
return s && (o += "__" + s), o + (i ? Object.keys(i).reduce(function(n, a) {
|
|
101
|
+
var h = i[a];
|
|
102
|
+
return h && (n += " " + (typeof h == "boolean" ? o + "--" + a : o + "--" + a + "_" + h)), n;
|
|
103
|
+
}, "") : "");
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
function gt(t, e, i) {
|
|
107
|
+
var s, o, n, a, h;
|
|
108
|
+
function r() {
|
|
109
|
+
var l = Date.now() - a;
|
|
110
|
+
l < e && l >= 0 ? s = setTimeout(r, e - l) : (s = null, i || (h = t.apply(n, o), n = o = null));
|
|
111
|
+
}
|
|
112
|
+
e == null && (e = 100);
|
|
113
|
+
var c = function() {
|
|
114
|
+
n = this, o = arguments, a = Date.now();
|
|
115
|
+
var l = i && !s;
|
|
116
|
+
return s || (s = setTimeout(r, e)), l && (h = t.apply(n, o), n = o = null), h;
|
|
117
|
+
};
|
|
118
|
+
return c.clear = function() {
|
|
119
|
+
s && (clearTimeout(s), s = null);
|
|
120
|
+
}, c.flush = function() {
|
|
121
|
+
s && (h = t.apply(n, o), n = o = null, clearTimeout(s), s = null);
|
|
122
|
+
}, c;
|
|
123
|
+
}
|
|
124
|
+
gt.debounce = gt;
|
|
125
|
+
var vt = gt, m = function() {
|
|
126
|
+
return m = Object.assign || function(t) {
|
|
127
|
+
for (var e, i = 1, s = arguments.length; i < s; i++) for (var o in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
|
|
128
|
+
return t;
|
|
129
|
+
}, m.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 Xt(t, e) {
|
|
146
|
+
var i, s;
|
|
147
|
+
return t && e ? (i = "" + t + e[0].toUpperCase() + e.slice(1), s = t + "-" + e) : (i = t || e, s = t || e), { name: i, classname: s };
|
|
148
|
+
}
|
|
149
|
+
function Yt(t) {
|
|
150
|
+
return /^blob:/.test(t);
|
|
151
|
+
}
|
|
152
|
+
function Ot(t) {
|
|
153
|
+
return Yt(t) || function(e) {
|
|
154
|
+
return /^data:/.test(e);
|
|
155
|
+
}(t);
|
|
156
|
+
}
|
|
157
|
+
function F(t) {
|
|
158
|
+
return !!(t && t.constructor && t.call && t.apply);
|
|
159
|
+
}
|
|
160
|
+
function A(t) {
|
|
161
|
+
return t === void 0;
|
|
162
|
+
}
|
|
163
|
+
function it(t) {
|
|
164
|
+
return typeof t == "object" && t !== null;
|
|
165
|
+
}
|
|
166
|
+
function bt(t, e, i) {
|
|
167
|
+
var s = {};
|
|
168
|
+
return it(t) ? (Object.keys(e).forEach(function(o) {
|
|
169
|
+
A(t[o]) ? s[o] = e[o] : it(e[o]) ? it(t[o]) ? s[o] = bt(t[o], e[o], i[o]) : s[o] = t[o] ? e[o] : i[o] : e[o] === !0 || e[o] === !1 ? s[o] = !!t[o] : s[o] = t[o];
|
|
170
|
+
}), s) : t ? e : i;
|
|
171
|
+
}
|
|
172
|
+
function K(t) {
|
|
173
|
+
var e = Number(t);
|
|
174
|
+
return Number.isNaN(e) ? t : e;
|
|
175
|
+
}
|
|
176
|
+
function Dt(t) {
|
|
177
|
+
return typeof (t == "number" || /* @__PURE__ */ function(e) {
|
|
178
|
+
return typeof e == "object" && e !== null;
|
|
179
|
+
}(t) && toString.call(t) == "[object Number]") && !Nt(t);
|
|
180
|
+
}
|
|
181
|
+
function Nt(t) {
|
|
182
|
+
return t != t;
|
|
183
|
+
}
|
|
184
|
+
function _t(t, e) {
|
|
185
|
+
return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2));
|
|
186
|
+
}
|
|
187
|
+
var q = function(t, e) {
|
|
188
|
+
t === void 0 && (t = {}), e === void 0 && (e = {}), this.type = "manipulateImage", this.move = t, this.scale = e;
|
|
189
|
+
}, de = function(t, e) {
|
|
190
|
+
e === void 0 && (e = {}), this.type = "resize", this.directions = t, this.params = e;
|
|
191
|
+
}, At = function(t) {
|
|
192
|
+
this.type = "move", this.directions = t;
|
|
193
|
+
}, fe = function() {
|
|
194
|
+
function t(e, i, s, o, n) {
|
|
195
|
+
this.type = "drag", this.nativeEvent = e, this.position = s, this.previousPosition = o, this.element = i, this.anchor = n;
|
|
196
|
+
}
|
|
197
|
+
return t.prototype.shift = function() {
|
|
198
|
+
var e = this, i = e.element, s = e.anchor, o = e.position;
|
|
199
|
+
if (i) {
|
|
200
|
+
var n = i.getBoundingClientRect(), a = n.left, h = n.top;
|
|
201
|
+
return { left: o.left - a - s.left, top: o.top - h - s.top };
|
|
202
|
+
}
|
|
203
|
+
return { left: 0, top: 0 };
|
|
204
|
+
}, t;
|
|
205
|
+
}(), Mt = { 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 = k(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, s = e.right, o = e.bottom, n = e.top;
|
|
235
|
+
this.anchor = { left: t.clientX - i, top: t.clientY - n, bottom: o - t.clientY, right: s - t.clientX };
|
|
236
|
+
}, processMove: function(t, e) {
|
|
237
|
+
var i = k(e);
|
|
238
|
+
if (this.touches.length) {
|
|
239
|
+
if (this.touches.length === 1 && i.length === 1) {
|
|
240
|
+
var s = this.$refs.draggable;
|
|
241
|
+
this.$emit("drag", new fe(t, s, { 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
|
+
Mt.render = function(t, e, i, s, o, n) {
|
|
249
|
+
return w(), y("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
|
+
}) }, [B(t.$slots, "default")], 34);
|
|
258
|
+
};
|
|
259
|
+
var ct = O("vue-handler-wrapper"), Vt = { name: "HandlerWrapper", components: { DraggableElement: Mt }, 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 = Xt(this.horizontalPosition, this.verticalPosition);
|
|
263
|
+
t = ct((C(e = {}, i.classname, !0), C(e, "disabled", this.disabled), e));
|
|
264
|
+
} else t = ct({ disabled: this.disabled });
|
|
265
|
+
return { root: t, draggable: ct("draggable") };
|
|
266
|
+
} }, emits: ["leave", "enter", "drag", "drag-end"] };
|
|
267
|
+
Vt.render = function(t, e, i, s, o, n) {
|
|
268
|
+
var a = T("DraggableElement");
|
|
269
|
+
return w(), y("div", { class: n.classes.root }, [R(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: $(function() {
|
|
278
|
+
return [B(t.$slots, "default")];
|
|
279
|
+
}), _: 3 }, 8, ["class"])], 2);
|
|
280
|
+
};
|
|
281
|
+
var me = O("vue-line-wrapper"), qt = { name: "LineWrapper", components: { DraggableElement: Mt }, props: { position: { type: String, required: !0 }, disabled: { type: Boolean, default: !1 } }, computed: { classname: function() {
|
|
282
|
+
var t;
|
|
283
|
+
return me((C(t = {}, this.position, !0), C(t, "disabled", this.disabled), t));
|
|
284
|
+
} }, emits: ["leave", "enter", "drag", "drag-end"] };
|
|
285
|
+
qt.render = function(t, e, i, s, o, n) {
|
|
286
|
+
var a = T("DraggableElement");
|
|
287
|
+
return w(), y(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: $(function() {
|
|
296
|
+
return [B(t.$slots, "default")];
|
|
297
|
+
}), _: 3 }, 8, ["class"]);
|
|
298
|
+
};
|
|
299
|
+
var I = ["left", "right", "top", "bottom"], pe = ["left", "right"], ge = ["top", "bottom"], ve = ["left", "top"], be = ["fill-area", "fit-area", "stencil", "none"], It = { left: 0, top: 0, width: 0, height: 0 };
|
|
300
|
+
function $t(t, e, i) {
|
|
301
|
+
return !(i = i || ["width", "height", "left", "top"]).some(function(s) {
|
|
302
|
+
return t[s] !== e[s];
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function H(t) {
|
|
306
|
+
return { left: t.left, top: t.top, right: t.left + t.width, bottom: t.top + t.height };
|
|
307
|
+
}
|
|
308
|
+
function X(t, e) {
|
|
309
|
+
return { left: t.left - e.left, top: t.top - e.top };
|
|
310
|
+
}
|
|
311
|
+
function M(t) {
|
|
312
|
+
return { left: t.left + t.width / 2, top: t.top + t.height / 2 };
|
|
313
|
+
}
|
|
314
|
+
function Z(t, e) {
|
|
315
|
+
var i = { left: 0, top: 0, right: 0, bottom: 0 };
|
|
316
|
+
return I.forEach(function(s) {
|
|
317
|
+
var o = e[s], n = H(t)[s];
|
|
318
|
+
i[s] = o !== void 0 && n !== void 0 ? s === "left" || s === "top" ? Math.max(0, o - n) : Math.max(0, n - o) : 0;
|
|
319
|
+
}), i;
|
|
320
|
+
}
|
|
321
|
+
function D(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 ot(t) {
|
|
325
|
+
return { left: -t.left, top: -t.top };
|
|
326
|
+
}
|
|
327
|
+
function x(t, e) {
|
|
328
|
+
return m(m({}, t), { left: t.left + e.left, top: t.top + e.top });
|
|
329
|
+
}
|
|
330
|
+
function W(t, e, i, s) {
|
|
331
|
+
if (e !== 1) {
|
|
332
|
+
if (i) {
|
|
333
|
+
var o = M(t);
|
|
334
|
+
return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2 + (i.left - o.left) * (1 - e), top: t.top + t.height * (1 - e) / 2 + (i.top - o.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 b(t) {
|
|
341
|
+
return t.width / t.height;
|
|
342
|
+
}
|
|
343
|
+
function Y(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 N(t, e) {
|
|
347
|
+
var i = { left: 0, top: 0 }, s = Z(t, e);
|
|
348
|
+
return s.left && s.left > 0 ? i.left = s.left : s.right && s.right > 0 && (i.left = -s.right), s.top && s.top > 0 ? i.top = s.top : s.bottom && s.bottom > 0 && (i.top = -s.bottom), i;
|
|
349
|
+
}
|
|
350
|
+
function lt(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 Zt(t, e) {
|
|
355
|
+
var i = b(t), s = b(e);
|
|
356
|
+
return e.width < 1 / 0 && e.height < 1 / 0 ? i > s ? { 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 Gt(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 U(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 rt(t, e) {
|
|
367
|
+
var i = Z(S(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, Y(t, e)) : Math.min((t.height + i.top + i.bottom) / t.height, Y(t, e)) : 1;
|
|
369
|
+
}
|
|
370
|
+
function S(t, e, i) {
|
|
371
|
+
i === void 0 && (i = !1);
|
|
372
|
+
var s = N(t, e);
|
|
373
|
+
return x(t, i ? ot(s) : s);
|
|
374
|
+
}
|
|
375
|
+
function wt(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 m(m({}, 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 Qt(t, e, i) {
|
|
382
|
+
i === void 0 && (i = !0);
|
|
383
|
+
var s = {};
|
|
384
|
+
return I.forEach(function(o) {
|
|
385
|
+
var n = t[o], a = e[o];
|
|
386
|
+
n !== void 0 && a !== void 0 ? s[o] = o === "left" || o === "top" ? i ? Math.max(n, a) : Math.min(n, a) : i ? Math.min(n, a) : Math.max(n, a) : a !== void 0 ? s[o] = a : n !== void 0 && (s[o] = n);
|
|
387
|
+
}), s;
|
|
388
|
+
}
|
|
389
|
+
function at(t, e) {
|
|
390
|
+
return Qt(t, e, !0);
|
|
391
|
+
}
|
|
392
|
+
function Ht(t) {
|
|
393
|
+
var e = t.size, i = t.aspectRatio, s = t.ignoreMinimum, o = t.sizeRestrictions;
|
|
394
|
+
return !!((e.correctRatio || b(e) >= i.minimum && b(e) <= i.maximum) && e.height <= o.maxHeight && e.width <= o.maxWidth && e.width && e.height && (s || e.height >= o.minHeight && e.width >= o.minWidth));
|
|
395
|
+
}
|
|
396
|
+
function Lt(t, e) {
|
|
397
|
+
return Math.pow(t.width - e.width, 2) + Math.pow(t.height - e.height, 2);
|
|
398
|
+
}
|
|
399
|
+
function P(t) {
|
|
400
|
+
var e = t.width, i = t.height, s = t.sizeRestrictions, o = { minimum: t.aspectRatio && t.aspectRatio.minimum || 0, maximum: t.aspectRatio && t.aspectRatio.maximum || 1 / 0 }, n = { width: Math.max(s.minWidth, Math.min(s.maxWidth, e)), height: Math.max(s.minHeight, Math.min(s.maxHeight, i)) };
|
|
401
|
+
function a(c, l) {
|
|
402
|
+
return l === void 0 && (l = !1), c.reduce(function(u, d) {
|
|
403
|
+
return Ht({ size: d, aspectRatio: o, sizeRestrictions: s, ignoreMinimum: l }) && (!u || Lt(d, { width: e, height: i }) < Lt(u, { width: e, height: i })) ? d : u;
|
|
404
|
+
}, null);
|
|
405
|
+
}
|
|
406
|
+
var h = [];
|
|
407
|
+
[o.minimum, o.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
|
+
}), Ht({ size: n, aspectRatio: o, sizeRestrictions: s }) && h.push(n);
|
|
410
|
+
var r = a(h) || a(h, !0);
|
|
411
|
+
return r && { width: r.width, height: r.height };
|
|
412
|
+
}
|
|
413
|
+
function yt(t) {
|
|
414
|
+
var e = t.event, i = t.coordinates, s = t.positionRestrictions, o = s === void 0 ? {} : s, n = x(i, e.directions);
|
|
415
|
+
return x(n, N(n, o));
|
|
416
|
+
}
|
|
417
|
+
function ye(t) {
|
|
418
|
+
var e = t.coordinates, i = t.transform, s = t.imageSize, o = t.sizeRestrictions, n = t.positionRestrictions, a = t.aspectRatio, h = t.visibleArea, r = function(l, u) {
|
|
419
|
+
return yt({ coordinates: l, positionRestrictions: n, event: new At({ left: u.left - l.left, top: u.top - l.top }) });
|
|
420
|
+
}, c = m({}, e);
|
|
421
|
+
return (Array.isArray(i) ? i : [i]).forEach(function(l) {
|
|
422
|
+
var u = {};
|
|
423
|
+
A((u = typeof l == "function" ? l({ coordinates: c, imageSize: s, visibleArea: h }) : l).width) && A(u.height) || (c = function(d, f) {
|
|
424
|
+
var p = m(m(m({}, d), P({ width: f.width, height: f.height, sizeRestrictions: o, aspectRatio: a })), { left: 0, top: 0 });
|
|
425
|
+
return r(p, { left: d.left, top: d.top });
|
|
426
|
+
}(c, m(m({}, c), u))), A(u.left) && A(u.top) || (c = r(c, m(m({}, c), u)));
|
|
427
|
+
}), c;
|
|
428
|
+
}
|
|
429
|
+
function ze(t) {
|
|
430
|
+
t.event;
|
|
431
|
+
var e = t.getAreaRestrictions, i = t.boundaries, s = t.coordinates, o = 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 = m({}, s), d = m({}, o), f = m({}, n);
|
|
436
|
+
r = b(f), c = b(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 = m(m({}, u), P({ sizeRestrictions: a, width: u.width, height: u.height, aspectRatio: { minimum: b(f), maximum: b(f) } })));
|
|
437
|
+
var p = rt(d = W(d, u.width * i.width / (d.width * f.width)), e({ visibleArea: d, type: "resize" }));
|
|
438
|
+
return p !== 1 && (d = W(d, p), u = W(u, p)), d = S(d = x(d, X(M(u), M(d))), e({ visibleArea: d, type: "move" })), { coordinates: u = S(u, at(H(d), h)), visibleArea: d };
|
|
439
|
+
}
|
|
440
|
+
function Re(t) {
|
|
441
|
+
var e = t.event, i = t.getAreaRestrictions, s = t.boundaries, o = t.coordinates, n = t.visibleArea;
|
|
442
|
+
t.aspectRatio, t.stencilSize, t.sizeRestrictions;
|
|
443
|
+
var a = t.positionRestrictions;
|
|
444
|
+
t.stencilReference;
|
|
445
|
+
var h = m({}, o), r = m({}, n);
|
|
446
|
+
if (o && n && e.type !== "manipulateImage") {
|
|
447
|
+
var c = { width: 0, height: 0 };
|
|
448
|
+
r.width, s.width, b(s) > b(h) ? (c.height = 0.8 * s.height, c.width = c.height * b(h)) : (c.width = 0.8 * s.width, c.height = c.width * b(h));
|
|
449
|
+
var l = rt(r = W(r, h.width * s.width / (r.width * c.width)), i({ visibleArea: r, type: "resize" }));
|
|
450
|
+
r = W(r, l), l !== 1 && (c.height /= l, c.width /= l), r = S(r = x(r, X(M(h), M(r))), i({ visibleArea: r, type: "move" })), h = S(h, at(H(r), a));
|
|
451
|
+
}
|
|
452
|
+
return { coordinates: h, visibleArea: r };
|
|
453
|
+
}
|
|
454
|
+
function Ae(t) {
|
|
455
|
+
var e = t.event, i = t.coordinates, s = t.visibleArea, o = t.getAreaRestrictions, n = m({}, s), a = m({}, 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 = W(n, Math.min(a.width / n.width, Y(n, o({ visibleArea: n, type: "resize" })))) : r > h && (n = W(n, Math.min(a.height / n.height, Y(n, o({ visibleArea: n, type: "resize" }))))), n = S(n = x(n, ot(N(a, H(n)))), o({ visibleArea: n, type: "move" }));
|
|
459
|
+
}
|
|
460
|
+
return { visibleArea: n, coordinates: a };
|
|
461
|
+
}
|
|
462
|
+
function Me(t) {
|
|
463
|
+
var e = t.imageSize, i = t.visibleArea, s = t.coordinates, o = i || e;
|
|
464
|
+
return { left: (i ? i.left : 0) + o.width / 2 - s.width / 2, top: (i ? i.top : 0) + o.height / 2 - s.height / 2 };
|
|
465
|
+
}
|
|
466
|
+
function Se(t) {
|
|
467
|
+
var e = t.imageSize, i = t.visibleArea, s = t.aspectRatio, o = t.sizeRestrictions, n = i || e, a = Math.min(s.maximum || 1 / 0, Math.max(s.minimum || 0, b(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 P(m(m({}, h), { aspectRatio: s, sizeRestrictions: o }));
|
|
469
|
+
}
|
|
470
|
+
function xe(t) {
|
|
471
|
+
var e, i, s = t.imageSize, o = t.visibleArea, n = t.boundaries, a = t.aspectRatio, h = t.sizeRestrictions, r = t.stencilSize, c = o || s;
|
|
472
|
+
return b(c) > b(n) ? i = (e = r.height * c.height / n.height) * b(r) : e = (i = r.width * c.width / n.width) / b(r), P({ width: i, height: e, aspectRatio: a, sizeRestrictions: h });
|
|
473
|
+
}
|
|
474
|
+
function Ee(t) {
|
|
475
|
+
var e = t.getAreaRestrictions, i = t.coordinates, s = t.imageSize, o = b(t.boundaries);
|
|
476
|
+
if (i) {
|
|
477
|
+
var n = { height: Math.max(i.height, s.height), width: Math.max(i.width, s.width) }, a = Zt({ width: b(n) > o ? n.width : n.height * o, height: b(n) > o ? n.width / o : n.height }, wt(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 = Z(i, H(m({ left: 0, top: 0 }, s))), c = {};
|
|
478
|
+
return !r.left && !r.right && h.width <= s.width && (c.left = 0, c.right = s.width), !r.top && !r.bottom && h.height <= s.height && (c.top = 0, c.bottom = s.height), S(h, c);
|
|
479
|
+
}
|
|
480
|
+
var l = b(s);
|
|
481
|
+
return a = { height: l > o ? s.height : s.width / o, width: l > o ? s.height * o : s.width }, { left: s.width / 2 - a.width / 2, top: s.height / 2 - a.height / 2, width: a.width, height: a.height };
|
|
482
|
+
}
|
|
483
|
+
function J(t, e) {
|
|
484
|
+
return Qt(t, H(e));
|
|
485
|
+
}
|
|
486
|
+
function Ce(t) {
|
|
487
|
+
var e = t.event, i = t.coordinates, s = t.visibleArea, o = t.sizeRestrictions, n = t.getAreaRestrictions, a = t.positionRestrictions, h = t.adjustStencil, r = e.scale, c = e.move, l = m({}, s), u = m({}, i), d = 1, f = 1, p = r.factor && Math.abs(r.factor - 1) > 1e-3;
|
|
488
|
+
l = x(l, { left: c.left || 0, top: c.top || 0 });
|
|
489
|
+
var g = { stencil: { minimum: Math.max(o.minWidth ? o.minWidth / u.width : 0, o.minHeight ? o.minHeight / u.height : 0), maximum: Math.min(o.maxWidth ? o.maxWidth / u.width : 1 / 0, o.maxHeight ? o.maxHeight / u.height : 1 / 0, Y(u, a)) }, area: { maximum: Y(l, n({ visibleArea: l, type: "resize" })) } };
|
|
490
|
+
r.factor && p && (r.factor < 1 ? (f = Math.max(r.factor, g.stencil.minimum)) > 1 && (f = 1) : r.factor > 1 && (f = Math.min(r.factor, Math.min(g.area.maximum, g.stencil.maximum))) < 1 && (f = 1)), f && (l = W(l, f, r.center));
|
|
491
|
+
var E = i.left - s.left, L = s.width + s.left - (i.width + i.left), _ = i.top - s.top, G = s.height + s.top - (i.height + i.top);
|
|
492
|
+
return l = S(l = x(l, N(l, { left: a.left !== void 0 ? a.left - E * f : void 0, top: a.top !== void 0 ? a.top - _ * f : void 0, bottom: a.bottom !== void 0 ? a.bottom + G * f : void 0, right: a.right !== void 0 ? a.right + L * f : void 0 })), n({ visibleArea: l, type: "move" })), u.width = u.width * f, u.height = u.height * f, u.left = l.left + E * f, u.top = l.top + _ * f, u = S(u, at(H(l), a)), r.factor && p && h && (r.factor > 1 ? d = Math.min(g.area.maximum, r.factor) / f : r.factor < 1 && (d = Math.max(u.height / l.height, u.width / l.width, r.factor / f)), d !== 1 && (l = x(l = S(l = W(l, d, r.factor > 1 ? r.center : M(u)), n({ visibleArea: l, type: "move" })), ot(N(u, H(l)))))), { coordinates: u, visibleArea: l };
|
|
493
|
+
}
|
|
494
|
+
function Te(t) {
|
|
495
|
+
var e = t.aspectRatio, i = t.getAreaRestrictions, s = t.coordinates, o = t.visibleArea, n = t.sizeRestrictions, a = t.positionRestrictions, h = t.imageSize, r = t.previousImageSize, c = t.angle, l = m({}, s), u = m({}, o), d = U(M(m({ left: 0, top: 0 }, r)), c);
|
|
496
|
+
return (l = m(m({}, P({ sizeRestrictions: n, aspectRatio: e, width: l.width, height: l.height })), U(M(l), c))).left -= d.left - h.width / 2 + l.width / 2, l.top -= d.top - h.height / 2 + l.height / 2, u = W(u, rt(u, i({ visibleArea: u, type: "resize" }))), { coordinates: l = S(l, a), visibleArea: u = S(u = x(u, X(M(l), M(s))), i({ visibleArea: u, type: "move" })) };
|
|
497
|
+
}
|
|
498
|
+
function We(t) {
|
|
499
|
+
var e = t.flip, i = t.previousFlip, s = t.rotate, o = t.getAreaRestrictions, n = t.coordinates, a = t.visibleArea, h = t.imageSize, r = m({}, n), c = m({}, a), l = i.horizontal !== e.horizontal, u = i.vertical !== e.vertical;
|
|
500
|
+
if (l || u) {
|
|
501
|
+
var d = U({ left: h.width / 2, top: h.height / 2 }, -s), f = U(M(r), -s), p = U({ left: l ? d.left - (f.left - d.left) : f.left, top: u ? d.top - (f.top - d.top) : f.top }, s);
|
|
502
|
+
r = x(r, X(p, M(r))), f = U(M(c), -s), c = S(c = x(c, X(p = U({ left: l ? d.left - (f.left - d.left) : f.left, top: u ? d.top - (f.top - d.top) : f.top }, s), M(c))), o({ visibleArea: c, type: "move" }));
|
|
503
|
+
}
|
|
504
|
+
return { coordinates: r, visibleArea: c };
|
|
505
|
+
}
|
|
506
|
+
function jt(t) {
|
|
507
|
+
var e = t.directions, i = t.coordinates, s = t.positionRestrictions, o = s === void 0 ? {} : s, n = t.sizeRestrictions, a = t.preserveRatio, h = t.compensate, r = m({}, e), c = D(i, r).width, l = D(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 = Z(D(i, r), o);
|
|
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 = Z(D(i, r), o));
|
|
511
|
+
var d = { width: 1 / 0, height: 1 / 0, left: 1 / 0, right: 1 / 0, top: 1 / 0, bottom: 1 / 0 };
|
|
512
|
+
if (I.forEach(function(g) {
|
|
513
|
+
var E = u[g];
|
|
514
|
+
E && r[g] && (d[g] = Math.max(0, 1 - E / r[g]));
|
|
515
|
+
}), a) {
|
|
516
|
+
var f = Math.min.apply(null, I.map(function(g) {
|
|
517
|
+
return d[g];
|
|
518
|
+
}));
|
|
519
|
+
f !== 1 / 0 && I.forEach(function(g) {
|
|
520
|
+
r[g] *= f;
|
|
521
|
+
});
|
|
522
|
+
} else I.forEach(function(g) {
|
|
523
|
+
d[g] !== 1 / 0 && (r[g] *= d[g]);
|
|
524
|
+
});
|
|
525
|
+
if (c = D(i, r).width, l = D(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 p = Math.min(d.width, d.height);
|
|
527
|
+
p !== 1 / 0 && I.forEach(function(g) {
|
|
528
|
+
r[g] *= p;
|
|
529
|
+
});
|
|
530
|
+
} else d.width !== 1 / 0 && pe.forEach(function(g) {
|
|
531
|
+
r[g] *= d.width;
|
|
532
|
+
}), d.height !== 1 / 0 && ge.forEach(function(g) {
|
|
533
|
+
r[g] *= d.height;
|
|
534
|
+
});
|
|
535
|
+
return r;
|
|
536
|
+
}
|
|
537
|
+
function tt(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 Oe = O("vue-simple-handler"), De = O("vue-simple-handler-wrapper"), St = { name: "SimpleHandler", components: { HandlerWrapper: Vt }, 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 = (C(t = {}, this.horizontalPosition, !!this.horizontalPosition), C(t, this.verticalPosition, !!this.verticalPosition), C(t, "".concat(this.horizontalPosition, "-").concat(this.verticalPosition), !!(this.verticalPosition && this.horizontalPosition)), C(t, "hover", this.hover), t);
|
|
544
|
+
return { default: z(Oe(e), this.defaultClass, this.hover && this.hoverClass), wrapper: z(De(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
|
+
St.render = function(t, e, i, s, o, n) {
|
|
555
|
+
var a = T("HandlerWrapper");
|
|
556
|
+
return w(), y(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: $(function() {
|
|
557
|
+
return [R("div", { class: n.classes.default }, null, 2)];
|
|
558
|
+
}), _: 1 }, 8, ["class", "vertical-position", "horizontal-position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
|
|
559
|
+
};
|
|
560
|
+
var Ie = O("vue-simple-line"), $e = O("vue-simple-line-wrapper"), xt = { name: "SimpleLine", components: { LineWrapper: qt }, 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: z(Ie(C({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass), wrapper: z($e(C({}, 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
|
+
xt.render = function(t, e, i, s, o, n) {
|
|
574
|
+
var a = T("LineWrapper");
|
|
575
|
+
return w(), y(a, { class: n.classes.wrapper, position: i.position, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: $(function() {
|
|
576
|
+
return [R("div", { class: n.classes.root }, null, 2)];
|
|
577
|
+
}), _: 1 }, 8, ["class", "position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
|
|
578
|
+
};
|
|
579
|
+
var ut = O("vue-bounding-box"), He = ["east", "west", null], Le = ["south", "north", null], Kt = { 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 St;
|
|
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 xt;
|
|
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 He.forEach(function(e) {
|
|
598
|
+
Le.forEach(function(i) {
|
|
599
|
+
if (e !== i) {
|
|
600
|
+
var s = Xt(e, i), o = s.name, n = s.classname;
|
|
601
|
+
t.push({ name: o, 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, s = this.linesWrappersClasses;
|
|
610
|
+
return { root: ut(), handlers: t, handlersWrappers: e, lines: i, linesWrappers: s };
|
|
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: z(t.classes.lines.default, t.classes.lines[i.name], !t.resizable && t.classes.lines.disabled), wrapperClass: z(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, s = this.height;
|
|
618
|
+
return this.points.forEach(function(o) {
|
|
619
|
+
if (t.handlers[o.name]) {
|
|
620
|
+
var n = { name: o.name, component: t.handlersComponent, class: z(t.classes.handlers.default, t.classes.handlers[o.name]), wrapperClass: z(t.classes.handlersWrappers.default, t.classes.handlersWrappers[o.name]), hoverClass: t.classes.handlers.hover, verticalDirection: o.verticalDirection, horizontalDirection: o.horizontalDirection, disabled: !t.resizable };
|
|
621
|
+
if (i && s) {
|
|
622
|
+
var a = o.horizontalDirection, h = o.verticalDirection, r = a === "east" ? i : a === "west" ? 0 : i / 2, c = h === "south" ? s : h === "north" ? 0 : s / 2;
|
|
623
|
+
n.wrapperClass = ut("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 = ut("handler", C({}, o.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 s, o = t.shift(), n = o.left, a = o.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 ? s = "width" : i && !e && (s = "height"), this.resizable && this.$emit("resize", new de(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: s }));
|
|
639
|
+
} }, emits: ["resize", "resize-end"] };
|
|
640
|
+
Kt.render = function(t, e, i, s, o, n) {
|
|
641
|
+
return w(), y("div", { ref: "box", class: n.classes.root, style: n.style }, [B(t.$slots, "default"), R("div", null, [(w(!0), y(Et, null, Ct(n.lineNodes, function(a) {
|
|
642
|
+
return w(), y(nt(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))]), (w(!0), y(Et, null, Ct(n.handlerNodes, function(a) {
|
|
648
|
+
return w(), y("div", { key: a.name, style: a.wrapperStyle, class: a.wrapperClass }, [(w(), y(nt(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 je = O("vue-draggable-area"), Jt = { name: "DraggableArea", props: { movable: { type: Boolean, default: !0 }, activationDistance: { type: Number, default: 20 } }, computed: { classnames: function() {
|
|
656
|
+
return { default: je() };
|
|
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 = k(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()) : _t({ 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, s = e.top;
|
|
683
|
+
this.anchor = { x: t.clientX - i, y: t.clientY - s };
|
|
684
|
+
}, processMove: function(t, e) {
|
|
685
|
+
var i = k(e);
|
|
686
|
+
if (this.touches.length) {
|
|
687
|
+
var s = this.$refs.container.getBoundingClientRect(), o = s.left, n = s.top;
|
|
688
|
+
this.touches.length === 1 && i.length === 1 && this.$emit("move", new At({ left: i[0].clientX - (o + 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
|
+
Jt.render = function(t, e, i, s, o, n) {
|
|
694
|
+
return w(), y("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
|
+
}) }, [B(t.$slots, "default")], 544);
|
|
699
|
+
};
|
|
700
|
+
function dt(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 Pe(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), f = 0; f < l; f++) d[f] = c.charCodeAt(f);
|
|
710
|
+
return u;
|
|
711
|
+
}(t));
|
|
712
|
+
else if (/^blob:/i.test(t)) {
|
|
713
|
+
var s = new FileReader();
|
|
714
|
+
s.onload = function(r) {
|
|
715
|
+
e(r.target.result);
|
|
716
|
+
}, n = t, a = function(r) {
|
|
717
|
+
s.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 o = new XMLHttpRequest();
|
|
723
|
+
o.onreadystatechange = function() {
|
|
724
|
+
o.readyState === 4 && (o.status === 200 || o.status === 0 ? e(o.response) : i("Warning: could not load an image to parse its orientation"), o = null);
|
|
725
|
+
}, o.onprogress = function() {
|
|
726
|
+
o.getResponseHeader("content-type") !== "image/jpeg" && o.abort();
|
|
727
|
+
}, o.withCredentials = !1, o.open("GET", t, !0), o.responseType = "arraybuffer", o.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 te(t) {
|
|
737
|
+
var e = t.rotate, i = t.flip, s = t.scaleX, o = t.scaleY, n = "";
|
|
738
|
+
return n += " rotate(" + e + "deg) ", n += " scaleX(" + s * (i.horizontal ? -1 : 1) + ") ", n += " scaleY(" + o * (i.vertical ? -1 : 1) + ") ";
|
|
739
|
+
}
|
|
740
|
+
function Be(t) {
|
|
741
|
+
try {
|
|
742
|
+
var e, i = new DataView(t), s = void 0, o = 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 && (s = n + 10, function(f, p, g) {
|
|
751
|
+
var E, L = "";
|
|
752
|
+
for (E = p, g += p; E < g; E++) L += String.fromCharCode(f.getUint8(E));
|
|
753
|
+
return L;
|
|
754
|
+
}(i, n + 4, 4) === "Exif")) {
|
|
755
|
+
var c = i.getUint16(s);
|
|
756
|
+
if (((o = c === 18761) || c === 19789) && i.getUint16(s + 2, o) === 42) {
|
|
757
|
+
var l = i.getUint32(s + 4, o);
|
|
758
|
+
l >= 8 && (a = s + l);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (a) {
|
|
762
|
+
for (var u = i.getUint16(a, o), d = 0; d < u; d++)
|
|
763
|
+
if (r = a + 12 * d + 2, i.getUint16(r, o) === 274) {
|
|
764
|
+
r += 8, e = i.getUint16(r, o), i.setUint16(r, 1, o);
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return e;
|
|
769
|
+
} catch {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
function Pt(t, e) {
|
|
774
|
+
var i = e.getBoundingClientRect(), s = i.left, o = i.top, n = { left: 0, top: 0 }, a = 0;
|
|
775
|
+
return t.forEach(function(h) {
|
|
776
|
+
n.left += (h.clientX - s) / t.length, n.top += (h.clientY - o) / t.length;
|
|
777
|
+
}), t.forEach(function(h) {
|
|
778
|
+
a += _t({ x: n.left, y: n.top }, { x: h.clientX - s, y: h.clientY - o });
|
|
779
|
+
}), { centerMass: n, spread: a, count: t.length };
|
|
780
|
+
}
|
|
781
|
+
var ee = { 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 = vt(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 q({ 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 = Pt(e, this.$refs.container), s = this.oldGeometricProperties;
|
|
792
|
+
s.count === i.count && s.count > 1 && this.$emit("resize", new q({ left: s.centerMass.left - i.centerMass.left, top: s.centerMass.top - i.centerMass.top }, { factor: s.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(), s = i.left, o = i.top, n = i.bottom, a = i.right;
|
|
805
|
+
this.touches = k(t.touches).filter(function(h) {
|
|
806
|
+
return h.clientX > s && h.clientX < a && h.clientY > o && h.clientY < n;
|
|
807
|
+
}), this.oldGeometricProperties = Pt(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 = k(t.touches).filter(function(s) {
|
|
815
|
+
return !s.identifier || e.touches.find(function(o) {
|
|
816
|
+
return o.identifier === s.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, s = e.top, o = 1 + this.wheelResize.ratio * (a = t.deltaY || t.detail || t.wheelDelta, (h = +a) == 0 || Nt(h) ? h : h > 0 ? 1 : -1), n = { left: t.clientX - i, top: t.clientY - s };
|
|
833
|
+
this.$emit("resize", new q({}, { factor: o, center: n })), this.touches.length || this.debouncedProcessEnd();
|
|
834
|
+
}
|
|
835
|
+
var a, h;
|
|
836
|
+
} }, emits: ["resize", "move", "transform-end"] };
|
|
837
|
+
ee.render = function(t, e, i, s, o, n) {
|
|
838
|
+
return w(), y("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
|
+
}) }, [B(t.$slots, "default")], 544);
|
|
845
|
+
};
|
|
846
|
+
var zt = { components: { TransformableImage: ee }, 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
|
+
zt.render = function(t, e, i, s, o, n) {
|
|
848
|
+
var a = T("transformable-image");
|
|
849
|
+
return w(), y(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: $(function() {
|
|
854
|
+
return [B(t.$slots, "default")];
|
|
855
|
+
}), _: 3 }, 8, ["touch-move", "touch-resize", "mouse-move", "wheel-resize"]);
|
|
856
|
+
};
|
|
857
|
+
var et = O("vue-preview"), ie = { 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: et({ fill: this.fill }), wrapper: et("wrapper"), imageWrapper: et("image-wrapper"), image: z(et("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 = v(v({ rotate: 0, flip: { horizontal: !1, vertical: !1 } }, this.image.transforms), {}, { scaleX: 1 / t, scaleY: 1 / t }), i = this.imageSize.width, s = this.imageSize.height, o = Gt({ width: i, height: s }, e.rotate), n = { width: "".concat(i, "px"), height: "".concat(s, "px"), left: "0px", top: "0px" }, a = { rotate: { left: (i - o.width) * e.scaleX / 2, top: (s - o.height) * e.scaleY / 2 }, scale: { left: (1 - e.scaleX) * i / 2, top: (1 - e.scaleY) * s / 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) ") + te(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
|
+
ie.render = function(t, e, i, s, o, n) {
|
|
901
|
+
return w(), y("div", { ref: "root", class: n.classes.root, style: n.style }, [R("div", { ref: "wrapper", class: n.classes.wrapper, style: n.wrapperStyle }, [Bt(R("img", { ref: "image", src: i.image && i.image.src, class: n.classes.image, style: n.imageStyle }, null, 14, ["src"]), [[Ut, i.image && i.image.src]])], 6)], 6);
|
|
902
|
+
};
|
|
903
|
+
var ne = { components: { Preview: ie }, inheritAttrs: !1 };
|
|
904
|
+
ne.render = function(t, e, i, s, o, n) {
|
|
905
|
+
var a = T("preview");
|
|
906
|
+
return w(), y(a, st(t.$attrs, { fill: !0 }), null, 16);
|
|
907
|
+
};
|
|
908
|
+
var ft = O("vue-rectangle-stencil"), se = { name: "RectangleStencil", components: { StencilPreview: ne, BoundingBox: Kt, DraggableArea: Jt }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object }, handlersComponent: { type: [Object, String], default: function() {
|
|
909
|
+
return St;
|
|
910
|
+
} }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
|
|
911
|
+
return xt;
|
|
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: z(ft({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: z(ft("preview"), this.previewClass), boundingBox: z(ft("bounding-box"), this.boundingBoxClass) };
|
|
924
|
+
}, style: function() {
|
|
925
|
+
var t = this.stencilCoordinates, e = t.height, i = t.width, s = t.left, o = t.top, n = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(s, "px, ").concat(o, "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
|
+
se.render = function(t, e, i, s, o, n) {
|
|
939
|
+
var a = T("stencil-preview"), h = T("draggable-area"), r = T("bounding-box");
|
|
940
|
+
return w(), y("div", { class: n.classes.stencil, style: n.style }, [R(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: $(function() {
|
|
941
|
+
return [R(h, { movable: i.movable, onMove: n.onMove, onMoveEnd: n.onMoveEnd }, { default: $(function() {
|
|
942
|
+
return [R(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 Ue = ["transitions"], j = O("vue-advanced-cropper"), oe = { name: "Cropper", components: { BackgroundWrapper: zt }, props: { src: { type: String, default: null }, stencilComponent: { type: [Object, String], default: function() {
|
|
947
|
+
return se;
|
|
948
|
+
} }, backgroundWrapperComponent: { type: [Object, String], default: function() {
|
|
949
|
+
return zt;
|
|
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 be.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, s = t.aspectRatio, o = t.positionRestrictions, n = t.sizeRestrictions, a = m(m({}, i), { right: i.left + i.width, bottom: i.top + i.height }), h = e.params || {}, r = m({}, 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), I.forEach(function(V) {
|
|
959
|
+
c[V] || (r[V] = 0);
|
|
960
|
+
});
|
|
961
|
+
var l = D(a, r = jt({ coordinates: a, directions: r, sizeRestrictions: n, positionRestrictions: o })).width, u = D(a, r).height, d = h.preserveRatio ? b(a) : lt(l / u, s);
|
|
962
|
+
if (d) {
|
|
963
|
+
var f = h.respectDirection;
|
|
964
|
+
if (f || (f = a.width >= a.height || d === 1 ? "width" : "height"), f === "width") {
|
|
965
|
+
var p = l / d - a.height;
|
|
966
|
+
if (c.top && c.bottom) {
|
|
967
|
+
var g = r.top, E = r.bottom;
|
|
968
|
+
r.bottom = tt(p, E, g), r.top = tt(p, g, E);
|
|
969
|
+
} else c.bottom ? r.bottom = p : c.top ? r.top = p : c.right ? r.right = 0 : c.left && (r.left = 0);
|
|
970
|
+
} else if (f === "height") {
|
|
971
|
+
var L = a.width - u * d;
|
|
972
|
+
if (c.left && c.right) {
|
|
973
|
+
var _ = r.left, G = r.right;
|
|
974
|
+
r.left = -tt(L, _, G), r.right = -tt(L, G, _);
|
|
975
|
+
} else c.left ? r.left = -L : c.right ? r.right = -L : c.top ? r.top = 0 : c.bottom && (r.bottom = 0);
|
|
976
|
+
}
|
|
977
|
+
r = jt({ directions: r, coordinates: a, sizeRestrictions: n, positionRestrictions: o, preserveRatio: !0, compensate: h.compensate });
|
|
978
|
+
}
|
|
979
|
+
return l = D(a, r).width, u = D(a, r).height, (d = h.preserveRatio ? b(a) : lt(l / u, s)) && Math.abs(d - l / u) > 1e-3 && I.forEach(function(V) {
|
|
980
|
+
c[V] || (r[V] = 0);
|
|
981
|
+
}), yt({ event: new At({ 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: o });
|
|
982
|
+
} }, moveAlgorithm: { type: Function, default: yt }, initStretcher: { type: Function, default: function(t) {
|
|
983
|
+
var e = t.stretcher, i = t.imageSize, s = b(i);
|
|
984
|
+
e.style.width = i.width + "px", e.style.height = e.clientWidth / s + "px", e.style.width = e.clientWidth + "px";
|
|
985
|
+
} }, fitCoordinates: { type: Function, default: function(t) {
|
|
986
|
+
var e = t.visibleArea, i = t.coordinates, s = t.aspectRatio, o = t.sizeRestrictions, n = t.positionRestrictions, a = m(m({}, i), P({ width: i.width, height: i.height, aspectRatio: s, sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minHeight: Math.min(e.height, o.minHeight), minWidth: Math.min(e.width, o.minWidth) } }));
|
|
987
|
+
return a = S(a = x(a, X(M(i), M(a))), at(H(e), n));
|
|
988
|
+
} }, fitVisibleArea: { type: Function, default: function(t) {
|
|
989
|
+
var e = t.visibleArea, i = t.boundaries, s = t.getAreaRestrictions, o = t.coordinates, n = m({}, e);
|
|
990
|
+
n.height = n.width / b(i), n.top += (e.height - n.height) / 2, (o.height - n.height > 0 || o.width - n.width > 0) && (n = W(n, Math.max(o.height / n.height, o.width / n.width)));
|
|
991
|
+
var a = ot(N(o, H(n = W(n, rt(n, s({ visibleArea: n, type: "resize" }))))));
|
|
992
|
+
return n.width < o.width && (a.left = 0), n.height < o.height && (a.top = 0), n = S(n = x(n, a), s({ visibleArea: n, type: "move" }));
|
|
993
|
+
} }, areaRestrictionsAlgorithm: { type: Function, default: function(t) {
|
|
994
|
+
var e = t.visibleArea, i = t.boundaries, s = t.imageSize, o = t.imageRestriction, n = t.type, a = {};
|
|
995
|
+
return o === "fill-area" ? a = { left: 0, top: 0, right: s.width, bottom: s.height } : o === "fit-area" && (b(i) > b(s) ? (a = { top: 0, bottom: s.height }, e && n === "move" && (e.width > s.width ? (a.left = -(e.width - s.width) / 2, a.right = s.width - a.left) : (a.left = 0, a.right = s.width))) : (a = { left: 0, right: s.width }, e && n === "move" && (e.height > s.height ? (a.top = -(e.height - s.height) / 2, a.bottom = s.height - a.top) : (a.top = 0, a.bottom = s.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: v({}, It) };
|
|
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 = bt(this.resizeImage, { touch: !0, wheel: { ratio: 0.1 }, adjustStencil: !0 }, { touch: !1, wheel: !1, adjustStencil: !1 });
|
|
1016
|
+
return { moveImage: bt(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: A(this.minWidth) ? 0 : K(this.minWidth), minHeight: A(this.minHeight) ? 0 : K(this.minHeight), maxWidth: A(this.maxWidth) ? 1 / 0 : K(this.maxWidth), maxHeight: A(this.maxHeight) ? 1 / 0 : K(this.maxHeight) });
|
|
1026
|
+
if (t = function(s) {
|
|
1027
|
+
var o = s.areaRestrictions, n = s.sizeRestrictions, a = s.boundaries, h = s.positionRestrictions, r = m(m({}, 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 = wt(o), l = Zt(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 = wt(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: j(), image: z(j("image"), this.imageClass), stencil: j("stencil"), boundaries: z(j("boundaries"), this.boundariesClass), stretcher: z(j("stretcher")), background: z(j("background"), this.backgroundClass), foreground: z(j("foreground"), this.foregroundClass), imageWrapper: z(j("image-wrapper")), cropperWrapper: z(j("cropper-wrapper")) };
|
|
1042
|
+
}, stencilCoordinates: function() {
|
|
1043
|
+
if (this.initialized) {
|
|
1044
|
+
var t = this.coordinates, e = t.width, i = t.height, s = t.left, o = t.top;
|
|
1045
|
+
return { width: e / this.coefficient, height: i / this.coefficient, left: (s - this.visibleArea.left) / this.coefficient, top: (o - 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 }, s = v(v({}, this.imageTransforms), {}, { scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / t.width), scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / t.height) }), o = { 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)") + te(s) };
|
|
1053
|
+
return this.transitionsOptions.enabled && (o.transition = "".concat(this.transitionsOptions.time, "ms ").concat(this.transitionsOptions.timingFunction)), o;
|
|
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 = vt(this.update, this.debounce), this.debouncedDisableTransitions = vt(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(v({}, this.coordinates)) : this.defaultCoordinates(), e = { rotate: this.imageTransforms.rotate % 360, flip: v({}, this.imageTransforms.flip) };
|
|
1083
|
+
if (this.src && this.imageLoaded) {
|
|
1084
|
+
var i = this;
|
|
1085
|
+
return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? v({}, 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 ? v({}, 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] : {}, s = i.transitions, o = s === void 0 || s;
|
|
1092
|
+
this.onManipulateImage(new q({}, { factor: 1 / t, center: e }), { normalize: !1, transitions: o });
|
|
1093
|
+
}, move: function(t, e) {
|
|
1094
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = i.transitions, o = s === void 0 || s;
|
|
1095
|
+
this.onManipulateImage(new q({ left: t || 0, top: e || 0 }), { normalize: !1, transitions: o });
|
|
1096
|
+
}, setCoordinates: function(t) {
|
|
1097
|
+
var e = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = i.autoZoom, o = s === void 0 || s, 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), o && 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, s = e.sizeRestrictions, o = 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 > s.maxWidth ? n.width = Math.floor(i.width) : n.width < s.minWidth && (n.width = Math.ceil(i.width)), n.height > s.maxHeight ? n.height = Math.floor(i.height) : n.height < s.minHeight && (n.height = Math.ceil(i.height)), S(n, o);
|
|
1122
|
+
}(v(v({}, this.getPublicProperties()), {}, { positionRestrictions: J(this.positionRestrictions, this.visibleArea), coordinates: t })) : t;
|
|
1123
|
+
}, processAutoZoom: function(t, e, i, s) {
|
|
1124
|
+
var o = this.autoZoomAlgorithm;
|
|
1125
|
+
o || (o = this.stencilSize ? ze : this.autoZoom ? Re : Ae);
|
|
1126
|
+
var n = o({ event: { type: t, params: s }, visibleArea: e, coordinates: i, boundaries: this.boundaries, aspectRatio: this.getAspectRatio(), positionRestrictions: this.positionRestrictions, getAreaRestrictions: this.getAreaRestrictions, sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize() });
|
|
1127
|
+
return v(v({}, n), {}, { changed: !$t(n.visibleArea, e) || !$t(n.coordinates, i) });
|
|
1128
|
+
}, runAutoZoom: function(t) {
|
|
1129
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, s = i !== void 0 && i, o = le(e, Ue), n = this.processAutoZoom(t, this.visibleArea, this.coordinates, o), a = n.visibleArea, h = n.coordinates, r = n.changed;
|
|
1130
|
+
s && r && this.enableTransitions(), this.visibleArea = a, this.coordinates = h, s && r && this.debouncedDisableTransitions();
|
|
1131
|
+
}, normalizeEvent: function(t) {
|
|
1132
|
+
return function(e) {
|
|
1133
|
+
var i = e.event, s = e.visibleArea, o = e.coefficient;
|
|
1134
|
+
if (i.type === "manipulateImage") return m(m({}, i), { move: { left: i.move && i.move.left ? o * i.move.left : 0, top: i.move && i.move.top ? o * 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 * o + s.left, top: i.scale.center.top * o + s.top } : null } });
|
|
1135
|
+
if (i.type === "resize") {
|
|
1136
|
+
var n = m(m({}, i), { directions: m({}, i.directions) });
|
|
1137
|
+
return I.forEach(function(h) {
|
|
1138
|
+
n.directions[h] *= o;
|
|
1139
|
+
}), n;
|
|
1140
|
+
}
|
|
1141
|
+
if (i.type === "move") {
|
|
1142
|
+
var a = m(m({}, i), { directions: m({}, i.directions) });
|
|
1143
|
+
return ve.forEach(function(h) {
|
|
1144
|
+
a.directions[h] *= o;
|
|
1145
|
+
}), a;
|
|
1146
|
+
}
|
|
1147
|
+
return i;
|
|
1148
|
+
}(v(v({}, 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 }, f = Gt(d, l), p = h.getContext("2d");
|
|
1153
|
+
h.height = f.height, h.width = f.width, p.save();
|
|
1154
|
+
var g = U(M(m({ left: 0, top: 0 }, d)), l);
|
|
1155
|
+
return p.translate(-(g.left - f.width / 2), -(g.top - f.height / 2)), p.rotate(l * Math.PI / 180), p.translate(u.horizontal ? d.width : 0, u.vertical ? d.height : 0), p.scale(u.horizontal ? -1 : 1, u.vertical ? -1 : 1), p.drawImage(r, 0, 0, d.width, d.height), p.restore(), h;
|
|
1156
|
+
}(this.$refs.sourceCanvas, e, this.imageTransforms) : e, s = v({ minWidth: 0, minHeight: 0, maxWidth: 1 / 0, maxHeight: 1 / 0, maxArea: this.maxCanvasSize, imageSmoothingEnabled: !0, imageSmoothingQuality: "high", fillColor: "transparent" }, this.canvas), o = function(h) {
|
|
1157
|
+
return h.find(function(r) {
|
|
1158
|
+
return c = r, !Number.isNaN(parseFloat(c)) && isFinite(c);
|
|
1159
|
+
var c;
|
|
1160
|
+
});
|
|
1161
|
+
}, n = P({ sizeRestrictions: { minWidth: o([s.width, s.minWidth]) || 0, minHeight: o([s.height, s.minHeight]) || 0, maxWidth: o([s.width, s.maxWidth]) || 1 / 0, maxHeight: o([s.height, s.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 (s.maxArea && n.width * n.height > s.maxArea) {
|
|
1163
|
+
var a = Math.sqrt(s.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 f = c.left < 0 ? -c.left : 0, p = c.top < 0 ? -c.top : 0;
|
|
1171
|
+
d.drawImage(r, c.left + f, c.top + p, c.width, c.height, f * (h.width / c.width), p * (h.height / c.height), h.width, h.height);
|
|
1172
|
+
}(t, i, this.coordinates, n, s), 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, s = this.visibleArea && e ? J(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
|
|
1178
|
+
return ye({ transform: t, coordinates: this.coordinates, imageSize: this.imageSize, sizeRestrictions: i, positionRestrictions: s, 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 ? xe : Se);
|
|
1185
|
+
var i = this.sizeRestrictions;
|
|
1186
|
+
i.minWidth, i.minHeight, i.maxWidth, i.maxHeight;
|
|
1187
|
+
var s = F(e) ? e({ boundaries: this.boundaries, imageSize: this.imageSize, aspectRatio: this.getAspectRatio(), sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize(), visibleArea: this.visibleArea }) : e, o = this.defaultPosition || Me, n = [s, function(a) {
|
|
1188
|
+
var h = a.coordinates;
|
|
1189
|
+
return v({}, F(o) ? o({ coordinates: h, imageSize: t.imageSize, visibleArea: t.visibleArea }) : t.defaultPosition);
|
|
1190
|
+
}];
|
|
1191
|
+
this.delayedTransforms && n.push.apply(n, k(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 s = { cropper: i, imageSize: t.imageSize };
|
|
1207
|
+
if (F(t.defaultBoundaries) ? t.boundaries = t.defaultBoundaries(s) : t.defaultBoundaries === "fit" ? t.boundaries = function(o) {
|
|
1208
|
+
var n = o.cropper, a = o.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
|
+
}(s) : t.boundaries = function(o) {
|
|
1211
|
+
var n = o.cropper;
|
|
1212
|
+
return { width: n.clientWidth, height: n.clientHeight };
|
|
1213
|
+
}(s), !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 = v(v({}, this.defaultImageTransforms), {}, { flip: v({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then(function() {
|
|
1218
|
+
t.priority !== "visible-area" && (t.visibleArea = null, t.resetCoordinates());
|
|
1219
|
+
var e, i, s, o, n, a, h = t.defaultVisibleArea || Ee;
|
|
1220
|
+
t.visibleArea = F(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, s = e.boundaries, o = e.getAreaRestrictions, n = m({}, i), a = b(s), n.width / n.height !== a && (n.height = n.width / a), S(n, o({ 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(o) {
|
|
1238
|
+
if (Ot(o)) return !1;
|
|
1239
|
+
var n = window.location, a = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(o) || [], 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 = A(this.crossOrigin) ? this.canvas : this.crossOrigin;
|
|
1245
|
+
i === !0 && (i = "anonymous"), this.imageAttributes.crossOrigin = i || null;
|
|
1246
|
+
}
|
|
1247
|
+
if (this.checkOrientation) {
|
|
1248
|
+
var s = (t = this.src, new Promise(function(o) {
|
|
1249
|
+
Pe(t).then(function(n) {
|
|
1250
|
+
var a = Be(n);
|
|
1251
|
+
o(n ? { source: t, arrayBuffer: n, orientation: a } : { source: t, arrayBuffer: null, orientation: null });
|
|
1252
|
+
}).catch(function(n) {
|
|
1253
|
+
console.warn(n), o({ source: t, arrayBuffer: null, orientation: null });
|
|
1254
|
+
});
|
|
1255
|
+
}));
|
|
1256
|
+
setTimeout(function() {
|
|
1257
|
+
s.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, s = t.arrayBuffer, o = t.orientation;
|
|
1272
|
+
this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, s && o && o > 1 ? Yt(i) || !Ot(i) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([s])), 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
|
+
}(s) : this.imageAttributes.src = i, F(this.defaultTransforms) ? this.appliedImageTransforms = dt(this.defaultTransforms()) : it(this.defaultTransforms) ? this.appliedImageTransforms = dt(this.defaultTransforms) : this.appliedImageTransforms = function(n) {
|
|
1279
|
+
var a = dt({});
|
|
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
|
+
}(o), this.defaultImageTransforms = v(v({}, this.appliedImageTransforms), {}, { flip: v({}, 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(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: J(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, s = Math.min(e.coordinates.width, e.coordinates.height, 20 * e.coefficient);
|
|
1322
|
+
e.coordinates = e.resizeAlgorithm(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: J(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, s), minHeight: Math.max(i.minHeight, s) }, 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, s = i !== void 0 && i, o = e.normalize, n = o === void 0 || o;
|
|
1328
|
+
s && this.enableTransitions();
|
|
1329
|
+
var a = Ce(v(v({}, 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(), s && 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, s = i === void 0 ? "move" : i;
|
|
1336
|
+
return this.areaRestrictionsAlgorithm({ boundaries: this.boundaries, imageSize: this.imageSize, imageRestriction: this.imageRestriction, visibleArea: e, type: s });
|
|
1337
|
+
}, getAspectRatio: function(t) {
|
|
1338
|
+
var e, i, s = this.stencilProps, o = s.aspectRatio, n = s.minAspectRatio, a = s.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 (A(e) && (e = A(o) ? n : o), A(i) && (i = A(o) ? a : o), !t && (A(e) || A(i))) {
|
|
1344
|
+
var r = this.getStencilSize(), c = r ? b(r) : null;
|
|
1345
|
+
A(e) && (e = Dt(c) ? c : void 0), A(i) && (i = Dt(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, s = t.aspectRatio, lt(b(o = F(i) ? i({ boundaries: e, aspectRatio: s }) : i), s) && (o = P({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: o.width, height: o.height, aspectRatio: { minimum: s.minimum, maximum: s.maximum } })), (o.width > e.width || o.height > e.height) && (o = P({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: o.width, height: o.height, aspectRatio: { minimum: b(o), maximum: b(o) } })), o;
|
|
1350
|
+
var t, e, i, s, o;
|
|
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 v({}, It);
|
|
1355
|
+
}, flip: function(t, e) {
|
|
1356
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = i.transitions, o = s === void 0 || s;
|
|
1357
|
+
if (!this.transitionsActive) {
|
|
1358
|
+
o && this.enableTransitions();
|
|
1359
|
+
var n = v({}, this.imageTransforms.flip), a = We({ 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(), o && this.debouncedDisableTransitions();
|
|
1361
|
+
}
|
|
1362
|
+
}, rotate: function(t) {
|
|
1363
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, s = i === void 0 || i;
|
|
1364
|
+
if (!this.transitionsActive) {
|
|
1365
|
+
s && this.enableTransitions();
|
|
1366
|
+
var o = v({}, this.imageSize);
|
|
1367
|
+
this.appliedImageTransforms.rotate += t;
|
|
1368
|
+
var n = Te({ visibleArea: this.visibleArea, coordinates: this.coordinates, previousImageSize: o, 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(), s && this.debouncedDisableTransitions();
|
|
1370
|
+
}
|
|
1371
|
+
} }, emits: ["change", "error", "ready"] }, ke = { key: 0, ref: "canvas", style: { display: "none" } }, Fe = { key: 1, ref: "sourceCanvas", style: { display: "none" } };
|
|
1372
|
+
oe.render = function(t, e, i, s, o, n) {
|
|
1373
|
+
return w(), y("div", { ref: "cropper", class: n.classes.cropper }, [R("div", { ref: "stretcher", class: n.classes.stretcher }, null, 2), R("div", { class: n.classes.boundaries, style: n.boundariesStyle }, [(w(), y(nt(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: $(function() {
|
|
1374
|
+
return [R("div", { class: n.classes.background, style: n.boundariesStyle }, null, 6), R("div", { class: n.classes.imageWrapper }, [R("img", { ref: "image", crossorigin: o.imageAttributes.crossOrigin, src: o.imageAttributes.src, class: n.classes.image, style: n.imageStyle, onMousedown: e[1] || (e[1] = Rt(function() {
|
|
1375
|
+
}, ["prevent"])) }, null, 46, ["crossorigin", "src"])], 2), R("div", { class: n.classes.foreground, style: n.boundariesStyle }, null, 6), Bt((w(), y(nt(i.stencilComponent), st({ ref: "stencil", image: n.image, coordinates: o.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"])), [[Ut, o.imageLoaded]]), i.canvas ? (w(), y("canvas", ke, null, 512)) : mt("", !0), i.canvas ? (w(), y("canvas", Fe, null, 512)) : mt("", !0)];
|
|
1376
|
+
}), _: 1 }, 8, ["class", "wheel-resize", "touch-resize", "touch-move", "mouse-move", "onMove", "onResize"]))], 6)], 2);
|
|
1377
|
+
};
|
|
1378
|
+
const Xe = {
|
|
1379
|
+
name: "ImageUploadModal",
|
|
1380
|
+
components: {
|
|
1381
|
+
Cropper: oe
|
|
1382
|
+
},
|
|
1383
|
+
emits: ["close"],
|
|
1384
|
+
props: {
|
|
1385
|
+
imageData: {
|
|
1386
|
+
type: String,
|
|
1387
|
+
required: !0
|
|
1388
|
+
},
|
|
1389
|
+
onImageUpload: {
|
|
1390
|
+
type: Function,
|
|
1391
|
+
required: !0
|
|
1392
|
+
},
|
|
1393
|
+
fileName: {
|
|
1394
|
+
type: String,
|
|
1395
|
+
default: "filename.png"
|
|
1396
|
+
},
|
|
1397
|
+
cropperOptions: {
|
|
1398
|
+
type: Object,
|
|
1399
|
+
default: () => ({})
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
data() {
|
|
1403
|
+
return {
|
|
1404
|
+
currentTarget: null
|
|
1405
|
+
};
|
|
1406
|
+
},
|
|
1407
|
+
methods: {
|
|
1408
|
+
onSave() {
|
|
1409
|
+
const { canvas: t } = this.$refs.cropper.getResult();
|
|
1410
|
+
t && t.toBlob((e) => {
|
|
1411
|
+
const i = new File([e], this.fileName, { type: e.type });
|
|
1412
|
+
return this.onImageUpload(i).then(() => {
|
|
1413
|
+
this.$emit("close");
|
|
1414
|
+
});
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}, Ye = { class: "flex min-h-0 max-w-[calc(100%_-_4_*_var(--rem))] flex-auto items-center justify-center pt-8" }, Ne = { class: "shrink-0 flex-grow py-8" };
|
|
1419
|
+
function _e(t, e, i, s, o, n) {
|
|
1420
|
+
const a = T("CButton"), h = T("Cropper");
|
|
1421
|
+
return w(), Ft("div", {
|
|
1422
|
+
class: "fixed inset-0 flex h-full w-full flex-col items-center justify-center gap-8 bg-black/80",
|
|
1423
|
+
onMousedown: e[1] || (e[1] = (r) => o.currentTarget = r.target),
|
|
1424
|
+
onMouseup: e[2] || (e[2] = Rt((r) => o.currentTarget === r.target ? t.$emit("close") : null, ["self"]))
|
|
1425
|
+
}, [
|
|
1426
|
+
R(a, {
|
|
1427
|
+
circle: "",
|
|
1428
|
+
icon: "x",
|
|
1429
|
+
type: "text",
|
|
1430
|
+
class: "absolute right-2 top-2 z-50 border-transparent bg-black/50 text-white/90",
|
|
1431
|
+
onClick: e[0] || (e[0] = (r) => t.$emit("close"))
|
|
1432
|
+
}),
|
|
1433
|
+
pt("div", Ye, [
|
|
1434
|
+
R(h, st(i.cropperOptions, {
|
|
1435
|
+
ref: "cropper",
|
|
1436
|
+
src: i.imageData,
|
|
1437
|
+
class: "h-full w-full"
|
|
1438
|
+
}), null, 16, ["src"])
|
|
1439
|
+
]),
|
|
1440
|
+
pt("div", Ne, [
|
|
1441
|
+
R(a, {
|
|
1442
|
+
type: "secondary",
|
|
1443
|
+
class: "w-36",
|
|
1444
|
+
onClick: n.onSave
|
|
1445
|
+
}, {
|
|
1446
|
+
default: $(() => [
|
|
1447
|
+
ae(he(t.$t("_common:save")), 1)
|
|
1448
|
+
]),
|
|
1449
|
+
_: 1
|
|
1450
|
+
}, 8, ["onClick"])
|
|
1451
|
+
])
|
|
1452
|
+
], 32);
|
|
1453
|
+
}
|
|
1454
|
+
const Ve = /* @__PURE__ */ kt(Xe, [["render", _e]]), qe = {
|
|
1455
|
+
i18nOptions: {
|
|
1456
|
+
namespaces: "imageUploadWrapper",
|
|
1457
|
+
messages: {
|
|
1458
|
+
en: {
|
|
1459
|
+
warningMessageValidFormats: "Invalid file format. Valid file formats are"
|
|
1460
|
+
},
|
|
1461
|
+
sv: {
|
|
1462
|
+
warningMessageValidFormats: "Filformatet är fel. Giltiga format är"
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
name: "ImageUploadWrapper",
|
|
1467
|
+
components: {
|
|
1468
|
+
BaseUpload: re
|
|
1469
|
+
},
|
|
1470
|
+
emits: ["upload"],
|
|
1471
|
+
props: {
|
|
1472
|
+
onImageUpload: {
|
|
1473
|
+
type: Function,
|
|
1474
|
+
required: !0
|
|
1475
|
+
},
|
|
1476
|
+
cropperOptions: {
|
|
1477
|
+
type: Object,
|
|
1478
|
+
default: () => ({})
|
|
1479
|
+
},
|
|
1480
|
+
uploadOptions: {
|
|
1481
|
+
type: Object,
|
|
1482
|
+
default: () => ({})
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
data() {
|
|
1486
|
+
return {
|
|
1487
|
+
newFiles: [],
|
|
1488
|
+
isModalOpen: !1,
|
|
1489
|
+
isUpdatingImage: !1,
|
|
1490
|
+
default: {
|
|
1491
|
+
multiple: !1,
|
|
1492
|
+
drop: !0,
|
|
1493
|
+
accept: "image/png, image/jpg, image/bmp, image/gif, image/jpeg, image/tiff, image/webp"
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1496
|
+
},
|
|
1497
|
+
computed: {
|
|
1498
|
+
mergedUploadOptions() {
|
|
1499
|
+
return { ...this.default, ...this.uploadOptions };
|
|
1500
|
+
},
|
|
1501
|
+
progress() {
|
|
1502
|
+
return this.newFiles.length ? parseInt(this.newFiles[this.newFiles.length - 1].progress, 10) : 0;
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
methods: {
|
|
1506
|
+
onClick() {
|
|
1507
|
+
this.$refs.upload && this.$refs.upload.$el.querySelector("input[type='file']").click();
|
|
1508
|
+
},
|
|
1509
|
+
uploadImg(t) {
|
|
1510
|
+
if (this.isModalOpen && !this.isUpdatingImage) return;
|
|
1511
|
+
const { file: e } = t[t.length - 1];
|
|
1512
|
+
if (!this.mergedUploadOptions.accept.includes(e.type)) {
|
|
1513
|
+
ce(
|
|
1514
|
+
"warning",
|
|
1515
|
+
`${this.$t("warningMessageValidFormats")}: gif, jpeg, jpg, png, bmp`
|
|
1516
|
+
);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
const i = new FileReader();
|
|
1520
|
+
i.onload = (s) => {
|
|
1521
|
+
let o;
|
|
1522
|
+
typeof s.target.result == "object" ? o = window.URL.createObjectURL(new Blob([s.target.result])) : o = s.target.result, this.show(o, e.name);
|
|
1523
|
+
}, i.readAsArrayBuffer(e);
|
|
1524
|
+
},
|
|
1525
|
+
show(t, e) {
|
|
1526
|
+
this.isModalOpen = !0, this.$modal.show(
|
|
1527
|
+
Ve,
|
|
1528
|
+
{
|
|
1529
|
+
cropperOptions: this.cropperOptions,
|
|
1530
|
+
imageData: t,
|
|
1531
|
+
onImageUpload: this.updateFile,
|
|
1532
|
+
fileName: e
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
height: "100%",
|
|
1536
|
+
width: "100%",
|
|
1537
|
+
classes: ""
|
|
1538
|
+
},
|
|
1539
|
+
{
|
|
1540
|
+
"before-close": () => {
|
|
1541
|
+
this.isModalOpen = !1;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
);
|
|
1545
|
+
},
|
|
1546
|
+
async updateFile(t) {
|
|
1547
|
+
this.$emit("upload"), this.isUpdatingImage = !0;
|
|
1548
|
+
const e = this.$refs.upload.$refs.upload.files, i = e[e.length - 1], s = i;
|
|
1549
|
+
s.file = t;
|
|
1550
|
+
const o = await this.$refs.upload.compressFile(s.file);
|
|
1551
|
+
await this.$refs.upload.$refs.upload.update(i, {
|
|
1552
|
+
...o,
|
|
1553
|
+
active: !0
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
function Ze(t, e, i, s, o, n) {
|
|
1559
|
+
const a = T("BaseUpload");
|
|
1560
|
+
return w(), Ft("div", null, [
|
|
1561
|
+
R(a, st(n.mergedUploadOptions, {
|
|
1562
|
+
ref: "upload",
|
|
1563
|
+
"model-value": o.newFiles,
|
|
1564
|
+
"onUpdate:modelValue": e[0] || (e[0] = (h) => o.isUpdatingImage ? null : n.uploadImg(h)),
|
|
1565
|
+
onUploadSuccess: e[1] || (e[1] = (h) => {
|
|
1566
|
+
o.isUpdatingImage = !1, i.onImageUpload(h);
|
|
1567
|
+
})
|
|
1568
|
+
}), {
|
|
1569
|
+
default: $(() => [
|
|
1570
|
+
t.$slots.image ? B(t.$slots, "image", { key: 0 }, void 0, !0) : mt("", !0)
|
|
1571
|
+
]),
|
|
1572
|
+
_: 3
|
|
1573
|
+
}, 16, ["model-value"]),
|
|
1574
|
+
pt("div", {
|
|
1575
|
+
style: { cursor: "pointer" },
|
|
1576
|
+
onClick: e[2] || (e[2] = Rt((...h) => n.onClick && n.onClick(...h), ["stop", "prevent"]))
|
|
1577
|
+
}, [
|
|
1578
|
+
B(t.$slots, "default", { progress: n.progress }, void 0, !0)
|
|
1579
|
+
])
|
|
1580
|
+
]);
|
|
1581
|
+
}
|
|
1582
|
+
const Ke = /* @__PURE__ */ kt(qe, [["render", Ze], ["__scopeId", "data-v-714387c8"]]);
|
|
1583
|
+
export {
|
|
1584
|
+
Ke as default
|
|
1585
|
+
};
|