1import { X as mi } from "./CSCE6Vg2.js"; 2var vi = ((a) => (a.Video = "Video", a.Image = "Image", a.Any = "Any", a))(vi || {}); 3const Zt = mi(/* @__PURE__ */ new Set()), ce = (a) => { 4 a && Zt.add(a); 5}, le = (a) => a ? Zt.has(a) : false; 6/*! 7* Cropper.js v1.6.2 8* https://fengyuanchen.github.io/cropperjs 9* 10* Copyright 2015-present Chen Fengyuan 11* Released under the MIT license 12* 13* Date: 2024-04-21T07:43:05.335Z 14*/ 15function kt(a, t) { 16 var e = Object.keys(a); 17 if (Object.getOwnPropertySymbols) { 18 var i = Object.getOwnPropertySymbols(a); 19 t && (i = i.filter(function(o) { 20 return Object.getOwnPropertyDescriptor(a, o).enumerable; 21 })), e.push.apply(e, i); 22 } 23 return e; 24} 25function Jt(a) { 26 for (var t = 1; t < arguments.length; t++) { 27 var e = arguments[t] != null ? arguments[t] : {}; 28 t % 2 ? kt(Object(e), true).forEach(function(i) { 29 xi(a, i, e[i]); 30 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(e)) : kt(Object(e)).forEach(function(i) { 31 Object.defineProperty(a, i, Object.getOwnPropertyDescriptor(e, i)); 32 }); 33 } 34 return a; 35} 36function wi(a, t) { 37 if (typeof a != "object" || !a) return a; 38 var e = a[Symbol.toPrimitive]; 39 if (e !== void 0) { 40 var i = e.call(a, t); 41 if (typeof i != "object") return i; 42 throw new TypeError("@@toPrimitive must return a primitive value."); 43 } 44 return String(a); 45} 46function ti(a) { 47 var t = wi(a, "string"); 48 return typeof t == "symbol" ? t : t + ""; 49} 50function vt(a) { 51 "@babel/helpers - typeof"; 52 return vt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) { 53 return typeof t; 54 } : function(t) { 55 return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; 56 }, vt(a); 57} 58function bi(a, t) { 59 if (!(a instanceof t)) throw new TypeError("Cannot call a class as a function"); 60} 61function Pt(a, t) { 62 for (var e = 0; e < t.length; e++) { 63 var i = t[e]; 64 i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(a, ti(i.key), i); 65 } 66} 67function yi(a, t, e) { 68 return t && Pt(a.prototype, t), e && Pt(a, e), Object.defineProperty(a, "prototype", { writable: false }), a; 69} 70function xi(a, t, e) { 71 return t = ti(t), t in a ? Object.defineProperty(a, t, { value: e, enumerable: true, configurable: true, writable: true }) : a[t] = e, a; 72} 73function ii(a) { 74 return Di(a) || Ei(a) || Mi(a) || Ti(); 75} 76function Di(a) { 77 if (Array.isArray(a)) return wt(a); 78} 79function Ei(a) { 80 if (typeof Symbol < "u" && a[Symbol.iterator] != null || a["@@iterator"] != null) return Array.from(a); 81} 82function Mi(a, t) { 83 if (a) { 84 if (typeof a == "string") return wt(a, t); 85 var e = Object.prototype.toString.call(a).slice(8, -1); 86 if (e === "Object" && a.constructor && (e = a.constructor.name), e === "Map" || e === "Set") return Array.from(a); 87 if (e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return wt(a, t); 88 } 89} 90function wt(a, t) { 91 (t == null || t > a.length) && (t = a.length); 92 for (var e = 0, i = new Array(t); e < t; e++) i[e] = a[e]; 93 return i; 94} 95function Ti() { 96 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 97} 98var dt = typeof window < "u" && typeof window.document < "u", P = dt ? window : {}, Ot = dt && P.document.documentElement ? "ontouchstart" in P.document.documentElement : false, Nt = dt ? "PointerEvent" in P : false, y = "cropper", At = "all", ei = "crop", ai = "move", ri = "zoom", $ = "e", q = "w", K = "s", H = "n", it = "ne", et = "nw", at = "se", rt = "sw", bt = "".concat(y, "-crop"), Xt = "".concat(y, "-disabled"), R = "".concat(y, "-hidden"), Yt = "".concat(y, "-hide"), Ci = "".concat(y, "-invisible"), ft = "".concat(y, "-modal"), yt = "".concat(y, "-move"), ot = "".concat(y, "Action"), ct = "".concat(y, "Preview"), Rt = "crop", ni = "move", oi = "none", xt = "crop", Dt = "cropend", Et = "cropmove", Mt = "cropstart", zt = "dblclick", Oi = Ot ? "touchstart" : "mousedown", Ni = Ot ? "touchmove" : "mousemove", Ai = Ot ? "touchend touchcancel" : "mouseup", Ht = Nt ? "pointerdown" : Oi, Wt = Nt ? "pointermove" : Ni, Ut = Nt ? "pointerup pointercancel" : Ai, jt = "ready", Vt = "resize", Gt = "wheel", Tt = "zoom", $t = "image/jpeg", Ri = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/, Si = /^data:/, Ii = /^data:image\/jpeg;base64,/, Li = /^img|canvas$/i, si = 200, hi = 100, qt = { viewMode: 0, dragMode: Rt, initialAspectRatio: NaN, aspectRatio: NaN, data: null, preview: "", responsive: true, restore: true, checkCrossOrigin: true, checkOrientation: true, modal: true, guides: true, center: true, highlight: true, background: true, autoCrop: true, autoCropArea: 0.8, movable: true, rotatable: true, scalable: true, zoomable: true, zoomOnTouch: true, zoomOnWheel: true, wheelZoomRatio: 0.1, cropBoxMovable: true, cropBoxResizable: true, toggleDragModeOnDblclick: true, minCanvasWidth: 0, minCanvasHeight: 0, minCropBoxWidth: 0, minCropBoxHeight: 0, minContainerWidth: si, minContainerHeight: hi, ready: null, cropstart: null, cropmove: null, cropend: null, crop: null, zoom: null }, Bi = '<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>
98', _i = Number.isNaN || P.isNaN; 99function p(a) { 100 return typeof a == "number" && !_i(a); 101} 102var Ft = function(t) { 103 return t > 0 && t < 1 / 0; 104}; 105function gt(a) { 106 return typeof a > "u"; 107} 108function F(a) { 109 return vt(a) === "object" && a !== null; 110} 111var ki = Object.prototype.hasOwnProperty; 112function Q(a) { 113 if (!F(a)) return false; 114 try { 115 var t = a.constructor, e = t.prototype; 116 return t && e && ki.call(e, "isPrototypeOf"); 117 } catch (e2) { 118 return false; 119 } 120} 121function A(a) { 122 return typeof a == "function"; 123} 124var Pi = Array.prototype.slice; 125function ci(a) { 126 return Array.from ? Array.from(a) : Pi.call(a); 127} 128function E(a, t) { 129 return a && A(t) && (Array.isArray(a) || p(a.length) ? ci(a).forEach(function(e, i) { 130 t.call(a, e, i, a); 131 }) : F(a) && Object.keys(a).forEach(function(e) { 132 t.call(a, a[e], e, a); 133 })), a; 134} 135var x = Object.assign || function(t) { 136 for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++) i[o - 1] = arguments[o]; 137 return F(t) && i.length > 0 && i.forEach(function(r) { 138 F(r) && Object.keys(r).forEach(function(n) { 139 t[n] = r[n]; 140 }); 141 }), t; 142}, Xi = /\.\d*(?:0|9){12}\d*$/; 143function J(a) { 144 var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11; 145 return Xi.test(a) ? Math.round(a * t) / t : a; 146} 147var Yi = /^width|height|left|top|marginLeft|marginTop$/; 148function W(a, t) { 149 var e = a.style; 150 E(t, function(i, o) { 151 Yi.test(o) && p(i) && (i = "".concat(i, "px")), e[o] = i; 152 }); 153} 154function zi(a, t) { 155 return a.classList ? a.classList.contains(t) : a.className.indexOf(t) > -1; 156} 157function O(a, t) { 158 if (t) { 159 if (p(a.length)) { 160 E(a, function(i) { 161 O(i, t); 162 }); 163 return; 164 } 165 if (a.classList) { 166 a.classList.add(t); 167 return; 168 } 169 var e = a.className.trim(); 170 e ? e.indexOf(t) < 0 && (a.className = "".concat(e, " ").concat(t)) : a.className = t; 171 } 172} 173function k(a, t) { 174 if (t) { 175 if (p(a.length)) { 176 E(a, function(e) { 177 k(e, t); 178 }); 179 return; 180 } 181 if (a.classList) { 182 a.classList.remove(t); 183 return; 184 } 185 a.className.indexOf(t) >= 0 && (a.className = a.className.replace(t, "")); 186 } 187} 188function Z(a, t, e) { 189 if (t) { 190 if (p(a.length)) { 191 E(a, function(i) { 192 Z(i, t, e); 193 }); 194 return; 195 } 196 e ? O(a, t) : k(a, t); 197 } 198} 199var Hi = /([a-z\d])([A-Z])/g; 200function St(a) { 201 return a.replace(Hi, "$1-$2").toLowerCase(); 202} 203function Ct(a, t) { 204 return F(a[t]) ? a[t] : a.dataset ? a.dataset[t] : a.getAttribute("data-".concat(St(t))); 205} 206function st(a, t, e) { 207 F(e) ? a[t] = e : a.dataset ? a.dataset[t] = e : a.setAttribute("data-".concat(St(t)), e); 208} 209function Wi(a, t) { 210 if (F(a[t])) try { 211 delete a[t]; 212 } catch (e) { 213 a[t] = void 0; 214 } 215 else if (a.dataset) try { 216 delete a.dataset[t]; 217 } catch (e) { 218 a.dataset[t] = void 0; 219 } 220 else a.removeAttribute("data-".concat(St(t))); 221} 222var li = /\s\s*/, fi = (function() { 223 var a = false; 224 if (dt) { 225 var t = false, e = function() { 226 }, i = Object.defineProperty({}, "once", { get: function() { 227 return a = true, t; 228 }, set: function(r) { 229 t = r; 230 } }); 231 P.addEventListener("test", e, i), P.removeEventListener("test", e, i); 232 } 233 return a; 234})(); 235function B(a, t, e) { 236 var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, o = e; 237 t.trim().split(li).forEach(function(r) { 238 if (!fi) { 239 var n = a.listeners; 240 n && n[r] && n[r][e] && (o = n[r][e], delete n[r][e], Object.keys(n[r]).length === 0 && delete n[r], Object.keys(n).length === 0 && delete a.listeners); 241 } 242 a.removeEventListener(r, o, i); 243 }); 244} 245function L(a, t, e) { 246 var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, o = e; 247 t.trim().split(li).forEach(function(r) { 248 if (i.once && !fi) { 249 var n = a.listeners, s = n === void 0 ? {} : n; 250 o = function() { 251 delete s[r][e], a.removeEventListener(r, o, i); 252 for (var l = arguments.length, h = new Array(l), c = 0; c < l; c++) h[c] = arguments[c]; 253 e.apply(a, h); 254 }, s[r] || (s[r] = {}), s[r][e] && a.removeEventListener(r, s[r][e], i), s[r][e] = o, a.listeners = s; 255 } 256 a.addEventListener(r, o, i); 257 }); 258} 259function tt(a, t, e) { 260 var i; 261 return A(Event) && A(CustomEvent) ? i = new CustomEvent(t, { detail: e, bubbles: true, cancelable: true }) : (i = document.createEvent("CustomEvent"), i.initCustomEvent(t, true, true, e)), a.dispatchEvent(i); 262} 263function di(a) { 264 var t = a.getBoundingClientRect(); 265 return { left: t.left + (window.pageXOffset - document.documentElement.clientLeft), top: t.top + (window.pageYOffset - document.documentElement.clientTop) }; 266} 267var mt = P.location, Ui = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i; 268function Kt(a) { 269 var t = a.match(Ui); 270 return t !== null && (t[1] !== mt.protocol || t[2] !== mt.hostname || t[3] !== mt.port); 271} 272function Qt(a) { 273 var t = "timestamp=".concat((/* @__PURE__ */ new Date()).getTime()); 274 return a + (a.indexOf("?") === -1 ? "?" : "&") + t; 275} 276function nt(a) { 277 var t = a.rotate, e = a.scaleX, i = a.scaleY, o = a.translateX, r = a.translateY, n = []; 278 p(o) && o !== 0 && n.push("translateX(".concat(o, "px)")), p(r) && r !== 0 && n.push("translateY(".concat(r, "px)")), p(t) && t !== 0 && n.push("rotate(".concat(t, "deg)")), p(e) && e !== 1 && n.push("scaleX(".concat(e, ")")), p(i) && i !== 1 && n.push("scaleY(".concat(i, ")")); 279 var s = n.length ? n.join(" ") : "none"; 280 return { WebkitTransform: s, msTransform: s, transform: s }; 281} 282function ji(a) { 283 var t = Jt({}, a), e = 0; 284 return E(a, function(i, o) { 285 delete t[o], E(t, function(r) { 286 var n = Math.abs(i.startX - r.startX), s = Math.abs(i.startY - r.startY), d = Math.abs(i.endX - r.endX), l = Math.abs(i.endY - r.endY), h = Math.sqrt(n * n + s * s), c = Math.sqrt(d * d + l * l), f = (c - h) / h; 287 Math.abs(f) > Math.abs(e) && (e = f); 288 }); 289 }), e; 290} 291function lt(a, t) { 292 var e = a.pageX, i = a.pageY, o = { endX: e, endY: i }; 293 return t ? o : Jt({ startX: e, startY: i }, o); 294} 295function Vi(a) { 296 var t = 0, e = 0, i = 0; 297 return E(a, function(o) { 298 var r = o.startX, n = o.startY; 299 t += r, e += n, i += 1; 300 }), t /= i, e /= i, { pageX: t, pageY: e }; 301} 302function U(a) { 303 var t = a.aspectRatio, e = a.height, i = a.width, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "contain", r = Ft(i), n = Ft(e); 304 if (r && n) { 305 var s = e * t; 306 o === "contain" && s > i || o === "cover" && s < i ? e = i / t : i = e * t; 307 } else r ? e = i / t : n && (i = e * t); 308 return { width: i, height: e }; 309} 310function Gi(a) { 311 var t = a.width, e = a.height, i = a.degree; 312 if (i = Math.abs(i) % 180, i === 90) return { width: e, height: t }; 313 var o = i % 90 * Math.PI / 180, r = Math.sin(o), n = Math.cos(o), s = t * n + e * r, d = t * r + e * n; 314 return i > 90 ? { width: d, height: s } : { width: s, height: d }; 315} 316function $i(a, t, e, i) {
317 var o = t.aspectRatio, r = t.naturalWidth, n = t.naturalHeight, s = t.rotate, d = s === void 0 ? 0 : s, l = t.scaleX, h = l === void 0 ? 1 : l, c = t.scaleY, f = c === void 0 ? 1 : c, m = e.aspectRatio, g = e.naturalWidth, b = e.naturalHeight, v = i.fillColor, M = v === void 0 ? "transparent" : v, C = i.imageSmoothingEnabled, D = C === void 0 ? true : C, X = i.imageSmoothingQuality, S = X === void 0 ? "low" : X, u = i.maxWidth, w = u === void 0 ? 1 / 0 : u, T = i.maxHeight, I = T === void 0 ? 1 / 0 : T, Y = i.minWidth, j = Y === void 0 ? 0 : Y, V = i.minHeight, z = V === void 0 ? 0 : V, _ = document.createElement("canvas"), N = _.getContext("2d"), G = U({ aspectRatio: m, width: w, height: I }), ht = U({ aspectRatio: m, width: j, height: z }, "cover"), ut = Math.min(G.width, Math.max(ht.width, g)), pt = Math.min(G.height, Math.max(ht.height, b)), It = U({ aspectRatio: o, width: w, height: I }), Lt = U({ aspectRatio: o, width: j, height: z }, "cover"), Bt = Math.min(It.width, Math.max(Lt.width, r)), _t = Math.min(It.height, Math.max(Lt.height, n)), pi = [-Bt / 2, -_t / 2, Bt, _t]; 318 return _.width = J(ut), _.height = J(pt), N.fillStyle = M, N.fillRect(0, 0, ut, pt), N.save(), N.translate(ut / 2, pt / 2), N.rotate(d * Math.PI / 180), N.scale(h, f), N.imageSmoothingEnabled = D, N.imageSmoothingQuality = S, N.drawImage.apply(N, [a].concat(ii(pi.map(function(gi) { 319 return Math.floor(J(gi)); 320 })))), N.restore(), _; 321} 322var ui = String.fromCharCode; 323function qi(a, t, e) { 324 var i = ""; 325 e += t; 326 for (var o = t; o < e; o += 1) i += ui(a.getUint8(o)); 327 return i; 328} 329var Fi = /^data:.*,/; 330function Ki(a) { 331 var t = a.replace(Fi, ""), e = atob(t), i = new ArrayBuffer(e.length), o = new Uint8Array(i); 332 return E(o, function(r, n) { 333 o[n] = e.charCodeAt(n); 334 }), i; 335} 336function Qi(a, t) { 337 for (var e = [], i = 8192, o = new Uint8Array(a); o.length > 0; ) e.push(ui.apply(null, ci(o.subarray(0, i)))), o = o.subarray(i); 338 return "data:".concat(t, ";base64,").concat(btoa(e.join(""))); 339} 340function Zi(a) { 341 var t = new DataView(a), e; 342 try { 343 var i, o, r; 344 if (t.getUint8(0) === 255 && t.getUint8(1) === 216) for (var n = t.byteLength, s = 2; s + 1 < n; ) { 345 if (t.getUint8(s) === 255 && t.getUint8(s + 1) === 225) { 346 o = s; 347 break; 348 } 349 s += 1; 350 } 351 if (o) { 352 var d = o + 4, l = o + 10; 353 if (qi(t, d, 4) === "Exif") { 354 var h = t.getUint16(l); 355 if (i = h === 18761, (i || h === 19789) && t.getUint16(l + 2, i) === 42) { 356 var c = t.getUint32(l + 4, i); 357 c >= 8 && (r = l + c); 358 } 359 } 360 } 361 if (r) { 362 var f = t.getUint16(r, i), m, g; 363 for (g = 0; g < f; g += 1) if (m = r + g * 12 + 2, t.getUint16(m, i) === 274) { 364 m += 8, e = t.getUint16(m, i), t.setUint16(m, 1, i); 365 break; 366 } 367 } 368 } catch (e2) { 369 e = 1; 370 } 371 return e; 372} 373function Ji(a) { 374 var t = 0, e = 1, i = 1; 375 switch (a) { 376 case 2: 377 e = -1; 378 break; 379 case 3: 380 t = -180; 381 break; 382 case 4: 383 i = -1; 384 break; 385 case 5: 386 t = 90, i = -1; 387 break; 388 case 6: 389 t = 90; 390 break; 391 case 7: 392 t = 90, e = -1; 393 break; 394 case 8: 395 t = -90; 396 break; 397 } 398 return { rotate: t, scaleX: e, scaleY: i }; 399} 400var te = { render: function() { 401 this.initContainer(), this.initCanvas(), this.initCropBox(), this.renderCanvas(), this.cropped && this.renderCropBox(); 402}, initContainer: function() { 403 var t = this.element, e = this.options, i = this.container, o = this.cropper, r = Number(e.minContainerWidth), n = Number(e.minContainerHeight); 404 O(o, R), k(t, R); 405 var s = { width: Math.max(i.offsetWidth, r >= 0 ? r : si), height: Math.max(i.offsetHeight, n >= 0 ? n : hi) }; 406 this.containerData = s, W(o, { width: s.width, height: s.height }), O(t, R), k(o, R); 407}, initCanvas: function() { 408 var t = this.containerData, e = this.imageData, i = this.options.viewMode, o = Math.abs(e.rotate) % 180 === 90, r = o ? e.naturalHeight : e.naturalWidth, n = o ? e.naturalWidth : e.naturalHeight, s = r / n, d = t.width, l = t.height; 409 t.height * s > t.width ? i === 3 ? d = t.height * s : l = t.width / s : i === 3 ? l = t.width / s : d = t.height * s;
vendor: 7,425 bytes, lines 410-465
410 var h = { aspectRatio: s, naturalWidth: r, naturalHeight: n, width: d, height: l }; 411 this.canvasData = h, this.limited = i === 1 || i === 2, this.limitCanvas(true, true), h.width = Math.min(Math.max(h.width, h.minWidth), h.maxWidth), h.height = Math.min(Math.max(h.height, h.minHeight), h.maxHeight), h.left = (t.width - h.width) / 2, h.top = (t.height - h.height) / 2, h.oldLeft = h.left, h.oldTop = h.top, this.initialCanvasData = x({}, h); 412}, limitCanvas: function(t, e) { 413 var i = this.options, o = this.containerData, r = this.canvasData, n = this.cropBoxData, s = i.viewMode, d = r.aspectRatio, l = this.cropped && n; 414 if (t) { 415 var h = Number(i.minCanvasWidth) || 0, c = Number(i.minCanvasHeight) || 0; 416 s > 1 ? (h = Math.max(h, o.width), c = Math.max(c, o.height), s === 3 && (c * d > h ? h = c * d : c = h / d)) : s > 0 && (h ? h = Math.max(h, l ? n.width : 0) : c ? c = Math.max(c, l ? n.height : 0) : l && (h = n.width, c = n.height, c * d > h ? h = c * d : c = h / d)); 417 var f = U({ aspectRatio: d, width: h, height: c }); 418 h = f.width, c = f.height, r.minWidth = h, r.minHeight = c, r.maxWidth = 1 / 0, r.maxHeight = 1 / 0; 419 } 420 if (e) if (s > (l ? 0 : 1)) { 421 var m = o.width - r.width, g = o.height - r.height; 422 r.minLeft = Math.min(0, m), r.minTop = Math.min(0, g), r.maxLeft = Math.max(0, m), r.maxTop = Math.max(0, g), l && this.limited && (r.minLeft = Math.min(n.left, n.left + (n.width - r.width)), r.minTop = Math.min(n.top, n.top + (n.height - r.height)), r.maxLeft = n.left, r.maxTop = n.top, s === 2 && (r.width >= o.width && (r.minLeft = Math.min(0, m), r.maxLeft = Math.max(0, m)), r.height >= o.height && (r.minTop = Math.min(0, g), r.maxTop = Math.max(0, g)))); 423 } else r.minLeft = -r.width, r.minTop = -r.height, r.maxLeft = o.width, r.maxTop = o.height; 424}, renderCanvas: function(t, e) { 425 var i = this.canvasData, o = this.imageData; 426 if (e) { 427 var r = Gi({ width: o.naturalWidth * Math.abs(o.scaleX || 1), height: o.naturalHeight * Math.abs(o.scaleY || 1), degree: o.rotate || 0 }), n = r.width, s = r.height, d = i.width * (n / i.naturalWidth), l = i.height * (s / i.naturalHeight); 428 i.left -= (d - i.width) / 2, i.top -= (l - i.height) / 2, i.width = d, i.height = l, i.aspectRatio = n / s, i.naturalWidth = n, i.naturalHeight = s, this.limitCanvas(true, false); 429 } 430 (i.width > i.maxWidth || i.width < i.minWidth) && (i.left = i.oldLeft), (i.height > i.maxHeight || i.height < i.minHeight) && (i.top = i.oldTop), i.width = Math.min(Math.max(i.width, i.minWidth), i.maxWidth), i.height = Math.min(Math.max(i.height, i.minHeight), i.maxHeight), this.limitCanvas(false, true), i.left = Math.min(Math.max(i.left, i.minLeft), i.maxLeft), i.top = Math.min(Math.max(i.top, i.minTop), i.maxTop), i.oldLeft = i.left, i.oldTop = i.top, W(this.canvas, x({ width: i.width, height: i.height }, nt({ translateX: i.left, translateY: i.top }))), this.renderImage(t), this.cropped && this.limited && this.limitCropBox(true, true); 431}, renderImage: function(t) { 432 var e = this.canvasData, i = this.imageData, o = i.naturalWidth * (e.width / e.naturalWidth), r = i.naturalHeight * (e.height / e.naturalHeight); 433 x(i, { width: o, height: r, left: (e.width - o) / 2, top: (e.height - r) / 2 }), W(this.image, x({ width: i.width, height: i.height }, nt(x({ translateX: i.left, translateY: i.top }, i)))), t && this.output(); 434}, initCropBox: function() { 435 var t = this.options, e = this.canvasData, i = t.aspectRatio || t.initialAspectRatio, o = Number(t.autoCropArea) || 0.8, r = { width: e.width, height: e.height }; 436 i && (e.height * i > e.width ? r.height = r.width / i : r.width = r.height * i), this.cropBoxData = r, this.limitCropBox(true, true), r.width = Math.min(Math.max(r.width, r.minWidth), r.maxWidth), r.height = Math.min(Math.max(r.height, r.minHeight), r.maxHeight), r.width = Math.max(r.minWidth, r.width * o), r.height = Math.max(r.minHeight, r.height * o), r.left = e.left + (e.width - r.width) / 2, r.top = e.top + (e.height - r.height) / 2, r.oldLeft = r.left, r.oldTop = r.top, this.initialCropBoxData = x({}, r); 437}, limitCropBox: function(t, e) { 438 var i = this.options, o = this.containerData, r = this.canvasData, n = this.cropBoxData, s = this.limited, d = i.aspectRatio; 439 if (t) { 440 var l = Number(i.minCropBoxWidth) || 0, h = Number(i.minCropBoxHeight) || 0, c = s ? Math.min(o.width, r.width, r.width + r.left, o.width - r.left) : o.width, f = s ? Math.min(o.height, r.height, r.height + r.top, o.height - r.top) : o.height; 441 l = Math.min(l, o.width), h = Math.min(h, o.height), d && (l && h ? h * d > l ? h = l / d : l = h * d : l ? h = l / d : h && (l = h * d), f * d > c ? f = c / d : c = f * d), n.minWidth = Math.min(l, c), n.minHeight = Math.min(h, f), n.maxWidth = c, n.maxHeight = f; 442 } 443 e && (s ? (n.minLeft = Math.max(0, r.left), n.minTop = Math.max(0, r.top), n.maxLeft = Math.min(o.width, r.left + r.width) - n.width, n.maxTop = Math.min(o.height, r.top + r.height) - n.height) : (n.minLeft = 0, n.minTop = 0, n.maxLeft = o.width - n.width, n.maxTop = o.height - n.height)); 444}, renderCropBox: function() { 445 var t = this.options, e = this.containerData, i = this.cropBoxData; 446 (i.width > i.maxWidth || i.width < i.minWidth) && (i.left = i.oldLeft), (i.height > i.maxHeight || i.height < i.minHeight) && (i.top = i.oldTop), i.width = Math.min(Math.max(i.width, i.minWidth), i.maxWidth), i.height = Math.min(Math.max(i.height, i.minHeight), i.maxHeight), this.limitCropBox(false, true), i.left = Math.min(Math.max(i.left, i.minLeft), i.maxLeft), i.top = Math.min(Math.max(i.top, i.minTop), i.maxTop), i.oldLeft = i.left, i.oldTop = i.top, t.movable && t.cropBoxMovable && st(this.face, ot, i.width >= e.width && i.height >= e.height ? ai : At), W(this.cropBox, x({ width: i.width, height: i.height }, nt({ translateX: i.left, translateY: i.top }))), this.cropped && this.limited && this.limitCanvas(true, true), this.disabled || this.output(); 447}, output: function() { 448 this.preview(), tt(this.element, xt, this.getData()); 449} }, ie = { initPreview: function() { 450 var t = this.element, e = this.crossOrigin, i = this.options.preview, o = e ? this.crossOriginUrl : this.url, r = t.alt || "The image to preview", n = document.createElement("img"); 451 if (e && (n.crossOrigin = e), n.src = o, n.alt = r, this.viewBox.appendChild(n), this.viewBoxImage = n, !!i) { 452 var s = i; 453 typeof i == "string" ? s = t.ownerDocument.querySelectorAll(i) : i.querySelector && (s = [i]), this.previews = s, E(s, function(d) { 454 var l = document.createElement("img"); 455 st(d, ct, { width: d.offsetWidth, height: d.offsetHeight, html: d.innerHTML }), e && (l.crossOrigin = e), l.src = o, l.alt = r, l.style.cssText = 'display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"', d.innerHTML = "", d.appendChild(l); 456 }); 457 } 458}, resetPreview: function() { 459 E(this.previews, function(t) { 460 var e = Ct(t, ct); 461 W(t, { width: e.width, height: e.height }), t.innerHTML = e.html, Wi(t, ct); 462 }); 463}, preview: function() { 464 var t = this.imageData, e = this.canvasData, i = this.cropBoxData, o = i.width, r = i.height, n = t.width, s = t.height, d = i.left - e.left - t.left, l = i.top - e.top - t.top; 465 !this.cropped || this.disabled || (W(this.viewBoxImage, x({ width: n, height: s }, nt(x({ translateX: -d, translateY: -l }
465, t)))), E(this.previews, function(h) { 466 var c = Ct(h, ct), f = c.width, m = c.height, g = f, b = m, v = 1; 467 o && (v = f / o, b = r * v), r && b > m && (v = m / r, g = o * v, b = m), W(h, { width: g, height: b }), W(h.getElementsByTagName("img")[0], x({ width: n * v, height: s * v }, nt(x({ translateX: -d * v, translateY: -l * v }, t)))); 468 })); 469} }, ee = { bind: function() { 470 var t = this.element, e = this.options, i = this.cropper; 471 A(e.cropstart) && L(t, Mt, e.cropstart), A(e.cropmove) && L(t, Et, e.cropmove), A(e.cropend) && L(t, Dt, e.cropend), A(e.crop) && L(t, xt, e.crop), A(e.zoom) && L(t, Tt, e.zoom), L(i, Ht, this.onCropStart = this.cropStart.bind(this)), e.zoomable && e.zoomOnWheel && L(i, Gt, this.onWheel = this.wheel.bind(this), { passive: false, capture: true }), e.toggleDragModeOnDblclick && L(i, zt, this.onDblclick = this.dblclick.bind(this)), L(t.ownerDocument, Wt, this.onCropMove = this.cropMove.bind(this)), L(t.ownerDocument, Ut, this.onCropEnd = this.cropEnd.bind(this)), e.responsive && L(window, Vt, this.onResize = this.resize.bind(this)); 472}, unbind: function() { 473 var t = this.element, e = this.options, i = this.cropper; 474 A(e.cropstart) && B(t, Mt, e.cropstart), A(e.cropmove) && B(t, Et, e.cropmove), A(e.cropend) && B(t, Dt, e.cropend), A(e.crop) && B(t, xt, e.crop), A(e.zoom) && B(t, Tt, e.zoom), B(i, Ht, this.onCropStart), e.zoomable && e.zoomOnWheel && B(i, Gt, this.onWheel, { passive: false, capture: true }), e.toggleDragModeOnDblclick && B(i, zt, this.onDblclick), B(t.ownerDocument, Wt, this.onCropMove), B(t.ownerDocument, Ut, this.onCropEnd), e.responsive && B(window, Vt, this.onResize); 475} }, ae = { resize: function() { 476 if (!this.disabled) { 477 var t = this.options, e = this.container, i = this.containerData, o = e.offsetWidth / i.width, r = e.offsetHeight / i.height, n = Math.abs(o - 1) > Math.abs(r - 1) ? o : r; 478 if (n !== 1) { 479 var s, d; 480 t.restore && (s = this.getCanvasData(), d = this.getCropBoxData()), this.render(), t.restore && (this.setCanvasData(E(s, function(l, h) { 481 s[h] = l * n; 482 })), this.setCropBoxData(E(d, function(l, h) { 483 d[h] = l * n; 484 }))); 485 } 486 } 487}, dblclick: function() { 488 this.disabled || this.options.dragMode === oi || this.setDragMode(zi(this.dragBox, bt) ? ni : Rt); 489}, wheel: function(t) { 490 var e = this, i = Number(this.options.wheelZoomRatio) || 0.1, o = 1; 491 this.disabled || (t.preventDefault(), !this.wheeling && (this.wheeling = true, setTimeout(function() { 492 e.wheeling = false; 493 }, 50), t.deltaY ? o = t.deltaY > 0 ? 1 : -1 : t.wheelDelta ? o = -t.wheelDelta / 120 : t.detail && (o = t.detail > 0 ? 1 : -1), this.zoom(-o * i, t))); 494}, cropStart: function(t) { 495 var e = t.buttons, i = t.button; 496 if (!(this.disabled || (t.type === "mousedown" || t.type === "pointerdown" && t.pointerType === "mouse") && (p(e) && e !== 1 || p(i) && i !== 0 || t.ctrlKey))) { 497 var o = this.options, r = this.pointers, n; 498 t.changedTouches ? E(t.changedTouches, function(s) { 499 r[s.identifier] = lt(s); 500 }) : r[t.pointerId || 0] = lt(t), Object.keys(r).length > 1 && o.zoomable && o.zoomOnTouch ? n = ri : n = Ct(t.target, ot), Ri.test(n) && tt(this.element, Mt, { originalEvent: t, action: n }) !== false && (t.preventDefault(), this.action = n, this.cropping = false, n === ei && (this.cropping = true, O(this.dragBox, ft))); 501 } 502}, cropMove: function(t) { 503 var e = this.action; 504 if (!(this.disabled || !e)) { 505 var i = this.pointers; 506 t.preventDefault(), tt(this.element, Et, { originalEvent: t, action: e }) !== false && (t.changedTouches ? E(t.changedTouches, function(o) { 507 x(i[o.identifier] || {}, lt(o, true)); 508 }) : x(i[t.pointerId || 0] || {}, lt(t, true)), this.change(t)); 509 } 510}, cropEnd: function(t) { 511 if (!this.disabled) { 512 var e = this.action, i = this.pointers; 513 t.changedTouches ? E(t.changedTouches, function(o) { 514 delete i[o.identifier]; 515 }) : delete i[t.pointerId || 0], e && (t.preventDefault(), Object.keys(i).length || (this.action = ""), this.cropping && (this.cropping = false, Z(this.dragBox, ft, this.cropped && this.options.modal)), tt(this.element, Dt, { originalEvent: t, action: e })); 516 } 517} }, re = { change: function(t) { 518 var e = this.options, i = this.canvasData, o = this.containerData, r = this.cropBoxData, n = this.pointers, s = this.action, d = e.aspectRatio, l = r.left, h = r.top, c = r.width, f = r.height, m = l + c, g = h + f, b = 0, v = 0, M = o.width, C = o.height, D = true, X;
519 !d && t.shiftKey && (d = c && f ? c / f : 1), this.limited && (b = r.minLeft, v = r.minTop, M = b + Math.min(o.width, i.width, i.left + i.width), C = v + Math.min(o.height, i.height, i.top + i.height)); 520 var S = n[Object.keys(n)[0]], u = { x: S.endX - S.startX, y: S.endY - S.startY }, w = function(I) { 521 switch (I) { 522 case $: 523 m + u.x > M && (u.x = M - m); 524 break; 525 case q: 526 l + u.x < b && (u.x = b - l); 527 break; 528 case H: 529 h + u.y < v && (u.y = v - h); 530 break; 531 case K: 532 g + u.y > C && (u.y = C - g); 533 break; 534 } 535 }; 536 switch (s) { 537 case At: 538 l += u.x, h += u.y; 539 break; 540 case $: 541 if (u.x >= 0 && (m >= M || d && (h <= v || g >= C))) { 542 D = false; 543 break; 544 } 545 w($), c += u.x, c < 0 && (s = q, c = -c, l -= c), d && (f = c / d, h += (r.height - f) / 2); 546 break; 547 case H: 548 if (u.y <= 0 && (h <= v || d && (l <= b || m >= M))) { 549 D = false; 550 break; 551 } 552 w(H), f -= u.y, h += u.y, f < 0 && (s = K, f = -f, h -= f), d && (c = f * d, l += (r.width - c) / 2); 553 break; 554 case q: 555 if (u.x <= 0 && (l <= b || d && (h <= v || g >= C))) { 556 D = false; 557 break; 558 } 559 w(q), c -= u.x, l += u.x, c < 0 && (s = $, c = -c, l -= c), d && (f = c / d, h += (r.height - f) / 2); 560 break; 561 case K: 562 if (u.y >= 0 && (g >= C || d && (l <= b || m >= M))) { 563 D = false; 564 break; 565 } 566 w(K), f += u.y, f < 0 && (s = H, f = -f, h -= f), d && (c = f * d, l += (r.width - c) / 2); 567 break; 568 case it: 569 if (d) { 570 if (u.y <= 0 && (h <= v || m >= M)) { 571 D = false; 572 break; 573 } 574 w(H), f -= u.y, h += u.y, c = f * d; 575 } else w(H), w($), u.x >= 0 ? m < M ? c += u.x : u.y <= 0 && h <= v && (D = false) : c += u.x, u.y <= 0 ? h > v && (f -= u.y, h += u.y) : (f -= u.y, h += u.y); 576 c < 0 && f < 0 ? (s = rt, f = -f, c = -c, h -= f, l -= c) : c < 0 ? (s = et, c = -c, l -= c) : f < 0 && (s = at, f = -f, h -= f); 577 break; 578 case et: 579 if (d) { 580 if (u.y <= 0 && (h <= v || l <= b)) { 581 D = false; 582 break; 583 } 584 w(H), f -= u.y, h += u.y, c = f * d, l += r.width - c; 585 } else w(H), w(q), u.x <= 0 ? l > b ? (c -= u.x, l += u.x) : u.y <= 0 && h <= v && (D = false) : (c -= u.x, l += u.x), u.y <= 0 ? h > v && (f -= u.y, h += u.y) : (f -= u.y, h += u.y); 586 c < 0 && f < 0 ? (s = at, f = -f, c = -c, h -= f, l -= c) : c < 0 ? (s = it, c = -c, l -= c) : f < 0 && (s = rt, f = -f, h -= f); 587 break; 588 case rt: 589 if (d) { 590 if (u.x <= 0 && (l <= b || g >= C)) { 591 D = false; 592 break; 593 } 594 w(q), c -= u.x, l += u.x, f = c / d; 595 } else w(K), w(q), u.x <= 0 ? l > b ? (c -= u.x, l += u.x) : u.y >= 0 && g >= C && (D = false) : (c -= u.x, l += u.x), u.y >= 0 ? g < C && (f += u.y) : f += u.y; 596 c < 0 && f < 0 ? (s = it, f = -f, c = -c, h -= f, l -= c) : c < 0 ? (s = at, c = -c, l -= c) : f < 0 && (s = et, f = -f, h -= f); 597 break; 598 case at: 599 if (d) { 600 if (u.x >= 0 && (m >= M || g >= C)) { 601 D = false; 602 break; 603 } 604 w($), c += u.x, f = c / d; 605 } else w(K), w($), u.x >= 0 ? m < M ? c += u.x : u.y >= 0 && g >= C && (D = false) : c += u.x, u.y >= 0 ? g < C && (f += u.y) : f += u.y; 606 c < 0 && f < 0 ? (s = et, f = -f, c = -c, h -= f, l -= c) : c < 0 ? (s = rt, c = -c, l -= c) : f < 0 && (s = it, f = -f, h -= f); 607 break; 608 case ai: 609 this.move(u.x, u.y), D = false; 610 break; 611 case ri: 612 this.zoom(ji(n), t), D = false; 613 break; 614 case ei: 615 if (!u.x || !u.y) { 616 D = false; 617 break; 618 } 619 X = di(this.cropper), l = S.startX - X.left, h = S.startY - X.top, c = r.minWidth, f = r.minHeight, u.x > 0 ? s = u.y > 0 ? at : it : u.x < 0 && (l -= c, s = u.y > 0 ? rt : et), u.y < 0 && (h -= f), this.cropped || (k(this.cropBox, R), this.cropped = true, this.limited && this.limitCropBox(true, true)); 620 break; 621 } 622 D && (r.width = c, r.height = f, r.left = l, r.top = h, this.action = s, this.renderCropBox()), E(n, function(T) { 623 T.startX = T.endX, T.startY = T.endY; 624 }); 625} }, ne = { crop: function() { 626 return this.ready && !this.cropped && !this.disabled && (this.cropped = true, this.limitCropBox(true, true), this.options.modal && O(this.dragBox, ft), k(this.cropBox, R), this.setCropBoxData(this.initialCropBoxData)), this; 627}, reset: function() { 628 return this.ready && !this.disabled && (this.imageData = x({}, this.initialImageData), this.canvasData = x({}, this.initialCanvasData), this.cropBoxData = x({}, this.initialCropBoxData), this.renderCanvas(), this.cropped && this.renderCropBox()), this; 629}, clear: function() { 630 return this.cropped && !this.disabled && (x(this.cropBoxData, { left
630: 0, top: 0, width: 0, height: 0 }), this.cropped = false, this.renderCropBox(), this.limitCanvas(true, true), this.renderCanvas(), k(this.dragBox, ft), O(this.cropBox, R)), this; 631}, replace: function(t) { 632 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 633 return !this.disabled && t && (this.isImg && (this.element.src = t), e ? (this.url = t, this.image.src = t, this.ready && (this.viewBoxImage.src = t, E(this.previews, function(i) { 634 i.getElementsByTagName("img")[0].src = t; 635 }))) : (this.isImg && (this.replaced = true), this.options.data = null, this.uncreate(), this.load(t))), this; 636}, enable: function() { 637 return this.ready && this.disabled && (this.disabled = false, k(this.cropper, Xt)), this; 638}, disable: function() { 639 return this.ready && !this.disabled && (this.disabled = true, O(this.cropper, Xt)), this; 640}, destroy: function() { 641 var t = this.element; 642 return t[y] ? (t[y] = void 0, this.isImg && this.replaced && (t.src = this.originalUrl), this.uncreate(), this) : this; 643}, move: function(t) { 644 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, i = this.canvasData, o = i.left, r = i.top; 645 return this.moveTo(gt(t) ? t : o + Number(t), gt(e) ? e : r + Number(e)); 646}, moveTo: function(t) { 647 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, i = this.canvasData, o = false; 648 return t = Number(t), e = Number(e), this.ready && !this.disabled && this.options.movable && (p(t) && (i.left = t, o = true), p(e) && (i.top = e, o = true), o && this.renderCanvas(true)), this; 649}, zoom: function(t, e) { 650 var i = this.canvasData; 651 return t = Number(t), t < 0 ? t = 1 / (1 - t) : t = 1 + t, this.zoomTo(i.width * t / i.naturalWidth, null, e); 652}, zoomTo: function(t, e, i) { 653 var o = this.options, r = this.canvasData, n = r.width, s = r.height, d = r.naturalWidth, l = r.naturalHeight; 654 if (t = Number(t), t >= 0 && this.ready && !this.disabled && o.zoomable) { 655 var h = d * t, c = l * t; 656 if (tt(this.element, Tt, { ratio: t, oldRatio: n / d, originalEvent: i }) === false) return this; 657 if (i) { 658 var f = this.pointers, m = di(this.cropper), g = f && Object.keys(f).length ? Vi(f) : { pageX: i.pageX, pageY: i.pageY }; 659 r.left -= (h - n) * ((g.pageX - m.left - r.left) / n), r.top -= (c - s) * ((g.pageY - m.top - r.top) / s); 660 } else Q(e) && p(e.x) && p(e.y) ? (r.left -= (h - n) * ((e.x - r.left) / n), r.top -= (c - s) * ((e.y - r.top) / s)) : (r.left -= (h - n) / 2, r.top -= (c - s) / 2); 661 r.width = h, r.height = c, this.renderCanvas(true); 662 } 663 return this; 664}, rotate: function(t) { 665 return this.rotateTo((this.imageData.rotate || 0) + Number(t)); 666}, rotateTo: function(t) { 667 return t = Number(t), p(t) && this.ready && !this.disabled && this.options.rotatable && (this.imageData.rotate = t % 360, this.renderCanvas(true, true)), this; 668}, scaleX: function(t) { 669 var e = this.imageData.scaleY; 670 return this.scale(t, p(e) ? e : 1); 671}, scaleY: function(t) { 672 var e = this.imageData.scaleX; 673 return this.scale(p(e) ? e : 1, t); 674}, scale: function(t) { 675 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, i = this.imageData, o = false; 676 return t = Number(t), e = Number(e), this.ready && !this.disabled && this.options.scalable && (p(t) && (i.scaleX = t, o = true), p(e) && (i.scaleY = e, o = true), o && this.renderCanvas(true, true)), this; 677}, getData: function() { 678 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, e = this.options, i = this.imageData, o = this.canvasData, r = this.cropBoxData, n; 679 if (this.ready && this.cropped) { 680 n = { x: r.left - o.left, y: r.top - o.top, width: r.width, height: r.height }; 681 var s = i.width / i.naturalWidth; 682 if (E(n, function(h, c) { 683 n[c] = h / s; 684 }), t) { 685 var d = Math.round(n.y + n.height), l = Math.round(n.x + n.width); 686 n.x = Math.round(n.x), n.y = Math.round(n.y), n.width = l - n.x, n.height = d - n.y; 687 } 688 } else n = { x: 0, y: 0, width: 0, height: 0 }; 689 return e.rotatable && (n.rotate = i.rotate || 0), e.scalable && (n.scaleX = i.scaleX || 1, n.scaleY = i.scaleY || 1), n; 690}, setData: function(t) { 691 var e = this.options, i = this.imageData, o = this.canvasData, r = {}; 692 if (this.ready && !this.disabled && Q(t)) { 693 var n = false;
694 e.rotatable && p(t.rotate) && t.rotate !== i.rotate && (i.rotate = t.rotate, n = true), e.scalable && (p(t.scaleX) && t.scaleX !== i.scaleX && (i.scaleX = t.scaleX, n = true), p(t.scaleY) && t.scaleY !== i.scaleY && (i.scaleY = t.scaleY, n = true)), n && this.renderCanvas(true, true); 695 var s = i.width / i.naturalWidth; 696 p(t.x) && (r.left = t.x * s + o.left), p(t.y) && (r.top = t.y * s + o.top), p(t.width) && (r.width = t.width * s), p(t.height) && (r.height = t.height * s), this.setCropBoxData(r); 697 } 698 return this; 699}, getContainerData: function() { 700 return this.ready ? x({}, this.containerData) : {}; 701}, getImageData: function() { 702 return this.sized ? x({}, this.imageData) : {}; 703}, getCanvasData: function() { 704 var t = this.canvasData, e = {}; 705 return this.ready && E(["left", "top", "width", "height", "naturalWidth", "naturalHeight"], function(i) { 706 e[i] = t[i]; 707 }), e; 708}, setCanvasData: function(t) { 709 var e = this.canvasData, i = e.aspectRatio; 710 return this.ready && !this.disabled && Q(t) && (p(t.left) && (e.left = t.left), p(t.top) && (e.top = t.top), p(t.width) ? (e.width = t.width, e.height = t.width / i) : p(t.height) && (e.height = t.height, e.width = t.height * i), this.renderCanvas(true)), this; 711}, getCropBoxData: function() { 712 var t = this.cropBoxData, e; 713 return this.ready && this.cropped && (e = { left: t.left, top: t.top, width: t.width, height: t.height }), e || {}; 714}, setCropBoxData: function(t) { 715 var e = this.cropBoxData, i = this.options.aspectRatio, o, r; 716 return this.ready && this.cropped && !this.disabled && Q(t) && (p(t.left) && (e.left = t.left), p(t.top) && (e.top = t.top), p(t.width) && t.width !== e.width && (o = true, e.width = t.width), p(t.height) && t.height !== e.height && (r = true, e.height = t.height), i && (o ? e.height = e.width / i : r && (e.width = e.height * i)), this.renderCropBox()), this; 717}, getCroppedCanvas: function() { 718 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 719 if (!this.ready || !window.HTMLCanvasElement) return null; 720 var e = this.canvasData, i = $i(this.image, this.imageData, e, t); 721 if (!this.cropped) return i; 722 var o = this.getData(t.rounded), r = o.x, n = o.y, s = o.width, d = o.height, l = i.width / Math.floor(e.naturalWidth); 723 l !== 1 && (r *= l, n *= l, s *= l, d *= l); 724 var h = s / d, c = U({ aspectRatio: h, width: t.maxWidth || 1 / 0, height: t.maxHeight || 1 / 0 }), f = U({ aspectRatio: h, width: t.minWidth || 0, height: t.minHeight || 0 }, "cover"), m = U({ aspectRatio: h, width: t.width || (l !== 1 ? i.width : s), height: t.height || (l !== 1 ? i.height : d) }), g = m.width, b = m.height; 725 g = Math.min(c.width, Math.max(f.width, g)), b = Math.min(c.height, Math.max(f.height, b)); 726 var v = document.createElement("canvas"), M = v.getContext("2d"); 727 v.width = J(g), v.height = J(b), M.fillStyle = t.fillColor || "transparent", M.fillRect(0, 0, g, b); 728 var C = t.imageSmoothingEnabled, D = C === void 0 ? true : C, X = t.imageSmoothingQuality; 729 M.imageSmoothingEnabled = D, X && (M.imageSmoothingQuality = X); 730 var S = i.width, u = i.height, w = r, T = n, I, Y, j, V, z, _; 731 w <= -s || w > S ? (w = 0, I = 0, j = 0, z = 0) : w <= 0 ? (j = -w, w = 0, I = Math.min(S, s + w), z = I) : w <= S && (j = 0, I = Math.min(s, S - w), z = I), I <= 0 || T <= -d || T > u ? (T = 0, Y = 0, V = 0, _ = 0) : T <= 0 ? (V = -T, T = 0, Y = Math.min(u, d + T), _ = Y) : T <= u && (V = 0, Y = Math.min(d, u - T), _ = Y); 732 var N = [w, T, I, Y]; 733 if (z > 0 && _ > 0) { 734 var G = g / s; 735 N.push(j * G, V * G, z * G, _ * G); 736 } 737 return M.drawImage.apply(M, [i].concat(ii(N.map(function(ht) { 738 return Math.floor(J(ht)); 739 })))), v; 740}, setAspectRatio: function(t) { 741 var e = this.options; 742 return !this.disabled && !gt(t) && (e.aspectRatio = Math.max(0, t) || NaN, this.ready && (this.initCropBox(), this.cropped && this.renderCropBox())), this; 743}, setDragMode: function(t) { 744 var e = this.options, i = this.dragBox, o = this.face; 745 if (this.ready && !this.disabled) { 746 var r = t === Rt, n = e.movable && t === ni; 747 t = r || n ? t : oi, e.dragMode = t, st(i, ot, t), Z(i, bt, r), Z(i, yt, n), e.cropBoxMovable || (st(o, ot, t), Z(o, bt, r), Z(o, yt, n)); 748 } 749 return this; 750} }, oe = P.Cropper, se = (function() { 751 function a(t) { 752 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 753 if (bi(this, a), !t || !Li.test(t.tagName)) throw new Error("The first argument is required and must be an <img> or <canvas> element."); 754 this.element = t, this.options = x({}, qt, Q(e) && e), this.cropped = false, this.disabled = false, this.pointers = {}, this.ready = false, this.reloading = false, this.replaced = false, this.sized = false, this.sizing = false, this.init(); 755 } 756 return yi(a, [{ key: "init", value: function() { 757 var e = this.element, i = e.tagName.toLowerCase(), o; 758 if (!e[y]) { 759 if (e[y] = this, i === "img") { 760 if (this.isImg = true, o = e.getAttribute("src") || "", this.originalUrl = o, !o) return; 761 o = e.src; 762 } else i === "canvas" && window.HTMLCanvasElement && (o = e.toDataURL()); 763 this.load(o); 764 } 765 } }, { key: "load", value: function(e) { 766 var i = this; 767 if (e) { 768 this.url = e, this.imageData = {}; 769 var o = this.element, r = this.options; 770 if (!r.rotatable && !r.scalable && (r.checkOrientation = false), !r.checkOrientation || !window.ArrayBuffer) { 771 this.clone(); 772 return; 773 } 774 if (Si.test(e)) { 775 Ii.test(e) ? this.read(Ki(e)) : this.clone(); 776 return; 777 } 778 var n = new XMLHttpRequest(), s = this.clone.bind(this); 779 this.reloading = true, this.xhr = n, n.onabort = s, n.onerror = s, n.ontimeout = s, n.onprogress = function() { 780 n.getResponseHeader("content-type") !== $t && n.abort(); 781 }, n.onload = function() { 782 i.read(n.response); 783 }, n.onloadend = function() { 784 i.reloading = false, i.xhr = null; 785 }, r.checkCrossOrigin && Kt(e) && o.crossOrigin && (e = Qt(e)), n.open("GET", e, true), n.responseType = "arraybuffer", n.withCredentials = o.crossOrigin === "use-credentials", n.send(); 786 } 787 } }, { key: "read", value: function(e) { 788 var i = this.options, o = this.imageData, r = Zi(e), n = 0, s = 1, d = 1; 789 if (r > 1) { 790 this.url = Qi(e, $t); 791 var l = Ji(r); 792 n = l.rotate, s = l.scaleX, d = l.scaleY; 793 } 794 i.rotatable && (o.rotate = n), i.scalable && (o.scaleX = s, o.scaleY = d), this.clone(); 795 } }, { key: "clone", value: function() { 796 var e = this.element, i = this.url, o = e.crossOrigin, r = i; 797 this.options.checkCrossOrigin && Kt(i) && (o || (o = "anonymous"), r = Qt(i)), this.crossOrigin = o, this.crossOriginUrl = r; 798 var n = document.createElement("img"); 799 o && (n.crossOrigin = o), n.src = r || i, n.alt = e.alt || "The image to crop", this.image = n, n.onload = this.start.bind(this), n.onerror = this.stop.bind(this), O(n, Yt), e.parentNode.insertBefore(n, e.nextSibling); 800 } }, { key: "start", value: function() { 801 var e = this, i = this.image; 802 i.onload = null, i.onerror = null, this.sizing = true; 803 var o = P.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(P.navigator.userAgent), r = function(l, h) {
804 x(e.imageData, { naturalWidth: l, naturalHeight: h, aspectRatio: l / h }), e.initialImageData = x({}, e.imageData), e.sizing = false, e.sized = true, e.build(); 805 }; 806 if (i.naturalWidth && !o) { 807 r(i.naturalWidth, i.naturalHeight); 808 return; 809 } 810 var n = document.createElement("img"), s = document.body || document.documentElement; 811 this.sizingImage = n, n.onload = function() { 812 r(n.width, n.height), o || s.removeChild(n); 813 }, n.src = i.src, o || (n.style.cssText = "left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;", s.appendChild(n)); 814 } }, { key: "stop", value: function() { 815 var e = this.image; 816 e.onload = null, e.onerror = null, e.parentNode.removeChild(e), this.image = null; 817 } }, { key: "build", value: function() { 818 if (!(!this.sized || this.ready)) { 819 var e = this.element, i = this.options, o = this.image, r = e.parentNode, n = document.createElement("div"); 820 n.innerHTML = Bi; 821 var s = n.querySelector(".".concat(y, "-container")), d = s.querySelector(".".concat(y, "-canvas")), l = s.querySelector(".".concat(y, "-drag-box")), h = s.querySelector(".".concat(y, "-crop-box")), c = h.querySelector(".".concat(y, "-face")); 822 this.container = r, this.cropper = s, this.canvas = d, this.dragBox = l, this.cropBox = h, this.viewBox = s.querySelector(".".concat(y, "-view-box")), this.face = c, d.appendChild(o), O(e, R), r.insertBefore(s, e.nextSibling), k(o, Yt), this.initPreview(), this.bind(), i.initialAspectRatio = Math.max(0, i.initialAspectRatio) || NaN, i.aspectRatio = Math.max(0, i.aspectRatio) || NaN, i.viewMode = Math.max(0, Math.min(3, Math.round(i.viewMode))) || 0, O(h, R), i.guides || O(h.getElementsByClassName("".concat(y, "-dashed")), R), i.center || O(h.getElementsByClassName("".concat(y, "-center")), R), i.background && O(s, "".concat(y, "-bg")), i.highlight || O(c, Ci), i.cropBoxMovable && (O(c, yt), st(c, ot, At)), i.cropBoxResizable || (O(h.getElementsByClassName("".concat(y, "-line")), R), O(h.getElementsByClassName("".concat(y, "-point")), R)), this.render(), this.ready = true, this.setDragMode(i.dragMode), i.autoCrop && this.crop(), this.setData(i.data), A(i.ready) && L(e, jt, i.ready, { once: true }), tt(e, jt); 823 } 824 } }, { key: "unbuild", value: function() { 825 if (this.ready) { 826 this.ready = false, this.unbind(), this.resetPreview(); 827 var e = this.cropper.parentNode; 828 e && e.removeChild(this.cropper), k(this.element, R); 829 } 830 } }, { key: "uncreate", value: function() { 831 this.ready ? (this.unbuild(), this.ready = false, this.cropped = false) : this.sizing ? (this.sizingImage.onload = null, this.sizing = false, this.sized = false) : this.reloading ? (this.xhr.onabort = null, this.xhr.abort()) : this.image && this.stop(); 832 } }], [{ key: "noConflict", value: function() { 833 return window.Cropper = oe, a; 834 } }, { key: "setDefaults", value: function(e) { 835 x(qt, Q(e) && e); 836 } }]); 837})(); 838x(se.prototype, te, ie, ee, ae, re, ne); 839export { 840 se as C, 841 vi as M, 842 le as c, 843 ce as m 844};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.