@cling-se/widget 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.internal.md +82 -0
  3. package/README.md +14 -40
  4. package/README.public.md +14 -0
  5. package/dist/AddClientCallout-e8d19R3f.js +101 -0
  6. package/dist/AnswerModal-BGvB8IVV.js +3291 -0
  7. package/dist/AttachmentItem-CkHbAm4l.js +171 -0
  8. package/dist/BaseUpload-BiJBcWRu.js +2472 -0
  9. package/dist/BlockMedia-CW5wgipC.js +103 -0
  10. package/dist/CCallout-Cy2eeIYd.js +104 -0
  11. package/dist/{CCurrencyDropdown-qH-3m2eP.js → CCurrencyDropdown-DE_3CTjm.js} +91 -49
  12. package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
  13. package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
  14. package/dist/{CPhoneFormat-CfQayFxw.js → CPhoneFormat-BS2nP9kc.js} +13 -21
  15. package/dist/CPhoneInput-Bf6329PO.js +207 -0
  16. package/dist/CPriceInput-d1yjuMQr.js +140 -0
  17. package/dist/CSelect-DgnT07Hk.js +98 -0
  18. package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
  19. package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
  20. package/dist/ClientModal-BzWQtWSZ.js +1181 -0
  21. package/dist/ColorPicker-BvoFN8nu.js +1408 -0
  22. package/dist/CompanyModal-Bp4V_az9.js +250 -0
  23. package/dist/ContentWrapper-CuH6xKmo.js +265 -0
  24. package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
  25. package/dist/DocAnswer-BcNA_KEg.js +33 -0
  26. package/dist/DocDetails-CStEwWnU.js +448 -0
  27. package/dist/DocForm-BOoILf5E.js +6748 -0
  28. package/dist/DocFormSend-CQIf-HJY.js +171 -0
  29. package/dist/DocLinks-BRX5QzNe.js +36 -0
  30. package/dist/DocModalBase-D72yWj-x.js +29 -0
  31. package/dist/DocPrint-BI1LXUPE.js +399 -0
  32. package/dist/DocReceipt-DaZ4V76p.js +341 -0
  33. package/dist/DocSendReminder-DKGZlo7s.js +181 -0
  34. package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
  35. package/dist/DocTimeline-DCwofzuk.js +537 -0
  36. package/dist/DocumentClient-vJdxCB53.js +90 -0
  37. package/dist/DocumentLayout-CKSi42ev.js +1368 -0
  38. package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
  39. package/dist/DocumentVoided-CRX2WxWO.js +33 -0
  40. package/dist/EmbedInput-B-oeC4Wy.js +157 -0
  41. package/dist/EmbedSettings-B9Yka2yB.js +103 -0
  42. package/dist/ErrorCallout-B_ygH33E.js +34 -0
  43. package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
  44. package/dist/Flag-BwTgCNHO.js +41 -0
  45. package/dist/HeaderSettings-DvC7nlyY.js +720 -0
  46. package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
  47. package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
  48. package/dist/Index-0_3ULrWX.js +126 -0
  49. package/dist/Index-4NPe0sfX.js +629 -0
  50. package/dist/Index-B1uA0FF6.js +4 -0
  51. package/dist/Index-BBkCYm2q.js +201 -0
  52. package/dist/{Index-DIOiMm9f.js → Index-BBwvo7S9.js} +10 -18
  53. package/dist/Index-BEMlsYwJ.js +68 -0
  54. package/dist/Index-BRBhJ6kz.js +21 -0
  55. package/dist/{Index--qPMWUMT.js → Index-BTFmHjUt.js} +48 -61
  56. package/dist/Index-BcUNnxLC.js +1098 -0
  57. package/dist/Index-Bo6ExBUL.js +93 -0
  58. package/dist/Index-BvMPCgdH.js +102 -0
  59. package/dist/Index-Bx5TOI9k.js +74 -0
  60. package/dist/Index-C7GZS8EI.js +16 -0
  61. package/dist/Index-CNWhm07R.js +25 -0
  62. package/dist/{Index-DcQbh-z2.js → Index-CQpznMKV.js} +9 -17
  63. package/dist/Index-CRzsnIij.js +159 -0
  64. package/dist/Index-CeSG1C41.js +140 -0
  65. package/dist/Index-CjfjdZj5.js +52 -0
  66. package/dist/Index-CskKmZpd.js +363 -0
  67. package/dist/Index-D5qwbCo1.js +28 -0
  68. package/dist/Index-D8Ae1Txt.js +228 -0
  69. package/dist/Index-DE8aenDB.js +3452 -0
  70. package/dist/Index-DI5EB5Rt.js +39 -0
  71. package/dist/Index-DaV57YPP.js +163 -0
  72. package/dist/Index-DbwkmoyM.js +38 -0
  73. package/dist/Index-Df9skok6.js +70 -0
  74. package/dist/{Index-Bu0MGrj6.js → Index-DfLLA0ij.js} +313 -206
  75. package/dist/Index-Dw1CO5F9.js +76 -0
  76. package/dist/Index-PZXyOoVb.js +87 -0
  77. package/dist/{Index-D4XgxmbD.js → Index-ZUnH-BHj.js} +10 -18
  78. package/dist/Index-cjKGSiDi.js +136 -0
  79. package/dist/Index-m-goRuKD.js +49 -0
  80. package/dist/Index-rGeWbLcB.js +47 -0
  81. package/dist/Index-vrljNp6G.js +28 -0
  82. package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
  83. package/dist/InputToggleRow-v6qAWPg6.js +99 -0
  84. package/dist/ManualPopover-BONBJIUA.js +57 -0
  85. package/dist/MediaWrapper-CXb2UGd9.js +18 -0
  86. package/dist/{NotBindingText-CNV2Wmdx.js → NotBindingText-BqESO13N.js} +13 -17
  87. package/dist/PackageGroup-AIysVmyh.js +1058 -0
  88. package/dist/PdfTerms-BlhHdTu3.js +34 -0
  89. package/dist/PdfViewer-DwZ1rwlN.js +392 -0
  90. package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
  91. package/dist/PriceHeader-C4XhnoA3.js +488 -0
  92. package/dist/SearchApi-B7lXgUY6.js +137 -0
  93. package/dist/SendForm-BcD0xSvB.js +7031 -0
  94. package/dist/Setup-C2qaYDei.js +47 -0
  95. package/dist/{SmartList-Qgu0rMrI.js → SmartList-DqG7Q5t7.js} +16 -24
  96. package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
  97. package/dist/{TermsSettings-CE3h_xkm.js → TermsSettings-BOCONyM4.js} +169 -49
  98. package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
  99. package/dist/ToggleBinding-7oq_oXPt.js +44 -0
  100. package/dist/UploadModal-C_X2NjVY.js +134 -0
  101. package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
  102. package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
  103. package/dist/VideoSelectModal-CW0OweCw.js +217 -0
  104. package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
  105. package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
  106. package/dist/{debounce-C1AuSpOZ.js → debounce-DNl99Gyo.js} +7 -7
  107. package/dist/dom-CkTGWrfu.js +69 -0
  108. package/dist/{focusDrawerMixin-Be6BAK8-.js → focusDrawerMixin-BwcErMDY.js} +1 -1
  109. package/dist/{formDrawerState-DRbg5rVI.js → formDrawerState-DaurePnd.js} +2 -2
  110. package/dist/helpers-CPW--XIz.js +44 -0
  111. package/dist/index-BjiGCJPI.js +149 -0
  112. package/dist/index-CFNv6OvX.js +188 -0
  113. package/dist/index-Cx71On5Z.js +508 -0
  114. package/dist/index-DKMxIBz_.js +270 -0
  115. package/dist/index-DKf5SGLD.js +125 -0
  116. package/dist/index-E32WgUp9.js +3525 -0
  117. package/dist/index-kp-GC5I0.js +513 -0
  118. package/dist/index.es.js +2 -5
  119. package/dist/index.umd.js +306 -1505
  120. package/dist/{main-WKzC-Dnu.js → main-Cb-nyil1.js} +33252 -33755
  121. package/dist/mapFormMixin-D3BihYWW.js +1544 -0
  122. package/dist/omit--YYr41Xp.js +31 -0
  123. package/dist/{publicSenderState-BujjYsZZ.js → publicSenderState-CdRW_Wwp.js} +4 -4
  124. package/dist/regions-BdZt9Srn.js +1250 -0
  125. package/dist/splitpanes-D-ThFkeR.js +342 -0
  126. package/dist/style.css +1 -4
  127. package/dist/template-BvaNnq-g.js +1493 -0
  128. package/dist/{throttle-CWPJmFid.js → throttle-D-bUGaVh.js} +2 -2
  129. package/dist/tippy.esm-BmKNqohP.js +1994 -0
  130. package/dist/useTermsModal-Dhf6_eYb.js +87 -0
  131. package/dist/{utils-CA_Zy6u1.js → utils-CBPcYdLv.js} +8 -11
  132. package/dist/validation-DOcUOoMe.js +40 -0
  133. package/package.json +25 -31
  134. package/.eslintrc.cjs +0 -4
  135. package/dist/AddClientCallout-BWnvyBcK.js +0 -46
  136. package/dist/AnswerModal-CLGRdSnK.js +0 -3874
  137. package/dist/AttachmentItem-BPS0-wyc.js +0 -78
  138. package/dist/BaseDatePicker-BbmV_GdD.js +0 -3183
  139. package/dist/BaseUpload-9gPgI7r6.js +0 -1977
  140. package/dist/BlockMedia-DkPFWiYL.js +0 -76
  141. package/dist/CCallout-T26jwUby.js +0 -59
  142. package/dist/CDropdownItem-BE8BAMD1.js +0 -636
  143. package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +0 -1
  144. package/dist/CFormField-DECEfoVq.js +0 -241
  145. package/dist/CPriceInput-C4SOB-P5.js +0 -112
  146. package/dist/CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js +0 -1
  147. package/dist/ClientAutocomplete-DSebA1Mx.js +0 -78
  148. package/dist/ClientModal-BXFYvYCF.js +0 -625
  149. package/dist/ColorPicker-CZ_bJabP.js +0 -2879
  150. package/dist/CompanyModal-CDr3t28n.js +0 -141
  151. package/dist/ContentWrapper-BwmMoe4W.js +0 -183
  152. package/dist/CoverBlockSettings-_F11-DGc.js +0 -275
  153. package/dist/DocAnswer-BR59xzkT.js +0 -36
  154. package/dist/DocDetails-D1qbCbps.js +0 -259
  155. package/dist/DocForm-DBc2a7z5.js +0 -7272
  156. package/dist/DocFormSend-Casix-yG.js +0 -144
  157. package/dist/DocLinks-DGTaewyX.js +0 -38
  158. package/dist/DocModalBase-BbS_qvSv.js +0 -28
  159. package/dist/DocPrint-0PqX3mbJ.js +0 -240
  160. package/dist/DocReceipt-CU3VD5pt.js +0 -210
  161. package/dist/DocSendReminder-CuycBspr.js +0 -137
  162. package/dist/DocTextEditor-CntS2Bd-.js +0 -17180
  163. package/dist/DocTimeline-DJuv3yBe.js +0 -481
  164. package/dist/DocumentClient-C25XXzz6.js +0 -136
  165. package/dist/DocumentLayout-B7afHRMr.js +0 -4909
  166. package/dist/DocumentLogotype-sqI51wvM.js +0 -87
  167. package/dist/DocumentVoided-TahdTSMn.js +0 -25
  168. package/dist/EmbedInput-BY-wHSfc.js +0 -113
  169. package/dist/EmbedSettings-8pfjk4NP.js +0 -72
  170. package/dist/ErrorCallout-Dsr8PNsU.js +0 -28
  171. package/dist/FilePreviewModal-CcEinEFg.js +0 -81
  172. package/dist/Flag-PJKrghi9.js +0 -114
  173. package/dist/HeaderSettings-BqczIOsG.js +0 -392
  174. package/dist/ImageSelectModal-Cd-HhKnH.js +0 -84
  175. package/dist/ImageUploadWrapper-Dv43rGdb.js +0 -1604
  176. package/dist/Index-6b5VBKE-.js +0 -107
  177. package/dist/Index-B4pRJnbw.js +0 -84
  178. package/dist/Index-B69f8qgZ.js +0 -62
  179. package/dist/Index-B79YN9RO.js +0 -25
  180. package/dist/Index-BBrlPoe8.js +0 -58
  181. package/dist/Index-BXfWJCuq.js +0 -52
  182. package/dist/Index-Bd76vb37.js +0 -55
  183. package/dist/Index-BmbtQO5F.js +0 -150
  184. package/dist/Index-ByV_kJaH.js +0 -77
  185. package/dist/Index-CDV5rhWS.js +0 -49
  186. package/dist/Index-CIx4OOK-.js +0 -144
  187. package/dist/Index-CL1OWLt6.js +0 -223
  188. package/dist/Index-Caow0eZu.js +0 -31
  189. package/dist/Index-Cd3-3PEK.js +0 -2402
  190. package/dist/Index-CdpZBEKU.js +0 -98
  191. package/dist/Index-CmU3Sys-.js +0 -754
  192. package/dist/Index-CtRtgnpm.js +0 -32
  193. package/dist/Index-Cukkr33D.js +0 -140
  194. package/dist/Index-Cuqw0ios.js +0 -57
  195. package/dist/Index-Czm_WdqC.js +0 -25
  196. package/dist/Index-DNdYXHgr.js +0 -33
  197. package/dist/Index-DcuBxutp.js +0 -642
  198. package/dist/Index-DpWNWiyY.js +0 -291
  199. package/dist/Index-DzS1rZdF.js +0 -24
  200. package/dist/Index-N6s5pZxv.js +0 -26
  201. package/dist/Index-g_DNu4mt.js +0 -69
  202. package/dist/Index-mJ8F41GY.js +0 -154
  203. package/dist/Index-q7W9KA8m.js +0 -21
  204. package/dist/Index-rtzblZp4.js +0 -70
  205. package/dist/InputToggleRow-CZjxsDOQ.js +0 -57
  206. package/dist/ManualPopover-CZrWiT-P.js +0 -58
  207. package/dist/MediaWrapper-D37qK4KR.js +0 -23
  208. package/dist/PackageGroup-Heo_s8ct.js +0 -699
  209. package/dist/PdfTerms-AB9tXAtU.js +0 -36
  210. package/dist/PdfViewer-CIVkvOBr.js +0 -373
  211. package/dist/PlainHtml-CPmIebjY.js +0 -20
  212. package/dist/PriceHeader-DhDAruwX.js +0 -339
  213. package/dist/SearchApi-BMgdaI4s.js +0 -161
  214. package/dist/Setup-VIaIV9uT.js +0 -50
  215. package/dist/ThemeColorRow-DYJNgk6S.js +0 -67
  216. package/dist/ToggleBinding-CuwCeYpO.js +0 -38
  217. package/dist/UploadModal-BITcxG-J.js +0 -95
  218. package/dist/VideoPlayerInput-8szEX_8L.js +0 -93
  219. package/dist/VideoPlayerSettings-BIPytm6w.js +0 -61
  220. package/dist/VideoSelectModal-B-Pe34nb.js +0 -100
  221. package/dist/answerDocumentMixin-W7vE1Gp4.js +0 -51
  222. package/dist/formComponentsInstall-Bm3VMOh6.js +0 -2507
  223. package/dist/formValidationMixin-COkY8COk.js +0 -49
  224. package/dist/index-BFvjENMH.js +0 -81
  225. package/dist/index-BV2nGWay.js +0 -492
  226. package/dist/index-BgJ05dYc.js +0 -165
  227. package/dist/index-CMPAXxzs.js +0 -347
  228. package/dist/index-DNDjI5uI.js +0 -3916
  229. package/dist/index-aoff9oUi.js +0 -102
  230. package/dist/mapFormMixin-QbevCwJK.js +0 -72
  231. package/dist/omit-CTp9CXoU.js +0 -31
  232. package/dist/splitpanes-BHUVsCZF.js +0 -382
  233. package/dist/tinycolor-kTl0yxzz.js +0 -633
  234. package/dist/tippy.esm-sS5koDSU.js +0 -1799
  235. package/dist/vuedraggable.umd-BA3ZDRAp.js +0 -3161
  236. package/dist/vuex.esm-DKGl8mcw.js +0 -467
  237. package/public/favicon.ico +0 -0
  238. package/tsconfig.json +0 -26
  239. package/tsconfig.node.json +0 -10
  240. package/tsconfig.paths.json +0 -17
  241. package/vite.config.ts +0 -60
@@ -1,1604 +0,0 @@
1
- import Xt from "./BaseUpload-9gPgI7r6.js";
2
- import { V as k, n as $t, O as Yt } from "./main-WKzC-Dnu.js";
3
- function yt(t, e) {
4
- var i = Object.keys(t);
5
- if (Object.getOwnPropertySymbols) {
6
- var n = Object.getOwnPropertySymbols(t);
7
- e && (n = n.filter(function(s) {
8
- return Object.getOwnPropertyDescriptor(t, s).enumerable;
9
- })), i.push.apply(i, n);
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 ? yt(Object(i), !0).forEach(function(n) {
17
- C(t, n, i[n]);
18
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : yt(Object(i)).forEach(function(n) {
19
- Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n));
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 Nt(t, e) {
28
- if (t == null)
29
- return {};
30
- var i, n, s = function(a, h) {
31
- if (a == null)
32
- return {};
33
- var r, c, l = {}, u = Object.keys(a);
34
- for (c = 0; c < u.length; c++)
35
- r = u[c], h.indexOf(r) >= 0 || (l[r] = a[r]);
36
- return l;
37
- }(t, e);
38
- if (Object.getOwnPropertySymbols) {
39
- var o = Object.getOwnPropertySymbols(t);
40
- for (n = 0; n < o.length; n++)
41
- i = o[n], e.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (s[i] = t[i]);
42
- }
43
- return s;
44
- }
45
- function _(t) {
46
- return function(e) {
47
- if (Array.isArray(e))
48
- return ot(e);
49
- }(t) || function(e) {
50
- if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null)
51
- return Array.from(e);
52
- }(t) || function(e, i) {
53
- if (e) {
54
- if (typeof e == "string")
55
- return ot(e, i);
56
- var n = Object.prototype.toString.call(e).slice(8, -1);
57
- if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set")
58
- return Array.from(e);
59
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
60
- return ot(e, i);
61
- }
62
- }(t) || function() {
63
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
64
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
65
- }();
66
- }
67
- function ot(t, e) {
68
- (e == null || e > t.length) && (e = t.length);
69
- for (var i = 0, n = new Array(e); i < e; i++)
70
- n[i] = t[i];
71
- return n;
72
- }
73
- var zt, Vt, V, w = (zt = function(t) {
74
- /*!
75
- Copyright (c) 2018 Jed Watson.
76
- Licensed under the MIT License (MIT), see
77
- http://jedwatson.github.io/classnames
78
- */
79
- (function() {
80
- var e = {}.hasOwnProperty;
81
- function i() {
82
- for (var n = [], s = 0; s < arguments.length; s++) {
83
- var o = arguments[s];
84
- if (o) {
85
- var a = typeof o;
86
- if (a === "string" || a === "number")
87
- n.push(o);
88
- else if (Array.isArray(o)) {
89
- if (o.length) {
90
- var h = i.apply(null, o);
91
- h && n.push(h);
92
- }
93
- } else if (a === "object")
94
- if (o.toString === Object.prototype.toString)
95
- for (var r in o)
96
- e.call(o, r) && o[r] && n.push(r);
97
- else
98
- n.push(o.toString());
99
- }
100
- }
101
- return n.join(" ");
102
- }
103
- t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
104
- })();
105
- }, zt(V = { path: Vt, exports: {}, require: function(t, e) {
106
- return function() {
107
- throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
108
- }(e == null && V.path);
109
- } }, V.exports), V.exports), M = function(t) {
110
- return function(e, i) {
111
- if (!e)
112
- return t;
113
- var n;
114
- typeof e == "string" ? n = e : i = e;
115
- var s = t;
116
- return n && (s += "__" + n), s + (i ? Object.keys(i).reduce(function(o, a) {
117
- var h = i[a];
118
- return h && (o += " " + (typeof h == "boolean" ? s + "--" + a : s + "--" + a + "_" + h)), o;
119
- }, "") : "");
120
- };
121
- };
122
- function mt(t, e, i) {
123
- var n, s, o, a, h;
124
- function r() {
125
- var l = Date.now() - a;
126
- l < e && l >= 0 ? n = setTimeout(r, e - l) : (n = null, i || (h = t.apply(o, s), o = s = null));
127
- }
128
- e == null && (e = 100);
129
- var c = function() {
130
- o = this, s = arguments, a = Date.now();
131
- var l = i && !n;
132
- return n || (n = setTimeout(r, e)), l && (h = t.apply(o, s), o = s = null), h;
133
- };
134
- return c.clear = function() {
135
- n && (clearTimeout(n), n = null);
136
- }, c.flush = function() {
137
- n && (h = t.apply(o, s), o = s = null, clearTimeout(n), n = null);
138
- }, c;
139
- }
140
- mt.debounce = mt;
141
- var pt = mt, p = function() {
142
- return p = Object.assign || function(t) {
143
- for (var e, i = 1, n = arguments.length; i < n; i++)
144
- for (var s in e = arguments[i])
145
- Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
146
- return t;
147
- }, p.apply(this, arguments);
148
- };
149
- /*! *****************************************************************************
150
- Copyright (c) Microsoft Corporation.
151
-
152
- Permission to use, copy, modify, and/or distribute this software for any
153
- purpose with or without fee is hereby granted.
154
-
155
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
156
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
157
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
158
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
159
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
160
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
161
- PERFORMANCE OF THIS SOFTWARE.
162
- ***************************************************************************** */
163
- function jt(t, e) {
164
- var i, n;
165
- return t && e ? (i = "" + t + e[0].toUpperCase() + e.slice(1), n = t + "-" + e) : (i = t || e, n = t || e), { name: i, classname: n };
166
- }
167
- function It(t) {
168
- return /^blob:/.test(t);
169
- }
170
- function Rt(t) {
171
- return It(t) || function(e) {
172
- return /^data:/.test(e);
173
- }(t);
174
- }
175
- function D(t) {
176
- return !!(t && t.constructor && t.call && t.apply);
177
- }
178
- function y(t) {
179
- return t === void 0;
180
- }
181
- function J(t) {
182
- return typeof t == "object" && t !== null;
183
- }
184
- function gt(t, e, i) {
185
- var n = {};
186
- return J(t) ? (Object.keys(e).forEach(function(s) {
187
- y(t[s]) ? n[s] = e[s] : J(e[s]) ? J(t[s]) ? n[s] = gt(t[s], e[s], i[s]) : n[s] = t[s] ? e[s] : i[s] : e[s] === !0 || e[s] === !1 ? n[s] = !!t[s] : n[s] = t[s];
188
- }), n) : t ? e : i;
189
- }
190
- function q(t) {
191
- var e = Number(t);
192
- return Number.isNaN(e) ? t : e;
193
- }
194
- function At(t) {
195
- return typeof (t == "number" || /* @__PURE__ */ function(e) {
196
- return typeof e == "object" && e !== null;
197
- }(t) && toString.call(t) == "[object Number]") && !Ht(t);
198
- }
199
- function Ht(t) {
200
- return t != t;
201
- }
202
- function _t(t, e) {
203
- return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2));
204
- }
205
- var X = function(t, e) {
206
- t === void 0 && (t = {}), e === void 0 && (e = {}), this.type = "manipulateImage", this.move = t, this.scale = e;
207
- }, qt = function(t, e) {
208
- e === void 0 && (e = {}), this.type = "resize", this.directions = t, this.params = e;
209
- }, vt = function(t) {
210
- this.type = "move", this.directions = t;
211
- }, Zt = function() {
212
- function t(e, i, n, s, o) {
213
- this.type = "drag", this.nativeEvent = e, this.position = n, this.previousPosition = s, this.element = i, this.anchor = o;
214
- }
215
- return t.prototype.shift = function() {
216
- var e = this, i = e.element, n = e.anchor, s = e.position, o = i.getBoundingClientRect(), a = o.left, h = o.top;
217
- return { left: s.left - a - n.left, top: s.top - h - n.top };
218
- }, t;
219
- }();
220
- function A(t, e, i, n, s, o, a, h, r, c) {
221
- const l = typeof i == "function" ? i.options : i;
222
- let u;
223
- return t && t.render && (l.render = t.render, l.staticRenderFns = t.staticRenderFns, l._compiled = !0), i;
224
- }
225
- var Dt = A({ render: function() {
226
- var t = this, e = t.$createElement;
227
- return (t._self._c || e)("div", { ref: "draggable", class: t.classname, on: { touchstart: t.onTouchStart, mousedown: t.onMouseDown, mouseover: t.onMouseOver, mouseleave: t.onMouseLeave } }, [t._t("default")], 2);
228
- }, staticRenderFns: [] }, void 0, { name: "DraggableElement", mixins: [{ beforeMount: function() {
229
- 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 });
230
- }, beforeDestroy: function() {
231
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
232
- }, mounted: function() {
233
- if (!this.$refs.draggable)
234
- throw new Error('You should add ref "draggable" to your root element to use draggable mixin');
235
- this.touches = [], this.hovered = !1;
236
- }, methods: { onMouseOver: function() {
237
- this.hovered || (this.hovered = !0, this.$emit("enter"));
238
- }, onMouseLeave: function() {
239
- this.hovered && !this.touches.length && (this.hovered = !1, this.$emit("leave"));
240
- }, onTouchStart: function(t) {
241
- t.cancelable && !this.disabled && t.touches.length === 1 && (this.touches = _(t.touches), this.hovered || (this.$emit("enter"), this.hovered = !0), t.touches.length && this.initAnchor(this.touches.reduce(function(e, i) {
242
- return { clientX: e.clientX + i.clientX / t.touches.length, clientY: e.clientY + i.clientY / t.touches.length };
243
- }, { clientX: 0, clientY: 0 })), t.preventDefault && t.preventDefault(), t.stopPropagation());
244
- }, onTouchEnd: function() {
245
- this.processEnd();
246
- }, onTouchMove: function(t) {
247
- this.touches.length && (this.processMove(t, t.touches), t.preventDefault && t.preventDefault(), t.stopPropagation && t.stopPropagation());
248
- }, onMouseDown: function(t) {
249
- if (!this.disabled && t.button === 0) {
250
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
251
- this.touches = [e], this.initAnchor(e), t.stopPropagation();
252
- }
253
- }, onMouseMove: function(t) {
254
- this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.preventDefault());
255
- }, onMouseUp: function() {
256
- this.processEnd();
257
- }, initAnchor: function(t) {
258
- var e = this.$refs.draggable.getBoundingClientRect(), i = e.left, n = e.right, s = e.bottom, o = e.top;
259
- this.anchor = { left: t.clientX - i, top: t.clientY - o, bottom: s - t.clientY, right: n - t.clientX };
260
- }, processMove: function(t, e) {
261
- var i = _(e);
262
- if (this.touches.length) {
263
- if (this.touches.length === 1 && i.length === 1) {
264
- var n = this.$refs.draggable;
265
- this.$emit("drag", new Zt(t, n, { left: i[0].clientX, top: i[0].clientY }, { left: this.touches[0].clientX, top: this.touches[0].clientY }, this.anchor));
266
- }
267
- this.touches = i;
268
- }
269
- }, processEnd: function() {
270
- this.touches.length && this.$emit("drag-end"), this.hovered && (this.$emit("leave"), this.hovered = !1), this.touches = [];
271
- } } }], props: { classname: { type: String } } }, void 0, !1), rt = M("vue-handler-wrapper"), Gt = A({ render: function() {
272
- var t = this, e = t.$createElement, i = t._self._c || e;
273
- return i("div", { class: t.classes.root }, [i("DraggableElement", { class: t.classes.draggable, on: { drag: function(n) {
274
- return t.$emit("drag", n);
275
- }, "drag-end": function(n) {
276
- return t.$emit("drag-end");
277
- }, leave: function(n) {
278
- return t.$emit("leave");
279
- }, enter: function(n) {
280
- return t.$emit("enter");
281
- } } }, [t._t("default")], 2)], 1);
282
- }, staticRenderFns: [] }, void 0, { name: "HandlerWrapper", components: { DraggableElement: Dt }, props: { horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, computed: { classes: function() {
283
- var t;
284
- if (this.horizontalPosition || this.verticalPosition) {
285
- var e, i = jt(this.horizontalPosition, this.verticalPosition);
286
- t = rt((C(e = {}, i.classname, !0), C(e, "disabled", this.disabled), e));
287
- } else
288
- t = rt({ disabled: this.disabled });
289
- return { root: t, draggable: rt("draggable") };
290
- } } }, void 0, !1), Qt = M("vue-line-wrapper"), Kt = A({ render: function() {
291
- var t = this, e = t.$createElement;
292
- return (t._self._c || e)("DraggableElement", { class: t.classname, on: { drag: function(i) {
293
- return t.$emit("drag", i);
294
- }, "drag-end": function(i) {
295
- return t.$emit("drag-end");
296
- }, leave: function(i) {
297
- return t.$emit("leave");
298
- }, enter: function(i) {
299
- return t.$emit("enter");
300
- } } }, [t._t("default")], 2);
301
- }, staticRenderFns: [] }, void 0, { name: "LineWrapper", components: { DraggableElement: Dt }, props: { position: { type: String, required: !0 }, disabled: { type: Boolean, default: !1 } }, computed: { classname: function() {
302
- var t;
303
- return Qt((C(t = {}, this.position, !0), C(t, "disabled", this.disabled), t));
304
- } } }, void 0, !1), W = ["left", "right", "top", "bottom"], Jt = ["left", "right"], te = ["top", "bottom"], ee = ["left", "top"], ie = ["fill-area", "fit-area", "stencil", "none"], xt = { left: 0, top: 0, width: 0, height: 0 };
305
- function St(t, e, i) {
306
- return !(i = i || ["width", "height", "left", "top"]).some(function(n) {
307
- return t[n] !== e[n];
308
- });
309
- }
310
- function T(t) {
311
- return { left: t.left, top: t.top, right: t.left + t.width, bottom: t.top + t.height };
312
- }
313
- function P(t, e) {
314
- return { left: t.left - e.left, top: t.top - e.top };
315
- }
316
- function R(t) {
317
- return { left: t.left + t.width / 2, top: t.top + t.height / 2 };
318
- }
319
- function Y(t, e) {
320
- var i = { left: 0, top: 0, right: 0, bottom: 0 };
321
- return W.forEach(function(n) {
322
- var s = e[n], o = T(t)[n];
323
- i[n] = s !== void 0 && o !== void 0 ? n === "left" || n === "top" ? Math.max(0, s - o) : Math.max(0, o - s) : 0;
324
- }), i;
325
- }
326
- function O(t, e) {
327
- 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 };
328
- }
329
- function tt(t) {
330
- return { left: -t.left, top: -t.top };
331
- }
332
- function x(t, e) {
333
- return p(p({}, t), { left: t.left + e.left, top: t.top + e.top });
334
- }
335
- function E(t, e, i, n) {
336
- if (e !== 1) {
337
- if (i) {
338
- var s = R(t);
339
- return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2 + (i.left - s.left) * (1 - e), top: t.top + t.height * (1 - e) / 2 + (i.top - s.top) * (1 - e) };
340
- }
341
- 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 };
342
- }
343
- return t;
344
- }
345
- function b(t) {
346
- return t.width / t.height;
347
- }
348
- function L(t, e) {
349
- 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);
350
- }
351
- function F(t, e) {
352
- var i = { left: 0, top: 0 }, n = Y(t, e);
353
- return n.left && n.left > 0 ? i.left = n.left : n.right && n.right > 0 && (i.left = -n.right), n.top && n.top > 0 ? i.top = n.top : n.bottom && n.bottom > 0 && (i.top = -n.bottom), i;
354
- }
355
- function at(t, e) {
356
- var i;
357
- return e.minimum && t < e.minimum ? i = e.minimum : e.maximum && t > e.maximum && (i = e.maximum), i;
358
- }
359
- function Mt(t, e) {
360
- var i = b(t), n = b(e);
361
- return e.width < 1 / 0 && e.height < 1 / 0 ? i > n ? { 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;
362
- }
363
- function bt(t, e) {
364
- var i = e * Math.PI / 180;
365
- 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)) };
366
- }
367
- function H(t, e) {
368
- var i = e * Math.PI / 180;
369
- return { left: t.left * Math.cos(i) - t.top * Math.sin(i), top: t.left * Math.sin(i) + t.top * Math.cos(i) };
370
- }
371
- function et(t, e) {
372
- var i = Y(z(t, e), e);
373
- 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, L(t, e)) : Math.min((t.height + i.top + i.bottom) / t.height, L(t, e)) : 1;
374
- }
375
- function z(t, e, i) {
376
- i === void 0 && (i = !1);
377
- var n = F(t, e);
378
- return x(t, i ? tt(n) : n);
379
- }
380
- function ht(t) {
381
- 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 };
382
- }
383
- function ne(t, e) {
384
- return p(p({}, t), { minWidth: Math.min(e.width, t.minWidth), minHeight: Math.min(e.height, t.minHeight), maxWidth: Math.min(e.width, t.maxWidth), maxHeight: Math.min(e.height, t.maxHeight) });
385
- }
386
- function Pt(t, e, i) {
387
- i === void 0 && (i = !0);
388
- var n = {};
389
- return W.forEach(function(s) {
390
- var o = t[s], a = e[s];
391
- o !== void 0 && a !== void 0 ? n[s] = s === "left" || s === "top" ? i ? Math.max(o, a) : Math.min(o, a) : i ? Math.min(o, a) : Math.max(o, a) : a !== void 0 ? n[s] = a : o !== void 0 && (n[s] = o);
392
- }), n;
393
- }
394
- function it(t, e) {
395
- return Pt(t, e, !0);
396
- }
397
- function Ct(t) {
398
- var e = t.size, i = t.aspectRatio, n = t.ignoreMinimum, s = t.sizeRestrictions;
399
- return !!((e.correctRatio || b(e) >= i.minimum && b(e) <= i.maximum) && e.height <= s.maxHeight && e.width <= s.maxWidth && e.width && e.height && (n || e.height >= s.minHeight && e.width >= s.minWidth));
400
- }
401
- function Et(t, e) {
402
- return Math.pow(t.width - e.width, 2) + Math.pow(t.height - e.height, 2);
403
- }
404
- function I(t) {
405
- var e = t.width, i = t.height, n = t.sizeRestrictions, s = { minimum: t.aspectRatio && t.aspectRatio.minimum || 0, maximum: t.aspectRatio && t.aspectRatio.maximum || 1 / 0 }, o = { width: Math.max(n.minWidth, Math.min(n.maxWidth, e)), height: Math.max(n.minHeight, Math.min(n.maxHeight, i)) };
406
- function a(c, l) {
407
- return l === void 0 && (l = !1), c.reduce(function(u, d) {
408
- return Ct({ size: d, aspectRatio: s, sizeRestrictions: n, ignoreMinimum: l }) && (!u || Et(d, { width: e, height: i }) < Et(u, { width: e, height: i })) ? d : u;
409
- }, null);
410
- }
411
- var h = [];
412
- s && [s.minimum, s.maximum].forEach(function(c) {
413
- c && h.push({ width: o.width, height: o.width / c, correctRatio: !0 }, { width: o.height * c, height: o.height, correctRatio: !0 });
414
- }), Ct({ size: o, aspectRatio: s, sizeRestrictions: n }) && h.push(o);
415
- var r = a(h) || a(h, !0);
416
- return r && { width: r.width, height: r.height };
417
- }
418
- function ft(t) {
419
- var e = t.event, i = t.coordinates, n = t.positionRestrictions, s = n === void 0 ? {} : n, o = x(i, e.directions);
420
- return x(o, F(o, s));
421
- }
422
- function se(t) {
423
- var e = t.coordinates, i = t.transform, n = t.imageSize, s = t.sizeRestrictions, o = t.positionRestrictions, a = t.aspectRatio, h = t.visibleArea, r = function(l, u) {
424
- return ft({ coordinates: l, positionRestrictions: o, event: new vt({ left: u.left - l.left, top: u.top - l.top }) });
425
- }, c = p({}, e);
426
- return (Array.isArray(i) ? i : [i]).forEach(function(l) {
427
- var u = {};
428
- y((u = typeof l == "function" ? l({ coordinates: c, imageSize: n, visibleArea: h }) : l).width) && y(u.height) || (c = function(d, m) {
429
- var g = p(p(p({}, d), I({ width: m.width, height: m.height, sizeRestrictions: s, aspectRatio: a })), { left: 0, top: 0 });
430
- return r(g, { left: d.left, top: d.top });
431
- }(c, p(p({}, c), u))), y(u.left) && y(u.top) || (c = r(c, p(p({}, c), u)));
432
- }), c;
433
- }
434
- function oe(t) {
435
- t.event;
436
- var e = t.getAreaRestrictions, i = t.boundaries, n = t.coordinates, s = t.visibleArea;
437
- t.aspectRatio;
438
- var o = t.stencilSize, a = t.sizeRestrictions, h = t.positionRestrictions;
439
- t.stencilReference;
440
- var r, c, l, u = p({}, n), d = p({}, s), m = p({}, o);
441
- r = b(m), 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 = p(p({}, u), I({ sizeRestrictions: a, width: u.width, height: u.height, aspectRatio: { minimum: b(m), maximum: b(m) } })));
442
- var g = et(d = E(d, u.width * i.width / (d.width * m.width)), e({ visibleArea: d, type: "resize" }));
443
- return g !== 1 && (d = E(d, g), u = E(u, g)), d = z(d = x(d, P(R(u), R(d))), e({ visibleArea: d, type: "move" })), { coordinates: u = z(u, it(T(d), h)), visibleArea: d };
444
- }
445
- function re(t) {
446
- var e = t.event, i = t.getAreaRestrictions, n = t.boundaries, s = t.coordinates, o = t.visibleArea;
447
- t.aspectRatio, t.stencilSize, t.sizeRestrictions;
448
- var a = t.positionRestrictions;
449
- t.stencilReference;
450
- var h = p({}, s), r = p({}, o);
451
- if (s && o && e.type !== "manipulateImage") {
452
- var c = { width: 0, height: 0 };
453
- r.width, n.width, b(n) > b(h) ? (c.height = 0.8 * n.height, c.width = c.height * b(h)) : (c.width = 0.8 * n.width, c.height = c.width * b(h));
454
- var l = et(r = E(r, h.width * n.width / (r.width * c.width)), i({ visibleArea: r, type: "resize" }));
455
- r = E(r, l), l !== 1 && (c.height /= l, c.width /= l), r = z(r = x(r, P(R(h), R(r))), i({ visibleArea: r, type: "move" })), h = z(h, it(T(r), a));
456
- }
457
- return { coordinates: h, visibleArea: r };
458
- }
459
- function ae(t) {
460
- var e = t.event, i = t.coordinates, n = t.visibleArea, s = t.getAreaRestrictions, o = p({}, n), a = p({}, i);
461
- if (e.type === "setCoordinates") {
462
- var h = Math.max(0, a.width - o.width), r = Math.max(0, a.height - o.height);
463
- h > r ? o = E(o, Math.min(a.width / o.width, L(o, s({ visibleArea: o, type: "resize" })))) : r > h && (o = E(o, Math.min(a.height / o.height, L(o, s({ visibleArea: o, type: "resize" }))))), o = z(o = x(o, tt(F(a, T(o)))), s({ visibleArea: o, type: "move" }));
464
- }
465
- return { visibleArea: o, coordinates: a };
466
- }
467
- function he(t) {
468
- var e = t.imageSize, i = t.visibleArea, n = t.aspectRatio, s = t.sizeRestrictions, o = i || e, a = Math.min(n.maximum || 1 / 0, Math.max(n.minimum || 0, b(o))), h = o.width < o.height ? { width: 0.8 * o.width, height: 0.8 * o.width / a } : { height: 0.8 * o.height, width: 0.8 * o.height * a };
469
- return I(p(p({}, h), { aspectRatio: n, sizeRestrictions: s }));
470
- }
471
- function ce(t) {
472
- var e, i, n = t.imageSize, s = t.visibleArea, o = t.boundaries, a = t.aspectRatio, h = t.sizeRestrictions, r = t.stencilSize, c = s || n;
473
- return b(c) > b(o) ? i = (e = r.height * c.height / o.height) * b(r) : e = (i = r.width * c.width / o.width) / b(r), I({ width: i, height: e, aspectRatio: a, sizeRestrictions: h });
474
- }
475
- function Z(t, e) {
476
- return Pt(t, T(e));
477
- }
478
- function le(t) {
479
- var e = t.event, i = t.coordinates, n = t.visibleArea, s = t.sizeRestrictions, o = t.getAreaRestrictions, a = t.positionRestrictions, h = t.adjustStencil, r = e.scale, c = e.move, l = p({}, n), u = p({}, i), d = 1, m = 1, g = r.factor && Math.abs(r.factor - 1) > 1e-3;
480
- l = x(l, { left: c.left || 0, top: c.top || 0 });
481
- var f = { stencil: { minimum: Math.max(s.minWidth ? s.minWidth / u.width : 0, s.minHeight ? s.minHeight / u.height : 0), maximum: Math.min(s.maxWidth ? s.maxWidth / u.width : 1 / 0, s.maxHeight ? s.maxHeight / u.height : 1 / 0, L(u, a)) }, area: { maximum: L(l, o({ visibleArea: l, type: "resize" })) } };
482
- r.factor && g && (r.factor < 1 ? (m = Math.max(r.factor, f.stencil.minimum)) > 1 && (m = 1) : r.factor > 1 && (m = Math.min(r.factor, Math.min(f.area.maximum, f.stencil.maximum))) < 1 && (m = 1)), m && (l = E(l, m, r.center));
483
- var S = i.left - n.left, $ = n.width + n.left - (i.width + i.left), B = i.top - n.top, N = n.height + n.top - (i.height + i.top);
484
- return l = z(l = x(l, F(l, { left: a.left !== void 0 ? a.left - S * m : void 0, top: a.top !== void 0 ? a.top - B * m : void 0, bottom: a.bottom !== void 0 ? a.bottom + N * m : void 0, right: a.right !== void 0 ? a.right + $ * m : void 0 })), o({ visibleArea: l, type: "move" })), u.width = u.width * m, u.height = u.height * m, u.left = l.left + S * m, u.top = l.top + B * m, u = z(u, it(T(l), a)), r.factor && g && h && (r.factor > 1 ? d = Math.min(f.area.maximum, r.factor) / m : r.factor < 1 && (d = Math.max(u.height / l.height, u.width / l.width, r.factor / m)), d !== 1 && (l = x(l = z(l = E(l, d, r.factor > 1 ? r.center : R(u)), o({ visibleArea: l, type: "move" })), tt(F(u, T(l)))))), { coordinates: u, visibleArea: l };
485
- }
486
- function ue(t) {
487
- var e = t.aspectRatio, i = t.getAreaRestrictions, n = t.coordinates, s = t.visibleArea, o = t.sizeRestrictions, a = t.positionRestrictions, h = t.imageSize, r = t.previousImageSize, c = t.angle, l = p({}, n), u = p({}, s), d = H(R(p({ left: 0, top: 0 }, r)), c);
488
- return (l = p(p({}, I({ sizeRestrictions: o, aspectRatio: e, width: l.width, height: l.height })), H(R(l), c))).left -= d.left - h.width / 2 + l.width / 2, l.top -= d.top - h.height / 2 + l.height / 2, u = E(u, et(u, i({ visibleArea: u, type: "resize" }))), { coordinates: l = z(l, a), visibleArea: u = z(u = x(u, P(R(l), R(n))), i({ visibleArea: u, type: "move" })) };
489
- }
490
- function de(t) {
491
- var e = t.flip, i = t.previousFlip, n = t.rotate, s = t.getAreaRestrictions, o = t.coordinates, a = t.visibleArea, h = t.imageSize, r = p({}, o), c = p({}, a), l = i.horizontal !== e.horizontal, u = i.vertical !== e.vertical;
492
- if (l || u) {
493
- var d = H({ left: h.width / 2, top: h.height / 2 }, -n), m = H(R(r), -n), g = H({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, n);
494
- r = x(r, P(g, R(r))), m = H(R(c), -n), c = z(c = x(c, P(g = H({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, n), R(c))), s({ visibleArea: c, type: "move" }));
495
- }
496
- return { coordinates: r, visibleArea: c };
497
- }
498
- function Ot(t) {
499
- var e = t.directions, i = t.coordinates, n = t.positionRestrictions, s = n === void 0 ? {} : n, o = t.sizeRestrictions, a = t.preserveRatio, h = t.compensate, r = p({}, e), c = O(i, r).width, l = O(i, r).height;
500
- c < 0 && (r.left < 0 && r.right < 0 ? (r.left = -(i.width - o.minWidth) / (r.left / r.right), r.right = -(i.width - o.minWidth) / (r.right / r.left)) : r.left < 0 ? r.left = -(i.width - o.minWidth) : r.right < 0 && (r.right = -(i.width - o.minWidth))), l < 0 && (r.top < 0 && r.bottom < 0 ? (r.top = -(i.height - o.minHeight) / (r.top / r.bottom), r.bottom = -(i.height - o.minHeight) / (r.bottom / r.top)) : r.top < 0 ? r.top = -(i.height - o.minHeight) : r.bottom < 0 && (r.bottom = -(i.height - o.minHeight)));
501
- var u = Y(O(i, r), s);
502
- 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 = Y(O(i, r), s));
503
- var d = { width: 1 / 0, height: 1 / 0, left: 1 / 0, right: 1 / 0, top: 1 / 0, bottom: 1 / 0 };
504
- if (W.forEach(function(f) {
505
- var S = u[f];
506
- S && r[f] && (d[f] = Math.max(0, 1 - S / r[f]));
507
- }), a) {
508
- var m = Math.min.apply(null, W.map(function(f) {
509
- return d[f];
510
- }));
511
- m !== 1 / 0 && W.forEach(function(f) {
512
- r[f] *= m;
513
- });
514
- } else
515
- W.forEach(function(f) {
516
- d[f] !== 1 / 0 && (r[f] *= d[f]);
517
- });
518
- if (c = O(i, r).width, l = O(i, r).height, r.right + r.left && (c > o.maxWidth ? d.width = (o.maxWidth - i.width) / (r.right + r.left) : c < o.minWidth && (d.width = (o.minWidth - i.width) / (r.right + r.left))), r.bottom + r.top && (l > o.maxHeight ? d.height = (o.maxHeight - i.height) / (r.bottom + r.top) : l < o.minHeight && (d.height = (o.minHeight - i.height) / (r.bottom + r.top))), a) {
519
- var g = Math.min(d.width, d.height);
520
- g !== 1 / 0 && W.forEach(function(f) {
521
- r[f] *= g;
522
- });
523
- } else
524
- d.width !== 1 / 0 && Jt.forEach(function(f) {
525
- r[f] *= d.width;
526
- }), d.height !== 1 / 0 && te.forEach(function(f) {
527
- r[f] *= d.height;
528
- });
529
- return r;
530
- }
531
- function G(t, e, i) {
532
- return e == 0 && i == 0 ? t / 2 : e == 0 ? 0 : i == 0 ? t : t * Math.abs(e / (e + i));
533
- }
534
- var me = M("vue-simple-handler"), pe = M("vue-simple-handler-wrapper"), nt = A({ render: function() {
535
- var t = this, e = t.$createElement, i = t._self._c || e;
536
- return i("HandlerWrapper", { class: t.classes.wrapper, attrs: { "vertical-position": t.verticalPosition, "horizontal-position": t.horizontalPosition, disabled: t.disabled }, on: { drag: t.onDrag, "drag-end": t.onDragEnd, enter: t.onEnter, leave: t.onLeave } }, [i("div", { class: t.classes.default })]);
537
- }, staticRenderFns: [] }, void 0, { name: "SimpleHandler", components: { HandlerWrapper: Gt }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
538
- return { hover: !1 };
539
- }, computed: { classes: function() {
540
- 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);
541
- return { default: w(me(e), this.defaultClass, this.hover && this.hoverClass), wrapper: w(pe(e), this.wrapperClass) };
542
- } }, methods: { onDrag: function(t) {
543
- this.$emit("drag", t);
544
- }, onEnter: function() {
545
- this.hover = !0;
546
- }, onLeave: function() {
547
- this.hover = !1;
548
- }, onDragEnd: function() {
549
- this.$emit("drag-end");
550
- } } }, void 0, !1), ge = M("vue-simple-line"), fe = M("vue-simple-line-wrapper"), st = A({ render: function() {
551
- var t = this, e = t.$createElement, i = t._self._c || e;
552
- return i("LineWrapper", { class: t.classes.wrapper, attrs: { position: t.position, disabled: t.disabled }, on: { drag: t.onDrag, "drag-end": t.onDragEnd, enter: t.onEnter, leave: t.onLeave } }, [i("div", { class: t.classes.root })]);
553
- }, staticRenderFns: [] }, void 0, { name: "SimpleLine", components: { LineWrapper: Kt }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, position: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
554
- return { hover: !1 };
555
- }, computed: { classes: function() {
556
- return { root: w(ge(C({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass), wrapper: w(fe(C({}, this.position, !0)), this.wrapperClass) };
557
- } }, methods: { onDrag: function(t) {
558
- this.$emit("drag", t);
559
- }, onEnter: function() {
560
- this.hover = !0;
561
- }, onLeave: function() {
562
- this.hover = !1;
563
- }, onDragEnd: function() {
564
- this.$emit("drag-end");
565
- } } }, void 0, !1), ct = M("vue-bounding-box"), ve = ["east", "west", null], be = ["south", "north", null], Lt = A({ render: function() {
566
- var t = this, e = t.$createElement, i = t._self._c || e;
567
- return i("div", { ref: "box", class: t.classes.root, style: t.style }, [t._t("default"), t._v(" "), i("div", t._l(t.lineNodes, function(n) {
568
- return i(n.component, { key: n.name, tag: "component", attrs: { "default-class": n.class, "hover-class": n.hoverClass, "wrapper-class": n.wrapperClass, position: n.name, disabled: n.disabled }, on: { drag: function(s) {
569
- return t.onHandlerDrag(s, n.horizontalDirection, n.verticalDirection);
570
- }, "drag-end": function(s) {
571
- return t.onEnd();
572
- } } });
573
- }), 1), t._v(" "), t._l(t.handlerNodes, function(n) {
574
- return i("div", { key: n.name, class: n.wrapperClass, style: n.wrapperStyle }, [i(n.component, { tag: "component", attrs: { "default-class": n.class, "hover-class": n.hoverClass, "wrapper-class": n.wrapperClass, "horizontal-position": n.horizontalDirection, "vertical-position": n.verticalDirection, disabled: n.disabled }, on: { drag: function(s) {
575
- return t.onHandlerDrag(s, n.horizontalDirection, n.verticalDirection);
576
- }, "drag-end": function(s) {
577
- return t.onEnd();
578
- } } })], 1);
579
- })], 2);
580
- }, staticRenderFns: [] }, void 0, { name: "BoundingBox", props: { width: { type: Number }, height: { type: Number }, transitions: { type: Object }, handlers: { type: Object, default: function() {
581
- return { eastNorth: !0, north: !0, westNorth: !0, west: !0, westSouth: !0, south: !0, eastSouth: !0, east: !0 };
582
- } }, handlersComponent: { type: [Object, String], default: function() {
583
- return nt;
584
- } }, handlersClasses: { type: Object, default: function() {
585
- return {};
586
- } }, handlersWrappersClasses: { type: Object, default: function() {
587
- return {};
588
- } }, lines: { type: Object, default: function() {
589
- return { west: !0, north: !0, east: !0, south: !0 };
590
- } }, linesComponent: { type: [Object, String], default: function() {
591
- return st;
592
- } }, linesClasses: { type: Object, default: function() {
593
- return {};
594
- } }, linesWrappersClasses: { type: Object, default: function() {
595
- return {};
596
- } }, resizable: { type: Boolean, default: !0 } }, data: function() {
597
- var t = [];
598
- return ve.forEach(function(e) {
599
- be.forEach(function(i) {
600
- if (e !== i) {
601
- var n = jt(e, i), s = n.name, o = n.classname;
602
- t.push({ name: s, classname: o, verticalDirection: i, horizontalDirection: e });
603
- }
604
- });
605
- }), { points: t };
606
- }, computed: { style: function() {
607
- var t = {};
608
- 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;
609
- }, classes: function() {
610
- var t = this.handlersClasses, e = this.handlersWrappersClasses, i = this.linesClasses, n = this.linesWrappersClasses;
611
- return { root: ct(), handlers: t, handlersWrappers: e, lines: i, linesWrappers: n };
612
- }, lineNodes: function() {
613
- var t = this, e = [];
614
- return this.points.forEach(function(i) {
615
- i.horizontalDirection && i.verticalDirection || !t.lines[i.name] || e.push({ name: i.name, component: t.linesComponent, class: w(t.classes.lines.default, t.classes.lines[i.name], !t.resizable && t.classes.lines.disabled), wrapperClass: w(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 });
616
- }), e;
617
- }, handlerNodes: function() {
618
- var t = this, e = [], i = this.width, n = this.height;
619
- return this.points.forEach(function(s) {
620
- if (t.handlers[s.name]) {
621
- var o = { name: s.name, component: t.handlersComponent, class: w(t.classes.handlers.default, t.classes.handlers[s.name]), wrapperClass: w(t.classes.handlersWrappers.default, t.classes.handlersWrappers[s.name]), hoverClass: t.classes.handlers.hover, verticalDirection: s.verticalDirection, horizontalDirection: s.horizontalDirection, disabled: !t.resizable };
622
- if (i && n) {
623
- var a = s.horizontalDirection, h = s.verticalDirection, r = a === "east" ? i : a === "west" ? 0 : i / 2, c = h === "south" ? n : h === "north" ? 0 : n / 2;
624
- o.wrapperClass = ct("handler"), o.wrapperStyle = { transform: "translate(".concat(r, "px, ").concat(c, "px)") }, t.transitions && t.transitions.enabled && (o.wrapperStyle.transition = "".concat(t.transitions.time, "ms ").concat(t.transitions.timingFunction));
625
- } else
626
- o.wrapperClass = ct("handler", C({}, s.classname, !0));
627
- e.push(o);
628
- }
629
- }), e;
630
- } }, beforeMount: function() {
631
- 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 });
632
- }, beforeDestroy: function() {
633
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
634
- }, mounted: function() {
635
- this.touches = [];
636
- }, methods: { onEnd: function() {
637
- this.$emit("resize-end");
638
- }, onHandlerDrag: function(t, e, i) {
639
- var n, s = t.shift(), o = s.left, a = s.top, h = { left: 0, right: 0, top: 0, bottom: 0 };
640
- e === "west" ? h.left -= o : e === "east" && (h.right += o), i === "north" ? h.top -= a : i === "south" && (h.bottom += a), !i && e ? n = "width" : i && !e && (n = "height"), this.resizable && this.$emit("resize", new qt(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: n }));
641
- } } }, void 0, !1), we = M("vue-draggable-area"), Ft = A({ render: function() {
642
- var t = this, e = t.$createElement;
643
- return (t._self._c || e)("div", { ref: "container", on: { touchstart: t.onTouchStart, mousedown: t.onMouseDown } }, [t._t("default")], 2);
644
- }, staticRenderFns: [] }, void 0, { name: "DraggableArea", props: { movable: { type: Boolean, default: !0 }, activationDistance: { type: Number, default: 20 } }, computed: { classnames: function() {
645
- return { default: we() };
646
- } }, beforeMount: function() {
647
- 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 });
648
- }, beforeDestroy: function() {
649
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
650
- }, mounted: function() {
651
- this.touches = [], this.touchStarted = !1;
652
- }, methods: { onTouchStart: function(t) {
653
- if (t.cancelable) {
654
- var e = this.movable && t.touches.length === 1;
655
- e && (this.touches = _(t.touches)), (this.touchStarted || e) && (t.preventDefault(), t.stopPropagation());
656
- }
657
- }, onTouchEnd: function() {
658
- this.touchStarted = !1, this.processEnd();
659
- }, onTouchMove: function(t) {
660
- 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));
661
- }, onMouseDown: function(t) {
662
- if (this.movable && t.button === 0) {
663
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
664
- this.touches = [e], this.initAnchor(e), t.stopPropagation();
665
- }
666
- }, onMouseMove: function(t) {
667
- this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.cancelable && t.preventDefault(), t.stopPropagation());
668
- }, onMouseUp: function() {
669
- this.processEnd();
670
- }, initAnchor: function(t) {
671
- var e = this.$refs.container.getBoundingClientRect(), i = e.left, n = e.top;
672
- this.anchor = { x: t.clientX - i, y: t.clientY - n };
673
- }, processMove: function(t, e) {
674
- var i = _(e);
675
- if (this.touches.length) {
676
- var n = this.$refs.container.getBoundingClientRect(), s = n.left, o = n.top;
677
- this.touches.length === 1 && i.length === 1 && this.$emit("move", new vt({ left: i[0].clientX - (s + this.anchor.x), top: i[0].clientY - (o + this.anchor.y) }));
678
- }
679
- }, processEnd: function() {
680
- this.touches.length && this.$emit("move-end"), this.touches = [];
681
- } } }, void 0, !1);
682
- function lt(t) {
683
- var e, i;
684
- 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 } };
685
- }
686
- function ye(t) {
687
- return new Promise(function(e, i) {
688
- try {
689
- if (t)
690
- if (/^data:/i.test(t))
691
- e(function(r) {
692
- r = r.replace(/^data:([^;]+);base64,/gim, "");
693
- for (var c = atob(r), l = c.length, u = new ArrayBuffer(l), d = new Uint8Array(u), m = 0; m < l; m++)
694
- d[m] = c.charCodeAt(m);
695
- return u;
696
- }(t));
697
- else if (/^blob:/i.test(t)) {
698
- var n = new FileReader();
699
- n.onload = function(r) {
700
- e(r.target.result);
701
- }, o = t, a = function(r) {
702
- n.readAsArrayBuffer(r);
703
- }, (h = new XMLHttpRequest()).open("GET", o, !0), h.responseType = "blob", h.onload = function() {
704
- this.status != 200 && this.status !== 0 || a(this.response);
705
- }, h.send();
706
- } else {
707
- var s = new XMLHttpRequest();
708
- s.onreadystatechange = function() {
709
- s.readyState === 4 && (s.status === 200 || s.status === 0 ? e(s.response) : i("Warning: could not load an image to parse its orientation"), s = null);
710
- }, s.onprogress = function() {
711
- s.getResponseHeader("content-type") !== "image/jpeg" && s.abort();
712
- }, s.withCredentials = !1, s.open("GET", t, !0), s.responseType = "arraybuffer", s.send(null);
713
- }
714
- else
715
- i("Error: the image is empty");
716
- } catch (r) {
717
- i(r);
718
- }
719
- var o, a, h;
720
- });
721
- }
722
- function wt(t) {
723
- var e = t.rotate, i = t.flip, n = t.scaleX, s = t.scaleY, o = "";
724
- return o += " rotate(" + e + "deg) ", o += " scaleX(" + n * (i.horizontal ? -1 : 1) + ") ", o += " scaleY(" + s * (i.vertical ? -1 : 1) + ") ";
725
- }
726
- function ze(t) {
727
- try {
728
- var e, i = new DataView(t), n = void 0, s = void 0, o = void 0, a = void 0;
729
- if (i.getUint8(0) === 255 && i.getUint8(1) === 216)
730
- for (var h = i.byteLength, r = 2; r + 1 < h; ) {
731
- if (i.getUint8(r) === 255 && i.getUint8(r + 1) === 225) {
732
- o = r;
733
- break;
734
- }
735
- r++;
736
- }
737
- if (o && (n = o + 10, function(m, g, f) {
738
- var S, $ = "";
739
- for (S = g, f += g; S < f; S++)
740
- $ += String.fromCharCode(m.getUint8(S));
741
- return $;
742
- }(i, o + 4, 4) === "Exif")) {
743
- var c = i.getUint16(n);
744
- if (((s = c === 18761) || c === 19789) && i.getUint16(n + 2, s) === 42) {
745
- var l = i.getUint32(n + 4, s);
746
- l >= 8 && (a = n + l);
747
- }
748
- }
749
- if (a) {
750
- for (var u = i.getUint16(a, s), d = 0; d < u; d++)
751
- if (r = a + 12 * d + 2, i.getUint16(r, s) === 274) {
752
- r += 8, e = i.getUint16(r, s), i.setUint16(r, 1, s);
753
- break;
754
- }
755
- }
756
- return e;
757
- } catch {
758
- return null;
759
- }
760
- }
761
- var Q = M("vue-preview-result");
762
- A({ render: function() {
763
- var t = this, e = t.$createElement, i = t._self._c || e;
764
- return i("div", { class: t.classes.root }, [i("div", { ref: "wrapper", class: t.classes.wrapper, style: t.wrapperStyle }, [i("img", { ref: "image", class: t.classes.image, style: t.imageStyle, attrs: { src: t.image.src } })])]);
765
- }, staticRenderFns: [] }, void 0, { name: "PreviewResult", props: { image: { type: Object }, transitions: { type: Object }, stencilCoordinates: { type: Object, default: function() {
766
- return { width: 0, height: 0, left: 0, top: 0 };
767
- } }, imageClass: { type: String } }, computed: { classes: function() {
768
- return { root: Q(), wrapper: Q("wrapper"), imageWrapper: Q("image-wrapper"), image: w(Q("image"), this.imageClass) };
769
- }, wrapperStyle: function() {
770
- var t = { width: "".concat(this.stencilCoordinates.width, "px"), height: "".concat(this.stencilCoordinates.height, "px"), left: "calc(50% - ".concat(this.stencilCoordinates.width / 2, "px)"), top: "calc(50% - ".concat(this.stencilCoordinates.height / 2, "px)") };
771
- return this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
772
- }, imageStyle: function() {
773
- var t = this.image.transforms, e = bt({ width: this.image.width, height: this.image.height }, t.rotate), i = { width: "".concat(this.image.width, "px"), height: "".concat(this.image.height, "px"), left: "0px", top: "0px" }, n = { left: (this.image.width - e.width) * t.scaleX / 2, top: (this.image.height - e.height) * t.scaleY / 2 }, s = { left: (1 - t.scaleX) * this.image.width / 2, top: (1 - t.scaleY) * this.image.height / 2 };
774
- return i.transform = `translate(
775
- `.concat(-this.stencilCoordinates.left - t.translateX - n.left - s.left, "px,").concat(-this.stencilCoordinates.top - t.translateY - n.top - s.top, "px) ") + wt(t), this.transitions && this.transitions.enabled && (i.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), i;
776
- } } }, void 0, !1);
777
- function Wt(t, e) {
778
- var i = e.getBoundingClientRect(), n = i.left, s = i.top, o = { left: 0, top: 0 }, a = 0;
779
- return t.forEach(function(h) {
780
- o.left += (h.clientX - n) / t.length, o.top += (h.clientY - s) / t.length;
781
- }), t.forEach(function(h) {
782
- a += _t({ x: o.left, y: o.top }, { x: h.clientX - n, y: h.clientY - s });
783
- }), { centerMass: o, spread: a, count: t.length };
784
- }
785
- var Re = A({ render: function() {
786
- var t = this, e = t.$createElement;
787
- return (t._self._c || e)("div", { ref: "container", on: { touchstart: t.onTouchStart, mousedown: t.onMouseDown, wheel: t.onWheel } }, [t._t("default")], 2);
788
- }, staticRenderFns: [] }, void 0, { 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() {
789
- 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 });
790
- }, beforeDestroy: function() {
791
- window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
792
- }, created: function() {
793
- this.transforming = !1, this.debouncedProcessEnd = pt(this.processEnd), this.touches = [];
794
- }, methods: { processMove: function(t, e) {
795
- if (this.touches.length) {
796
- if (this.touches.length === 1 && e.length === 1)
797
- this.$emit("move", new X({ left: this.touches[0].clientX - e[0].clientX, top: this.touches[0].clientY - e[0].clientY }));
798
- else if (this.touches.length > 1 && this.touchResize) {
799
- var i = Wt(e, this.$refs.container), n = this.oldGeometricProperties;
800
- n.count === i.count && n.count > 1 && this.$emit("resize", new X({ left: n.centerMass.left - i.centerMass.left, top: n.centerMass.top - i.centerMass.top }, { factor: n.spread / i.spread, center: i.centerMass })), this.oldGeometricProperties = i;
801
- }
802
- this.touches = e;
803
- }
804
- }, processEnd: function() {
805
- this.transforming && (this.transforming = !1, this.$emit("transform-end"));
806
- }, processStart: function() {
807
- this.transforming = !0, this.debouncedProcessEnd.clear();
808
- }, processEvent: function(t) {
809
- return this.eventsFilter ? this.eventsFilter(t, this.transforming) !== !1 : (t.preventDefault(), t.stopPropagation(), !0);
810
- }, onTouchStart: function(t) {
811
- if (t.cancelable && (this.touchMove || this.touchResize && t.touches.length > 1) && this.processEvent(t)) {
812
- var e = this.$refs.container, i = e.getBoundingClientRect(), n = i.left, s = i.top, o = i.bottom, a = i.right;
813
- this.touches = _(t.touches).filter(function(h) {
814
- return h.clientX > n && h.clientX < a && h.clientY > s && h.clientY < o;
815
- }), this.oldGeometricProperties = Wt(this.touches, e);
816
- }
817
- }, onTouchEnd: function(t) {
818
- t.touches.length === 0 && (this.touches = [], this.processEnd());
819
- }, onTouchMove: function(t) {
820
- var e = this;
821
- if (this.touches.length) {
822
- var i = _(t.touches).filter(function(n) {
823
- return !n.identifier || e.touches.find(function(s) {
824
- return s.identifier === n.identifier;
825
- });
826
- });
827
- this.processEvent(t) && (this.processMove(t, i), this.processStart());
828
- }
829
- }, onMouseDown: function(t) {
830
- if (this.mouseMove && "buttons" in t && t.buttons === 1 && this.processEvent(t)) {
831
- var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
832
- this.touches = [e], this.processStart();
833
- }
834
- }, onMouseMove: function(t) {
835
- this.touches.length && this.processEvent(t) && this.processMove(t, [{ clientX: t.clientX, clientY: t.clientY }]);
836
- }, onMouseUp: function() {
837
- this.touches = [], this.processEnd();
838
- }, onWheel: function(t) {
839
- if (this.wheelResize && this.processEvent(t)) {
840
- var e = this.$refs.container.getBoundingClientRect(), i = e.left, n = e.top, s = 1 + this.wheelResize.ratio * (a = t.deltaY || t.detail || t.wheelDelta, (h = +a) == 0 || Ht(h) ? h : h > 0 ? 1 : -1), o = { left: t.clientX - i, top: t.clientY - n };
841
- this.$emit("resize", new X({}, { factor: s, center: o })), this.touches.length || this.debouncedProcessEnd();
842
- }
843
- var a, h;
844
- } } }, void 0, !1), Tt = A({ render: function() {
845
- var t = this, e = t.$createElement;
846
- return (t._self._c || e)("transformable-image", { attrs: { "touch-move": t.touchMove, "touch-resize": t.touchResize, "mouse-move": t.mouseMove, "wheel-resize": t.wheelResize }, on: { move: function(i) {
847
- return t.$emit("move", i);
848
- }, resize: function(i) {
849
- return t.$emit("resize", i);
850
- } } }, [t._t("default")], 2);
851
- }, staticRenderFns: [] }, void 0, { components: { TransformableImage: Re }, props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 } } }, void 0, !1), K = M("vue-preview"), Ae = A({ render: function() {
852
- var t = this, e = t.$createElement, i = t._self._c || e;
853
- return i("div", { ref: "root", class: t.classes.root, style: t.style }, [i("div", { ref: "wrapper", class: t.classes.wrapper, style: t.wrapperStyle }, [i("img", { directives: [{ name: "show", rawName: "v-show", value: t.image && t.image.src, expression: "image && image.src" }], ref: "image", class: t.classes.image, style: t.imageStyle, attrs: { src: t.image && t.image.src } })])]);
854
- }, staticRenderFns: [] }, void 0, { props: { coordinates: { type: Object }, transitions: { type: Object }, image: { type: Object, default: function() {
855
- return {};
856
- } }, imageClass: { type: String }, width: { type: Number }, height: { type: Number }, fill: { type: Boolean } }, data: function() {
857
- return { calculatedImageSize: { width: 0, height: 0 }, calculatedSize: { width: 0, height: 0 } };
858
- }, computed: { classes: function() {
859
- return { root: K({ fill: this.fill }), wrapper: K("wrapper"), imageWrapper: K("image-wrapper"), image: w(K("image"), this.imageClass) };
860
- }, style: function() {
861
- if (this.fill)
862
- return {};
863
- var t = {};
864
- 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;
865
- }, wrapperStyle: function() {
866
- 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)") };
867
- return this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
868
- }, imageStyle: function() {
869
- if (this.coordinates && this.image) {
870
- 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, n = this.imageSize.height, s = bt({ width: i, height: n }, e.rotate), o = { width: "".concat(i, "px"), height: "".concat(n, "px"), left: "0px", top: "0px" }, a = { rotate: { left: (i - s.width) * e.scaleX / 2, top: (n - s.height) * e.scaleY / 2 }, scale: { left: (1 - e.scaleX) * i / 2, top: (1 - e.scaleY) * n / 2 } };
871
- return o.transform = `translate(
872
- `.concat(-this.coordinates.left / t - a.rotate.left - a.scale.left, "px,").concat(-this.coordinates.top / t - a.rotate.top - a.scale.top, "px) ") + wt(e), this.transitions && this.transitions.enabled && (o.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), o;
873
- }
874
- return {};
875
- }, size: function() {
876
- return { width: this.width || this.calculatedSize.width, height: this.height || this.calculatedSize.height };
877
- }, imageSize: function() {
878
- return { width: this.image.width || this.calculatedImageSize.width, height: this.image.height || this.calculatedImageSize.height };
879
- } }, watch: { image: function(t) {
880
- (t.width || t.height) && this.onChangeImage();
881
- } }, mounted: function() {
882
- var t = this;
883
- this.onChangeImage(), this.$refs.image.addEventListener("load", function() {
884
- t.refreshImage();
885
- }), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
886
- }, destroyed: function() {
887
- window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh);
888
- }, methods: { refreshImage: function() {
889
- var t = this.$refs.image;
890
- this.calculatedImageSize.height = t.naturalHeight, this.calculatedImageSize.width = t.naturalWidth;
891
- }, refresh: function() {
892
- var t = this.$refs.root;
893
- this.width || (this.calculatedSize.width = t.clientWidth), this.height || (this.calculatedSize.height = t.clientHeight);
894
- }, onChangeImage: function() {
895
- var t = this.$refs.image;
896
- t && t.complete && this.refreshImage(), this.refresh();
897
- } } }, void 0, !1), Bt = A({ render: function() {
898
- var t = this, e = t.$createElement;
899
- return (t._self._c || e)("preview", t._b({ attrs: { fill: !0 } }, "preview", t.$attrs, !1));
900
- }, staticRenderFns: [] }, void 0, { components: { Preview: Ae }, inheritAttrs: !1 }, void 0, !1), ut = M("vue-rectangle-stencil"), Ut = A({ render: function() {
901
- var t = this, e = t.$createElement, i = t._self._c || e;
902
- return i("div", { class: t.classes.stencil, style: t.style }, [i("bounding-box", { class: t.classes.boundingBox, attrs: { width: t.stencilCoordinates.width, height: t.stencilCoordinates.height, transitions: t.transitions, handlers: t.handlers, "handlers-component": t.handlersComponent, "handlers-classes": t.handlersClasses, "handlers-wrappers-classes": t.handlersWrappersClasses, lines: t.lines, "lines-component": t.linesComponent, "lines-classes": t.linesClasses, "lines-wrappers-classes": t.linesWrappersClasses, resizable: t.resizable }, on: { resize: t.onResize, "resize-end": t.onResizeEnd } }, [i("draggable-area", { attrs: { movable: t.movable }, on: { move: t.onMove, "move-end": t.onMoveEnd } }, [i("stencil-preview", { class: t.classes.preview, attrs: { image: t.image, coordinates: t.coordinates, width: t.stencilCoordinates.width, height: t.stencilCoordinates.height, transitions: t.transitions } })], 1)], 1)], 1);
903
- }, staticRenderFns: [] }, void 0, { name: "RectangleStencil", components: { StencilPreview: Bt, BoundingBox: Lt, DraggableArea: Ft }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object }, handlersComponent: { type: [Object, String], default: function() {
904
- return nt;
905
- } }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
906
- return st;
907
- } }, 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() {
908
- return {};
909
- } }, linesWrappersClasses: { type: Object, default: function() {
910
- return {};
911
- } }, handlersClasses: { type: Object, default: function() {
912
- return {};
913
- } }, handlersWrappersClasses: { type: Object, default: function() {
914
- return {};
915
- } } }, data: function() {
916
- return { moving: !1, resizing: !1 };
917
- }, computed: { classes: function() {
918
- return { stencil: w(ut({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: w(ut("preview"), this.previewClass), boundingBox: w(ut("bounding-box"), this.boundingBoxClass) };
919
- }, style: function() {
920
- var t = this.stencilCoordinates, e = t.height, i = t.width, n = t.left, s = t.top, o = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(n, "px, ").concat(s, "px)") };
921
- return this.transitions && this.transitions.enabled && (o.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), o;
922
- } }, methods: { onMove: function(t) {
923
- this.$emit("move", t), this.moving = !0;
924
- }, onMoveEnd: function() {
925
- this.$emit("move-end"), this.moving = !1;
926
- }, onResize: function(t) {
927
- this.$emit("resize", t), this.resizing = !0;
928
- }, onResizeEnd: function() {
929
- this.$emit("resize-end"), this.resizing = !1;
930
- }, aspectRatios: function() {
931
- return { minimum: this.aspectRatio || this.minAspectRatio, maximum: this.aspectRatio || this.maxAspectRatio };
932
- } } }, void 0, !1), dt = M("vue-circle-stencil"), xe = A({ render: function() {
933
- var t = this, e = t.$createElement, i = t._self._c || e;
934
- return i("div", { class: t.classes.stencil, style: t.style }, [i("bounding-box", { class: t.classes.boundingBox, attrs: { width: t.stencilCoordinates.width, height: t.stencilCoordinates.height, transitions: t.transitions, handlers: t.handlers, "handlers-component": t.handlersComponent, "handlers-classes": t.handlersClasses, "handlers-wrappers-classes": t.handlersWrappersClasses, lines: t.lines, "lines-component": t.linesComponent, "lines-classes": t.linesClasses, "lines-wrappers-classes": t.linesWrappersClasses, resizable: t.resizable }, on: { resize: t.onResize, "resize-end": t.onResizeEnd } }, [i("draggable-area", { attrs: { movable: t.movable }, on: { move: t.onMove, "move-end": t.onMoveEnd } }, [i("stencil-preview", { class: t.classes.preview, attrs: { image: t.image, coordinates: t.coordinates, width: t.stencilCoordinates.width, height: t.stencilCoordinates.height, transitions: t.transitions } })], 1)], 1)], 1);
935
- }, staticRenderFns: [] }, void 0, { components: { StencilPreview: Bt, BoundingBox: Lt, DraggableArea: Ft }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object, default: function() {
936
- return { eastNorth: !0, westNorth: !0, westSouth: !0, eastSouth: !0 };
937
- } }, handlersComponent: { type: [Object, String], default: function() {
938
- return nt;
939
- } }, handlersClasses: { type: Object, default: function() {
940
- return {};
941
- } }, handlersWrappersClasses: { type: Object, default: function() {
942
- return {};
943
- } }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
944
- return st;
945
- } }, linesClasses: { type: Object, default: function() {
946
- return {};
947
- } }, linesWrappersClasses: { type: Object, default: function() {
948
- return {};
949
- } }, 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 } }, data: function() {
950
- return { moving: !1, resizing: !1 };
951
- }, computed: { classes: function() {
952
- return { stencil: w(dt({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: w(dt("preview"), this.previewClass), boundingBox: w(dt("bounding-box"), this.boundingBoxClass) };
953
- }, style: function() {
954
- var t = this.stencilCoordinates, e = t.height, i = t.width, n = t.left, s = t.top, o = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(n, "px, ").concat(s, "px)") };
955
- return this.transitions && this.transitions.enabled && (o.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), o;
956
- } }, methods: { onMove: function(t) {
957
- this.$emit("move", t), this.moving = !0;
958
- }, onMoveEnd: function() {
959
- this.$emit("move-end"), this.moving = !1;
960
- }, onResize: function(t) {
961
- this.$emit("resize", t), this.resizing = !0;
962
- }, onResizeEnd: function() {
963
- this.$emit("resize-end"), this.resizing = !1;
964
- }, aspectRatios: function() {
965
- return { minimum: 1, maximum: 1 };
966
- } } }, void 0, !1), Se = ["transitions"], j = M("vue-advanced-cropper"), Me = { name: "Cropper", components: { BackgroundWrapper: Tt }, props: { src: { type: String, default: null }, stencilComponent: { type: [Object, String], default: function() {
967
- return Ut;
968
- } }, backgroundWrapperComponent: { type: [Object, String], default: function() {
969
- return Tt;
970
- } }, stencilProps: { type: Object, default: function() {
971
- return {};
972
- } }, 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) {
973
- return ie.indexOf(t) !== -1;
974
- } }, roundResult: { type: Boolean, default: !0 }, defaultSize: { type: [Function, Object] }, defaultPosition: { type: [Function, Object], default: function(t) {
975
- var e = t.imageSize, i = t.visibleArea, n = t.coordinates, s = i || e;
976
- return { left: (i ? i.left : 0) + s.width / 2 - n.width / 2, top: (i ? i.top : 0) + s.height / 2 - n.height / 2 };
977
- } }, defaultVisibleArea: { type: [Function, Object], default: function(t) {
978
- var e = t.getAreaRestrictions, i = t.coordinates, n = t.imageSize, s = b(t.boundaries);
979
- if (i) {
980
- var o = { height: Math.max(i.height, n.height), width: Math.max(i.width, n.width) }, a = Mt({ width: b(o) > s ? o.width : o.height * s, height: b(o) > s ? o.width / s : o.height }, ht(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 = Y(i, T(p({ left: 0, top: 0 }, n))), c = {};
981
- return !r.left && !r.right && h.width <= n.width && (c.left = 0, c.right = n.width), !r.top && !r.bottom && h.height <= n.height && (c.top = 0, c.bottom = n.height), z(h, c);
982
- }
983
- var l = b(n);
984
- return a = { height: l > s ? n.height : n.width / s, width: l > s ? n.height * s : n.width }, { left: n.width / 2 - a.width / 2, top: n.height / 2 - a.height / 2, width: a.width, height: a.height };
985
- } }, defaultTransforms: { type: [Function, Object] }, defaultBoundaries: { type: [Function, String], validator: function(t) {
986
- return !(typeof t == "string" && t !== "fill" && t !== "fit");
987
- } }, 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) {
988
- var e = t.event, i = t.coordinates, n = t.aspectRatio, s = t.positionRestrictions, o = t.sizeRestrictions, a = p(p({}, i), { right: i.left + i.width, bottom: i.top + i.height }), h = e.params || {}, r = p({}, e.directions), c = h.allowedDirections || { left: !0, right: !0, bottom: !0, top: !0 };
989
- o.widthFrozen && (r.left = 0, r.right = 0), o.heightFrozen && (r.top = 0, r.bottom = 0), W.forEach(function(U) {
990
- c[U] || (r[U] = 0);
991
- });
992
- var l = O(a, r = Ot({ coordinates: a, directions: r, sizeRestrictions: o, positionRestrictions: s })).width, u = O(a, r).height, d = h.preserveRatio ? b(a) : at(l / u, n);
993
- if (d) {
994
- var m = h.respectDirection;
995
- if (m || (m = a.width >= a.height || d === 1 ? "width" : "height"), m === "width") {
996
- var g = l / d - a.height;
997
- if (c.top && c.bottom) {
998
- var f = r.top, S = r.bottom;
999
- r.bottom = G(g, S, f), r.top = G(g, f, S);
1000
- } else
1001
- c.bottom ? r.bottom = g : c.top ? r.top = g : c.right ? r.right = 0 : c.left && (r.left = 0);
1002
- } else if (m === "height") {
1003
- var $ = a.width - u * d;
1004
- if (c.left && c.right) {
1005
- var B = r.left, N = r.right;
1006
- r.left = -G($, B, N), r.right = -G($, N, B);
1007
- } else
1008
- c.left ? r.left = -$ : c.right ? r.right = -$ : c.top ? r.top = 0 : c.bottom && (r.bottom = 0);
1009
- }
1010
- r = Ot({ directions: r, coordinates: a, sizeRestrictions: o, positionRestrictions: s, preserveRatio: !0, compensate: h.compensate });
1011
- }
1012
- return l = O(a, r).width, u = O(a, r).height, (d = h.preserveRatio ? b(a) : at(l / u, n)) && Math.abs(d - l / u) > 1e-3 && W.forEach(function(U) {
1013
- c[U] || (r[U] = 0);
1014
- }), ft({ event: new vt({ left: -r.left, top: -r.top }), coordinates: { width: i.width + r.right + r.left, height: i.height + r.top + r.bottom, left: i.left, top: i.top }, positionRestrictions: s });
1015
- } }, moveAlgorithm: { type: Function, default: ft }, initStretcher: { type: Function, default: function(t) {
1016
- var e = t.stretcher, i = t.imageSize, n = b(i);
1017
- e.style.width = i.width + "px", e.style.height = e.clientWidth / n + "px", e.style.width = e.clientWidth + "px";
1018
- } }, fitCoordinates: { type: Function, default: function(t) {
1019
- var e = t.visibleArea, i = t.coordinates, n = t.aspectRatio, s = t.sizeRestrictions, o = t.positionRestrictions, a = p(p({}, i), I({ width: i.width, height: i.height, aspectRatio: n, sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minHeight: Math.min(e.height, s.minHeight), minWidth: Math.min(e.width, s.minWidth) } }));
1020
- return a = z(a = x(a, P(R(i), R(a))), it(T(e), o));
1021
- } }, fitVisibleArea: { type: Function, default: function(t) {
1022
- var e = t.visibleArea, i = t.boundaries, n = t.getAreaRestrictions, s = t.coordinates, o = p({}, e);
1023
- o.height = o.width / b(i), o.top += (e.height - o.height) / 2, (s.height - o.height > 0 || s.width - o.width > 0) && (o = E(o, Math.max(s.height / o.height, s.width / o.width)));
1024
- var a = tt(F(s, T(o = E(o, et(o, n({ visibleArea: o, type: "resize" }))))));
1025
- return o.width < s.width && (a.left = 0), o.height < s.height && (a.top = 0), o = z(o = x(o, a), n({ visibleArea: o, type: "move" }));
1026
- } }, areaRestrictionsAlgorithm: { type: Function, default: function(t) {
1027
- var e = t.visibleArea, i = t.boundaries, n = t.imageSize, s = t.imageRestriction, o = t.type, a = {};
1028
- return s === "fill-area" ? a = { left: 0, top: 0, right: n.width, bottom: n.height } : s === "fit-area" && (b(i) > b(n) ? (a = { top: 0, bottom: n.height }, e && o === "move" && (e.width > n.width ? (a.left = -(e.width - n.width) / 2, a.right = n.width - a.left) : (a.left = 0, a.right = n.width))) : (a = { left: 0, right: n.width }, e && o === "move" && (e.height > n.height ? (a.top = -(e.height - n.height) / 2, a.bottom = n.height - a.top) : (a.top = 0, a.bottom = n.height)))), a;
1029
- } }, sizeRestrictionsAlgorithm: { type: Function, default: function(t) {
1030
- return { minWidth: t.minWidth, minHeight: t.minHeight, maxWidth: t.maxWidth, maxHeight: t.maxHeight };
1031
- } }, positionRestrictionsAlgorithm: { type: Function, default: function(t) {
1032
- var e = t.imageSize, i = {};
1033
- return t.imageRestriction !== "none" && (i = { left: 0, top: 0, right: e.width, bottom: e.height }), i;
1034
- } } }, data: function() {
1035
- return { transitionsActive: !1, imageLoaded: !1, imageAttributes: { width: null, height: null, crossOrigin: !1, 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({}, xt) };
1036
- }, computed: { image: function() {
1037
- return { src: this.imageAttributes.src, width: this.imageAttributes.width, height: this.imageAttributes.height, transforms: this.imageTransforms };
1038
- }, imageTransforms: function() {
1039
- 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 };
1040
- }, imageSize: function() {
1041
- var t = function(e) {
1042
- return e * Math.PI / 180;
1043
- }(this.imageTransforms.rotate);
1044
- 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)) };
1045
- }, initialized: function() {
1046
- return !!(this.visibleArea && this.imageLoaded);
1047
- }, settings: function() {
1048
- var t = gt(this.resizeImage, { touch: !0, wheel: { ratio: 0.1 }, adjustStencil: !0 }, { touch: !1, wheel: !1, adjustStencil: !1 });
1049
- return { moveImage: gt(this.moveImage, { touch: !0, mouse: !0 }, { touch: !1, mouse: !1 }), resizeImage: t };
1050
- }, coefficient: function() {
1051
- return this.visibleArea ? this.visibleArea.width / this.boundaries.width : 0;
1052
- }, areaRestrictions: function() {
1053
- return this.imageLoaded ? this.areaRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction, boundaries: this.boundaries }) : {};
1054
- }, transitionsOptions: function() {
1055
- return { enabled: this.transitionsActive, timingFunction: "ease-in-out", time: 350 };
1056
- }, sizeRestrictions: function() {
1057
- if (this.boundaries.width && this.boundaries.height && this.imageSize.width && this.imageSize.height) {
1058
- var t = this.sizeRestrictionsAlgorithm({ imageSize: this.imageSize, minWidth: y(this.minWidth) ? 0 : q(this.minWidth), minHeight: y(this.minHeight) ? 0 : q(this.minHeight), maxWidth: y(this.maxWidth) ? 1 / 0 : q(this.maxWidth), maxHeight: y(this.maxHeight) ? 1 / 0 : q(this.maxHeight) });
1059
- if (t = function(n) {
1060
- var s = n.areaRestrictions, o = n.sizeRestrictions, a = n.boundaries, h = n.positionRestrictions, r = p(p({}, o), { minWidth: o.minWidth !== void 0 ? o.minWidth : 0, minHeight: o.minHeight !== void 0 ? o.minHeight : 0, maxWidth: o.maxWidth !== void 0 ? o.maxWidth : 1 / 0, maxHeight: o.maxHeight !== void 0 ? o.maxHeight : 1 / 0 });
1061
- 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));
1062
- var c = ht(s), l = Mt(a, c);
1063
- 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;
1064
- }({ 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) {
1065
- var e = this.getStencilSize(), i = ht(this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }));
1066
- 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);
1067
- }
1068
- return t;
1069
- }
1070
- return { minWidth: 0, minHeight: 0, maxWidth: 0, maxHeight: 0 };
1071
- }, positionRestrictions: function() {
1072
- return this.positionRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction });
1073
- }, classes: function() {
1074
- return { cropper: j(), image: w(j("image"), this.imageClass), stencil: j("stencil"), boundaries: w(j("boundaries"), this.boundariesClass), stretcher: w(j("stretcher")), background: w(j("background"), this.backgroundClass), foreground: w(j("foreground"), this.foregroundClass), imageWrapper: w(j("image-wrapper")), cropperWrapper: w(j("cropper-wrapper")) };
1075
- }, stencilCoordinates: function() {
1076
- if (this.initialized) {
1077
- var t = this.coordinates, e = t.width, i = t.height, n = t.left, s = t.top;
1078
- return { width: e / this.coefficient, height: i / this.coefficient, left: (n - this.visibleArea.left) / this.coefficient, top: (s - this.visibleArea.top) / this.coefficient };
1079
- }
1080
- return this.defaultCoordinates();
1081
- }, boundariesStyle: function() {
1082
- 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" };
1083
- return this.imageLoaded || (t.opacity = "0"), t;
1084
- }, imageStyle: function() {
1085
- 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 }, n = v(v({}, this.imageTransforms), {}, { scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / t.width), scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / t.height) }), s = { width: "".concat(t.width, "px"), height: "".concat(t.height, "px"), left: "0px", top: "0px", transform: "translate(".concat(-e.left - i.left - this.imageTransforms.translateX, "px, ").concat(-e.top - i.top - this.imageTransforms.translateY, "px)") + wt(n) };
1086
- return this.transitionsOptions.enabled && (s.transition = "".concat(this.transitionsOptions.time, "ms ").concat(this.transitionsOptions.timingFunction)), s;
1087
- } }, watch: { src: function() {
1088
- this.onChangeImage();
1089
- }, stencilComponent: function() {
1090
- var t = this;
1091
- this.$nextTick(function() {
1092
- t.resetCoordinates(), t.runAutoZoom("setCoordinates"), t.onChange();
1093
- });
1094
- }, minWidth: function() {
1095
- this.onPropsChange();
1096
- }, maxWidth: function() {
1097
- this.onPropsChange();
1098
- }, minHeight: function() {
1099
- this.onPropsChange();
1100
- }, maxHeight: function() {
1101
- this.onPropsChange();
1102
- }, imageRestriction: function() {
1103
- this.reset();
1104
- }, stencilProps: function(t, e) {
1105
- ["aspectRatio", "minAspectRatio", "maxAspectRatio"].find(function(i) {
1106
- return t[i] !== e[i];
1107
- }) && this.$nextTick(this.onPropsChange);
1108
- } }, created: function() {
1109
- this.debouncedUpdate = pt(this.update, this.debounce), this.debouncedDisableTransitions = pt(this.disableTransitions, this.transitionsOptions.time), this.awaiting = !1;
1110
- }, mounted: function() {
1111
- 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);
1112
- }, destroyed: function() {
1113
- 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();
1114
- }, methods: { getResult: function() {
1115
- var t = this.initialized ? this.prepareResult(v({}, this.coordinates)) : this.defaultCoordinates(), e = { rotate: this.imageTransforms.rotate % 360, flip: v({}, this.imageTransforms.flip) };
1116
- if (this.src && this.imageLoaded) {
1117
- var i = this;
1118
- return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? v({}, this.visibleArea) : null, imageTransforms: e, get canvas() {
1119
- return i.canvas ? i.getCanvas() : void 0;
1120
- } };
1121
- }
1122
- return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? v({}, this.visibleArea) : null, canvas: void 0, imageTransforms: e };
1123
- }, zoom: function(t, e) {
1124
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = i.transitions, s = n === void 0 || n;
1125
- this.onManipulateImage(new X({}, { factor: 1 / t, center: e }), { normalize: !1, transitions: s });
1126
- }, move: function(t, e) {
1127
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = i.transitions, s = n === void 0 || n;
1128
- this.onManipulateImage(new X({ left: t || 0, top: e || 0 }), { normalize: !1, transitions: s });
1129
- }, setCoordinates: function(t) {
1130
- var e = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = i.autoZoom, s = n === void 0 || n, o = i.transitions, a = o === void 0 || o;
1131
- this.$nextTick(function() {
1132
- e.imageLoaded ? (e.transitionsActive || (a && e.enableTransitions(), e.coordinates = e.applyTransform(t), s && e.runAutoZoom("setCoordinates"), a && e.debouncedDisableTransitions()), e.onChange()) : e.delayedTransforms = t;
1133
- });
1134
- }, refresh: function() {
1135
- var t = this, e = this.$refs.image;
1136
- if (this.src && e)
1137
- return this.initialized ? this.updateVisibleArea().then(function() {
1138
- t.onChange();
1139
- }) : this.resetVisibleArea().then(function() {
1140
- t.onChange();
1141
- });
1142
- }, reset: function() {
1143
- var t = this;
1144
- return this.resetVisibleArea().then(function() {
1145
- t.onChange(!1);
1146
- });
1147
- }, awaitRender: function(t) {
1148
- var e = this;
1149
- this.awaiting || (this.awaiting = !0, this.$nextTick(function() {
1150
- t(), e.awaiting = !1;
1151
- }));
1152
- }, prepareResult: function(t) {
1153
- return this.roundResult ? function(e) {
1154
- var i = e.coordinates, n = e.sizeRestrictions, s = e.positionRestrictions, o = { width: Math.round(i.width), height: Math.round(i.height), left: Math.round(i.left), top: Math.round(i.top) };
1155
- return o.width > n.maxWidth ? o.width = Math.floor(i.width) : o.width < n.minWidth && (o.width = Math.ceil(i.width)), o.height > n.maxHeight ? o.height = Math.floor(i.height) : o.height < n.minHeight && (o.height = Math.ceil(i.height)), z(o, s);
1156
- }(v(v({}, this.getPublicProperties()), {}, { positionRestrictions: Z(this.positionRestrictions, this.visibleArea), coordinates: t })) : t;
1157
- }, processAutoZoom: function(t, e, i, n) {
1158
- var s = this.autoZoomAlgorithm;
1159
- s || (s = this.stencilSize ? oe : this.autoZoom ? re : ae);
1160
- var o = s({ event: { type: t, params: n }, visibleArea: e, coordinates: i, boundaries: this.boundaries, aspectRatio: this.getAspectRatio(), positionRestrictions: this.positionRestrictions, getAreaRestrictions: this.getAreaRestrictions, sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize() });
1161
- return v(v({}, o), {}, { changed: !St(o.visibleArea, e) || !St(o.coordinates, i) });
1162
- }, runAutoZoom: function(t) {
1163
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, n = i !== void 0 && i, s = Nt(e, Se), o = this.processAutoZoom(t, this.visibleArea, this.coordinates, s), a = o.visibleArea, h = o.coordinates, r = o.changed;
1164
- n && r && this.enableTransitions(), this.visibleArea = a, this.coordinates = h, n && r && this.debouncedDisableTransitions();
1165
- }, normalizeEvent: function(t) {
1166
- return function(e) {
1167
- var i = e.event, n = e.visibleArea, s = e.coefficient;
1168
- if (i.type === "manipulateImage")
1169
- return p(p({}, i), { move: { left: i.move && i.move.left ? s * i.move.left : 0, top: i.move && i.move.top ? s * i.move.top : 0 }, scale: { factor: i.scale && i.scale.factor ? i.scale.factor : 1, center: i.scale && i.scale.center ? { left: i.scale.center.left * s + n.left, top: i.scale.center.top * s + n.top } : null } });
1170
- if (i.type === "resize") {
1171
- var o = p(p({}, i), { directions: p({}, i.directions) });
1172
- return W.forEach(function(h) {
1173
- o.directions[h] *= s;
1174
- }), o;
1175
- }
1176
- if (i.type === "move") {
1177
- var a = p(p({}, i), { directions: p({}, i.directions) });
1178
- return ee.forEach(function(h) {
1179
- a.directions[h] *= s;
1180
- }), a;
1181
- }
1182
- return i;
1183
- }(v(v({}, this.getPublicProperties()), {}, { event: t }));
1184
- }, getCanvas: function() {
1185
- if (this.$refs.canvas) {
1186
- 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) {
1187
- var l = c.rotate, u = c.flip, d = { width: r.naturalWidth, height: r.naturalHeight }, m = bt(d, l), g = h.getContext("2d");
1188
- h.height = m.height, h.width = m.width, g.save();
1189
- var f = H(R(p({ left: 0, top: 0 }, d)), l);
1190
- return g.translate(-(f.left - m.width / 2), -(f.top - m.height / 2)), g.rotate(l * Math.PI / 180), g.translate(u.horizontal ? d.width : 0, u.vertical ? d.height : 0), g.scale(u.horizontal ? -1 : 1, u.vertical ? -1 : 1), g.drawImage(r, 0, 0, d.width, d.height), g.restore(), h;
1191
- }(this.$refs.sourceCanvas, e, this.imageTransforms) : e, n = v({ minWidth: 0, minHeight: 0, maxWidth: 1 / 0, maxHeight: 1 / 0, maxArea: this.maxCanvasSize, imageSmoothingEnabled: !0, imageSmoothingQuality: "high", fillColor: "transparent" }, this.canvas), s = function(h) {
1192
- return h.find(function(r) {
1193
- return c = r, !Number.isNaN(parseFloat(c)) && isFinite(c);
1194
- var c;
1195
- });
1196
- }, o = I({ sizeRestrictions: { minWidth: s([n.width, n.minWidth]) || 0, minHeight: s([n.height, n.minHeight]) || 0, maxWidth: s([n.width, n.maxWidth]) || 1 / 0, maxHeight: s([n.height, n.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 } });
1197
- if (n.maxArea && o.width * o.height > n.maxArea) {
1198
- var a = Math.sqrt(n.maxArea / (o.width * o.height));
1199
- o = { width: Math.round(a * o.width), height: Math.round(a * o.height) };
1200
- }
1201
- return function(h, r, c, l, u) {
1202
- h.width = l ? l.width : c.width, h.height = l ? l.height : c.height;
1203
- var d = h.getContext("2d");
1204
- 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()));
1205
- var m = c.left < 0 ? -c.left : 0, g = c.top < 0 ? -c.top : 0;
1206
- d.drawImage(r, c.left + m, c.top + g, c.width, c.height, m, g, h.width, h.height);
1207
- }(t, i, this.coordinates, o, n), t;
1208
- }
1209
- }, update: function() {
1210
- this.$emit("change", this.getResult());
1211
- }, applyTransform: function(t) {
1212
- var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.visibleArea && e ? ne(this.sizeRestrictions, this.visibleArea) : this.sizeRestrictions, n = this.visibleArea && e ? Z(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
1213
- return se({ transform: t, coordinates: this.coordinates, imageSize: this.imageSize, sizeRestrictions: i, positionRestrictions: n, aspectRatio: this.getAspectRatio(), visibleArea: this.visibleArea });
1214
- }, resetCoordinates: function() {
1215
- var t = this;
1216
- if (this.$refs.image) {
1217
- this.$refs.cropper, this.$refs.image;
1218
- var e = this.defaultSize;
1219
- e || (e = this.stencilSize ? ce : he);
1220
- var i = this.sizeRestrictions;
1221
- i.minWidth, i.minHeight, i.maxWidth, i.maxHeight;
1222
- var n = [D(e) ? e({ boundaries: this.boundaries, imageSize: this.imageSize, aspectRatio: this.getAspectRatio(), sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize(), visibleArea: this.visibleArea }) : e, function(s) {
1223
- var o = s.coordinates;
1224
- return v({}, D(t.defaultPosition) ? t.defaultPosition({ coordinates: o, imageSize: t.imageSize, visibleArea: t.visibleArea }) : t.defaultPosition);
1225
- }];
1226
- this.delayedTransforms && n.push.apply(n, _(Array.isArray(this.delayedTransforms) ? this.delayedTransforms : [this.delayedTransforms])), this.coordinates = this.applyTransform(n, !0), this.delayedTransforms = null;
1227
- }
1228
- }, clearImage: function() {
1229
- var t = this;
1230
- this.imageLoaded = !1, setTimeout(function() {
1231
- var e = t.$refs.stretcher;
1232
- e && (e.style.height = "auto", e.style.width = "auto"), t.coordinates = t.defaultCoordinates(), t.boundaries = { width: 0, height: 0 };
1233
- }, this.transitionTime);
1234
- }, enableTransitions: function() {
1235
- this.transitions && (this.transitionsActive = !0);
1236
- }, disableTransitions: function() {
1237
- this.transitionsActive = !1;
1238
- }, updateBoundaries: function() {
1239
- var t = this, e = this.$refs.stretcher, i = this.$refs.cropper;
1240
- return this.initStretcher({ cropper: i, stretcher: e, imageSize: this.imageSize }), this.$nextTick().then(function() {
1241
- var n = { cropper: i, imageSize: t.imageSize };
1242
- if (D(t.defaultBoundaries) ? t.boundaries = t.defaultBoundaries(n) : t.defaultBoundaries === "fit" ? t.boundaries = function(s) {
1243
- var o = s.cropper, a = s.imageSize, h = o.clientHeight, r = o.clientWidth, c = h, l = a.width * h / a.height;
1244
- return l > r && (l = r, c = a.height * r / a.width), { width: l, height: c };
1245
- }(n) : t.boundaries = function(s) {
1246
- var o = s.cropper;
1247
- return { width: o.clientWidth, height: o.clientHeight };
1248
- }(n), !t.boundaries.width || !t.boundaries.height)
1249
- throw new Error("It's impossible to fit the cropper in the current container");
1250
- });
1251
- }, resetVisibleArea: function() {
1252
- var t = this;
1253
- return this.appliedImageTransforms = v(v({}, this.defaultImageTransforms), {}, { flip: v({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then(function() {
1254
- var e, i, n, s, o, a;
1255
- t.priority !== "visible-area" && (t.visibleArea = null, t.resetCoordinates()), t.visibleArea = D(t.defaultVisibleArea) ? t.defaultVisibleArea({ 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, n = e.boundaries, s = e.getAreaRestrictions, o = p({}, i), a = b(n), o.width / o.height !== a && (o.height = o.width / a), z(o, s({ visibleArea: o, 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");
1256
- }).catch(function() {
1257
- t.visibleArea = null;
1258
- });
1259
- }, updateVisibleArea: function() {
1260
- var t = this;
1261
- return this.updateBoundaries().then(function() {
1262
- 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");
1263
- }).catch(function() {
1264
- t.visibleArea = null;
1265
- });
1266
- }, onChange: function() {
1267
- var t = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0];
1268
- this.$listeners && this.$listeners.change && (t && this.debounce ? this.debouncedUpdate() : this.update());
1269
- }, onChangeImage: function() {
1270
- var t, e = this;
1271
- if (this.imageLoaded = !1, this.delayedTransforms = null, this.src) {
1272
- if (function(s) {
1273
- if (Rt(s))
1274
- return !1;
1275
- var o = window.location, a = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(s) || [], h = { protocol: a[1] || "", host: a[2] || "", port: a[3] || "" }, r = function(c) {
1276
- return c.port || ((c.protocol || o.protocol) === "http" ? 80 : 433);
1277
- };
1278
- return !(!h.protocol && !h.host && !h.port || h.protocol && h.protocol == o.protocol && h.host && h.host == o.host && h.host && r(h) == r(o));
1279
- }(this.src)) {
1280
- var i = y(this.crossOrigin) ? this.canvas : this.crossOrigin;
1281
- i === !0 && (i = "anonymous"), this.imageAttributes.crossOrigin = i;
1282
- }
1283
- if (this.checkOrientation) {
1284
- var n = (t = this.src, new Promise(function(s) {
1285
- ye(t).then(function(o) {
1286
- var a = ze(o);
1287
- s(o ? { source: t, arrayBuffer: o, orientation: a } : { source: t, arrayBuffer: null, orientation: null });
1288
- }).catch(function(o) {
1289
- console.warn(o), s({ source: t, arrayBuffer: null, orientation: null });
1290
- });
1291
- }));
1292
- setTimeout(function() {
1293
- n.then(e.onParseImage);
1294
- }, this.transitionTime);
1295
- } else
1296
- setTimeout(function() {
1297
- e.onParseImage({ source: e.src });
1298
- }, this.transitionTime);
1299
- } else
1300
- this.clearImage();
1301
- }, onFailLoadImage: function() {
1302
- this.imageAttributes.src && (this.clearImage(), this.$emit("error"));
1303
- }, onSuccessLoadImage: function() {
1304
- var t = this, e = this.$refs.image;
1305
- e && !this.imageLoaded && (this.imageAttributes.height = e.naturalHeight, this.imageAttributes.width = e.naturalWidth, this.imageLoaded = !0, this.resetVisibleArea().then(function() {
1306
- t.$emit("ready"), t.onChange(!1);
1307
- }));
1308
- }, onParseImage: function(t) {
1309
- var e = this, i = t.source, n = t.arrayBuffer, s = t.orientation;
1310
- this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, n && s && s > 1 ? It(i) || !Rt(i) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([n])), this.imageAttributes.revoke = !0) : this.imageAttributes.src = function(o) {
1311
- for (var a = [], h = new Uint8Array(o); h.length > 0; ) {
1312
- var r = h.subarray(0, 8192);
1313
- a.push(String.fromCharCode.apply(null, Array.from ? Array.from(r) : r.slice())), h = h.subarray(8192);
1314
- }
1315
- return "data:image/jpeg;base64," + btoa(a.join(""));
1316
- }(n) : this.imageAttributes.src = i, D(this.defaultTransforms) ? this.appliedImageTransforms = lt(this.defaultTransforms()) : J(this.defaultTransforms) ? this.appliedImageTransforms = lt(this.defaultTransforms) : this.appliedImageTransforms = function(o) {
1317
- var a = lt({});
1318
- if (o)
1319
- switch (o) {
1320
- case 2:
1321
- a.flip.horizontal = !0;
1322
- break;
1323
- case 3:
1324
- a.rotate = -180;
1325
- break;
1326
- case 4:
1327
- a.flip.vertical = !0;
1328
- break;
1329
- case 5:
1330
- a.rotate = 90, a.flip.vertical = !0;
1331
- break;
1332
- case 6:
1333
- a.rotate = 90;
1334
- break;
1335
- case 7:
1336
- a.rotate = 90, a.flip.horizontal = !0;
1337
- break;
1338
- case 8:
1339
- a.rotate = -90;
1340
- }
1341
- return a;
1342
- }(s), this.defaultImageTransforms = v(v({}, this.appliedImageTransforms), {}, { flip: v({}, this.appliedImageTransforms.flip) }), this.$nextTick(function() {
1343
- var o = e.$refs.image;
1344
- o && o.complete && (function(a) {
1345
- return !!a.naturalWidth;
1346
- }(o) ? e.onSuccessLoadImage() : e.onFailLoadImage());
1347
- });
1348
- }, onResizeEnd: function() {
1349
- this.runAutoZoom("resize", { transitions: !0 });
1350
- }, onMoveEnd: function() {
1351
- this.runAutoZoom("move", { transitions: !0 });
1352
- }, onMove: function(t) {
1353
- var e = this;
1354
- this.transitionsOptions.enabled || this.awaitRender(function() {
1355
- e.coordinates = e.moveAlgorithm(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: Z(e.positionRestrictions, e.visibleArea), coordinates: e.coordinates, event: e.normalizeEvent(t) })), e.onChange();
1356
- });
1357
- }, onResize: function(t) {
1358
- var e = this;
1359
- this.transitionsOptions.enabled || this.stencilSize && !this.autoZoom || this.awaitRender(function() {
1360
- var i = e.sizeRestrictions, n = Math.min(e.coordinates.width, e.coordinates.height, 20 * e.coefficient);
1361
- e.coordinates = e.resizeAlgorithm(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: Z(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, n), minHeight: Math.max(i.minHeight, n) }, event: e.normalizeEvent(t) })), e.onChange(), e.ticking = !1;
1362
- });
1363
- }, onManipulateImage: function(t) {
1364
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1365
- if (!this.transitionsOptions.enabled) {
1366
- var i = e.transitions, n = i !== void 0 && i, s = e.normalize, o = s === void 0 || s;
1367
- n && this.enableTransitions();
1368
- var a = le(v(v({}, this.getPublicProperties()), {}, { event: o ? this.normalizeEvent(t) : t, getAreaRestrictions: this.getAreaRestrictions, imageRestriction: this.imageRestriction, adjustStencil: !this.stencilSize && this.settings.resizeImage.adjustStencil })), h = a.visibleArea, r = a.coordinates;
1369
- this.visibleArea = h, this.coordinates = r, this.runAutoZoom("manipulateImage"), this.onChange(), n && this.debouncedDisableTransitions();
1370
- }
1371
- }, onPropsChange: function() {
1372
- this.coordinates = this.applyTransform(this.coordinates, !0), this.onChange(!1);
1373
- }, getAreaRestrictions: function() {
1374
- var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.visibleArea, i = t.type, n = i === void 0 ? "move" : i;
1375
- return this.areaRestrictionsAlgorithm({ boundaries: this.boundaries, imageSize: this.imageSize, imageRestriction: this.imageRestriction, visibleArea: e, type: n });
1376
- }, getAspectRatio: function(t) {
1377
- var e, i, n = this.stencilProps, s = n.aspectRatio, o = n.minAspectRatio, a = n.maxAspectRatio;
1378
- if (this.$refs.stencil && this.$refs.stencil.aspectRatios) {
1379
- var h = this.$refs.stencil.aspectRatios();
1380
- e = h.minimum, i = h.maximum;
1381
- }
1382
- if (y(e) && (e = y(s) ? o : s), y(i) && (i = y(s) ? a : s), !t && (y(e) || y(i))) {
1383
- var r = this.getStencilSize(), c = r ? b(r) : null;
1384
- y(e) && (e = At(c) ? c : void 0), y(i) && (i = At(c) ? c : void 0);
1385
- }
1386
- return { minimum: e, maximum: i };
1387
- }, getStencilSize: function() {
1388
- if (this.stencilSize)
1389
- 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, n = t.aspectRatio, at(b(s = D(i) ? i({ boundaries: e, aspectRatio: n }) : i), n) && (s = I({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: n.minimum, maximum: n.maximum } })), (s.width > e.width || s.height > e.height) && (s = I({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: b(s), maximum: b(s) } })), s;
1390
- var t, e, i, n, s;
1391
- }, getPublicProperties: function() {
1392
- 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 };
1393
- }, defaultCoordinates: function() {
1394
- return v({}, xt);
1395
- }, flip: function(t, e) {
1396
- var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = i.transitions, s = n === void 0 || n;
1397
- if (!this.transitionsActive) {
1398
- s && this.enableTransitions();
1399
- var o = v({}, this.imageTransforms.flip), a = de({ flip: { horizontal: t ? !o.horizontal : o.horizontal, vertical: e ? !o.vertical : o.vertical }, previousFlip: o, 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;
1400
- t && (this.appliedImageTransforms.flip.horizontal = !this.appliedImageTransforms.flip.horizontal), e && (this.appliedImageTransforms.flip.vertical = !this.appliedImageTransforms.flip.vertical), this.visibleArea = h, this.coordinates = r, this.onChange(), s && this.debouncedDisableTransitions();
1401
- }
1402
- }, rotate: function(t) {
1403
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, n = i === void 0 || i;
1404
- if (!this.transitionsActive) {
1405
- n && this.enableTransitions();
1406
- var s = v({}, this.imageSize);
1407
- this.appliedImageTransforms.rotate += t;
1408
- var o = ue({ visibleArea: this.visibleArea, coordinates: this.coordinates, previousImageSize: s, imageSize: this.imageSize, angle: t, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), a = o.visibleArea, h = o.coordinates, r = this.processAutoZoom("rotateImage", a, h);
1409
- a = r.visibleArea, h = r.coordinates, this.visibleArea = a, this.coordinates = h, this.onChange(), n && this.debouncedDisableTransitions();
1410
- }
1411
- } } }, kt = A({ render: function() {
1412
- var t = this, e = t.$createElement, i = t._self._c || e;
1413
- return i("div", { ref: "cropper", class: t.classes.cropper }, [i("div", { ref: "stretcher", class: t.classes.stretcher }), t._v(" "), i("div", { class: t.classes.boundaries, style: t.boundariesStyle }, [i(t.backgroundWrapperComponent, { tag: "component", class: t.classes.cropperWrapper, attrs: { "wheel-resize": t.settings.resizeImage.wheel, "touch-resize": t.settings.resizeImage.touch, "touch-move": t.settings.moveImage.touch, "mouse-move": t.settings.moveImage.mouse }, on: { move: t.onManipulateImage, resize: t.onManipulateImage } }, [i("div", { class: t.classes.background, style: t.boundariesStyle }), t._v(" "), i("div", { class: t.classes.imageWrapper }, [i("img", { ref: "image", class: t.classes.image, style: t.imageStyle, attrs: { crossorigin: t.imageAttributes.crossOrigin, src: t.imageAttributes.src }, on: { mousedown: function(n) {
1414
- n.preventDefault();
1415
- } } })]), t._v(" "), i("div", { class: t.classes.foreground, style: t.boundariesStyle }), t._v(" "), i(t.stencilComponent, t._b({ directives: [{ name: "show", rawName: "v-show", value: t.imageLoaded, expression: "imageLoaded" }], ref: "stencil", tag: "component", attrs: { image: t.image, coordinates: t.coordinates, "stencil-coordinates": t.stencilCoordinates, transitions: t.transitionsOptions }, on: { resize: t.onResize, "resize-end": t.onResizeEnd, move: t.onMove, "move-end": t.onMoveEnd } }, "component", t.stencilProps, !1)), t._v(" "), t.canvas ? i("canvas", { ref: "canvas", style: { display: "none" } }) : t._e(), t._v(" "), t.canvas ? i("canvas", { ref: "sourceCanvas", style: { display: "none" } }) : t._e()], 1)], 1)]);
1416
- }, staticRenderFns: [] }, void 0, Me, void 0, !1);
1417
- k.component("cropper", kt), k.component("rectangle-stencil", Ut), k.component("circle-stencil", xe), k.component("simple-handler", nt), k.component("simple-line", st);
1418
- const Ce = {
1419
- name: "ImageUploadModal",
1420
- components: {
1421
- Cropper: kt
1422
- },
1423
- props: {
1424
- imageData: {
1425
- type: String,
1426
- required: !0
1427
- },
1428
- onImageUpload: {
1429
- type: Function,
1430
- required: !0
1431
- },
1432
- fileName: {
1433
- type: String,
1434
- default: "filename.png"
1435
- },
1436
- cropperOptions: {
1437
- type: Object,
1438
- default: () => ({})
1439
- }
1440
- },
1441
- data() {
1442
- return {
1443
- currentTarget: null
1444
- };
1445
- },
1446
- methods: {
1447
- onSave() {
1448
- const { canvas: t } = this.$refs.cropper.getResult();
1449
- t && t.toBlob((e) => {
1450
- const i = new File([e], this.fileName, { type: e.type });
1451
- return this.onImageUpload(i).then(() => {
1452
- this.$emit("close");
1453
- });
1454
- });
1455
- }
1456
- }
1457
- };
1458
- var Ee = function() {
1459
- var e = this, i = e._self._c;
1460
- return i("div", { staticClass: "fixed inset-0 flex h-full w-full flex-col items-center justify-center gap-8 bg-black/80", on: { mousedown: function(n) {
1461
- e.currentTarget = n.target;
1462
- }, mouseup: function(n) {
1463
- if (n.target !== n.currentTarget)
1464
- return null;
1465
- e.currentTarget === n.target && e.$emit("close");
1466
- } } }, [i("CButton", { staticClass: "absolute right-2 top-2 z-50 border-transparent bg-black/50 text-white/90", attrs: { circle: "", icon: "x", type: "text" }, on: { click: function(n) {
1467
- return e.$emit("close");
1468
- } } }), i("div", { staticClass: "flex min-h-0 max-w-[calc(100%_-_4_*_var(--rem))] flex-auto items-center justify-center pt-8" }, [i("Cropper", e._b({ ref: "cropper", staticClass: "h-full w-full", attrs: { src: e.imageData } }, "Cropper", e.cropperOptions, !1))], 1), i("div", { staticClass: "shrink-0 flex-grow py-8" }, [i("CButton", { staticClass: "w-36", attrs: { type: "secondary" }, on: { click: e.onSave } }, [e._v(" " + e._s(e.$t("_common:save")) + " ")])], 1)], 1);
1469
- }, Oe = [], We = /* @__PURE__ */ $t(
1470
- Ce,
1471
- Ee,
1472
- Oe,
1473
- !1,
1474
- null,
1475
- null
1476
- );
1477
- const Te = We.exports, $e = {
1478
- i18nOptions: {
1479
- namespaces: "imageUploadWrapper",
1480
- messages: {
1481
- en: {
1482
- warningMessageValidFormats: "Invalid file format. Valid file formats are"
1483
- },
1484
- sv: {
1485
- warningMessageValidFormats: "Filformatet är fel. Giltiga format är"
1486
- }
1487
- }
1488
- },
1489
- name: "ImageUploadWrapper",
1490
- components: {
1491
- BaseUpload: Xt
1492
- },
1493
- props: {
1494
- onImageUpload: {
1495
- type: Function,
1496
- required: !0
1497
- },
1498
- cropperOptions: {
1499
- type: Object,
1500
- default: () => ({})
1501
- },
1502
- uploadOptions: {
1503
- type: Object,
1504
- default: () => ({})
1505
- }
1506
- },
1507
- data() {
1508
- return {
1509
- newFiles: [],
1510
- isModalOpen: !1,
1511
- isUpdatingImage: !1,
1512
- default: {
1513
- multiple: !1,
1514
- drop: !0,
1515
- // extensions: ['jpg', 'png', 'jpeg', 'bmp', 'gif'],
1516
- accept: "image/png, image/jpg, image/bmp, image/gif, image/jpeg, image/tiff, image/webp"
1517
- }
1518
- };
1519
- },
1520
- computed: {
1521
- mergedUploadOptions() {
1522
- return { ...this.default, ...this.uploadOptions };
1523
- },
1524
- progress() {
1525
- return this.newFiles.length ? parseInt(this.newFiles[this.newFiles.length - 1].progress, 10) : 0;
1526
- }
1527
- },
1528
- methods: {
1529
- onClick() {
1530
- this.$refs.upload && this.$refs.upload.$el.querySelector("input[type='file']").click();
1531
- },
1532
- uploadImg(t) {
1533
- if (this.isModalOpen && !this.isUpdatingImage)
1534
- return;
1535
- const { file: e } = t[t.length - 1];
1536
- if (!this.mergedUploadOptions.accept.includes(e.type)) {
1537
- Yt(
1538
- "warning",
1539
- `${this.$t("warningMessageValidFormats")}: gif, jpeg, jpg, png, bmp`
1540
- );
1541
- return;
1542
- }
1543
- const i = new FileReader();
1544
- i.onload = (n) => {
1545
- let s;
1546
- typeof n.target.result == "object" ? s = window.URL.createObjectURL(new Blob([n.target.result])) : s = n.target.result, this.show(s, e.name);
1547
- }, i.readAsArrayBuffer(e);
1548
- },
1549
- show(t, e) {
1550
- this.isModalOpen = !0, this.$modal.show(
1551
- Te,
1552
- {
1553
- cropperOptions: this.cropperOptions,
1554
- imageData: t,
1555
- onImageUpload: this.updateFile,
1556
- fileName: e
1557
- },
1558
- {
1559
- height: "100%",
1560
- width: "100%",
1561
- classes: ""
1562
- },
1563
- {
1564
- "before-close": () => {
1565
- this.isModalOpen = !1;
1566
- }
1567
- }
1568
- );
1569
- },
1570
- async updateFile(t) {
1571
- this.$emit("upload"), this.isUpdatingImage = !0;
1572
- const e = this.$refs.upload.$refs.upload.files, i = e[e.length - 1], n = i;
1573
- n.file = t;
1574
- const s = await this.$refs.upload.compressFile(n.file);
1575
- await this.$refs.upload.$refs.upload.update(i, {
1576
- ...s,
1577
- active: !0
1578
- });
1579
- }
1580
- }
1581
- };
1582
- var je = function() {
1583
- var e = this, i = e._self._c;
1584
- return i("div", [i("BaseUpload", e._b({ ref: "upload", on: { input: function(n) {
1585
- e.isUpdatingImage || e.uploadImg(n);
1586
- }, "upload-success": (n) => {
1587
- e.isUpdatingImage = !1, e.onImageUpload(n);
1588
- } }, model: { value: e.newFiles, callback: function(n) {
1589
- e.newFiles = n;
1590
- }, expression: "newFiles" } }, "BaseUpload", e.mergedUploadOptions, !1), [e.$slots.image ? e._t("image") : e._e()], 2), i("div", { staticStyle: { cursor: "pointer" }, on: { click: function(n) {
1591
- return n.stopPropagation(), n.preventDefault(), e.onClick.apply(null, arguments);
1592
- } } }, [e._t("default", null, { progress: e.progress })], 2)], 1);
1593
- }, Ie = [], He = /* @__PURE__ */ $t(
1594
- $e,
1595
- je,
1596
- Ie,
1597
- !1,
1598
- null,
1599
- "66b0d147"
1600
- );
1601
- const Pe = He.exports;
1602
- export {
1603
- Pe as default
1604
- };