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G,EAAc1L,KAAKjB,KAAMuG,GACzBnB,EAAepF,KAAK8J,SAAS+C,SAEjChE,OAAQ,SAAU6Q,GACdD,GAAQxY,KAAKjB,KAAM0Z,IAEvB8B,QAAS,WACL,OAAOzB,GAAS9Y,KAAKjB,SAGtBkI,SAzlDW","sources":["webpack://telegram-t/./node_modules/croppie/croppie.js"],"sourcesContent":["/*************************\r\n * Croppie\r\n * Copyright 2019\r\n * Foliotek\r\n * Version: 2.6.5\r\n *************************/\r\n(function (root, factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define(factory);\r\n } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {\r\n // CommonJS\r\n module.exports = factory();\r\n } else {\r\n // Browser globals\r\n root.Croppie = factory();\r\n }\r\n}(typeof self !== 'undefined' ? self : this, function () {\r\n\r\n /* Polyfills */\r\n if (typeof Promise !== 'function') {\r\n /*! promise-polyfill 3.1.0 */\r\n !function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if(\"object\"!==typeof this)throw new TypeError(\"Promises must be constructed via new\");if(\"function\"!==typeof a)throw new TypeError(\"not a function\");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void k(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError(\"A promise cannot be resolved with itself.\");if(a&&(\"object\"===typeof a||\"function\"===typeof a)){var c=a.then;if(\"function\"===typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled=\"function\"===typeof a?a:null,this.onRejected=\"function\"===typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j=setTimeout,k=\"function\"===typeof setImmediate&&setImmediate||function(a){j(a,1)},l=Array.isArray||function(a){return\"[object Array]\"===Object.prototype.toString.call(a)};c.prototype[\"catch\"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&(\"object\"===typeof g||\"function\"===typeof g)){var h=g.then;if(\"function\"===typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){k=a},\"undefined\"!==typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this);\r\n }\r\n\r\n if (typeof window !== 'undefined' && typeof window.CustomEvent !== \"function\") {\r\n (function(){\r\n function CustomEvent ( event, params ) {\r\n params = params || { bubbles: false, cancelable: false, detail: undefined };\r\n var evt = document.createEvent( 'CustomEvent' );\r\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\r\n return evt;\r\n }\r\n CustomEvent.prototype = window.Event.prototype;\r\n window.CustomEvent = CustomEvent;\r\n }());\r\n }\r\n\r\n if (typeof HTMLCanvasElement !== 'undefined' && !HTMLCanvasElement.prototype.toBlob) {\r\n Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {\r\n value: function (callback, type, quality) {\r\n var binStr = atob( this.toDataURL(type, quality).split(',')[1] ),\r\n len = binStr.length,\r\n arr = new Uint8Array(len);\r\n\r\n for (var i=0; i -1 ? EXIF_NORM : EXIF_FLIP,\r\n index = arr.indexOf(ornt),\r\n offset = (rotate / 90) % arr.length;// 180 = 2%4 = 2 shift exif by 2 indexes\r\n\r\n return arr[(arr.length + index + (offset % arr.length)) % arr.length];\r\n }\r\n\r\n // Credits to : Andrew Dupont - http://andrewdupont.net/2009/08/28/deep-extending-objects-in-javascript/\r\n function deepExtend(destination, source) {\r\n destination = destination || {};\r\n for (var property in source) {\r\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\r\n destination[property] = destination[property] || {};\r\n deepExtend(destination[property], source[property]);\r\n } else {\r\n destination[property] = source[property];\r\n }\r\n }\r\n return destination;\r\n }\r\n\r\n function clone(object) {\r\n return deepExtend({}, object);\r\n }\r\n\r\n function debounce(func, wait, immediate) {\r\n var timeout;\r\n return function () {\r\n var context = this, args = arguments;\r\n var later = function () {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n }\r\n\r\n function dispatchChange(element) {\r\n if (\"createEvent\" in document) {\r\n var evt = document.createEvent(\"HTMLEvents\");\r\n evt.initEvent(\"change\", false, true);\r\n element.dispatchEvent(evt);\r\n }\r\n else {\r\n element.fireEvent(\"onchange\");\r\n }\r\n }\r\n\r\n //http://jsperf.com/vanilla-css\r\n function css(el, styles, val) {\r\n if (typeof (styles) === 'string') {\r\n var tmp = styles;\r\n styles = {};\r\n styles[tmp] = val;\r\n }\r\n\r\n for (var prop in styles) {\r\n el.style[prop] = styles[prop];\r\n }\r\n }\r\n\r\n function addClass(el, c) {\r\n if (el.classList) {\r\n el.classList.add(c);\r\n }\r\n else {\r\n el.className += ' ' + c;\r\n }\r\n }\r\n\r\n function removeClass(el, c) {\r\n if (el.classList) {\r\n el.classList.remove(c);\r\n }\r\n else {\r\n el.className = el.className.replace(c, '');\r\n }\r\n }\r\n\r\n function setAttributes(el, attrs) {\r\n for (var key in attrs) {\r\n el.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n\r\n function num(v) {\r\n return parseInt(v, 10);\r\n }\r\n\r\n /* Utilities */\r\n function loadImage(src, doExif) {\r\n if (!src) { throw 'Source image missing'; }\r\n \r\n var img = new Image();\r\n img.style.opacity = '0';\r\n return new Promise(function (resolve, reject) {\r\n function _resolve() {\r\n img.style.opacity = '1';\r\n setTimeout(function () {\r\n resolve(img);\r\n }, 1);\r\n }\r\n\r\n img.removeAttribute('crossOrigin');\r\n if (src.match(/^https?:\\/\\/|^\\/\\//)) {\r\n img.setAttribute('crossOrigin', 'anonymous');\r\n }\r\n\r\n img.onload = function () {\r\n if (doExif) {\r\n EXIF.getData(img, function () {\r\n _resolve();\r\n });\r\n }\r\n else {\r\n _resolve();\r\n }\r\n };\r\n img.onerror = function (ev) {\r\n img.style.opacity = 1;\r\n setTimeout(function () {\r\n reject(ev);\r\n }, 1);\r\n };\r\n img.src = src;\r\n });\r\n }\r\n\r\n function naturalImageDimensions(img, ornt) {\r\n var w = img.naturalWidth;\r\n var h = img.naturalHeight;\r\n var orient = ornt || getExifOrientation(img);\r\n if (orient && orient >= 5) {\r\n var x= w;\r\n w = h;\r\n h = x;\r\n }\r\n return { width: w, height: h };\r\n }\r\n\r\n /* CSS Transform Prototype */\r\n var TRANSLATE_OPTS = {\r\n 'translate3d': {\r\n suffix: ', 0px'\r\n },\r\n 'translate': {\r\n suffix: ''\r\n }\r\n };\r\n var Transform = function (x, y, scale) {\r\n this.x = parseFloat(x);\r\n this.y = parseFloat(y);\r\n this.scale = parseFloat(scale);\r\n };\r\n\r\n Transform.parse = function (v) {\r\n if (v.style) {\r\n return Transform.parse(v.style[CSS_TRANSFORM]);\r\n }\r\n else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) {\r\n return Transform.fromMatrix(v);\r\n }\r\n else {\r\n return Transform.fromString(v);\r\n }\r\n };\r\n\r\n Transform.fromMatrix = function (v) {\r\n var vals = v.substring(7).split(',');\r\n if (!vals.length || v === 'none') {\r\n vals = [1, 0, 0, 1, 0, 0];\r\n }\r\n\r\n return new Transform(num(vals[4]), num(vals[5]), parseFloat(vals[0]));\r\n };\r\n\r\n Transform.fromString = function (v) {\r\n var values = v.split(') '),\r\n translate = values[0].substring(Croppie.globals.translate.length + 1).split(','),\r\n scale = values.length > 1 ? values[1].substring(6) : 1,\r\n x = translate.length > 1 ? translate[0] : 0,\r\n y = translate.length > 1 ? translate[1] : 0;\r\n\r\n return new Transform(x, y, scale);\r\n };\r\n\r\n Transform.prototype.toString = function () {\r\n var suffix = TRANSLATE_OPTS[Croppie.globals.translate].suffix || '';\r\n return Croppie.globals.translate + '(' + this.x + 'px, ' + this.y + 'px' + suffix + ') scale(' + this.scale + ')';\r\n };\r\n\r\n var TransformOrigin = function (el) {\r\n if (!el || !el.style[CSS_TRANS_ORG]) {\r\n this.x = 0;\r\n this.y = 0;\r\n return;\r\n }\r\n var css = el.style[CSS_TRANS_ORG].split(' ');\r\n this.x = parseFloat(css[0]);\r\n this.y = parseFloat(css[1]);\r\n };\r\n\r\n TransformOrigin.prototype.toString = function () {\r\n return this.x + 'px ' + this.y + 'px';\r\n };\r\n\r\n function getExifOrientation (img) {\r\n return img.exifdata && img.exifdata.Orientation ? num(img.exifdata.Orientation) : 1;\r\n }\r\n\r\n function drawCanvas(canvas, img, orientation) {\r\n var width = img.width,\r\n height = img.height,\r\n ctx = canvas.getContext('2d');\r\n\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n\r\n ctx.save();\r\n switch (orientation) {\r\n case 2:\r\n ctx.translate(width, 0);\r\n ctx.scale(-1, 1);\r\n break;\r\n\r\n case 3:\r\n ctx.translate(width, height);\r\n ctx.rotate(180*Math.PI/180);\r\n break;\r\n\r\n case 4:\r\n ctx.translate(0, height);\r\n ctx.scale(1, -1);\r\n break;\r\n\r\n case 5:\r\n canvas.width = height;\r\n canvas.height = width;\r\n ctx.rotate(90*Math.PI/180);\r\n ctx.scale(1, -1);\r\n break;\r\n\r\n case 6:\r\n canvas.width = height;\r\n canvas.height = width;\r\n ctx.rotate(90*Math.PI/180);\r\n ctx.translate(0, -height);\r\n break;\r\n\r\n case 7:\r\n canvas.width = height;\r\n canvas.height = width;\r\n ctx.rotate(-90*Math.PI/180);\r\n ctx.translate(-width, height);\r\n ctx.scale(1, -1);\r\n break;\r\n\r\n case 8:\r\n canvas.width = height;\r\n canvas.height = width;\r\n ctx.translate(0, width);\r\n ctx.rotate(-90*Math.PI/180);\r\n break;\r\n }\r\n ctx.drawImage(img, 0,0, width, height);\r\n ctx.restore();\r\n }\r\n\r\n /* Private Methods */\r\n function _create() {\r\n var self = this,\r\n contClass = 'croppie-container',\r\n customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null,\r\n boundary, img, viewport, overlay, bw, bh;\r\n\r\n self.options.useCanvas = self.options.enableOrientation || _hasExif.call(self);\r\n // Properties on class\r\n self.data = {};\r\n self.elements = {};\r\n\r\n boundary = self.elements.boundary = document.createElement('div');\r\n viewport = self.elements.viewport = document.createElement('div');\r\n img = self.elements.img = document.createElement('img');\r\n overlay = self.elements.overlay = document.createElement('div');\r\n\r\n if (self.options.useCanvas) {\r\n self.elements.canvas = document.createElement('canvas');\r\n self.elements.preview = self.elements.canvas;\r\n }\r\n else {\r\n self.elements.preview = img;\r\n }\r\n\r\n addClass(boundary, 'cr-boundary');\r\n boundary.setAttribute('aria-dropeffect', 'none');\r\n bw = self.options.boundary.width;\r\n bh = self.options.boundary.height;\r\n css(boundary, {\r\n width: (bw + (isNaN(bw) ? '' : 'px')),\r\n height: (bh + (isNaN(bh) ? '' : 'px'))\r\n });\r\n\r\n addClass(viewport, 'cr-viewport');\r\n if (customViewportClass) {\r\n addClass(viewport, customViewportClass);\r\n }\r\n css(viewport, {\r\n width: self.options.viewport.width + 'px',\r\n height: self.options.viewport.height + 'px'\r\n });\r\n viewport.setAttribute('tabindex', 0);\r\n\r\n addClass(self.elements.preview, 'cr-image');\r\n setAttributes(self.elements.preview, { 'alt': 'preview', 'aria-grabbed': 'false' });\r\n addClass(overlay, 'cr-overlay');\r\n\r\n self.element.appendChild(boundary);\r\n boundary.appendChild(self.elements.preview);\r\n boundary.appendChild(viewport);\r\n boundary.appendChild(overlay);\r\n\r\n addClass(self.element, contClass);\r\n if (self.options.customClass) {\r\n addClass(self.element, self.options.customClass);\r\n }\r\n\r\n _initDraggable.call(this);\r\n\r\n if (self.options.enableZoom) {\r\n _initializeZoom.call(self);\r\n }\r\n\r\n // if (self.options.enableOrientation) {\r\n // _initRotationControls.call(self);\r\n // }\r\n\r\n if (self.options.enableResize) {\r\n _initializeResize.call(self);\r\n }\r\n }\r\n\r\n // function _initRotationControls () {\r\n // var self = this,\r\n // wrap, btnLeft, btnRight, iLeft, iRight;\r\n\r\n // wrap = document.createElement('div');\r\n // self.elements.orientationBtnLeft = btnLeft = document.createElement('button');\r\n // self.elements.orientationBtnRight = btnRight = document.createElement('button');\r\n\r\n // wrap.appendChild(btnLeft);\r\n // wrap.appendChild(btnRight);\r\n\r\n // iLeft = document.createElement('i');\r\n // iRight = document.createElement('i');\r\n // btnLeft.appendChild(iLeft);\r\n // btnRight.appendChild(iRight);\r\n\r\n // addClass(wrap, 'cr-rotate-controls');\r\n // addClass(btnLeft, 'cr-rotate-l');\r\n // addClass(btnRight, 'cr-rotate-r');\r\n\r\n // self.elements.boundary.appendChild(wrap);\r\n\r\n // btnLeft.addEventListener('click', function () {\r\n // self.rotate(-90);\r\n // });\r\n // btnRight.addEventListener('click', function () {\r\n // self.rotate(90);\r\n // });\r\n // }\r\n\r\n function _hasExif() {\r\n return this.options.enableExif && window.EXIF;\r\n }\r\n\r\n function _initializeResize () {\r\n var self = this;\r\n var wrap = document.createElement('div');\r\n var isDragging = false;\r\n var direction;\r\n var originalX;\r\n var originalY;\r\n var minSize = 50;\r\n var maxWidth;\r\n var maxHeight;\r\n var vr;\r\n var hr;\r\n\r\n addClass(wrap, 'cr-resizer');\r\n css(wrap, {\r\n width: this.options.viewport.width + 'px',\r\n height: this.options.viewport.height + 'px'\r\n });\r\n\r\n if (this.options.resizeControls.height) {\r\n vr = document.createElement('div');\r\n addClass(vr, 'cr-resizer-vertical');\r\n wrap.appendChild(vr);\r\n }\r\n\r\n if (this.options.resizeControls.width) {\r\n hr = document.createElement('div');\r\n addClass(hr, 'cr-resizer-horisontal');\r\n wrap.appendChild(hr);\r\n }\r\n\r\n function mouseDown(ev) {\r\n if (ev.button !== undefined && ev.button !== 0) return;\r\n\r\n ev.preventDefault();\r\n if (isDragging) {\r\n return;\r\n }\r\n\r\n var overlayRect = self.elements.overlay.getBoundingClientRect();\r\n\r\n isDragging = true;\r\n originalX = ev.pageX;\r\n originalY = ev.pageY;\r\n direction = ev.currentTarget.className.indexOf('vertical') !== -1 ? 'v' : 'h';\r\n maxWidth = overlayRect.width;\r\n maxHeight = overlayRect.height;\r\n\r\n if (ev.touches) {\r\n var touches = ev.touches[0];\r\n originalX = touches.pageX;\r\n originalY = touches.pageY;\r\n }\r\n\r\n window.addEventListener('mousemove', mouseMove);\r\n window.addEventListener('touchmove', mouseMove);\r\n window.addEventListener('mouseup', mouseUp);\r\n window.addEventListener('touchend', mouseUp);\r\n document.body.style[CSS_USERSELECT] = 'none';\r\n }\r\n\r\n function mouseMove(ev) {\r\n var pageX = ev.pageX;\r\n var pageY = ev.pageY;\r\n\r\n ev.preventDefault();\r\n\r\n if (ev.touches) {\r\n var touches = ev.touches[0];\r\n pageX = touches.pageX;\r\n pageY = touches.pageY;\r\n }\r\n\r\n var deltaX = pageX - originalX;\r\n var deltaY = pageY - originalY;\r\n var newHeight = self.options.viewport.height + deltaY;\r\n var newWidth = self.options.viewport.width + deltaX;\r\n\r\n if (direction === 'v' && newHeight >= minSize && newHeight <= maxHeight) {\r\n css(wrap, {\r\n height: newHeight + 'px'\r\n });\r\n\r\n self.options.boundary.height += deltaY;\r\n css(self.elements.boundary, {\r\n height: self.options.boundary.height + 'px'\r\n });\r\n\r\n self.options.viewport.height += deltaY;\r\n css(self.elements.viewport, {\r\n height: self.options.viewport.height + 'px'\r\n });\r\n }\r\n else if (direction === 'h' && newWidth >= minSize && newWidth <= maxWidth) {\r\n css(wrap, {\r\n width: newWidth + 'px'\r\n });\r\n\r\n self.options.boundary.width += deltaX;\r\n css(self.elements.boundary, {\r\n width: self.options.boundary.width + 'px'\r\n });\r\n\r\n self.options.viewport.width += deltaX;\r\n css(self.elements.viewport, {\r\n width: self.options.viewport.width + 'px'\r\n });\r\n }\r\n\r\n _updateOverlay.call(self);\r\n _updateZoomLimits.call(self);\r\n _updateCenterPoint.call(self);\r\n _triggerUpdate.call(self);\r\n originalY = pageY;\r\n originalX = pageX;\r\n }\r\n\r\n function mouseUp() {\r\n isDragging = false;\r\n window.removeEventListener('mousemove', mouseMove);\r\n window.removeEventListener('touchmove', mouseMove);\r\n window.removeEventListener('mouseup', mouseUp);\r\n window.removeEventListener('touchend', mouseUp);\r\n document.body.style[CSS_USERSELECT] = '';\r\n }\r\n\r\n if (vr) {\r\n vr.addEventListener('mousedown', mouseDown);\r\n vr.addEventListener('touchstart', mouseDown);\r\n }\r\n\r\n if (hr) {\r\n hr.addEventListener('mousedown', mouseDown);\r\n hr.addEventListener('touchstart', mouseDown);\r\n }\r\n\r\n this.elements.boundary.appendChild(wrap);\r\n }\r\n\r\n function _setZoomerVal(v) {\r\n if (this.options.enableZoom) {\r\n var z = this.elements.zoomer,\r\n val = fix(v, 4);\r\n\r\n z.value = Math.max(parseFloat(z.min), Math.min(parseFloat(z.max), val)).toString();\r\n }\r\n }\r\n\r\n function _initializeZoom() {\r\n var self = this,\r\n wrap = self.elements.zoomerWrap = document.createElement('div'),\r\n zoomer = self.elements.zoomer = document.createElement('input');\r\n\r\n addClass(wrap, 'cr-slider-wrap');\r\n addClass(zoomer, 'cr-slider');\r\n zoomer.type = 'range';\r\n zoomer.step = '0.0001';\r\n zoomer.value = '1';\r\n zoomer.style.display = self.options.showZoomer ? '' : 'none';\r\n zoomer.setAttribute('aria-label', 'zoom');\r\n\r\n self.element.appendChild(wrap);\r\n wrap.appendChild(zoomer);\r\n\r\n self._currentZoom = 1;\r\n\r\n function change() {\r\n _onZoom.call(self, {\r\n value: parseFloat(zoomer.value),\r\n origin: new TransformOrigin(self.elements.preview),\r\n viewportRect: self.elements.viewport.getBoundingClientRect(),\r\n transform: Transform.parse(self.elements.preview)\r\n });\r\n }\r\n\r\n function scroll(ev) {\r\n var delta, targetZoom;\r\n\r\n if(self.options.mouseWheelZoom === 'ctrl' && ev.ctrlKey !== true){\r\n return 0;\r\n } else if (ev.wheelDelta) {\r\n delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2\r\n } else if (ev.deltaY) {\r\n delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2\r\n } else if (ev.detail) {\r\n delta = ev.detail / -60; //delta min: -3 max: 3 // max x 10 x 2\r\n } else {\r\n delta = 0;\r\n }\r\n\r\n targetZoom = self._currentZoom + (delta * self._currentZoom);\r\n\r\n ev.preventDefault();\r\n _setZoomerVal.call(self, targetZoom);\r\n change.call(self);\r\n }\r\n\r\n self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress\r\n self.elements.zoomer.addEventListener('change', change);\r\n\r\n if (self.options.mouseWheelZoom) {\r\n self.elements.boundary.addEventListener('mousewheel', scroll);\r\n self.elements.boundary.addEventListener('DOMMouseScroll', scroll);\r\n }\r\n }\r\n\r\n function _onZoom(ui) {\r\n var self = this,\r\n transform = ui ? ui.transform : Transform.parse(self.elements.preview),\r\n vpRect = ui ? ui.viewportRect : self.elements.viewport.getBoundingClientRect(),\r\n origin = ui ? ui.origin : new TransformOrigin(self.elements.preview);\r\n\r\n function applyCss() {\r\n var transCss = {};\r\n transCss[CSS_TRANSFORM] = transform.toString();\r\n transCss[CSS_TRANS_ORG] = origin.toString();\r\n css(self.elements.preview, transCss);\r\n }\r\n\r\n self._currentZoom = ui ? ui.value : self._currentZoom;\r\n transform.scale = self._currentZoom;\r\n self.elements.zoomer.setAttribute('aria-valuenow', self._currentZoom);\r\n applyCss();\r\n\r\n if (self.options.enforceBoundary) {\r\n var boundaries = _getVirtualBoundaries.call(self, vpRect),\r\n transBoundaries = boundaries.translate,\r\n oBoundaries = boundaries.origin;\r\n\r\n if (transform.x >= transBoundaries.maxX) {\r\n origin.x = oBoundaries.minX;\r\n transform.x = transBoundaries.maxX;\r\n }\r\n\r\n if (transform.x <= transBoundaries.minX) {\r\n origin.x = oBoundaries.maxX;\r\n transform.x = transBoundaries.minX;\r\n }\r\n\r\n if (transform.y >= transBoundaries.maxY) {\r\n origin.y = oBoundaries.minY;\r\n transform.y = transBoundaries.maxY;\r\n }\r\n\r\n if (transform.y <= transBoundaries.minY) {\r\n origin.y = oBoundaries.maxY;\r\n transform.y = transBoundaries.minY;\r\n }\r\n }\r\n applyCss();\r\n _debouncedOverlay.call(self);\r\n _triggerUpdate.call(self);\r\n }\r\n\r\n function _getVirtualBoundaries(viewport) {\r\n var self = this,\r\n scale = self._currentZoom,\r\n vpWidth = viewport.width,\r\n vpHeight = viewport.height,\r\n centerFromBoundaryX = self.elements.boundary.clientWidth / 2,\r\n centerFromBoundaryY = self.elements.boundary.clientHeight / 2,\r\n imgRect = self.elements.preview.getBoundingClientRect(),\r\n curImgWidth = imgRect.width,\r\n curImgHeight = imgRect.height,\r\n halfWidth = vpWidth / 2,\r\n halfHeight = vpHeight / 2;\r\n\r\n var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1;\r\n var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale)));\r\n\r\n var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1;\r\n var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale)));\r\n\r\n var originMinX = (1 / scale) * halfWidth;\r\n var originMaxX = (curImgWidth * (1 / scale)) - originMinX;\r\n\r\n var originMinY = (1 / scale) * halfHeight;\r\n var originMaxY = (curImgHeight * (1 / scale)) - originMinY;\r\n\r\n return {\r\n translate: {\r\n maxX: maxX,\r\n minX: minX,\r\n maxY: maxY,\r\n minY: minY\r\n },\r\n origin: {\r\n maxX: originMaxX,\r\n minX: originMinX,\r\n maxY: originMaxY,\r\n minY: originMinY\r\n }\r\n };\r\n }\r\n\r\n function _updateCenterPoint(rotate) {\r\n var self = this,\r\n scale = self._currentZoom,\r\n data = self.elements.preview.getBoundingClientRect(),\r\n vpData = self.elements.viewport.getBoundingClientRect(),\r\n transform = Transform.parse(self.elements.preview.style[CSS_TRANSFORM]),\r\n pc = new TransformOrigin(self.elements.preview),\r\n top = (vpData.top - data.top) + (vpData.height / 2),\r\n left = (vpData.left - data.left) + (vpData.width / 2),\r\n center = {},\r\n adj = {};\r\n\r\n if (rotate) {\r\n var cx = pc.x;\r\n var cy = pc.y;\r\n var tx = transform.x;\r\n var ty = transform.y;\r\n\r\n center.y = cx;\r\n center.x = cy;\r\n transform.y = tx;\r\n transform.x = ty;\r\n }\r\n else {\r\n center.y = top / scale;\r\n center.x = left / scale;\r\n\r\n adj.y = (center.y - pc.y) * (1 - scale);\r\n adj.x = (center.x - pc.x) * (1 - scale);\r\n\r\n transform.x -= adj.x;\r\n transform.y -= adj.y;\r\n }\r\n\r\n var newCss = {};\r\n newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px';\r\n newCss[CSS_TRANSFORM] = transform.toString();\r\n css(self.elements.preview, newCss);\r\n }\r\n\r\n function _initDraggable() {\r\n var self = this,\r\n isDragging = false,\r\n originalX,\r\n originalY,\r\n originalDistance,\r\n vpRect,\r\n transform;\r\n\r\n function assignTransformCoordinates(deltaX, deltaY) {\r\n var imgRect = self.elements.preview.getBoundingClientRect(),\r\n top = transform.y + deltaY,\r\n left = transform.x + deltaX;\r\n\r\n if (self.options.enforceBoundary) {\r\n if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) {\r\n transform.y = top;\r\n }\r\n\r\n if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) {\r\n transform.x = left;\r\n }\r\n }\r\n else {\r\n transform.y = top;\r\n transform.x = left;\r\n }\r\n }\r\n\r\n function toggleGrabState(isDragging) {\r\n self.elements.preview.setAttribute('aria-grabbed', isDragging);\r\n self.elements.boundary.setAttribute('aria-dropeffect', isDragging? 'move': 'none');\r\n }\r\n\r\n function keyDown(ev) {\r\n var LEFT_ARROW = 37,\r\n UP_ARROW = 38,\r\n RIGHT_ARROW = 39,\r\n DOWN_ARROW = 40;\r\n\r\n if (ev.shiftKey && (ev.keyCode === UP_ARROW || ev.keyCode === DOWN_ARROW)) {\r\n var zoom;\r\n if (ev.keyCode === UP_ARROW) {\r\n zoom = parseFloat(self.elements.zoomer.value) + parseFloat(self.elements.zoomer.step)\r\n }\r\n else {\r\n zoom = parseFloat(self.elements.zoomer.value) - parseFloat(self.elements.zoomer.step)\r\n }\r\n self.setZoom(zoom);\r\n }\r\n else if (self.options.enableKeyMovement && (ev.keyCode >= 37 && ev.keyCode <= 40)) {\r\n ev.preventDefault();\r\n var movement = parseKeyDown(ev.keyCode);\r\n\r\n transform = Transform.parse(self.elements.preview);\r\n document.body.style[CSS_USERSELECT] = 'none';\r\n vpRect = self.elements.viewport.getBoundingClientRect();\r\n keyMove(movement);\r\n }\r\n\r\n function parseKeyDown(key) {\r\n switch (key) {\r\n case LEFT_ARROW:\r\n return [1, 0];\r\n case UP_ARROW:\r\n return [0, 1];\r\n case RIGHT_ARROW:\r\n return [-1, 0];\r\n case DOWN_ARROW:\r\n return [0, -1];\r\n }\r\n }\r\n }\r\n\r\n function keyMove(movement) {\r\n var deltaX = movement[0],\r\n deltaY = movement[1],\r\n newCss = {};\r\n\r\n assignTransformCoordinates(deltaX, deltaY);\r\n\r\n newCss[CSS_TRANSFORM] = transform.toString();\r\n css(self.elements.preview, newCss);\r\n _updateOverlay.call(self);\r\n document.body.style[CSS_USERSELECT] = '';\r\n _updateCenterPoint.call(self);\r\n _triggerUpdate.call(self);\r\n originalDistance = 0;\r\n }\r\n\r\n function mouseDown(ev) {\r\n if (ev.button !== undefined && ev.button !== 0) return;\r\n\r\n ev.preventDefault();\r\n if (isDragging) return;\r\n isDragging = true;\r\n originalX = ev.pageX;\r\n originalY = ev.pageY;\r\n\r\n if (ev.touches) {\r\n var touches = ev.touches[0];\r\n originalX = touches.pageX;\r\n originalY = touches.pageY;\r\n }\r\n toggleGrabState(isDragging);\r\n transform = Transform.parse(self.elements.preview);\r\n window.addEventListener('mousemove', mouseMove);\r\n window.addEventListener('touchmove', mouseMove);\r\n window.addEventListener('mouseup', mouseUp);\r\n window.addEventListener('touchend', mouseUp);\r\n document.body.style[CSS_USERSELECT] = 'none';\r\n vpRect = self.elements.viewport.getBoundingClientRect();\r\n }\r\n\r\n function mouseMove(ev) {\r\n ev.preventDefault();\r\n var pageX = ev.pageX,\r\n pageY = ev.pageY;\r\n\r\n if (ev.touches) {\r\n var touches = ev.touches[0];\r\n pageX = touches.pageX;\r\n pageY = touches.pageY;\r\n }\r\n\r\n var deltaX = pageX - originalX,\r\n deltaY = pageY - originalY,\r\n newCss = {};\r\n\r\n if (ev.type === 'touchmove') {\r\n if (ev.touches.length > 1) {\r\n var touch1 = ev.touches[0];\r\n var touch2 = ev.touches[1];\r\n var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY));\r\n\r\n if (!originalDistance) {\r\n originalDistance = dist / self._currentZoom;\r\n }\r\n\r\n var scale = dist / originalDistance;\r\n\r\n _setZoomerVal.call(self, scale);\r\n dispatchChange(self.elements.zoomer);\r\n return;\r\n }\r\n }\r\n\r\n assignTransformCoordinates(deltaX, deltaY);\r\n\r\n newCss[CSS_TRANSFORM] = transform.toString();\r\n css(self.elements.preview, newCss);\r\n _updateOverlay.call(self);\r\n originalY = pageY;\r\n originalX = pageX;\r\n }\r\n\r\n function mouseUp() {\r\n isDragging = false;\r\n toggleGrabState(isDragging);\r\n window.removeEventListener('mousemove', mouseMove);\r\n window.removeEventListener('touchmove', mouseMove);\r\n window.removeEventListener('mouseup', mouseUp);\r\n window.removeEventListener('touchend', mouseUp);\r\n document.body.style[CSS_USERSELECT] = '';\r\n _updateCenterPoint.call(self);\r\n _triggerUpdate.call(self);\r\n originalDistance = 0;\r\n }\r\n\r\n self.elements.overlay.addEventListener('mousedown', mouseDown);\r\n self.elements.viewport.addEventListener('keydown', keyDown);\r\n self.elements.overlay.addEventListener('touchstart', mouseDown);\r\n }\r\n\r\n function _updateOverlay() {\r\n if (!this.elements) return; // since this is debounced, it can be fired after destroy\r\n var self = this,\r\n boundRect = self.elements.boundary.getBoundingClientRect(),\r\n imgData = self.elements.preview.getBoundingClientRect();\r\n\r\n css(self.elements.overlay, {\r\n width: imgData.width + 'px',\r\n height: imgData.height + 'px',\r\n top: (imgData.top - boundRect.top) + 'px',\r\n left: (imgData.left - boundRect.left) + 'px'\r\n });\r\n }\r\n var _debouncedOverlay = debounce(_updateOverlay, 500);\r\n\r\n function _triggerUpdate() {\r\n var self = this,\r\n data = self.get();\r\n\r\n if (!_isVisible.call(self)) {\r\n return;\r\n }\r\n\r\n self.options.update.call(self, data);\r\n if (self.$ && typeof Prototype === 'undefined') {\r\n self.$(self.element).trigger('update.croppie', data);\r\n }\r\n else {\r\n var ev;\r\n if (window.CustomEvent) {\r\n ev = new CustomEvent('update', { detail: data });\r\n } else {\r\n ev = document.createEvent('CustomEvent');\r\n ev.initCustomEvent('update', true, true, data);\r\n }\r\n\r\n self.element.dispatchEvent(ev);\r\n }\r\n }\r\n\r\n function _isVisible() {\r\n return this.elements.preview.offsetHeight > 0 && this.elements.preview.offsetWidth > 0;\r\n }\r\n\r\n function _updatePropertiesFromImage() {\r\n var self = this,\r\n initialZoom = 1,\r\n cssReset = {},\r\n img = self.elements.preview,\r\n imgData,\r\n transformReset = new Transform(0, 0, initialZoom),\r\n originReset = new TransformOrigin(),\r\n isVisible = _isVisible.call(self);\r\n\r\n if (!isVisible || self.data.bound) {// if the croppie isn't visible or it doesn't need binding\r\n return;\r\n }\r\n\r\n self.data.bound = true;\r\n cssReset[CSS_TRANSFORM] = transformReset.toString();\r\n cssReset[CSS_TRANS_ORG] = originReset.toString();\r\n cssReset['opacity'] = 1;\r\n css(img, cssReset);\r\n\r\n imgData = self.elements.preview.getBoundingClientRect();\r\n\r\n self._originalImageWidth = imgData.width;\r\n self._originalImageHeight = imgData.height;\r\n self.data.orientation = _hasExif.call(self) ? getExifOrientation(self.elements.img) : self.data.orientation;\r\n\r\n if (self.options.enableZoom) {\r\n _updateZoomLimits.call(self, true);\r\n }\r\n else {\r\n self._currentZoom = initialZoom;\r\n }\r\n\r\n transformReset.scale = self._currentZoom;\r\n cssReset[CSS_TRANSFORM] = transformReset.toString();\r\n css(img, cssReset);\r\n\r\n if (self.data.points.length) {\r\n _bindPoints.call(self, self.data.points);\r\n }\r\n else {\r\n _centerImage.call(self);\r\n }\r\n\r\n _updateCenterPoint.call(self);\r\n _updateOverlay.call(self);\r\n }\r\n\r\n function _updateZoomLimits (initial) {\r\n var self = this,\r\n minZoom = Math.max(self.options.minZoom, 0) || 0,\r\n maxZoom = self.options.maxZoom || 1.5,\r\n initialZoom,\r\n defaultInitialZoom,\r\n zoomer = self.elements.zoomer,\r\n scale = parseFloat(zoomer.value),\r\n boundaryData = self.elements.boundary.getBoundingClientRect(),\r\n imgData = naturalImageDimensions(self.elements.img, self.data.orientation),\r\n vpData = self.elements.viewport.getBoundingClientRect(),\r\n minW,\r\n minH;\r\n if (self.options.enforceBoundary) {\r\n minW = vpData.width / imgData.width;\r\n minH = vpData.height / imgData.height;\r\n minZoom = Math.max(minW, minH);\r\n }\r\n\r\n if (minZoom >= maxZoom) {\r\n maxZoom = minZoom + 1;\r\n }\r\n\r\n zoomer.min = fix(minZoom, 4);\r\n zoomer.max = fix(maxZoom, 4);\r\n\r\n if (!initial && (scale < zoomer.min || scale > zoomer.max)) {\r\n _setZoomerVal.call(self, scale < zoomer.min ? zoomer.min : zoomer.max);\r\n }\r\n else if (initial) {\r\n defaultInitialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));\r\n initialZoom = self.data.boundZoom !== null ? self.data.boundZoom : defaultInitialZoom;\r\n _setZoomerVal.call(self, initialZoom);\r\n }\r\n\r\n dispatchChange(zoomer);\r\n }\r\n\r\n function _bindPoints(points) {\r\n if (points.length !== 4) {\r\n throw \"Croppie - Invalid number of points supplied: \" + points;\r\n }\r\n var self = this,\r\n pointsWidth = points[2] - points[0],\r\n // pointsHeight = points[3] - points[1],\r\n vpData = self.elements.viewport.getBoundingClientRect(),\r\n boundRect = self.elements.boundary.getBoundingClientRect(),\r\n vpOffset = {\r\n left: vpData.left - boundRect.left,\r\n top: vpData.top - boundRect.top\r\n },\r\n scale = vpData.width / pointsWidth,\r\n originTop = points[1],\r\n originLeft = points[0],\r\n transformTop = (-1 * points[1]) + vpOffset.top,\r\n transformLeft = (-1 * points[0]) + vpOffset.left,\r\n newCss = {};\r\n\r\n newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px';\r\n newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString();\r\n css(self.elements.preview, newCss);\r\n\r\n _setZoomerVal.call(self, scale);\r\n self._currentZoom = scale;\r\n }\r\n\r\n function _centerImage() {\r\n var self = this,\r\n imgDim = self.elements.preview.getBoundingClientRect(),\r\n vpDim = self.elements.viewport.getBoundingClientRect(),\r\n boundDim = self.elements.boundary.getBoundingClientRect(),\r\n vpLeft = vpDim.left - boundDim.left,\r\n vpTop = vpDim.top - boundDim.top,\r\n w = vpLeft - ((imgDim.width - vpDim.width) / 2),\r\n h = vpTop - ((imgDim.height - vpDim.height) / 2),\r\n transform = new Transform(w, h, self._currentZoom);\r\n\r\n css(self.elements.preview, CSS_TRANSFORM, transform.toString());\r\n }\r\n\r\n function _transferImageToCanvas(customOrientation) {\r\n var self = this,\r\n canvas = self.elements.canvas,\r\n img = self.elements.img,\r\n ctx = canvas.getContext('2d');\r\n\r\n ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n\r\n var orientation = self.options.enableOrientation && customOrientation || getExifOrientation(img);\r\n drawCanvas(canvas, img, orientation);\r\n }\r\n\r\n function _getCanvas(data) {\r\n var self = this,\r\n points = data.points,\r\n left = num(points[0]),\r\n top = num(points[1]),\r\n right = num(points[2]),\r\n bottom = num(points[3]),\r\n width = right-left,\r\n height = bottom-top,\r\n circle = data.circle,\r\n canvas = document.createElement('canvas'),\r\n ctx = canvas.getContext('2d'),\r\n startX = 0,\r\n startY = 0,\r\n canvasWidth = data.outputWidth || width,\r\n canvasHeight = data.outputHeight || height;\r\n\r\n canvas.width = canvasWidth;\r\n canvas.height = canvasHeight;\r\n\r\n if (data.backgroundColor) {\r\n ctx.fillStyle = data.backgroundColor;\r\n ctx.fillRect(0, 0, canvasWidth, canvasHeight);\r\n }\r\n\r\n // By default assume we're going to draw the entire\r\n // source image onto the destination canvas.\r\n var sx = left,\r\n sy = top,\r\n sWidth = width,\r\n sHeight = height,\r\n dx = 0,\r\n dy = 0,\r\n dWidth = canvasWidth,\r\n dHeight = canvasHeight;\r\n\r\n //\r\n // Do not go outside of the original image's bounds along the x-axis.\r\n // Handle translations when projecting onto the destination canvas.\r\n //\r\n\r\n // The smallest possible source x-position is 0.\r\n if (left < 0) {\r\n sx = 0;\r\n dx = (Math.abs(left) / width) * canvasWidth;\r\n }\r\n\r\n // The largest possible source width is the original image's width.\r\n if (sWidth + sx > self._originalImageWidth) {\r\n sWidth = self._originalImageWidth - sx;\r\n dWidth = (sWidth / width) * canvasWidth;\r\n }\r\n\r\n //\r\n // Do not go outside of the original image's bounds along the y-axis.\r\n //\r\n\r\n // The smallest possible source y-position is 0.\r\n if (top < 0) {\r\n sy = 0;\r\n dy = (Math.abs(top) / height) * canvasHeight;\r\n }\r\n\r\n // The largest possible source height is the original image's height.\r\n if (sHeight + sy > self._originalImageHeight) {\r\n sHeight = self._originalImageHeight - sy;\r\n dHeight = (sHeight / height) * canvasHeight;\r\n }\r\n\r\n // console.table({ left, right, top, bottom, canvasWidth, canvasHeight, width, height, startX, startY, circle, sx, sy, dx, dy, sWidth, sHeight, dWidth, dHeight });\r\n\r\n ctx.drawImage(this.elements.preview, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);\r\n if (circle) {\r\n ctx.fillStyle = '#fff';\r\n ctx.globalCompositeOperation = 'destination-in';\r\n ctx.beginPath();\r\n ctx.arc(canvas.width / 2, canvas.height / 2, canvas.width / 2, 0, Math.PI * 2, true);\r\n ctx.closePath();\r\n ctx.fill();\r\n }\r\n return canvas;\r\n }\r\n\r\n function _getHtmlResult(data) {\r\n var points = data.points,\r\n div = document.createElement('div'),\r\n img = document.createElement('img'),\r\n width = points[2] - points[0],\r\n height = points[3] - points[1];\r\n\r\n addClass(div, 'croppie-result');\r\n div.appendChild(img);\r\n css(img, {\r\n left: (-1 * points[0]) + 'px',\r\n top: (-1 * points[1]) + 'px'\r\n });\r\n img.src = data.url;\r\n css(div, {\r\n width: width + 'px',\r\n height: height + 'px'\r\n });\r\n\r\n return div;\r\n }\r\n\r\n function _getBase64Result(data) {\r\n return _getCanvas.call(this, data).toDataURL(data.format, data.quality);\r\n }\r\n\r\n function _getBlobResult(data) {\r\n var self = this;\r\n return new Promise(function (resolve) {\r\n _getCanvas.call(self, data).toBlob(function (blob) {\r\n resolve(blob);\r\n }, data.format, data.quality);\r\n });\r\n }\r\n\r\n function _replaceImage(img) {\r\n if (this.elements.img.parentNode) {\r\n Array.prototype.forEach.call(this.elements.img.classList, function(c) { img.classList.add(c); });\r\n this.elements.img.parentNode.replaceChild(img, this.elements.img);\r\n this.elements.preview = img; // if the img is attached to the DOM, they're not using the canvas\r\n }\r\n this.elements.img = img;\r\n }\r\n\r\n function _bind(options, cb) {\r\n var self = this,\r\n url,\r\n points = [],\r\n zoom = null,\r\n hasExif = _hasExif.call(self);\r\n\r\n if (typeof (options) === 'string') {\r\n url = options;\r\n options = {};\r\n }\r\n else if (Array.isArray(options)) {\r\n points = options.slice();\r\n }\r\n else if (typeof (options) === 'undefined' && self.data.url) { //refreshing\r\n _updatePropertiesFromImage.call(self);\r\n _triggerUpdate.call(self);\r\n return null;\r\n }\r\n else {\r\n url = options.url;\r\n points = options.points || [];\r\n zoom = typeof(options.zoom) === 'undefined' ? null : options.zoom;\r\n }\r\n\r\n self.data.bound = false;\r\n self.data.url = url || self.data.url;\r\n self.data.boundZoom = zoom;\r\n\r\n return loadImage(url, hasExif).then(function (img) {\r\n _replaceImage.call(self, img);\r\n if (!points.length) {\r\n var natDim = naturalImageDimensions(img);\r\n var rect = self.elements.viewport.getBoundingClientRect();\r\n var aspectRatio = rect.width / rect.height;\r\n var imgAspectRatio = natDim.width / natDim.height;\r\n var width, height;\r\n\r\n if (imgAspectRatio > aspectRatio) {\r\n height = natDim.height;\r\n width = height * aspectRatio;\r\n }\r\n else {\r\n width = natDim.width;\r\n height = natDim.height / aspectRatio;\r\n }\r\n\r\n var x0 = (natDim.width - width) / 2;\r\n var y0 = (natDim.height - height) / 2;\r\n var x1 = x0 + width;\r\n var y1 = y0 + height;\r\n self.data.points = [x0, y0, x1, y1];\r\n }\r\n else if (self.options.relative) {\r\n points = [\r\n points[0] * img.naturalWidth / 100,\r\n points[1] * img.naturalHeight / 100,\r\n points[2] * img.naturalWidth / 100,\r\n points[3] * img.naturalHeight / 100\r\n ];\r\n }\r\n\r\n self.data.orientation = options.orientation || 1;\r\n self.data.points = points.map(function (p) {\r\n return parseFloat(p);\r\n });\r\n if (self.options.useCanvas) {\r\n _transferImageToCanvas.call(self, self.data.orientation);\r\n }\r\n _updatePropertiesFromImage.call(self);\r\n _triggerUpdate.call(self);\r\n cb && cb();\r\n });\r\n }\r\n\r\n function fix(v, decimalPoints) {\r\n return parseFloat(v).toFixed(decimalPoints || 0);\r\n }\r\n\r\n function _get() {\r\n var self = this,\r\n imgData = self.elements.preview.getBoundingClientRect(),\r\n vpData = self.elements.viewport.getBoundingClientRect(),\r\n x1 = vpData.left - imgData.left,\r\n y1 = vpData.top - imgData.top,\r\n widthDiff = (vpData.width - self.elements.viewport.offsetWidth) / 2, //border\r\n heightDiff = (vpData.height - self.elements.viewport.offsetHeight) / 2,\r\n x2 = x1 + self.elements.viewport.offsetWidth + widthDiff,\r\n y2 = y1 + self.elements.viewport.offsetHeight + heightDiff,\r\n scale = self._currentZoom;\r\n\r\n if (scale === Infinity || isNaN(scale)) {\r\n scale = 1;\r\n }\r\n\r\n var max = self.options.enforceBoundary ? 0 : Number.NEGATIVE_INFINITY;\r\n x1 = Math.max(max, x1 / scale);\r\n y1 = Math.max(max, y1 / scale);\r\n x2 = Math.max(max, x2 / scale);\r\n y2 = Math.max(max, y2 / scale);\r\n\r\n return {\r\n points: [fix(x1), fix(y1), fix(x2), fix(y2)],\r\n zoom: scale,\r\n orientation: self.data.orientation\r\n };\r\n }\r\n\r\n var RESULT_DEFAULTS = {\r\n type: 'canvas',\r\n format: 'png',\r\n quality: 1\r\n },\r\n RESULT_FORMATS = ['jpeg', 'webp', 'png'];\r\n\r\n function _result(options) {\r\n var self = this,\r\n data = _get.call(self),\r\n opts = deepExtend(clone(RESULT_DEFAULTS), clone(options)),\r\n resultType = (typeof (options) === 'string' ? options : (opts.type || 'base64')),\r\n size = opts.size || 'viewport',\r\n format = opts.format,\r\n quality = opts.quality,\r\n backgroundColor = opts.backgroundColor,\r\n circle = typeof opts.circle === 'boolean' ? opts.circle : (self.options.viewport.type === 'circle'),\r\n vpRect = self.elements.viewport.getBoundingClientRect(),\r\n ratio = vpRect.width / vpRect.height,\r\n prom;\r\n\r\n if (size === 'viewport') {\r\n data.outputWidth = vpRect.width;\r\n data.outputHeight = vpRect.height;\r\n } else if (typeof size === 'object') {\r\n if (size.width && size.height) {\r\n data.outputWidth = size.width;\r\n data.outputHeight = size.height;\r\n } else if (size.width) {\r\n data.outputWidth = size.width;\r\n data.outputHeight = size.width / ratio;\r\n } else if (size.height) {\r\n data.outputWidth = size.height * ratio;\r\n data.outputHeight = size.height;\r\n }\r\n }\r\n\r\n if (RESULT_FORMATS.indexOf(format) > -1) {\r\n data.format = 'image/' + format;\r\n data.quality = quality;\r\n }\r\n\r\n data.circle = circle;\r\n data.url = self.data.url;\r\n data.backgroundColor = backgroundColor;\r\n\r\n prom = new Promise(function (resolve) {\r\n switch(resultType.toLowerCase())\r\n {\r\n case 'rawcanvas':\r\n resolve(_getCanvas.call(self, data));\r\n break;\r\n case 'canvas':\r\n case 'base64':\r\n resolve(_getBase64Result.call(self, data));\r\n break;\r\n case 'blob':\r\n _getBlobResult.call(self, data).then(resolve);\r\n break;\r\n default:\r\n resolve(_getHtmlResult.call(self, data));\r\n break;\r\n }\r\n });\r\n return prom;\r\n }\r\n\r\n function _refresh() {\r\n _updatePropertiesFromImage.call(this);\r\n }\r\n\r\n function _rotate(deg) {\r\n if (!this.options.useCanvas || !this.options.enableOrientation) {\r\n throw 'Croppie: Cannot rotate without enableOrientation && EXIF.js included';\r\n }\r\n\r\n var self = this,\r\n canvas = self.elements.canvas;\r\n\r\n self.data.orientation = getExifOffset(self.data.orientation, deg);\r\n drawCanvas(canvas, self.elements.img, self.data.orientation);\r\n _updateCenterPoint.call(self, true);\r\n _updateZoomLimits.call(self);\r\n\r\n // Reverses image dimensions if the degrees of rotation is not divisible by 180.\r\n if ((Math.abs(deg) / 90) % 2 === 1) {\r\n var oldHeight = self._originalImageHeight;\r\n var oldWidth = self._originalImageWidth;\r\n self._originalImageWidth = oldHeight;\r\n self._originalImageHeight = oldWidth;\r\n }\r\n }\r\n\r\n function _destroy() {\r\n var self = this;\r\n self.element.removeChild(self.elements.boundary);\r\n removeClass(self.element, 'croppie-container');\r\n if (self.options.enableZoom) {\r\n self.element.removeChild(self.elements.zoomerWrap);\r\n }\r\n delete self.elements;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.jQuery) {\r\n var $ = window.jQuery;\r\n $.fn.croppie = function (opts) {\r\n var ot = typeof opts;\r\n\r\n if (ot === 'string') {\r\n var args = Array.prototype.slice.call(arguments, 1);\r\n var singleInst = $(this).data('croppie');\r\n\r\n if (opts === 'get') {\r\n return singleInst.get();\r\n }\r\n else if (opts === 'result') {\r\n return singleInst.result.apply(singleInst, args);\r\n }\r\n else if (opts === 'bind') {\r\n return singleInst.bind.apply(singleInst, args);\r\n }\r\n\r\n return this.each(function () {\r\n var i = $(this).data('croppie');\r\n if (!i) return;\r\n\r\n var method = i[opts];\r\n if ($.isFunction(method)) {\r\n method.apply(i, args);\r\n if (opts === 'destroy') {\r\n $(this).removeData('croppie');\r\n }\r\n }\r\n else {\r\n throw 'Croppie ' + opts + ' method not found';\r\n }\r\n });\r\n }\r\n else {\r\n return this.each(function () {\r\n var i = new Croppie(this, opts);\r\n i.$ = $;\r\n $(this).data('croppie', i);\r\n });\r\n }\r\n };\r\n }\r\n\r\n function Croppie(element, opts) {\r\n if (element.className.indexOf('croppie-container') > -1) {\r\n throw new Error(\"Croppie: Can't initialize croppie more than once\");\r\n }\r\n this.element = element;\r\n this.options = deepExtend(clone(Croppie.defaults), opts);\r\n\r\n if (this.element.tagName.toLowerCase() === 'img') {\r\n var origImage = this.element;\r\n addClass(origImage, 'cr-original-image');\r\n setAttributes(origImage, {'aria-hidden' : 'true', 'alt' : '' });\r\n var replacementDiv = document.createElement('div');\r\n this.element.parentNode.appendChild(replacementDiv);\r\n replacementDiv.appendChild(origImage);\r\n this.element = replacementDiv;\r\n this.options.url = this.options.url || origImage.src;\r\n }\r\n\r\n _create.call(this);\r\n if (this.options.url) {\r\n var bindOpts = {\r\n url: this.options.url,\r\n points: this.options.points\r\n };\r\n delete this.options['url'];\r\n delete this.options['points'];\r\n _bind.call(this, bindOpts);\r\n }\r\n }\r\n\r\n Croppie.defaults = {\r\n viewport: {\r\n width: 100,\r\n height: 100,\r\n type: 'square'\r\n },\r\n boundary: { },\r\n orientationControls: {\r\n enabled: true,\r\n leftClass: '',\r\n rightClass: ''\r\n },\r\n resizeControls: {\r\n width: true,\r\n height: true\r\n },\r\n customClass: '',\r\n showZoomer: true,\r\n enableZoom: true,\r\n enableResize: false,\r\n mouseWheelZoom: true,\r\n enableExif: false,\r\n enforceBoundary: true,\r\n enableOrientation: false,\r\n enableKeyMovement: true,\r\n update: function () { }\r\n };\r\n\r\n Croppie.globals = {\r\n translate: 'translate3d'\r\n };\r\n\r\n deepExtend(Croppie.prototype, {\r\n bind: function (options, cb) {\r\n return _bind.call(this, options, cb);\r\n },\r\n get: function () {\r\n var data = _get.call(this);\r\n var points = data.points;\r\n if (this.options.relative) {\r\n points[0] /= this.elements.img.naturalWidth / 100;\r\n points[1] /= this.elements.img.naturalHeight / 100;\r\n points[2] /= this.elements.img.naturalWidth / 100;\r\n points[3] /= this.elements.img.naturalHeight / 100;\r\n }\r\n return data;\r\n },\r\n result: function (type) {\r\n return _result.call(this, type);\r\n },\r\n refresh: function () {\r\n return _refresh.call(this);\r\n },\r\n setZoom: function (v) {\r\n _setZoomerVal.call(this, v);\r\n dispatchChange(this.elements.zoomer);\r\n },\r\n rotate: function (deg) {\r\n _rotate.call(this, deg);\r\n },\r\n destroy: function () {\r\n return _destroy.call(this);\r\n }\r\n });\r\n return Croppie;\r\n}));\r\n"],"names":["self","Promise","a","b","apply","arguments","c","this","TypeError","_state","_value","_deferreds","i","e","f","d","push","k","onFulfilled","onRejected","reject","resolve","then","g","call","length","h","j","setTimeout","setImmediate","l","Array","isArray","Object","prototype","toString","all","slice","constructor","race","_setImmediateFn","module","exports","window","CustomEvent","event","params","bubbles","cancelable","detail","undefined","evt","document","createEvent","initCustomEvent","Event","HTMLCanvasElement","toBlob","defineProperty","value","callback","type","quality","binStr","atob","toDataURL","split","len","arr","Uint8Array","charCodeAt","Blob","CSS_TRANS_ORG","CSS_TRANSFORM","CSS_USERSELECT","cssPrefixes","emptyStyles","createElement","style","EXIF_NORM","EXIF_FLIP","vendorPrefix","prop","capProp","toUpperCase","deepExtend","destination","source","property","clone","object","dispatchChange","element","initEvent","dispatchEvent","fireEvent","css","el","styles","val","tmp","addClass","classList","add","className","setAttributes","attrs","key","setAttribute","num","v","parseInt","naturalImageDimensions","img","ornt","w","naturalWidth","naturalHeight","orient","getExifOrientation","x","width","height","TRANSLATE_OPTS","suffix","Transform","y","scale","parseFloat","parse","indexOf","fromMatrix","fromString","vals","substring","values","translate","Croppie","globals","TransformOrigin","exifdata","Orientation","drawCanvas","canvas","orientation","ctx","getContext","save","rotate","Math","PI","drawImage","restore","_create","boundary","viewport","overlay","bw","bh","customViewportClass","options","useCanvas","enableOrientation","_hasExif","data","elements","preview","isNaN","appendChild","customClass","_initDraggable","enableZoom","_initializeZoom","enableResize","_initializeResize","enableExif","EXIF","direction","originalX","originalY","maxWidth","maxHeight","vr","hr","wrap","isDragging","mouseDown","ev","button","preventDefault","overlayRect","getBoundingClientRect","pageX","pageY","currentTarget","touches","addEventListener","mouseMove","mouseUp","body","deltaX","deltaY","newHeight","newWidth","_updateOverlay","_updateZoomLimits","_updateCenterPoint","_triggerUpdate","removeEventListener","resizeControls","_setZoomerVal","z","zoomer","fix","max","min","zoomerWrap","change","_onZoom","origin","viewportRect","transform","scroll","delta","targetZoom","mouseWheelZoom","ctrlKey","wheelDelta","_currentZoom","step","display","showZoomer","ui","vpRect","applyCss","transCss","enforceBoundary","boundaries","_getVirtualBoundaries","transBoundaries","oBoundaries","maxX","minX","maxY","minY","_debouncedOverlay","vpWidth","vpHeight","centerFromBoundaryX","clientWidth","centerFromBoundaryY","clientHeight","imgRect","curImgWidth","curImgHeight","halfWidth","halfHeight","originMinX","originMinY","vpData","pc","top","left","center","adj","cx","cy","tx","ty","newCss","originalDistance","assignTransformCoordinates","bottom","right","toggleGrabState","touch1","touch2","dist","sqrt","zoom","shiftKey","keyCode","enableKeyMovement","movement","parseKeyDown","keyMove","setZoom","boundRect","imgData","func","wait","immediate","timeout","context","args","later","callNow","clearTimeout","get","_isVisible","update","$","Prototype","trigger","offsetHeight","offsetWidth","_updatePropertiesFromImage","cssReset","transformReset","originReset","bound","_originalImageWidth","_originalImageHeight","points","_bindPoints","_centerImage","initial","initialZoom","defaultInitialZoom","minW","minH","minZoom","maxZoom","boundaryData","boundZoom","pointsWidth","vpOffset","originTop","originLeft","transformTop","transformLeft","imgDim","vpDim","boundDim","vpLeft","vpTop","_transferImageToCanvas","customOrientation","clearRect","_getCanvas","circle","canvasWidth","outputWidth","canvasHeight","outputHeight","backgroundColor","fillStyle","fillRect","sx","sy","sWidth","sHeight","dx","dy","dWidth","dHeight","abs","globalCompositeOperation","beginPath","arc","closePath","fill","_getHtmlResult","div","src","url","_getBase64Result","format","_getBlobResult","blob","_replaceImage","parentNode","forEach","replaceChild","_bind","cb","hasExif","doExif","Image","opacity","_resolve","removeAttribute","match","onload","getData","onerror","loadImage","relative","natDim","rect","aspectRatio","x0","y0","x1","y1","map","p","decimalPoints","toFixed","_get","widthDiff","heightDiff","x2","y2","Infinity","Number","NEGATIVE_INFINITY","RESULT_DEFAULTS","RESULT_FORMATS","_result","opts","resultType","size","ratio","toLowerCase","_refresh","_rotate","deg","index","offset","oldHeight","oldWidth","_destroy","removeChild","remove","replace","jQuery","fn","croppie","singleInst","result","bind","each","method","isFunction","removeData","Error","defaults","tagName","origImage","replacementDiv","bindOpts","orientationControls","enabled","leftClass","rightClass","refresh","destroy"],"sourceRoot":""}