PHP Classes

File: js/dropzone.js

Recommend this page to a friend!
  Classes of Ganesh Kandu   Palette PHP CMS System   js/dropzone.js   Download  
File: js/dropzone.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Palette PHP CMS System
Manage content site edited visually in the browser
Author: By
Last change:
Date: 2 years ago
Size: 34,784 bytes
 

Contents

Class file image Download
(function(){var g,i,b,d,a,e,k,j,f=[].slice,h={}.hasOwnProperty,c=function(o,m){for(var l in m){if(h.call(m,l)){o[l]=m[l]}}function n(){this.constructor=o}n.prototype=m.prototype;o.prototype=new n();o.__super__=m.prototype;return o};k=function(){};i=(function(){function l(){}l.prototype.addEventListener=l.prototype.on;l.prototype.on=function(n,m){this._callbacks=this._callbacks||{};if(!this._callbacks[n]){this._callbacks[n]=[]}this._callbacks[n].push(m);return this};l.prototype.emit=function(){var n,r,p,o,q,m;o=arguments[0],n=2<=arguments.length?f.call(arguments,1):[];this._callbacks=this._callbacks||{};p=this._callbacks[o];if(p){for(q=0,m=p.length;q<m;q++){r=p[q];r.apply(this,n)}}return this};l.prototype.removeListener=l.prototype.off;l.prototype.removeAllListeners=l.prototype.off;l.prototype.removeEventListener=l.prototype.off;l.prototype.off=function(q,o){var s,p,n,r,m;if(!this._callbacks||arguments.length===0){this._callbacks={};return this}p=this._callbacks[q];if(!p){return this}if(arguments.length===1){delete this._callbacks[q];return this}for(n=r=0,m=p.length;r<m;n=++r){s=p[n];if(s===o){p.splice(n,1);break}}return this};return l})();g=(function(n){var o,l;c(m,n);m.prototype.Emitter=i;m.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];m.prototype.defaultOptions={url:null,method:"post",withCredentials:false,parallelUploads:2,uploadMultiple:false,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1000,maxFiles:null,params:{},clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,dictDefaultMessage:lang.dfh,dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(q,p){return p()},init:function(){return k},forceFallback:false,fallback:function(){var u,q,r,t,p,s;this.element.className=""+this.element.className+" dz-browser-not-supported";s=this.element.getElementsByTagName("div");for(t=0,p=s.length;t<p;t++){u=s[t];if(/(^| )dz-message($| )/.test(u.className)){q=u;u.className="dz-message";continue}}if(!q){q=m.createElement('<div class="dz-message"><span></span></div>');this.element.appendChild(q)}r=q.getElementsByTagName("span")[0];if(r){if(r.textContent!=null){r.textContent=this.options.dictFallbackMessage}else{if(r.innerText!=null){r.innerText=this.options.dictFallbackMessage}}}return this.element.appendChild(this.getFallbackForm())},resize:function(q){var s,r,p;s={srcX:0,srcY:0,srcWidth:q.width,srcHeight:q.height};r=q.width/q.height;s.optWidth=this.options.thumbnailWidth;s.optHeight=this.options.thumbnailHeight;if((s.optWidth==null)&&(s.optHeight==null)){s.optWidth=s.srcWidth;s.optHeight=s.srcHeight}else{if(s.optWidth==null){s.optWidth=r*s.optHeight}else{if(s.optHeight==null){s.optHeight=(1/r)*s.optWidth}}}p=s.optWidth/s.optHeight;if(q.height<s.optHeight||q.width<s.optWidth){s.trgHeight=s.srcHeight;s.trgWidth=s.srcWidth}else{if(r>p){s.srcHeight=q.height;s.srcWidth=s.srcHeight*p}else{s.srcWidth=q.width;s.srcHeight=s.srcWidth/p}}s.srcX=(q.width-s.srcWidth)/2;s.srcY=(q.height-s.srcHeight)/2;return s},drop:function(p){return this.element.classList.remove("dz-drag-hover")},dragstart:k,dragend:function(p){return this.element.classList.remove("dz-drag-hover")},dragenter:function(p){return this.element.classList.add("dz-drag-hover")},dragover:function(p){return this.element.classList.add("dz-drag-hover")},dragleave:function(p){return this.element.classList.remove("dz-drag-hover")},paste:k,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(s){var r,A,B,y,x,u,C,q,p,z,w,t,v;if(this.element===this.previewsContainer){this.element.classList.add("dz-started")}if(this.previewsContainer){s.previewElement=m.createElement(this.options.previewTemplate.trim());s.previewTemplate=s.previewElement;this.previewsContainer.appendChild(s.previewElement);z=s.previewElement.querySelectorAll("[data-dz-name]");for(y=0,C=z.length;y<C;y++){r=z[y];r.textContent=this._renameFilename(s.name)}w=s.previewElement.querySelectorAll("[data-dz-size]");for(x=0,q=w.length;x<q;x++){r=w[x];r.innerHTML=this.filesize(s.size)}if(this.options.addRemoveLinks){s._removeLink=m.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>");s.previewElement.appendChild(s._removeLink)}A=(function(D){return function(E){E.preventDefault();E.stopPropagation();if(s.status===m.UPLOADING){return m.confirm(D.options.dictCancelUploadConfirmation,function(){return D.removeFile(s)})}else{if(D.options.dictRemoveFileConfirmation){return m.confirm(D.options.dictRemoveFileConfirmation,function(){return D.removeFile(s)})}else{return D.removeFile(s)}}}})(this);t=s.previewElement.querySelectorAll("[data-dz-remove]");v=[];for(u=0,p=t.length;u<p;u++){B=t[u];v.push(B.addEventListener("click",A))}return v}},removedfile:function(p){var q;if(p.previewElement){if((q=p.previewElement)!=null){q.parentNode.removeChild(p.previewElement)}}return this._updateMaxFilesReachedClass()},thumbnail:function(r,u){var q,t,p,s;if(r.previewElement){r.previewElement.classList.remove("dz-file-preview");s=r.previewElement.querySelectorAll("[data-dz-thumbnail]");for(t=0,p=s.length;t<p;t++){q=s[t];q.alt=r.name;q.src=u}return setTimeout(((function(v){return function(){return r.previewElement.classList.add("dz-image-preview")}})(this)),1)}},error:function(r,t){var s,v,q,u,p;if(r.previewElement){r.previewElement.classList.add("dz-error");if(typeof t!=="String"&&t.error){t=t.error}u=r.previewElement.querySelectorAll("[data-dz-errormessage]");p=[];for(v=0,q=u.length;v<q;v++){s=u[v];p.push(s.textContent=t)}return p}},errormultiple:k,processing:function(p){if(p.previewElement){p.previewElement.classList.add("dz-processing");if(p._removeLink){return p._removeLink.textContent=this.options.dictCancelUpload}}},processingmultiple:k,uploadprogress:function(t,r,s){var u,w,q,v,p;if(t.previewElement){v=t.previewElement.querySelectorAll("[data-dz-uploadprogress]");p=[];for(w=0,q=v.length;w<q;w++){u=v[w];if(u.nodeName==="PROGRESS"){p.push(u.value=r)}else{p.push(u.style.width=""+r+"%")}}return p}},totaluploadprogress:k,sending:k,sendingmultiple:k,success:function(p){if(p.previewElement){return p.previewElement.classList.add("dz-success")}},successmultiple:k,canceled:function(p){return this.emit("error",p,"Upload canceled.")},canceledmultiple:k,complete:function(p){if(p._removeLink){p._removeLink.textContent=this.options.dictRemoveFile}if(p.previewElement){return p.previewElement.classList.add("dz-complete")}},completemultiple:k,maxfilesexceeded:k,maxfilesreached:k,queuecomplete:k,addedfiles:k,previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>'};o=function(){var r,q,t,u,v,s,p;u=arguments[0],t=2<=arguments.length?f.call(arguments,1):[];for(s=0,p=t.length;s<p;s++){q=t[s];for(r in q){v=q[r];u[r]=v}}return u};function m(r,q){var p,t,s;this.element=r;this.version=m.version;this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,"");this.clickableElements=[];this.listeners=[];this.files=[];if(typeof this.element==="string"){this.element=document.querySelector(this.element)}if(!(this.element&&(this.element.nodeType!=null))){throw new Error("Invalid dropzone element.")}if(this.element.dropzone){throw new Error("Dropzone already attached.")}m.instances.push(this);this.element.dropzone=this;p=(s=m.optionsForElement(this.element))!=null?s:{};this.options=o({},this.defaultOptions,p,q!=null?q:{});if(this.options.forceFallback||!m.isBrowserSupported()){return this.options.fallback.call(this)}if(this.options.url==null){this.options.url=this.element.getAttribute("action")}if(!this.options.url){throw new Error("No URL provided.")}if(this.options.acceptedFiles&&this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.")}if(this.options.acceptedMimeTypes){this.options.acceptedFiles=this.options.acceptedMimeTypes;delete this.options.acceptedMimeTypes}this.options.method=this.options.method.toUpperCase();if((t=this.getExistingFallback())&&t.parentNode){t.parentNode.removeChild(t)}if(this.options.previewsContainer!==false){if(this.options.previewsContainer){this.previewsContainer=m.getElement(this.options.previewsContainer,"previewsContainer")}else{this.previewsContainer=this.element}}if(this.options.clickable){if(this.options.clickable===true){this.clickableElements=[this.element]}else{this.clickableElements=m.getElements(this.options.clickable,"clickable")}}this.init()}m.prototype.getAcceptedFiles=function(){var r,t,q,s,p;s=this.files;p=[];for(t=0,q=s.length;t<q;t++){r=s[t];if(r.accepted){p.push(r)}}return p};m.prototype.getRejectedFiles=function(){var r,t,q,s,p;s=this.files;p=[];for(t=0,q=s.length;t<q;t++){r=s[t];if(!r.accepted){p.push(r)}}return p};m.prototype.getFilesWithStatus=function(r){var s,u,q,t,p;t=this.files;p=[];for(u=0,q=t.length;u<q;u++){s=t[u];if(s.status===r){p.push(s)}}return p};m.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(m.QUEUED)};m.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(m.UPLOADING)};m.prototype.getAddedFiles=function(){return this.getFilesWithStatus(m.ADDED)};m.prototype.getActiveFiles=function(){var r,t,q,s,p;s=this.files;p=[];for(t=0,q=s.length;t<q;t++){r=s[t];if(r.status===m.UPLOADING||r.status===m.QUEUED){p.push(r)}}return p};m.prototype.init=function(){var r,v,u,t,q,s,p;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data")}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(m.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>"))}if(this.clickableElements.length){u=(function(w){return function(){if(w.hiddenFileInput){w.hiddenFileInput.parentNode.removeChild(w.hiddenFileInput)}w.hiddenFileInput=document.createElement("input");w.hiddenFileInput.setAttribute("type","file");if((w.options.maxFiles==null)||w.options.maxFiles>1){w.hiddenFileInput.setAttribute("multiple","multiple")}w.hiddenFileInput.className="dz-hidden-input";if(w.options.acceptedFiles!=null){w.hiddenFileInput.setAttribute("accept",w.options.acceptedFiles)}if(w.options.capture!=null){w.hiddenFileInput.setAttribute("capture",w.options.capture)}w.hiddenFileInput.style.visibility="hidden";w.hiddenFileInput.style.position="absolute";w.hiddenFileInput.style.top="0";w.hiddenFileInput.style.left="0";w.hiddenFileInput.style.height="0";w.hiddenFileInput.style.width="0";document.querySelector(w.options.hiddenInputContainer).appendChild(w.hiddenFileInput);return w.hiddenFileInput.addEventListener("change",function(){var y,z,A,x;z=w.hiddenFileInput.files;if(z.length){for(A=0,x=z.length;A<x;A++){y=z[A];w.addFile(y)}}w.emit("addedfiles",z);return u()})}})(this);u()}this.URL=(s=window.URL)!=null?s:window.webkitURL;p=this.events;for(t=0,q=p.length;t<q;t++){r=p[t];this.on(r,this.options[r])}this.on("uploadprogress",(function(w){return function(){return w.updateTotalUploadProgress()}})(this));this.on("removedfile",(function(w){return function(){return w.updateTotalUploadProgress()}})(this));this.on("canceled",(function(w){return function(x){return w.emit("complete",x)}})(this));this.on("complete",(function(w){return function(x){if(w.getAddedFiles().length===0&&w.getUploadingFiles().length===0&&w.getQueuedFiles().length===0){return setTimeout((function(){return w.emit("queuecomplete")}),0)}}})(this));v=function(w){w.stopPropagation();if(w.preventDefault){return w.preventDefault()}else{return w.returnValue=false}};this.listeners=[{element:this.element,events:{dragstart:(function(w){return function(x){return w.emit("dragstart",x)}})(this),dragenter:(function(w){return function(x){v(x);return w.emit("dragenter",x)}})(this),dragover:(function(w){return function(y){var x;try{x=y.dataTransfer.effectAllowed}catch(z){}y.dataTransfer.dropEffect="move"===x||"linkMove"===x?"move":"copy";v(y);return w.emit("dragover",y)}})(this),dragleave:(function(w){return function(x){return w.emit("dragleave",x)}})(this),drop:(function(w){return function(x){v(x);return w.drop(x)}})(this),dragend:(function(w){return function(x){return w.emit("dragend",x)}})(this)}}];this.clickableElements.forEach((function(w){return function(x){return w.listeners.push({element:x,events:{click:function(y){if((x!==w.element)||(y.target===w.element||m.elementInside(y.target,w.element.querySelector(".dz-message")))){w.hiddenFileInput.click()}return true}}})}})(this));this.enable();return this.options.init.call(this)};m.prototype.destroy=function(){var p;this.disable();this.removeAllFiles(true);if((p=this.hiddenFileInput)!=null?p.parentNode:void 0){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null}delete this.element.dropzone;return m.instances.splice(m.instances.indexOf(this),1)};m.prototype.updateTotalUploadProgress=function(){var r,s,w,p,v,u,q,t;p=0;w=0;r=this.getActiveFiles();if(r.length){t=this.getActiveFiles();for(u=0,q=t.length;u<q;u++){s=t[u];p+=s.upload.bytesSent;w+=s.upload.total}v=100*p/w}else{v=100}return this.emit("totaluploadprogress",v,w,p)};m.prototype._getParamName=function(p){if(typeof this.options.paramName==="function"){return this.options.paramName(p)}else{return""+this.options.paramName+(this.options.uploadMultiple?"["+p+"]":"")}};m.prototype._renameFilename=function(p){if(typeof this.options.renameFilename!=="function"){return p}return this.options.renameFilename(p)};m.prototype.getFallbackForm=function(){var q,p,s,r;if(q=this.getExistingFallback()){return q}s='<div class="dz-fallback">';if(this.options.dictFallbackText){s+="<p>"+this.options.dictFallbackText+"</p>"}s+='<input type="file" name="'+(this._getParamName(0))+'" '+(this.options.uploadMultiple?'multiple="multiple"':void 0)+' /><input type="submit" value="Upload!"></div>';p=m.createElement(s);if(this.element.tagName!=="FORM"){r=m.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>');r.appendChild(p)}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method)}return r!=null?r:p};m.prototype.getExistingFallback=function(){var u,r,q,t,p,s;r=function(y){var w,x,v;for(x=0,v=y.length;x<v;x++){w=y[x];if(/(^| )fallback($| )/.test(w.className)){return w}}};s=["div","form"];for(t=0,p=s.length;t<p;t++){q=s[t];if(u=r(this.element.getElementsByTagName(q))){return u}}};m.prototype.setupEventListeners=function(){var s,r,v,u,q,t,p;t=this.listeners;p=[];for(u=0,q=t.length;u<q;u++){s=t[u];p.push((function(){var w,x;w=s.events;x=[];for(r in w){v=w[r];x.push(s.element.addEventListener(r,v,false))}return x})())}return p};m.prototype.removeEventListeners=function(){var s,r,v,u,q,t,p;t=this.listeners;p=[];for(u=0,q=t.length;u<q;u++){s=t[u];p.push((function(){var w,x;w=s.events;x=[];for(r in w){v=w[r];x.push(s.element.removeEventListener(r,v,false))}return x})())}return p};m.prototype.disable=function(){var r,t,q,s,p;this.clickableElements.forEach(function(u){return u.classList.remove("dz-clickable")});this.removeEventListeners();s=this.files;p=[];for(t=0,q=s.length;t<q;t++){r=s[t];p.push(this.cancelUpload(r))}return p};m.prototype.enable=function(){this.clickableElements.forEach(function(p){return p.classList.add("dz-clickable")});return this.setupEventListeners()};m.prototype.filesize=function(x){var q,t,r,p,w,u,s,v;r=0;p="b";if(x>0){u=["TB","GB","MB","KB","b"];for(t=s=0,v=u.length;s<v;t=++s){w=u[t];q=Math.pow(this.options.filesizeBase,4-t)/10;if(x>=q){r=x/Math.pow(this.options.filesizeBase,4-t);p=w;break}}r=Math.round(10*r)/10}return"<strong>"+r+"</strong> "+p};m.prototype._updateMaxFilesReachedClass=function(){if((this.options.maxFiles!=null)&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit("maxfilesreached",this.files)}return this.element.classList.add("dz-max-files-reached")}else{return this.element.classList.remove("dz-max-files-reached")}};m.prototype.drop=function(r){var q,p;if(!r.dataTransfer){return}this.emit("drop",r);q=r.dataTransfer.files;this.emit("addedfiles",q);if(q.length){p=r.dataTransfer.items;if(p&&p.length&&(p[0].webkitGetAsEntry!=null)){this._addFilesFromItems(p)}else{this.handleFiles(q)}}};m.prototype.paste=function(r){var p,q;if((r!=null?(q=r.clipboardData)!=null?q.items:void 0:void 0)==null){return}this.emit("paste",r);p=r.clipboardData.items;if(p.length){return this._addFilesFromItems(p)}};m.prototype.handleFiles=function(s){var r,t,q,p;p=[];for(t=0,q=s.length;t<q;t++){r=s[t];p.push(this.addFile(r))}return p};m.prototype._addFilesFromItems=function(r){var t,s,u,q,p;p=[];for(u=0,q=r.length;u<q;u++){s=r[u];if((s.webkitGetAsEntry!=null)&&(t=s.webkitGetAsEntry())){if(t.isFile){p.push(this.addFile(s.getAsFile()))}else{if(t.isDirectory){p.push(this._addFilesFromDirectory(t,t.name))}else{p.push(void 0)}}}else{if(s.getAsFile!=null){if((s.kind==null)||s.kind==="file"){p.push(this.addFile(s.getAsFile()))}else{p.push(void 0)}}else{p.push(void 0)}}}return p};m.prototype._addFilesFromDirectory=function(p,t){var s,r,q;s=p.createReader();r=function(u){return typeof console!=="undefined"&&console!==null?typeof console.log==="function"?console.log(u):void 0:void 0};q=(function(u){return function(){return s.readEntries(function(v){var x,y,w;if(v.length>0){for(y=0,w=v.length;y<w;y++){x=v[y];if(x.isFile){x.file(function(z){if(u.options.ignoreHiddenFiles&&z.name.substring(0,1)==="."){return}z.fullPath=""+t+"/"+z.name;return u.addFile(z)})}else{if(x.isDirectory){u._addFilesFromDirectory(x,""+t+"/"+x.name)}}}q()}return null},r)}})(this);return q()};m.prototype.accept=function(q,p){if(q.size>this.options.maxFilesize*1024*1024){return p(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(q.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize))}else{if(!m.isValidFile(q,this.options.acceptedFiles)){return p(this.options.dictInvalidFileType)}else{if((this.options.maxFiles!=null)&&this.getAcceptedFiles().length>=this.options.maxFiles){p(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));return this.emit("maxfilesexceeded",q)}else{return this.options.accept.call(this,q,p)}}}};m.prototype.addFile=function(p){p.upload={progress:0,total:p.size,bytesSent:0};this.files.push(p);p.status=m.ADDED;this.emit("addedfile",p);this._enqueueThumbnail(p);return this.accept(p,(function(q){return function(r){if(r){p.accepted=false;q._errorProcessing([p],r)}else{p.accepted=true;if(q.options.autoQueue){q.enqueueFile(p)}}return q._updateMaxFilesReachedClass()}})(this))};m.prototype.enqueueFiles=function(r){var q,s,p;for(s=0,p=r.length;s<p;s++){q=r[s];this.enqueueFile(q)}return null};m.prototype.enqueueFile=function(p){if(p.status===m.ADDED&&p.accepted===true){p.status=m.QUEUED;if(this.options.autoProcessQueue){return setTimeout(((function(q){return function(){return q.processQueue()}})(this)),0)}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.")}};m.prototype._thumbnailQueue=[];m.prototype._processingThumbnail=false;m.prototype._enqueueThumbnail=function(p){if(this.options.createImageThumbnails&&p.type.match(/image.*/)&&p.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(p);return setTimeout(((function(q){return function(){return q._processThumbnailQueue()}})(this)),0)}};m.prototype._processThumbnailQueue=function(){if(this._processingThumbnail||this._thumbnailQueue.length===0){return}this._processingThumbnail=true;return this.createThumbnail(this._thumbnailQueue.shift(),(function(p){return function(){p._processingThumbnail=false;return p._processThumbnailQueue()}})(this))};m.prototype.removeFile=function(p){if(p.status===m.UPLOADING){this.cancelUpload(p)}this.files=j(this.files,p);this.emit("removedfile",p);if(this.files.length===0){return this.emit("reset")}};m.prototype.removeAllFiles=function(t){var q,s,p,r;if(t==null){t=false}r=this.files.slice();for(s=0,p=r.length;s<p;s++){q=r[s];if(q.status!==m.UPLOADING||t){this.removeFile(q)}}return null};m.prototype.createThumbnail=function(q,r){var p;p=new FileReader;p.onload=(function(s){return function(){if(q.type==="image/svg+xml"){s.emit("thumbnail",q,p.result);if(r!=null){r()}return}return s.createThumbnailFromUrl(q,p.result,r)}})(this);return p.readAsDataURL(q)};m.prototype.createThumbnailFromUrl=function(s,r,t,q){var p;p=document.createElement("img");if(q){p.crossOrigin=q}p.onload=(function(u){return function(){var x,w,A,C,y,v,B,z;s.width=p.width;s.height=p.height;A=u.options.resize.call(u,s);if(A.trgWidth==null){A.trgWidth=A.optWidth}if(A.trgHeight==null){A.trgHeight=A.optHeight}x=document.createElement("canvas");w=x.getContext("2d");x.width=A.trgWidth;x.height=A.trgHeight;e(w,p,(y=A.srcX)!=null?y:0,(v=A.srcY)!=null?v:0,A.srcWidth,A.srcHeight,(B=A.trgX)!=null?B:0,(z=A.trgY)!=null?z:0,A.trgWidth,A.trgHeight);C=x.toDataURL("image/png");u.emit("thumbnail",s,C);if(t!=null){return t()}}})(this);if(t!=null){p.onerror=t}return p.src=r};m.prototype.processQueue=function(){var q,s,p,r;s=this.options.parallelUploads;p=this.getUploadingFiles().length;q=p;if(p>=s){return}r=this.getQueuedFiles();if(!(r.length>0)){return}if(this.options.uploadMultiple){return this.processFiles(r.slice(0,s-p))}else{while(q<s){if(!r.length){return}this.processFile(r.shift());q++}}};m.prototype.processFile=function(p){return this.processFiles([p])};m.prototype.processFiles=function(r){var q,s,p;for(s=0,p=r.length;s<p;s++){q=r[s];q.processing=true;q.status=m.UPLOADING;this.emit("processing",q)}if(this.options.uploadMultiple){this.emit("processingmultiple",r)}return this.uploadFiles(r)};m.prototype._getFilesWithXhr=function(r){var p,q;return q=(function(){var v,t,u,s;u=this.files;s=[];for(v=0,t=u.length;v<t;v++){p=u[v];if(p.xhr===r){s.push(p)}}return s}).call(this)};m.prototype.cancelUpload=function(t){var r,s,w,u,q,p,v;if(t.status===m.UPLOADING){s=this._getFilesWithXhr(t.xhr);for(w=0,q=s.length;w<q;w++){r=s[w];r.status=m.CANCELED}t.xhr.abort();for(u=0,p=s.length;u<p;u++){r=s[u];this.emit("canceled",r)}if(this.options.uploadMultiple){this.emit("canceledmultiple",s)}}else{if((v=t.status)===m.ADDED||v===m.QUEUED){t.status=m.CANCELED;this.emit("canceled",t);if(this.options.uploadMultiple){this.emit("canceledmultiple",[t])}}}if(this.options.autoProcessQueue){return this.processQueue()}};l=function(){var p,q;q=arguments[0],p=2<=arguments.length?f.call(arguments,1):[];if(typeof q==="function"){return q.apply(this,p)}return q};m.prototype.uploadFile=function(p){return this.uploadFiles([p])};m.prototype.uploadFiles=function(D){var S,Q,I,N,F,y,R,L,H,O,X,B,M,E,r,J,C,P,G,x,v,t,q,U,W,V,T,p,K,A,z,w,u,s;G=new XMLHttpRequest();for(x=0,U=D.length;x<U;x++){S=D[x];S.xhr=G}B=l(this.options.method,D);C=l(this.options.url,D);G.open(B,C,true);G.withCredentials=!!this.options.withCredentials;r=null;I=(function(Y){return function(){var ab,aa,Z;Z=[];for(ab=0,aa=D.length;ab<aa;ab++){S=D[ab];Z.push(Y._errorProcessing(D,r||Y.options.dictResponseError.replace("{{statusCode}}",G.status),G))}return Z}})(this);J=(function(Y){return function(ai){var ad,aa,ah,af,ae,ac,ab,Z,ag;if(ai!=null){aa=100*ai.loaded/ai.total;for(ah=0,ac=D.length;ah<ac;ah++){S=D[ah];S.upload={progress:aa,total:ai.total,bytesSent:ai.loaded}}}else{ad=true;aa=100;for(af=0,ab=D.length;af<ab;af++){S=D[af];if(!(S.upload.progress===100&&S.upload.bytesSent===S.upload.total)){ad=false}S.upload.progress=aa;S.upload.bytesSent=S.upload.total}if(ad){return}}ag=[];for(ae=0,Z=D.length;ae<Z;ae++){S=D[ae];ag.push(Y.emit("uploadprogress",S,aa,S.upload.bytesSent))}return ag}})(this);G.onload=(function(Y){return function(aa){var Z;if(D[0].status===m.CANCELED){return}if(G.readyState!==4){return}r=G.responseText;if(G.getResponseHeader("content-type")&&~G.getResponseHeader("content-type").indexOf("application/json")){try{r=JSON.parse(r)}catch(ab){aa=ab;r="Invalid JSON response from server."}}J();if(!((200<=(Z=G.status)&&Z<300))){return I()}else{return Y._finished(D,r,aa)}}})(this);G.onerror=(function(Y){return function(){if(D[0].status===m.CANCELED){return}return I()}})(this);E=(K=G.upload)!=null?K:G;E.onprogress=J;y={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){o(y,this.options.headers)}for(N in y){F=y[N];if(F){G.setRequestHeader(N,F)}}Q=new FormData();if(this.options.params){A=this.options.params;for(X in A){P=A[X];Q.append(X,P)}}for(v=0,W=D.length;v<W;v++){S=D[v];this.emit("sending",S,G,Q)}if(this.options.uploadMultiple){this.emit("sendingmultiple",D,G,Q)}if(this.element.tagName==="FORM"){z=this.element.querySelectorAll("input, textarea, select, button");for(t=0,V=z.length;t<V;t++){L=z[t];H=L.getAttribute("name");O=L.getAttribute("type");if(L.tagName==="SELECT"&&L.hasAttribute("multiple")){w=L.options;for(q=0,T=w.length;q<T;q++){M=w[q];if(M.selected){Q.append(H,M.value)}}}else{if(!O||((u=O.toLowerCase())!=="checkbox"&&u!=="radio")||L.checked){Q.append(H,L.value)}}}}for(R=p=0,s=D.length-1;0<=s?p<=s:p>=s;R=0<=s?++p:--p){Q.append(this._getParamName(R),D[R],this._renameFilename(D[R].name))}return this.submitRequest(G,Q,D)};m.prototype.submitRequest=function(r,q,p){return r.send(q)};m.prototype._finished=function(r,t,u){var q,s,p;for(s=0,p=r.length;s<p;s++){q=r[s];q.status=m.SUCCESS;this.emit("success",q,t,u);this.emit("complete",q)}if(this.options.uploadMultiple){this.emit("successmultiple",r,t,u);this.emit("completemultiple",r)}if(this.options.autoProcessQueue){return this.processQueue()}};m.prototype._errorProcessing=function(s,r,u){var q,t,p;for(t=0,p=s.length;t<p;t++){q=s[t];q.status=m.ERROR;this.emit("error",q,r,u);this.emit("complete",q)}if(this.options.uploadMultiple){this.emit("errormultiple",s,r,u);this.emit("completemultiple",s)}if(this.options.autoProcessQueue){return this.processQueue()}};return m})(i);g.version="4.3.0";g.options={};g.optionsForElement=function(l){if(l.getAttribute("id")){return g.options[b(l.getAttribute("id"))]}else{return void 0}};g.instances=[];g.forElement=function(l){if(typeof l==="string"){l=document.querySelector(l)}if((l!=null?l.dropzone:void 0)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.")}return l.dropzone};g.autoDiscover=true;g.discover=function(){var q,n,o,p,m,l;if(document.querySelectorAll){o=document.querySelectorAll(".dropzone")}else{o=[];q=function(v){var t,u,s,r;r=[];for(u=0,s=v.length;u<s;u++){t=v[u];if(/(^| )dropzone($| )/.test(t.className)){r.push(o.push(t))}else{r.push(void 0)}}return r};q(document.getElementsByTagName("div"));q(document.getElementsByTagName("form"))}l=[];for(p=0,m=o.length;p<m;p++){n=o[p];if(g.optionsForElement(n)!==false){l.push(new g(n))}else{l.push(void 0)}}return l};g.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i];g.isBrowserSupported=function(){var m,n,p,l,o;m=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList" in document.createElement("a"))){m=false}else{o=g.blacklistedBrowsers;for(p=0,l=o.length;p<l;p++){n=o[p];if(n.test(navigator.userAgent)){m=false;continue}}}}else{m=false}return m};j=function(q,n){var o,p,m,l;l=[];for(p=0,m=q.length;p<m;p++){o=q[p];if(o!==n){l.push(o)}}return l};b=function(l){return l.replace(/[\-_](\w)/g,function(m){return m.charAt(1).toUpperCase()})};g.createElement=function(l){var m;m=document.createElement("div");m.innerHTML=l;return m.childNodes[0]};g.elementInside=function(m,l){if(m===l){return true}while(m=m.parentNode){if(m===l){return true}}return false};g.getElement=function(n,l){var m;if(typeof n==="string"){m=document.querySelector(n)}else{if(n.nodeType!=null){m=n}}if(m==null){throw new Error("Invalid `"+l+"` option provided. Please provide a CSS selector or a plain HTML element.")}return m};g.getElements=function(r,m){var t,o,l,q,p,u,n,s;if(r instanceof Array){l=[];try{for(q=0,u=r.length;q<u;q++){o=r[q];l.push(this.getElement(o,m))}}catch(v){t=v;l=null}}else{if(typeof r==="string"){l=[];s=document.querySelectorAll(r);for(p=0,n=s.length;p<n;p++){o=s[p];l.push(o)}}else{if(r.nodeType!=null){l=[r]}}}if(!((l!=null)&&l.length)){throw new Error("Invalid `"+m+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.")}return l};g.confirm=function(l,n,m){if(window.confirm(l)){return n()}else{if(m!=null){return m()}}};g.isValidFile=function(o,l){var n,r,p,q,m;if(!l){return true}l=l.split(",");r=o.type;n=r.replace(/\/.*$/,"");for(q=0,m=l.length;q<m;q++){p=l[q];p=p.trim();if(p.charAt(0)==="."){if(o.name.toLowerCase().indexOf(p.toLowerCase(),o.name.length-p.length)!==-1){return true}}else{if(/\/\*$/.test(p)){if(n===p.replace(/\/.*$/,"")){return true}}else{if(r===p){return true}}}}return false};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(l){return this.each(function(){return new g(this,l)})}}if(typeof module!=="undefined"&&module!==null){module.exports=g}else{window.Dropzone=g}g.ADDED="added";g.QUEUED="queued";g.ACCEPTED=g.QUEUED;g.UPLOADING="uploading";g.PROCESSING=g.UPLOADING;g.CANCELED="canceled";g.ERROR="error";g.SUCCESS="success";a=function(p){var n,l,v,o,q,u,m,t,r,s;m=p.naturalWidth;u=p.naturalHeight;l=document.createElement("canvas");l.width=1;l.height=u;v=l.getContext("2d");v.drawImage(p,0,0);o=v.getImageData(0,0,1,u).data;s=0;q=u;t=u;while(t>s){n=o[(t-1)*4+3];if(n===0){q=t}else{s=t}t=(q+s)>>1}r=t/u;if(r===0){return 1}else{return r}};e=function(t,m,r,q,s,n,v,u,l,p){var o;o=a(m);return t.drawImage(m,r,q,s,n,v,u,l,p/o)};d=function(n,r){var w,s,m,v,o,l,u,q,p;m=false;p=true;s=n.document;q=s.documentElement;w=(s.addEventListener?"addEventListener":"attachEvent");u=(s.addEventListener?"removeEventListener":"detachEvent");l=(s.addEventListener?"":"on");v=function(x){if(x.type==="readystatechange"&&s.readyState!=="complete"){return}(x.type==="load"?n:s)[u](l+x.type,v,false);if(!m&&(m=true)){return r.call(n,x.type||x)}};o=function(){var x;try{q.doScroll("left")}catch(y){x=y;setTimeout(o,50);return}return v("poll")};if(s.readyState!=="complete"){if(s.createEventObject&&q.doScroll){try{p=!n.frameElement}catch(t){}if(p){o()}}s[w](l+"DOMContentLoaded",v,false);s[w](l+"readystatechange",v,false);return n[w](l+"load",v,false)}};g._autoDiscoverFunction=function(){if(g.autoDiscover){return g.discover()}};d(window,g._autoDiscoverFunction)}).call(this);