{"version":3,"sources":["webpack:///./node_modules/compressorjs/dist/compressor.js"],"names":["global","factory","module","exports","this","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread2","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_classCallCheck","instance","Constructor","TypeError","_defineProperties","props","descriptor","configurable","writable","_toPropertyKey","_createClass","protoProps","staticProps","prototype","obj","value","_extends","assign","bind","hasOwnProperty","call","_toPrimitive","input","hint","prim","Symbol","toPrimitive","undefined","res","String","Number","arg","canvasToBlob","window","CanvasPrototype","HTMLCanvasElement","hasBlobConstructor","Blob","Boolean","e","hasArrayBufferViewSupport","Uint8Array","size","BlobBuilder","WebKitBlobBuilder","MozBlobBuilder","MSBlobBuilder","dataURIPattern","dataURLtoBlob","atob","ArrayBuffer","dataURI","matches","mediaType","isBase64","dataString","byteString","arrayBuffer","intArray","bb","match","Error","slice","decodeURIComponent","charCodeAt","type","append","getBlob","toBlob","mozGetAsFile","callback","quality","self","setTimeout","toDataURL","msToBlob","isBlob","toString","DEFAULTS","strict","checkOrientation","retainExif","maxWidth","Infinity","maxHeight","minWidth","minHeight","width","height","resize","mimeType","convertTypes","convertSize","beforeDraw","drew","success","error","IS_BROWSER","document","WINDOW","isPositiveNumber","Array","toArray","from","REGEXP_IMAGE_TYPE","isImageType","test","imageTypeToExtension","extension","substr","concat","fromCharCode","getStringFromCharCode","dataView","start","str","getUint8","btoa","arrayBufferToDataURL","chunks","chunkSize","uint8","subarray","join","resetAndGetOrientation","orientation","DataView","littleEndian","app1Start","ifdStart","byteLength","offset","exifIDCode","tiffOffset","endianness","getUint16","firstIFDOffset","getUint32","_offset","_length","setUint16","parseOrientation","rotate","scaleX","scaleY","REGEXP_DECIMALS","normalizeDecimalNumber","times","Math","round","getAdjustedSizes","_ref","aspectRatio","isValidWidth","isValidHeight","adjustedWidth","getExif","array","segments","next","end","segment","reduce","exifArray","current","insertExif","app0Length","newArrayBuffer","ArrayBuffer$1","FileReader","URL","webkitURL","REGEXP_EXTENSION","AnotherCompressor","Compressor","file","options","exif","image","Image","aborted","result","init","_this","isJPEGImage","reader","onload","data","url","createObjectURL","load","onabort","fail","onerror","onloadend","readAsArrayBuffer","readAsDataURL","_this2","draw","naturalWidth","naturalHeight","navigator","userAgent","crossOrigin","alt","name","src","_ref2","_this3","_ref2$rotate","_ref2$scaleX","_ref2$scaleY","canvas","createElement","context","getContext","is90DegreesRotated","abs","resizable","max","_ref3","_ref4","_ref5","_getAdjustedSizes","_getAdjustedSizes2","_getAdjustedSizes3","_getAdjustedSizes4","_getAdjustedSizes4$wi","_getAdjustedSizes4$he","floor","min","destX","destY","destWidth","destHeight","params","srcX","srcY","srcWidth","srcHeight","_getAdjustedSizes5","contain","cover","_ref6","fillStyle","indexOf","fillRect","save","translate","PI","scale","drawImage","restore","blob","done","then","catch","_ref7","_ref8","revokeObjectURL","date","Date","lastModified","getTime","lastModifiedDate","replace","err","abort","complete"],"mappings":";;;;;;;;;;CAUA,SAAWA,EAAQC,GAC8CC,EAAOC,QAAUF,KADlF,CAIGG,GAAM,WAAe,aAEtB,SAASC,EAAQC,EAAQC,GACvB,IAAIC,EAAOC,OAAOD,KAAKF,GACvB,GAAIG,OAAOC,sBAAuB,CAChC,IAAIC,EAAUF,OAAOC,sBAAsBJ,GAC3CC,IAAmBI,EAAUA,EAAQC,QAAO,SAAUC,GACpD,OAAOJ,OAAOK,yBAAyBR,EAAQO,GAAKE,eACjDP,EAAKQ,KAAKC,MAAMT,EAAMG,GAE7B,OAAOH,EAET,SAASU,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CACzC,IAAIG,EAAS,MAAQF,UAAUD,GAAKC,UAAUD,GAAK,GACnDA,EAAI,EAAIf,EAAQI,OAAOc,IAAS,GAAIC,SAAQ,SAAUC,GACpDC,EAAgBP,EAAQM,EAAKF,EAAO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js v1.2.1\n * https://fengyuanchen.github.io/compressorjs\n *\n * Copyright 2018-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2023-02-28T14:09:41.732Z\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Compressor = factory());\n})(this, (function () { 'use strict';\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n }\n function _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n }\n\n var canvasToBlob = {exports: {}};\n\n /*\n * JavaScript Canvas to Blob\n * https://github.com/blueimp/JavaScript-Canvas-to-Blob\n *\n * Copyright 2012, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on stackoverflow user Stoive's code snippet:\n * http://stackoverflow.com/q/4998908\n */\n (function (module) {\n if (typeof window === 'undefined') {\n return;\n }\n (function (window) {\n\n var CanvasPrototype = window.HTMLCanvasElement && window.HTMLCanvasElement.prototype;\n var hasBlobConstructor = window.Blob && function () {\n try {\n return Boolean(new Blob());\n } catch (e) {\n return false;\n }\n }();\n var hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && function () {\n try {\n return new Blob([new Uint8Array(100)]).size === 100;\n } catch (e) {\n return false;\n }\n }();\n var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n var dataURIPattern = /^data:((.*?)(;charset=.*?)?)(;base64)?,/;\n var dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array && function (dataURI) {\n var matches, mediaType, isBase64, dataString, byteString, arrayBuffer, intArray, i, bb;\n // Parse the dataURI components as per RFC 2397\n matches = dataURI.match(dataURIPattern);\n if (!matches) {\n throw new Error('invalid data URI');\n }\n // Default to text/plain;charset=US-ASCII\n mediaType = matches[2] ? matches[1] : 'text/plain' + (matches[3] || ';charset=US-ASCII');\n isBase64 = !!matches[4];\n dataString = dataURI.slice(matches[0].length);\n if (isBase64) {\n // Convert base64 to raw binary data held in a string:\n byteString = atob(dataString);\n } else {\n // Convert base64/URLEncoded data component to raw binary:\n byteString = decodeURIComponent(dataString);\n }\n // Write the bytes of the string to an ArrayBuffer:\n arrayBuffer = new ArrayBuffer(byteString.length);\n intArray = new Uint8Array(arrayBuffer);\n for (i = 0; i < byteString.length; i += 1) {\n intArray[i] = byteString.charCodeAt(i);\n }\n // Write the ArrayBuffer (or ArrayBufferView) to a blob:\n if (hasBlobConstructor) {\n return new Blob([hasArrayBufferViewSupport ? intArray : arrayBuffer], {\n type: mediaType\n });\n }\n bb = new BlobBuilder();\n bb.append(arrayBuffer);\n return bb.getBlob(mediaType);\n };\n if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {\n if (CanvasPrototype.mozGetAsFile) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n } else {\n callback(self.mozGetAsFile('blob', type));\n }\n });\n };\n } else if (CanvasPrototype.toDataURL && dataURLtoBlob) {\n if (CanvasPrototype.msToBlob) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n if ((type && type !== 'image/png' || quality) && CanvasPrototype.toDataURL && dataURLtoBlob) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n } else {\n callback(self.msToBlob(type));\n }\n });\n };\n } else {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n });\n };\n }\n }\n }\n if (module.exports) {\n module.exports = dataURLtoBlob;\n } else {\n window.dataURLtoBlob = dataURLtoBlob;\n }\n })(window);\n })(canvasToBlob);\n var toBlob = canvasToBlob.exports;\n\n var isBlob = function isBlob(value) {\n if (typeof Blob === 'undefined') {\n return false;\n }\n return value instanceof Blob || Object.prototype.toString.call(value) === '[object Blob]';\n };\n\n var DEFAULTS = {\n /**\n * Indicates if output the original image instead of the compressed one\n * when the size of the compressed image is greater than the original one's\n * @type {boolean}\n */\n strict: true,\n /**\n * Indicates if read the image's Exif Orientation information,\n * and then rotate or flip the image automatically.\n * @type {boolean}\n */\n checkOrientation: true,\n /**\n * Indicates if retain the image's Exif information after compressed.\n * @type {boolean}\n */\n retainExif: false,\n /**\n * The max width of the output image.\n * @type {number}\n */\n maxWidth: Infinity,\n /**\n * The max height of the output image.\n * @type {number}\n */\n maxHeight: Infinity,\n /**\n * The min width of the output image.\n * @type {number}\n */\n minWidth: 0,\n /**\n * The min height of the output image.\n * @type {number}\n */\n minHeight: 0,\n /**\n * The width of the output image.\n * If not specified, the natural width of the source image will be used.\n * @type {number}\n */\n width: undefined,\n /**\n * The height of the output image.\n * If not specified, the natural height of the source image will be used.\n * @type {number}\n */\n height: undefined,\n /**\n * Sets how the size of the image should be resized to the container\n * specified by the `width` and `height` options.\n * @type {string}\n */\n resize: 'none',\n /**\n * The quality of the output image.\n * It must be a number between `0` and `1`,\n * and only available for `image/jpeg` and `image/webp` images.\n * Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.\n * @type {number}\n */\n quality: 0.8,\n /**\n * The mime type of the output image.\n * By default, the original mime type of the source image file will be used.\n * @type {string}\n */\n mimeType: 'auto',\n /**\n * Files whose file type is included in this list,\n * and whose file size exceeds the `convertSize` value will be converted to JPEGs.\n * @type {string|Array}\n */\n convertTypes: ['image/png'],\n /**\n * PNG files over this size (5 MB by default) will be converted to JPEGs.\n * To disable this, just set the value to `Infinity`.\n * @type {number}\n */\n convertSize: 5000000,\n /**\n * The hook function to execute before draw the image into the canvas for compression.\n * @type {Function}\n * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.\n * @param {HTMLCanvasElement} canvas - The canvas for compression.\n * @example\n * function (context, canvas) {\n * context.fillStyle = '#fff';\n * }\n */\n beforeDraw: null,\n /**\n * The hook function to execute after drew the image into the canvas for compression.\n * @type {Function}\n * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.\n * @param {HTMLCanvasElement} canvas - The canvas for compression.\n * @example\n * function (context, canvas) {\n * context.filter = 'grayscale(100%)';\n * }\n */\n drew: null,\n /**\n * The hook function to execute when success to compress the image.\n * @type {Function}\n * @param {File} file - The compressed image File object.\n * @example\n * function (file) {\n * console.log(file);\n * }\n */\n success: null,\n /**\n * The hook function to execute when fail to compress the image.\n * @type {Function}\n * @param {Error} err - An Error object.\n * @example\n * function (err) {\n * console.log(err.message);\n * }\n */\n error: null\n };\n\n var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var WINDOW = IS_BROWSER ? window : {};\n\n /**\n * Check if the given value is a positive number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.\n */\n var isPositiveNumber = function isPositiveNumber(value) {\n return value > 0 && value < Infinity;\n };\n var slice = Array.prototype.slice;\n\n /**\n * Convert array-like or iterable object to an array.\n * @param {*} value - The value to convert.\n * @returns {Array} Returns a new array.\n */\n function toArray(value) {\n return Array.from ? Array.from(value) : slice.call(value);\n }\n var REGEXP_IMAGE_TYPE = /^image\\/.+$/;\n\n /**\n * Check if the given value is a mime type of image.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given is a mime type of image, else `false`.\n */\n function isImageType(value) {\n return REGEXP_IMAGE_TYPE.test(value);\n }\n\n /**\n * Convert image type to extension.\n * @param {string} value - The image type to convert.\n * @returns {boolean} Returns the image extension.\n */\n function imageTypeToExtension(value) {\n var extension = isImageType(value) ? value.substr(6) : '';\n if (extension === 'jpeg') {\n extension = 'jpg';\n }\n return \".\".concat(extension);\n }\n var fromCharCode = String.fromCharCode;\n\n /**\n * Get string from char code in data view.\n * @param {DataView} dataView - The data view for read.\n * @param {number} start - The start index.\n * @param {number} length - The read length.\n * @returns {string} The read result.\n */\n function getStringFromCharCode(dataView, start, length) {\n var str = '';\n var i;\n length += start;\n for (i = start; i < length; i += 1) {\n str += fromCharCode(dataView.getUint8(i));\n }\n return str;\n }\n var btoa = WINDOW.btoa;\n\n /**\n * Transform array buffer to Data URL.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {string} mimeType - The mime type of the Data URL.\n * @returns {string} The result Data URL.\n */\n function arrayBufferToDataURL(arrayBuffer, mimeType) {\n var chunks = [];\n var chunkSize = 8192;\n var uint8 = new Uint8Array(arrayBuffer);\n while (uint8.length > 0) {\n // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9\n // eslint-disable-next-line prefer-spread\n chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));\n uint8 = uint8.subarray(chunkSize);\n }\n return \"data:\".concat(mimeType, \";base64,\").concat(btoa(chunks.join('')));\n }\n\n /**\n * Get orientation value from given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {number} The read orientation value.\n */\n function resetAndGetOrientation(arrayBuffer) {\n var dataView = new DataView(arrayBuffer);\n var orientation;\n\n // Ignores range error when the image does not have correct Exif information\n try {\n var littleEndian;\n var app1Start;\n var ifdStart;\n\n // Only handle JPEG image (start by 0xFFD8)\n if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {\n var length = dataView.byteLength;\n var offset = 2;\n while (offset + 1 < length) {\n if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {\n app1Start = offset;\n break;\n }\n offset += 1;\n }\n }\n if (app1Start) {\n var exifIDCode = app1Start + 4;\n var tiffOffset = app1Start + 10;\n if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {\n var endianness = dataView.getUint16(tiffOffset);\n littleEndian = endianness === 0x4949;\n if (littleEndian || endianness === 0x4D4D /* bigEndian */) {\n if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {\n var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);\n if (firstIFDOffset >= 0x00000008) {\n ifdStart = tiffOffset + firstIFDOffset;\n }\n }\n }\n }\n }\n if (ifdStart) {\n var _length = dataView.getUint16(ifdStart, littleEndian);\n var _offset;\n var i;\n for (i = 0; i < _length; i += 1) {\n _offset = ifdStart + i * 12 + 2;\n if (dataView.getUint16(_offset, littleEndian) === 0x0112 /* Orientation */) {\n // 8 is the offset of the current tag's value\n _offset += 8;\n\n // Get the original orientation value\n orientation = dataView.getUint16(_offset, littleEndian);\n\n // Override the orientation with its default value\n dataView.setUint16(_offset, 1, littleEndian);\n break;\n }\n }\n }\n } catch (e) {\n orientation = 1;\n }\n return orientation;\n }\n\n /**\n * Parse Exif Orientation value.\n * @param {number} orientation - The orientation to parse.\n * @returns {Object} The parsed result.\n */\n function parseOrientation(orientation) {\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n switch (orientation) {\n // Flip horizontal\n case 2:\n scaleX = -1;\n break;\n\n // Rotate left 180°\n case 3:\n rotate = -180;\n break;\n\n // Flip vertical\n case 4:\n scaleY = -1;\n break;\n\n // Flip vertical and rotate right 90°\n case 5:\n rotate = 90;\n scaleY = -1;\n break;\n\n // Rotate right 90°\n case 6:\n rotate = 90;\n break;\n\n // Flip horizontal and rotate right 90°\n case 7:\n rotate = 90;\n scaleX = -1;\n break;\n\n // Rotate left 90°\n case 8:\n rotate = -90;\n break;\n }\n return {\n rotate: rotate,\n scaleX: scaleX,\n scaleY: scaleY\n };\n }\n var REGEXP_DECIMALS = /\\.\\d*(?:0|9){12}\\d*$/;\n\n /**\n * Normalize decimal number.\n * Check out {@link https://0.30000000000000004.com/}\n * @param {number} value - The value to normalize.\n * @param {number} [times=100000000000] - The times for normalizing.\n * @returns {number} Returns the normalized number.\n */\n function normalizeDecimalNumber(value) {\n var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;\n return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;\n }\n\n /**\n * Get the max sizes in a rectangle under the given aspect ratio.\n * @param {Object} data - The original sizes.\n * @param {string} [type='contain'] - The adjust type.\n * @returns {Object} The result sizes.\n */\n function getAdjustedSizes(_ref) {\n var aspectRatio = _ref.aspectRatio,\n height = _ref.height,\n width = _ref.width;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'none';\n var isValidWidth = isPositiveNumber(width);\n var isValidHeight = isPositiveNumber(height);\n if (isValidWidth && isValidHeight) {\n var adjustedWidth = height * aspectRatio;\n if ((type === 'contain' || type === 'none') && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n } else if (isValidWidth) {\n height = width / aspectRatio;\n } else if (isValidHeight) {\n width = height * aspectRatio;\n }\n return {\n width: width,\n height: height\n };\n }\n\n /**\n * Get Exif information from the given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {Array} The read Exif information.\n */\n function getExif(arrayBuffer) {\n var array = toArray(new Uint8Array(arrayBuffer));\n var length = array.length;\n var segments = [];\n var start = 0;\n while (start + 3 < length) {\n var value = array[start];\n var next = array[start + 1];\n\n // SOS (Start of Scan)\n if (value === 0xFF && next === 0xDA) {\n break;\n }\n\n // SOI (Start of Image)\n if (value === 0xFF && next === 0xD8) {\n start += 2;\n } else {\n var offset = array[start + 2] * 256 + array[start + 3];\n var end = start + offset + 2;\n var segment = array.slice(start, end);\n segments.push(segment);\n start = end;\n }\n }\n return segments.reduce(function (exifArray, current) {\n if (current[0] === 0xFF && current[1] === 0xE1) {\n return exifArray.concat(current);\n }\n return exifArray;\n }, []);\n }\n\n /**\n * Insert Exif information into the given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {Array} exifArray - The Exif information to insert.\n * @returns {ArrayBuffer} The transformed array buffer.\n */\n function insertExif(arrayBuffer, exifArray) {\n var array = toArray(new Uint8Array(arrayBuffer));\n if (array[2] !== 0xFF || array[3] !== 0xE0) {\n return arrayBuffer;\n }\n var app0Length = array[4] * 256 + array[5];\n var newArrayBuffer = [0xFF, 0xD8].concat(exifArray, array.slice(4 + app0Length));\n return new Uint8Array(newArrayBuffer);\n }\n\n var ArrayBuffer$1 = WINDOW.ArrayBuffer,\n FileReader = WINDOW.FileReader;\n var URL = WINDOW.URL || WINDOW.webkitURL;\n var REGEXP_EXTENSION = /\\.\\w+$/;\n var AnotherCompressor = WINDOW.Compressor;\n\n /**\n * Creates a new image compressor.\n * @class\n */\n var Compressor = /*#__PURE__*/function () {\n /**\n * The constructor of Compressor.\n * @param {File|Blob} file - The target image file for compressing.\n * @param {Object} [options] - The options for compressing.\n */\n function Compressor(file, options) {\n _classCallCheck(this, Compressor);\n this.file = file;\n this.exif = [];\n this.image = new Image();\n this.options = _objectSpread2(_objectSpread2({}, DEFAULTS), options);\n this.aborted = false;\n this.result = null;\n this.init();\n }\n _createClass(Compressor, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n var file = this.file,\n options = this.options;\n if (!isBlob(file)) {\n this.fail(new Error('The first argument must be a File or Blob object.'));\n return;\n }\n var mimeType = file.type;\n if (!isImageType(mimeType)) {\n this.fail(new Error('The first argument must be an image File or Blob object.'));\n return;\n }\n if (!URL || !FileReader) {\n this.fail(new Error('The current browser does not support image compression.'));\n return;\n }\n if (!ArrayBuffer$1) {\n options.checkOrientation = false;\n options.retainExif = false;\n }\n var isJPEGImage = mimeType === 'image/jpeg';\n var checkOrientation = isJPEGImage && options.checkOrientation;\n var retainExif = isJPEGImage && options.retainExif;\n if (URL && !checkOrientation && !retainExif) {\n this.load({\n url: URL.createObjectURL(file)\n });\n } else {\n var reader = new FileReader();\n this.reader = reader;\n reader.onload = function (_ref) {\n var target = _ref.target;\n var result = target.result;\n var data = {};\n var orientation = 1;\n if (checkOrientation) {\n // Reset the orientation value to its default value 1\n // as some iOS browsers will render image with its orientation\n orientation = resetAndGetOrientation(result);\n if (orientation > 1) {\n _extends(data, parseOrientation(orientation));\n }\n }\n if (retainExif) {\n _this.exif = getExif(result);\n }\n if (checkOrientation || retainExif) {\n if (!URL\n\n // Generate a new URL with the default orientation value 1.\n || orientation > 1) {\n data.url = arrayBufferToDataURL(result, mimeType);\n } else {\n data.url = URL.createObjectURL(file);\n }\n } else {\n data.url = result;\n }\n _this.load(data);\n };\n reader.onabort = function () {\n _this.fail(new Error('Aborted to read the image with FileReader.'));\n };\n reader.onerror = function () {\n _this.fail(new Error('Failed to read the image with FileReader.'));\n };\n reader.onloadend = function () {\n _this.reader = null;\n };\n if (checkOrientation || retainExif) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsDataURL(file);\n }\n }\n }\n }, {\n key: \"load\",\n value: function load(data) {\n var _this2 = this;\n var file = this.file,\n image = this.image;\n image.onload = function () {\n _this2.draw(_objectSpread2(_objectSpread2({}, data), {}, {\n naturalWidth: image.naturalWidth,\n naturalHeight: image.naturalHeight\n }));\n };\n image.onabort = function () {\n _this2.fail(new Error('Aborted to load the image.'));\n };\n image.onerror = function () {\n _this2.fail(new Error('Failed to load the image.'));\n };\n\n // Match all browsers that use WebKit as the layout engine in iOS devices,\n // such as Safari for iOS, Chrome for iOS, and in-app browsers.\n if (WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent)) {\n // Fix the `The operation is insecure` error (#57)\n image.crossOrigin = 'anonymous';\n }\n image.alt = file.name;\n image.src = data.url;\n }\n }, {\n key: \"draw\",\n value: function draw(_ref2) {\n var _this3 = this;\n var naturalWidth = _ref2.naturalWidth,\n naturalHeight = _ref2.naturalHeight,\n _ref2$rotate = _ref2.rotate,\n rotate = _ref2$rotate === void 0 ? 0 : _ref2$rotate,\n _ref2$scaleX = _ref2.scaleX,\n scaleX = _ref2$scaleX === void 0 ? 1 : _ref2$scaleX,\n _ref2$scaleY = _ref2.scaleY,\n scaleY = _ref2$scaleY === void 0 ? 1 : _ref2$scaleY;\n var file = this.file,\n image = this.image,\n options = this.options;\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n var is90DegreesRotated = Math.abs(rotate) % 180 === 90;\n var resizable = (options.resize === 'contain' || options.resize === 'cover') && isPositiveNumber(options.width) && isPositiveNumber(options.height);\n var maxWidth = Math.max(options.maxWidth, 0) || Infinity;\n var maxHeight = Math.max(options.maxHeight, 0) || Infinity;\n var minWidth = Math.max(options.minWidth, 0) || 0;\n var minHeight = Math.max(options.minHeight, 0) || 0;\n var aspectRatio = naturalWidth / naturalHeight;\n var width = options.width,\n height = options.height;\n if (is90DegreesRotated) {\n var _ref3 = [maxHeight, maxWidth];\n maxWidth = _ref3[0];\n maxHeight = _ref3[1];\n var _ref4 = [minHeight, minWidth];\n minWidth = _ref4[0];\n minHeight = _ref4[1];\n var _ref5 = [height, width];\n width = _ref5[0];\n height = _ref5[1];\n }\n if (resizable) {\n aspectRatio = width / height;\n }\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: maxWidth,\n height: maxHeight\n }, 'contain');\n maxWidth = _getAdjustedSizes.width;\n maxHeight = _getAdjustedSizes.height;\n var _getAdjustedSizes2 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n minWidth = _getAdjustedSizes2.width;\n minHeight = _getAdjustedSizes2.height;\n if (resizable) {\n var _getAdjustedSizes3 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: width,\n height: height\n }, options.resize);\n width = _getAdjustedSizes3.width;\n height = _getAdjustedSizes3.height;\n } else {\n var _getAdjustedSizes4 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: width,\n height: height\n });\n var _getAdjustedSizes4$wi = _getAdjustedSizes4.width;\n width = _getAdjustedSizes4$wi === void 0 ? naturalWidth : _getAdjustedSizes4$wi;\n var _getAdjustedSizes4$he = _getAdjustedSizes4.height;\n height = _getAdjustedSizes4$he === void 0 ? naturalHeight : _getAdjustedSizes4$he;\n }\n width = Math.floor(normalizeDecimalNumber(Math.min(Math.max(width, minWidth), maxWidth)));\n height = Math.floor(normalizeDecimalNumber(Math.min(Math.max(height, minHeight), maxHeight)));\n var destX = -width / 2;\n var destY = -height / 2;\n var destWidth = width;\n var destHeight = height;\n var params = [];\n if (resizable) {\n var srcX = 0;\n var srcY = 0;\n var srcWidth = naturalWidth;\n var srcHeight = naturalHeight;\n var _getAdjustedSizes5 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: naturalWidth,\n height: naturalHeight\n }, {\n contain: 'cover',\n cover: 'contain'\n }[options.resize]);\n srcWidth = _getAdjustedSizes5.width;\n srcHeight = _getAdjustedSizes5.height;\n srcX = (naturalWidth - srcWidth) / 2;\n srcY = (naturalHeight - srcHeight) / 2;\n params.push(srcX, srcY, srcWidth, srcHeight);\n }\n params.push(destX, destY, destWidth, destHeight);\n if (is90DegreesRotated) {\n var _ref6 = [height, width];\n width = _ref6[0];\n height = _ref6[1];\n }\n canvas.width = width;\n canvas.height = height;\n if (!isImageType(options.mimeType)) {\n options.mimeType = file.type;\n }\n var fillStyle = 'transparent';\n\n // Converts PNG files over the `convertSize` to JPEGs.\n if (file.size > options.convertSize && options.convertTypes.indexOf(options.mimeType) >= 0) {\n options.mimeType = 'image/jpeg';\n }\n var isJPEGImage = options.mimeType === 'image/jpeg';\n if (isJPEGImage) {\n fillStyle = '#fff';\n }\n\n // Override the default fill color (#000, black)\n context.fillStyle = fillStyle;\n context.fillRect(0, 0, width, height);\n if (options.beforeDraw) {\n options.beforeDraw.call(this, context, canvas);\n }\n if (this.aborted) {\n return;\n }\n context.save();\n context.translate(width / 2, height / 2);\n context.rotate(rotate * Math.PI / 180);\n context.scale(scaleX, scaleY);\n context.drawImage.apply(context, [image].concat(params));\n context.restore();\n if (options.drew) {\n options.drew.call(this, context, canvas);\n }\n if (this.aborted) {\n return;\n }\n var callback = function callback(blob) {\n if (!_this3.aborted) {\n var done = function done(result) {\n return _this3.done({\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n result: result\n });\n };\n if (blob && isJPEGImage && options.retainExif && _this3.exif && _this3.exif.length > 0) {\n var next = function next(arrayBuffer) {\n return done(toBlob(arrayBufferToDataURL(insertExif(arrayBuffer, _this3.exif), options.mimeType)));\n };\n if (blob.arrayBuffer) {\n blob.arrayBuffer().then(next).catch(function () {\n _this3.fail(new Error('Failed to read the compressed image with Blob.arrayBuffer().'));\n });\n } else {\n var reader = new FileReader();\n _this3.reader = reader;\n reader.onload = function (_ref7) {\n var target = _ref7.target;\n next(target.result);\n };\n reader.onabort = function () {\n _this3.fail(new Error('Aborted to read the compressed image with FileReader.'));\n };\n reader.onerror = function () {\n _this3.fail(new Error('Failed to read the compressed image with FileReader.'));\n };\n reader.onloadend = function () {\n _this3.reader = null;\n };\n reader.readAsArrayBuffer(blob);\n }\n } else {\n done(blob);\n }\n }\n };\n if (canvas.toBlob) {\n canvas.toBlob(callback, options.mimeType, options.quality);\n } else {\n callback(toBlob(canvas.toDataURL(options.mimeType, options.quality)));\n }\n }\n }, {\n key: \"done\",\n value: function done(_ref8) {\n var naturalWidth = _ref8.naturalWidth,\n naturalHeight = _ref8.naturalHeight,\n result = _ref8.result;\n var file = this.file,\n image = this.image,\n options = this.options;\n if (URL && image.src.indexOf('blob:') === 0) {\n URL.revokeObjectURL(image.src);\n }\n if (result) {\n // Returns original file if the result is greater than it and without size related options\n if (options.strict && !options.retainExif && result.size > file.size && options.mimeType === file.type && !(options.width > naturalWidth || options.height > naturalHeight || options.minWidth > naturalWidth || options.minHeight > naturalHeight || options.maxWidth < naturalWidth || options.maxHeight < naturalHeight)) {\n result = file;\n } else {\n var date = new Date();\n result.lastModified = date.getTime();\n result.lastModifiedDate = date;\n result.name = file.name;\n\n // Convert the extension to match its type\n if (result.name && result.type !== file.type) {\n result.name = result.name.replace(REGEXP_EXTENSION, imageTypeToExtension(result.type));\n }\n }\n } else {\n // Returns original file if the result is null in some cases.\n result = file;\n }\n this.result = result;\n if (options.success) {\n options.success.call(this, result);\n }\n }\n }, {\n key: \"fail\",\n value: function fail(err) {\n var options = this.options;\n if (options.error) {\n options.error.call(this, err);\n } else {\n throw err;\n }\n }\n }, {\n key: \"abort\",\n value: function abort() {\n if (!this.aborted) {\n this.aborted = true;\n if (this.reader) {\n this.reader.abort();\n } else if (!this.image.complete) {\n this.image.onload = null;\n this.image.onabort();\n } else {\n this.fail(new Error('The compression process has been aborted.'));\n }\n }\n }\n\n /**\n * Get the no conflict compressor class.\n * @returns {Compressor} The compressor class.\n */\n }], [{\n key: \"noConflict\",\n value: function noConflict() {\n window.Compressor = AnotherCompressor;\n return Compressor;\n }\n\n /**\n * Change the default options.\n * @param {Object} options - The new default options.\n */\n }, {\n key: \"setDefaults\",\n value: function setDefaults(options) {\n _extends(DEFAULTS, options);\n }\n }]);\n return Compressor;\n }();\n\n return Compressor;\n\n}));\n"],"sourceRoot":""}