!function(){function e(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(t,i){return i&&("object"==(i&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)||"function"==typeof i)?i:e(t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l,s=function(){function e(){t(this,e)}return n(e,[{key:"on",value:function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}},{key:"emit",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];this._callbacks=this._callbacks||{};var r=this._callbacks[e],o=!0,a=!1,l=void 0;if(r)try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0)s.value.apply(this,i)}catch(e){a=!0,l=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw l}}return this.element&&this.element.dispatchEvent(this.makeEvent("dropzone:"+e,{args:i})),this}},{key:"makeEvent",value:function(e,t){var i={bubbles:!0,cancelable:!0,detail:t};if("function"==typeof window.CustomEvent)return new CustomEvent(e,i);var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,i.bubbles,i.cancelable,i.detail),n}},{key:"off",value:function(e,t){if(!this._callbacks||0==arguments.length)return this._callbacks={},this;var i=this._callbacks[e];if(!i)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1);break}return this}}]),e}(),u={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2097152,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,defaultHeaders:!0,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",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",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You cannot upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(e,t,i){if(i)return{dzuuid:i.file.upload.uuid,dzchunkindex:i.index,dztotalfilesize:i.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:i.file.upload.totalChunkCount,dzchunkbyteoffset:i.index*this.options.chunkSize}},accept:function(e,t){return t()},chunksUploaded:function(e,t){t()},binaryBody:!1,fallback:function(){this.element.className="".concat(this.element.className," dz-browser-not-supported");var e=!0,t=!1,i=void 0;try{for(var n,r,o=this.element.getElementsByTagName("div")[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var a=r.value;if(/(^| )dz-message($| )/.test(a.className)){n=a,a.className="dz-message";break}}}catch(e){t=!0,i=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw i}}n||(n=c.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(n));var l=n.getElementsByTagName("span")[0];return l&&(null!=l.textContent?l.textContent=this.options.dictFallbackMessage:null!=l.innerText&&(l.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,i,n){var r={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},o=e.width/e.height;null==t&&null==i?(t=r.srcWidth,i=r.srcHeight):null==t?t=i*o:null==i&&(i=t/o);var a=(t=Math.min(t,r.srcWidth))/(i=Math.min(i,r.srcHeight));if(r.srcWidth>t||r.srcHeight>i){if("crop"===n)o>a?(r.srcHeight=e.height,r.srcWidth=r.srcHeight*a):(r.srcWidth=e.width,r.srcHeight=r.srcWidth/a);else if("contain"===n)o>a?i=t/o:t=i*o;else throw Error("Unknown resizeMethod '".concat(n,"'"))}return r.srcX=(e.width-r.srcWidth)/2,r.srcY=(e.height-r.srcHeight)/2,r.trgWidth=t,r.trgHeight=i,r},transformFile:function(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:(l='<div class="dz-file-preview dz-preview"> <div class="dz-image"><img data-dz-thumbnail></div> <div class="dz-details"> <div class="dz-size"><span data-dz-size></span></div> <div class="dz-filename"><span data-dz-name></span></div> </div> <div class="dz-progress"> <span class="dz-upload" data-dz-uploadprogress></span> </div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark"> <svg width="54" height="54" fill="#fff"><path d="m10.207 29.793 4.086-4.086a1 1 0 0 1 1.414 0l5.586 5.586a1 1 0 0 0 1.414 0l15.586-15.586a1 1 0 0 1 1.414 0l4.086 4.086a1 1 0 0 1 0 1.414L22.707 42.293a1 1 0 0 1-1.414 0L10.207 31.207a1 1 0 0 1 0-1.414Z"/></svg> </div> <div class="dz-error-mark"> <svg width="54" height="54" fill="#fff"><path d="m26.293 20.293-7.086-7.086a1 1 0 0 0-1.414 0l-4.586 4.586a1 1 0 0 0 0 1.414l7.086 7.086a1 1 0 0 1 0 1.414l-7.086 7.086a1 1 0 0 0 0 1.414l4.586 4.586a1 1 0 0 0 1.414 0l7.086-7.086a1 1 0 0 1 1.414 0l7.086 7.086a1 1 0 0 0 1.414 0l4.586-4.586a1 1 0 0 0 0-1.414l-7.086-7.086a1 1 0 0 1 0-1.414l7.086-7.086a1 1 0 0 0 0-1.414l-4.586-4.586a1 1 0 0 0-1.414 0l-7.086 7.086a1 1 0 0 1-1.414 0Z"/></svg> </div> </div>').__esModule?l.default:l,drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function(e){},dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:function(e){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var t=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){e.previewElement=c.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);var i=!0,n=!1,r=void 0;try{for(var o,a=e.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value;l.textContent=e.name}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var s=!0,u=!1,d=void 0;try{for(var h,p=e.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator]();!(s=(h=p.next()).done);s=!0)(l=h.value).innerHTML=this.filesize(e.size)}catch(e){u=!0,d=e}finally{try{s||null==p.return||p.return()}finally{if(u)throw d}}this.options.addRemoveLinks&&(e._removeLink=c.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),e.previewElement.appendChild(e._removeLink));var f=function(i){return(i.preventDefault(),i.stopPropagation(),e.status===c.UPLOADING)?c.confirm(t.options.dictCancelUploadConfirmation,function(){return t.removeFile(e)}):t.options.dictRemoveFileConfirmation?c.confirm(t.options.dictRemoveFileConfirmation,function(){return t.removeFile(e)}):t.removeFile(e)},m=!0,v=!1,y=void 0;try{for(var g,b=e.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator]();!(m=(g=b.next()).done);m=!0)g.value.addEventListener("click",f)}catch(e){v=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(v)throw y}}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");var i=!0,n=!1,r=void 0;try{for(var o,a=e.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value;l.alt=e.name,l.src=t}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return setTimeout(function(){return e.previewElement.classList.add("dz-image-preview")},1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);var i=!0,n=!1,r=void 0;try{for(var o,a=e.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)o.value.textContent=t}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t,i){var n=!0,r=!1,o=void 0;if(e.previewElement)try{for(var a,l=e.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;"PROGRESS"===s.nodeName?s.value=t:s.style.width="".concat(t,"%")}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},c=function(i){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(h,i);var l,c=(l=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=a(h);return e=l?Reflect.construct(t,arguments,a(this).constructor):t.apply(this,arguments),o(this,e)});function h(i,n){if(t(this,h),(r=c.call(this)).element=i,r.clickableElements=[],r.listeners=[],r.files=[],"string"==typeof r.element&&(r.element=document.querySelector(r.element)),null===r.element||!r.element instanceof HTMLElement)throw Error("Invalid dropzone element: not an instance of HTMLElement.");if(r.element.dropzone)throw Error("Dropzone already attached.");h.instances.push(e(r)),r.element.dropzone=e(r);var r,a,l,s=null!=(l=h.optionsForElement(r.element))?l:{};if(r.options=Object.assign({},u,s,null!=n?n:{}),r.options.previewTemplate=r.options.previewTemplate.replace(/\n*/g,""),r.options.forceFallback||!h.isBrowserSupported())return o(r,r.options.fallback.call(e(r)));if(null==r.options.url&&(r.options.url=r.element.getAttribute("action")),!r.options.url)throw Error("No URL provided.");if(r.options.uploadMultiple&&r.options.chunking)throw Error("You cannot set both: uploadMultiple and chunking.");if(r.options.binaryBody&&r.options.uploadMultiple)throw Error("You cannot set both: binaryBody and uploadMultiple.");return"string"==typeof r.options.method&&(r.options.method=r.options.method.toUpperCase()),(a=r.getExistingFallback())&&a.parentNode&&a.parentNode.removeChild(a),!1!==r.options.previewsContainer&&(r.options.previewsContainer?r.previewsContainer=h.getElement(r.options.previewsContainer,"previewsContainer"):r.previewsContainer=r.element),r.options.clickable&&(!0===r.options.clickable?r.clickableElements=[r.element]:r.clickableElements=h.getElements(r.options.clickable,"clickable")),r.init(),r}return n(h,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(e){return e.accepted}).map(function(e){return e})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(e){return!e.accepted}).map(function(e){return e})}},{key:"getFilesWithStatus",value:function(e){return this.files.filter(function(t){return t.status===e}).map(function(e){return e})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(h.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(h.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(h.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(e){return e.status===h.UPLOADING||e.status===h.QUEUED}).map(function(e){return e})}},{key:"init",value:function(){var e=this;if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(h.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var t=function(){var i;e.hiddenFileInput&&(null===(i=e.hiddenFileInput.parentNode)||void 0===i||i.removeChild(e.hiddenFileInput)),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),e.hiddenFileInput.setAttribute("form",e.element.id),(null===e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!==e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!==e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.setAttribute("tabindex","-1"),e.hiddenFileInput.setAttribute("aria-label","dropzone hidden input"),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",h.getElement(e.options.hiddenInputContainer,"hiddenInputContainer").appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",function(){var i=e.hiddenFileInput.files,n=!0,r=!1,o=void 0;if(i.length)try{for(var a,l=i[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;e.addFile(s)}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}e.emit("addedfiles",i),t()})};t()}this.URL=null!==window.URL?window.URL:window.webkitURL;var i=!0,n=!1,r=void 0;try{for(var o,a=this.events[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value;this.on(l,this.options[l])}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}this.on("uploadprogress",function(){return e.updateTotalUploadProgress()}),this.on("removedfile",function(){return e.updateTotalUploadProgress()}),this.on("canceled",function(t){return e.emit("complete",t)}),this.on("complete",function(t){if(0===e.getAddedFiles().length&&0===e.getUploadingFiles().length&&0===e.getQueuedFiles().length)return setTimeout(function(){return e.emit("queuecomplete")},0)});var s=function(e){if(e.dataTransfer.types&&e.dataTransfer.types.includes("Files"))return e.stopPropagation(),e.preventDefault()};return this.listeners=[{element:this.element,events:{dragstart:function(t){return e.emit("dragstart",t)},dragenter:function(t){return s(t),e.emit("dragenter",t)},dragover:function(t){var i=t.dataTransfer.effectAllowed;return t.dataTransfer.dropEffect="move"===i||"linkMove"===i?"move":"copy",s(t),e.emit("dragover",t)},dragleave:function(t){return e.emit("dragleave",t)},drop:function(t){return s(t),e.drop(t)},dragend:function(t){return e.emit("dragend",t)}}}],this.clickableElements.forEach(function(t){return e.listeners.push({element:t,events:{click:function(i){return(t!==e.element||i.target===e.element||h.elementInside(i.target,e.element.querySelector(".dz-message")))&&e.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,h.instances.splice(h.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var e=0,t=0;if(this.getActiveFiles().length){var i=!0,n=!1,r=void 0;try{for(var o,a,l=this.getActiveFiles()[Symbol.iterator]();!(i=(a=l.next()).done);i=!0){var s=a.value;e+=s.upload.bytesSent,t+=s.upload.total}}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}o=100*e/t}else o=100;return this.emit("totaluploadprogress",o,t,e)}},{key:"_getParamName",value:function(e){return"function"==typeof this.options.paramName?this.options.paramName(e):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(e,"]"):"")}},{key:"_renameFile",value:function(e){var t,i,n=(t=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){var n;n=i[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),i=i={name:e.name.replace(/\u202F/g," ")},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):(function(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i.push.apply(i,n)}return i})(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t);return"function"!=typeof this.options.renameFile?n.name:this.options.renameFile(n)}},{key:"getFallbackForm",value:function(){if(e=this.getExistingFallback())return e;var e,t,i='<div class="dz-fallback">';this.options.dictFallbackText&&(i+="<p>".concat(this.options.dictFallbackText,"</p>")),i+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var n=h.createElement(i),r=this.resolveOption(this.options.method),o=this.resolveOption(this.options.url);return"FORM"!==this.element.tagName?(t=h.createElement('<form action="'.concat(o,'" enctype="multipart/form-data" method="').concat(r,'"></form>'))).appendChild(n):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",r)),null!=t?t:n}},{key:"getExistingFallback",value:function(){for(var e=0,t=["div","form"];e<t.length;e++){var i,n=t[e];if(i=function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(/(^| )fallback($| )/.test(a.className))return a}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}(this.element.getElementsByTagName(n)))return i}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(e){return function(){var t=[];for(var i in e.events){var n=e.events[i];t.push(e.element.addEventListener(i,n,!1))}return t}()})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(e){return function(){var t=[];for(var i in e.events){var n=e.events[i];t.push(e.element.removeEventListener(i,n,!1))}return t}()})}},{key:"disable",value:function(){var e=this;return this.clickableElements.forEach(function(e){return e.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(t){return e.cancelUpload(t)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(e){return e.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(e){var t=0,i="b";if(e>0){for(var n=["tb","gb","mb","kb","b"],r=0;r<n.length;r++){var o=n[r];if(e>=Math.pow(this.options.filesizeBase,4-r)/10){t=e/Math.pow(this.options.filesizeBase,4-r),i=o;break}}t=Math.round(10*t)/10}return"<strong>".concat(t,"</strong> ").concat(this.options.dictFileSizeUnits[i])}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],i=0;i<e.dataTransfer.files.length;i++)t[i]=e.dataTransfer.files[i];if(t.length){var n=e.dataTransfer.items;n&&n.length&&null!=n[0].webkitGetAsEntry?this._addFilesFromItems(n):this.handleFiles(t)}this.emit("addedfiles",t)}}},{key:"paste",value:function(e){var t,i;if(null!=(t=null!=e?e.clipboardData:void 0,i=function(e){return e.items},null!=t?i(t):void 0)){this.emit("paste",e);var n=e.clipboardData.items;if(n.length)return this._addFilesFromItems(n)}}},{key:"handleFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this.addFile(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"_addFilesFromItems",value:function(e){var t=this;return function(){var i=[],n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s,u=a.value;null!=u.webkitGetAsEntry&&(s=u.webkitGetAsEntry())?s.isFile?i.push(t.addFile(u.getAsFile())):s.isDirectory?i.push(t._addFilesFromDirectory(s,s.name)):i.push(void 0):null!=u.getAsFile&&(null==u.kind||"file"===u.kind)?i.push(t.addFile(u.getAsFile())):i.push(void 0)}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}return i}()}},{key:"_addFilesFromDirectory",value:function(e,t){var i=this,n=e.createReader(),r=function(e){var t,i;return t=console,i=function(t){return t.log(e)},null!=t&&"function"==typeof t.log?i(t,"log"):void 0},o=function(){return n.readEntries(function(e){if(e.length>0){var n=!0,r=!1,a=void 0;try{for(var l,s=e[Symbol.iterator]();!(n=(l=s.next()).done);n=!0){var u=l.value;u.isFile?u.file(function(e){if(!i.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath="".concat(t,"/").concat(e.name),i.addFile(e)}):u.isDirectory&&i._addFilesFromDirectory(u,"".concat(t,"/").concat(u.name))}}catch(e){r=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw a}}o()}return null},r)};return o()}},{key:"accept",value:function(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):h.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var t=this;e.upload={uuid:window.isSecureContext?self.crypto.randomUUID():h.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=h.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(i){i?(e.accepted=!1,t._errorProcessing([e],i)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this.enqueueFile(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status===h.ADDED&&!0===e.accepted){if(e.status=h.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return t.processQueue()},0)}else throw Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout(function(){return t._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var t=this._thumbnailQueue.shift();return this.createThumbnail(t,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(i){return e.emit("thumbnail",t,i),e._processingThumbnail=!1,e._processThumbnailQueue()})}}},{key:"removeFile",value:function(e){if(e.status===h.UPLOADING&&this.cancelUpload(e),this.files=d(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);var t=!0,i=!1,n=void 0;try{for(var r,o=this.files.slice()[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;(a.status!==h.UPLOADING||e)&&this.removeFile(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"resizeImage",value:function(e,t,i,n,r){var o=this;return this.createThumbnail(e,t,i,n,!0,function(t,i){if(null==i)return r(e);var n=o.options.resizeMimeType;null==n&&(n=e.type);var a=i.toDataURL(n,o.options.resizeQuality);return("image/jpeg"===n||"image/jpg"===n)&&(a=function(e,t){var i="data:image/jpeg;base64,";if(!(e.startsWith(i)&&t.startsWith(i)))return t;var n=window.atob(e.slice(i.length));if(!n.startsWith("ÿØÿ"))return t;for(var r=0,o="";r<n.length&&"ÿÚ"!=n.slice(r,r+2);)if("ÿØ"==n.slice(r,r+2))r+=2;else{var a=256*n.charCodeAt(r+2)+n.charCodeAt(r+3),l=r+a+2,s=n.slice(r,l);s.startsWith("ÿá")&&(o+=s),r=l}if(""==o)return t;var u=window.atob(t.slice(i.length));if(!u.startsWith("ÿØÿ"))return t;var c=4+256*u.charCodeAt(4)+u.charCodeAt(5);return u=u.slice(0,c)+o+u.slice(c),i+window.btoa(u)}(e.dataURL,a)),r(h.dataURItoBlob(a))},!0)}},{key:"createThumbnail",value:function(e,t,i,n,r,o){var a=this,l=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=new FileReader;s.onload=function(){if(e.dataURL=s.result,"image/svg+xml"===e.type){null!=o&&o(s.result);return}a.createThumbnailFromUrl(e,t,i,n,r,o,void 0,l)},s.readAsDataURL(e)}},{key:"displayExistingFile",value:function(e,t,i,n){var r=this,o=!(arguments.length>4)||void 0===arguments[4]||arguments[4];this.emit("addedfile",e),this.emit("complete",e),o?(e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,function(t){r.emit("thumbnail",e,t),i&&i()},n)):(this.emit("thumbnail",e,t),i&&i())}},{key:"createThumbnailFromUrl",value:function(e,t,i,n,r,o,a){var l=this,s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u=document.createElement("img");a&&(u.crossOrigin=a),r="from-image"!=getComputedStyle(document.body).imageOrientation&&r,u.onload=function(){var a=function(e){return e(1)};return"undefined"!=typeof EXIF&&null!==EXIF&&r&&(a=function(e){return EXIF.getData(u,function(){return e(EXIF.getTag(this,"Orientation"))})}),a(function(r){e.width=u.width,e.height=u.height;var a=l.options.resize.call(l,e,t,i,n),s=document.createElement("canvas"),c=s.getContext("2d");switch(s.width=a.trgWidth,s.height=a.trgHeight,r>4&&(s.width=a.trgHeight,s.height=a.trgWidth),r){case 2:c.translate(s.width,0),c.scale(-1,1);break;case 3:c.translate(s.width,s.height),c.rotate(Math.PI);break;case 4:c.translate(0,s.height),c.scale(1,-1);break;case 5:c.rotate(.5*Math.PI),c.scale(1,-1);break;case 6:c.rotate(.5*Math.PI),c.translate(0,-s.width);break;case 7:c.rotate(.5*Math.PI),c.translate(s.height,-s.width),c.scale(-1,1);break;case 8:c.rotate(-.5*Math.PI),c.translate(-s.height,0)}f(c,u,null!=a.srcX?a.srcX:0,null!=a.srcY?a.srcY:0,a.srcWidth,a.srcHeight,null!=a.trgX?a.trgX:0,null!=a.trgY?a.trgY:0,a.trgWidth,a.trgHeight);var d=s.toDataURL("image/png");if(null!=o)return o(d,s)})},null!=o&&(u.onerror=o);var c=e.dataURL;return s&&(c=function(e){var t="data:image/jpeg;base64,";if(!e.startsWith(t))return e;var i=window.atob(e.slice(t.length));if(!i.startsWith("ÿØÿ"))return e;for(var n=0,r="";n<i.length;){if("ÿÚ"==i.slice(n,n+2)){r+=i.slice(n);break}if("ÿØ"==i.slice(n,n+2))r+=i.slice(n,n+2),n+=2;else{var o=256*i.charCodeAt(n+2)+i.charCodeAt(n+3),a=n+o+2,l=i.slice(n,a);l.startsWith("ÿá")||(r+=l),n=a}}return t+window.btoa(r)}(c)),u.src=c}},{key:"processQueue",value:function(){var e=this.options.parallelUploads,t=this.getUploadingFiles().length,i=t;if(!(t>=e)){var n=this.getQueuedFiles();if(n.length>0){if(this.options.uploadMultiple)return this.processFiles(n.slice(0,e-t));for(;i<e;){if(!n.length)return;this.processFile(n.shift()),i++}}}}},{key:"processFile",value:function(e){return this.processFiles([e])}},{key:"processFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.processing=!0,a.status=h.UPLOADING,this.emit("processing",a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}},{key:"_getFilesWithXhr",value:function(e){return this.files.filter(function(t){return t.xhr===e}).map(function(e){return e})}},{key:"cancelUpload",value:function(e){if(e.status===h.UPLOADING){var t=this._getFilesWithXhr(e.xhr),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)o.value.status=h.CANCELED}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}void 0!==e.xhr&&e.xhr.abort();var l=!0,s=!1,u=void 0;try{for(var c,d=t[Symbol.iterator]();!(l=(c=d.next()).done);l=!0){var p=c.value;this.emit("canceled",p)}}catch(e){s=!0,u=e}finally{try{l||null==d.return||d.return()}finally{if(s)throw u}}this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else(e.status===h.ADDED||e.status===h.QUEUED)&&(e.status=h.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return"function"==typeof e?e.apply(this,i):e}},{key:"uploadFile",value:function(e){return this.uploadFiles([e])}},{key:"uploadFiles",value:function(e){var t=this;this._transformFiles(e,function(i){if(t.options.chunking){var n=i[0];e[0].upload.chunked=t.options.chunking&&(t.options.forceChunking||n.size>t.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/t.options.chunkSize),0===n.size&&(e[0].upload.totalChunkCount=1)}if(e[0].upload.chunked){var r=e[0],o=i[0];r.upload.chunks=[];var a=function(){for(var i=0;void 0!==r.upload.chunks[i];)i++;if(!(i>=r.upload.totalChunkCount)){var n=i*t.options.chunkSize,a=Math.min(n+t.options.chunkSize,o.size),l={name:t._getParamName(0),data:o.webkitSlice?o.webkitSlice(n,a):o.slice(n,a),filename:r.upload.filename,chunkIndex:i};r.upload.chunks[i]={file:r,index:i,dataBlock:l,status:h.UPLOADING,progress:0,retries:0},t._uploadData(e,[l])}};if(r.upload.finishedChunkUpload=function(i,n){var o=!0;i.status=h.SUCCESS,i.dataBlock=null,i.response=i.xhr.responseText,i.responseHeaders=i.xhr.getAllResponseHeaders(),i.xhr=null;for(var l=0;l<r.upload.totalChunkCount;l++){if(void 0===r.upload.chunks[l])return a();r.upload.chunks[l].status!==h.SUCCESS&&(o=!1)}o&&t.options.chunksUploaded(r,function(){t._finished(e,n,null)})},t.options.parallelChunkUploads)for(var l=Math.min(!0===t.options.parallelChunkUploads?t.options.parallelUploads:t.options.parallelChunkUploads,r.upload.totalChunkCount),s=0;s<l;s++)a();else a()}else{for(var u=[],c=0;c<e.length;c++)u[c]={name:t._getParamName(c),data:i[c],filename:e[c].upload.filename};t._uploadData(e,u)}})}},{key:"_getChunk",value:function(e,t){for(var i=0;i<e.upload.totalChunkCount;i++)if(void 0!==e.upload.chunks[i]&&e.upload.chunks[i].xhr===t)return e.upload.chunks[i]}},{key:"_uploadData",value:function(e,t){var i=this,n=new XMLHttpRequest,r=!0,o=!1,a=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done);r=!0)l.value.xhr=n}catch(e){o=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw a}}e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=n);var u=this.resolveOption(this.options.method,e,t),c=this.resolveOption(this.options.url,e,t);n.open(u,c,!0),this.resolveOption(this.options.timeout,e)&&(n.timeout=this.resolveOption(this.options.timeout,e)),n.withCredentials=!!this.options.withCredentials,n.onload=function(t){i._finishedUploading(e,n,t)},n.ontimeout=function(){i._handleUploadError(e,n,"Request timedout after ".concat(i.options.timeout/1e3," seconds"))},n.onerror=function(){i._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=function(t){return i._updateFilesUploadProgress(e,n,t)};var d=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};for(var h in this.options.binaryBody&&(d["Content-Type"]=e[0].type),this.options.headers&&Object.assign(d,this.options.headers),d){var p=d[h];p&&n.setRequestHeader(h,p)}if(this.options.binaryBody){var f=!0,m=!1,v=void 0;try{for(var y,g=e[Symbol.iterator]();!(f=(y=g.next()).done);f=!0){var b=y.value;this.emit("sending",b,n)}}catch(e){m=!0,v=e}finally{try{f||null==g.return||g.return()}finally{if(m)throw v}}this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{var k=new FormData;if(this.options.params){var w=this.options.params;for(var F in"function"==typeof w&&(w=w.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null)),w){var E=w[F];if(Array.isArray(E))for(var C=0;C<E.length;C++)k.append(F,E[C]);else k.append(F,E)}}var z=!0,S=!1,x=void 0;try{for(var _,U=e[Symbol.iterator]();!(z=(_=U.next()).done);z=!0){var A=_.value;this.emit("sending",A,n,k)}}catch(e){S=!0,x=e}finally{try{z||null==U.return||U.return()}finally{if(S)throw x}}this.options.uploadMultiple&&this.emit("sendingmultiple",e,n,k),this._addFormElementData(k);for(var T=0;T<t.length;T++){var L=t[T];k.append(L.name,L.data,L.filename)}this.submitRequest(n,k,e)}}},{key:"_transformFiles",value:function(e,t){for(var i=this,n=function(n){i.options.transformFile.call(i,e[n],function(i){r[n]=i,++o===e.length&&t(r)})},r=[],o=0,a=0;a<e.length;a++)n(a)}},{key:"_addFormElementData",value:function(e){var t=!0,i=!1,n=void 0;if("FORM"===this.element.tagName)try{for(var r,o=this.element.querySelectorAll("input, textarea, select, button")[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value,l=a.getAttribute("name"),s=a.getAttribute("type");if(s&&(s=s.toLowerCase()),null!=l){if("SELECT"===a.tagName&&a.hasAttribute("multiple")){var u=!0,c=!1,d=void 0;try{for(var h,p=a.options[Symbol.iterator]();!(u=(h=p.next()).done);u=!0){var f=h.value;f.selected&&e.append(l,f.value)}}catch(e){c=!0,d=e}finally{try{u||null==p.return||p.return()}finally{if(c)throw d}}}else(!s||"checkbox"!==s&&"radio"!==s||a.checked)&&e.append(l,a.value)}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"_updateFilesUploadProgress",value:function(e,t,i){var n=!0,r=!1,o=void 0;if(e[0].upload.chunked){var a=e[0],l=this._getChunk(a,t);i?(l.progress=100*i.loaded/i.total,l.total=i.total,l.bytesSent=i.loaded):(l.progress=100,l.bytesSent=l.total),a.upload.progress=0,a.upload.total=0,a.upload.bytesSent=0;for(var s=0;s<a.upload.totalChunkCount;s++)a.upload.chunks[s]&&void 0!==a.upload.chunks[s].progress&&(a.upload.progress+=a.upload.chunks[s].progress,a.upload.total+=a.upload.chunks[s].total,a.upload.bytesSent+=a.upload.chunks[s].bytesSent);a.upload.progress=a.upload.progress/a.upload.totalChunkCount,this.emit("uploadprogress",a,a.upload.progress,a.upload.bytesSent)}else try{for(var u,c=e[Symbol.iterator]();!(n=(u=c.next()).done);n=!0){var d=u.value;d.upload.total&&d.upload.bytesSent&&d.upload.bytesSent==d.upload.total||(i?(d.upload.progress=100*i.loaded/i.total,d.upload.total=i.total,d.upload.bytesSent=i.loaded):(d.upload.progress=100,d.upload.bytesSent=d.upload.total),this.emit("uploadprogress",d,d.upload.progress,d.upload.bytesSent))}}catch(e){r=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw o}}}},{key:"_finishedUploading",value:function(e,t,i){var n;if(e[0].status!==h.CANCELED&&4===t.readyState){if("arraybuffer"!==t.responseType&&"blob"!==t.responseType&&(n=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{n=JSON.parse(n)}catch(e){i=e,n="Invalid JSON response from server."}this._updateFilesUploadProgress(e,t),200<=t.status&&t.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],t),n):this._finished(e,n,i):this._handleUploadError(e,t,n)}}},{key:"_handleUploadError",value:function(e,t,i){if(e[0].status!==h.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){var n=this._getChunk(e[0],t);if(n.retries++<this.options.retryChunksLimit){this._uploadData(e,[n.dataBlock]);return}console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,i||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}},{key:"submitRequest",value:function(e,t,i){if(1!=e.readyState){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}if("watchXHRTimout"in this.options&&this._watchXHRTimeout(e,i,this.options.watchXHRTimout),this.options.binaryBody){if(i[0].upload.chunked){var n=this._getChunk(i[0],e);e.send(n.dataBlock.data)}else e.send(i[0])}else e.send(t)}},{key:"_finished",value:function(e,t,i){var n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;s.status=h.SUCCESS,this.emit("success",s,t,i),this.emit("complete",s)}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,i),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(e,t,i){var n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;s.status=h.ERROR,this.emit("error",s,t,i),this.emit("complete",s)}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,i),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_getBytesSent",value:function(e){if(e[0].upload.chunked)return e[0].upload.bytesSent;var t=0,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value;t+=l.upload.bytesSent}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"_getTotalBytes",value:function(e,t){if(e[0].upload.chunked)return this._getChunk(e[0],t).file.size;var i=0,n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;i+=s.upload.total}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}return i}},{key:"_watchXHRTimeout",value:function(e,t,i){var n=this;if(!1!==i&&(null==i&&(i=2e3),!(i<=0))){var r=this._getBytesSent(t),o=this._getTotalBytes(t,e),a=setInterval(function(){var l=n._getBytesSent(t);if(l!==r){r=l;return}if(clearInterval(a),t[0].upload.chunked){if(l===o)return;var s=n._getChunk(t[0],e);if(s&&s.bytesSent===s.total)return}else if(l>0)return;e.onerror=null,e.abort(),n._handleUploadError(t,e,"Request timedout after ".concat(i," seconds"))},i);e.onreadystatechange=function(){if(4==e.readyState)try{clearInterval(a)}catch(e){}}}}}],[{key:"initClass",value:function(){this.prototype.Emitter=s,this.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"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"uuidv4",value:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)})}}]),h}(s);c.initClass(),c.options={},c.optionsForElement=function(e){return e.getAttribute("id")&&void 0!==c.options?c.options[h(e.getAttribute("id"))]:void 0},c.instances=[],c.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),(null!=e?e.dropzone:void 0)==null)throw 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 e.dropzone},c.discover=function(){var e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];var t=function(t){return function(){var i=[],n=!0,r=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var s=a.value;/(^| )dropzone($| )/.test(s.className)?i.push(e.push(s)):i.push(void 0)}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}return i}()};t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return function(){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var l=o.value;!1!==c.optionsForElement(l)?t.push(new c(l)):t.push(void 0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}()},c.isBrowserSupported=function(){return"undefined"!=typeof Promise},c.dataURItoBlob=function(e){for(var t=atob(e.split(",")[1]),i=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(t.length),r=new Uint8Array(n),o=0,a=t.length,l=0<=a;l?o<=a:o>=a;l?o++:o--)r[o]=t.charCodeAt(o);return new Blob([n],{type:i})};var d=function(e,t){return e.filter(function(e){return e!==t}).map(function(e){return e})},h=function(e){return e.replace(/[\-_](\w)/g,function(e){return e.charAt(1).toUpperCase()})};c.createElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},c.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},c.getElement=function(e,t){var i;if("string"==typeof e?i=document.querySelector(e):null!=e.nodeType&&(i=e),null==i)throw Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector or a plain HTML element."));return i},c.getElements=function(e,t){var i,n;if(e instanceof Array){n=[];try{var r=!0,o=!1,a=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done);r=!0)i=l.value,n.push(this.getElement(i,t))}catch(e){o=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw a}}}catch(e){n=null}}else if("string"==typeof e){n=[];var u=!0,c=!1,d=void 0;try{for(var h,p=document.querySelectorAll(e)[Symbol.iterator]();!(u=(h=p.next()).done);u=!0)i=h.value,n.push(i)}catch(e){c=!0,d=e}finally{try{u||null==p.return||p.return()}finally{if(c)throw d}}}else null!=e.nodeType&&(n=[e]);if(null==n||!n.length)throw Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return n},c.confirm=function(e,t,i){return window.confirm(e)?t():null!=i?i():void 0},c.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");var i=e.type,n=i.replace(/\/.*$/,""),r=!0,o=!1,a=void 0;try{for(var l,s=t[Symbol.iterator]();!(r=(l=s.next()).done);r=!0){var u=l.value;if(u=u.trim(),"."===u.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(u.toLowerCase(),e.name.length-u.length))return!0}else if(/\/\*$/.test(u)){if(n===u.replace(/\/.*$/,""))return!0}else if(i===u)return!0}}catch(e){o=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw a}}return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each(function(){return new c(this,e)})}),c.ADDED="added",c.QUEUED="queued",c.ACCEPTED=c.QUEUED,c.UPLOADING="uploading",c.PROCESSING=c.UPLOADING,c.CANCELED="canceled",c.ERROR="error",c.SUCCESS="success";var p=function(e){var t=e.naturalHeight,i=document.createElement("canvas");i.width=1,i.height=t;var n=i.getContext("2d");n.drawImage(e,0,0);for(var r=n.getImageData(1,0,1,t).data,o=0,a=t,l=t;l>o;)0===r[(l-1)*4+3]?a=l:o=l,l=a+o>>1;var s=l/t;return 0===s?1:s},f=function(e,t,i,n,r,o,a,l,s,u){var c=p(t);return e.drawImage(t,i,n,r,o,a,l,s,u/c)};window.Dropzone=c}();