(function(a){if(typeof define==="function"&&define.amd){define(["jquery","load-image","load-image-meta","load-image-exif","canvas-to-blob","./jquery.fileupload-process"],a);}else{if(typeof exports==="object"){a(require("jquery"),require("blueimp-load-image/js/load-image"),require("blueimp-load-image/js/load-image-meta"),require("blueimp-load-image/js/load-image-exif"),require("blueimp-canvas-to-blob"),require("./jquery.fileupload-process"));}else{a(window.jQuery,window.loadImage);}}}(function(a,b){a.blueimp.fileupload.prototype.options.processQueue.unshift({action:"loadImageMetaData",disableImageHead:"@",disableExif:"@",disableExifThumbnail:"@",disableExifSub:"@",disableExifGps:"@",disabled:"@disableImageMetaDataLoad"},{action:"loadImage",prefix:true,fileTypes:"@",maxFileSize:"@",noRevoke:"@",disabled:"@disableImageLoad"},{action:"resizeImage",prefix:"image",maxWidth:"@",maxHeight:"@",minWidth:"@",minHeight:"@",crop:"@",orientation:"@",forceResize:"@",disabled:"@disableImageResize"},{action:"saveImage",quality:"@imageQuality",type:"@imageType",disabled:"@disableImageResize"},{action:"saveImageMetaData",disabled:"@disableImageMetaDataSave"},{action:"resizeImage",prefix:"preview",maxWidth:"@",maxHeight:"@",minWidth:"@",minHeight:"@",crop:"@",orientation:"@",thumbnail:"@",canvas:"@",disabled:"@disableImagePreview"},{action:"setImage",name:"@imagePreviewName",disabled:"@disableImagePreview"},{action:"deleteImageReferences",disabled:"@disableImageReferencesDeletion"});a.widget("blueimp.fileupload",a.blueimp.fileupload,{options:{loadImageFileTypes:/^image\/(gif|jpeg|png|svg\+xml)$/,loadImageMaxFileSize:10000000,imageMaxWidth:1920,imageMaxHeight:1080,imageOrientation:false,imageCrop:false,disableImageResize:true,previewMaxWidth:80,previewMaxHeight:80,previewOrientation:true,previewThumbnail:true,previewCrop:false,previewCanvas:true},processActions:{loadImage:function(g,d){if(d.disabled){return g;}var f=this,e=g.files[g.index],c=a.Deferred();if((a.type(d.maxFileSize)==="number"&&e.size>d.maxFileSize)||(d.fileTypes&&!d.fileTypes.test(e.type))||!b(e,function(h){if(h.src){g.img=h;}c.resolveWith(f,[g]);},d)){return g;}return c.promise();},resizeImage:function(h,e){if(e.disabled||!(h.canvas||h.img)){return h;}e=a.extend({canvas:true},e);var f=this,c=a.Deferred(),d=(e.canvas&&h.canvas)||h.img,g=function(j){if(j&&(j.width!==d.width||j.height!==d.height||e.forceResize)){h[j.getContext?"canvas":"img"]=j;}h.preview=j;c.resolveWith(f,[h]);},i;if(h.exif){if(e.orientation===true){e.orientation=h.exif.get("Orientation");}if(e.thumbnail){i=h.exif.get("Thumbnail");if(i){b(i,g,e);return c.promise();}}if(h.orientation){delete e.orientation;}else{h.orientation=e.orientation;}}if(d){g(b.scale(d,e));return c.promise();}return h;},saveImage:function(g,d){if(!g.canvas||d.disabled){return g;}var f=this,e=g.files[g.index],c=a.Deferred();if(g.canvas.toBlob){g.canvas.toBlob(function(h){if(!h.name){if(e.type===h.type){h.name=e.name;}else{if(e.name){h.name=e.name.replace(/\.\w+$/,"."+h.type.substr(6));}}}if(e.type!==h.type){delete g.imageHead;}g.files[g.index]=h;c.resolveWith(f,[g]);},d.type||e.type,d.quality);}else{return g;}return c.promise();},loadImageMetaData:function(f,d){if(d.disabled){return f;}var e=this,c=a.Deferred();b.parseMetaData(f.files[f.index],function(g){a.extend(f,g);c.resolveWith(e,[f]);},d);return c.promise();},saveImageMetaData:function(f,d){if(!(f.imageHead&&f.canvas&&f.canvas.toBlob&&!d.disabled)){return f;}var e=f.files[f.index],c=new Blob([f.imageHead,this._blobSlice.call(e,20)],{type:e.type});c.name=e.name;f.files[f.index]=c;return f;},setImage:function(d,c){if(d.preview&&!c.disabled){d.files[d.index][c.name||"preview"]=d.preview;}return d;},deleteImageReferences:function(d,c){if(!c.disabled){delete d.img;delete d.canvas;delete d.preview;delete d.imageHead;}return d;}}});}));