"use strict";(self.webpackChunkgitea=self.webpackChunkgitea||[]).push([["dropzone"],{"./node_modules/dropzone/dist/dropzone.css":function(C,f,g){g.r(f)},"./node_modules/dropzone/dist/dropzone.mjs":function(C,f,g){g.r(f),g.d(f,{Dropzone:function(){return r},default:function(){return r}});var v=F;function F(){var n=[].slice.call(arguments),e=!1;typeof n[0]=="boolean"&&(e=n.shift());var i=n[0];if(y(i))throw new Error("extendee must be an object");for(var t=n.slice(1),s=t.length,l=0;l<s;l++){var o=t[l];for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a)){var u=o[a];if(e&&b(u)){var d=Array.isArray(u)?[]:{};i[a]=F(!0,Object.prototype.hasOwnProperty.call(i,a)&&!y(i[a])?i[a]:d,u)}else i[a]=u}}return i}function b(n){return Array.isArray(n)||{}.toString.call(n)=="[object Object]"}function y(n){return!n||typeof n!="object"&&typeof n!="function"}function z(n){return n&&n.__esModule?n.default:n}class E{on(e,i){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(i),this}emit(e,...i){this._callbacks=this._callbacks||{};let t=this._callbacks[e];if(t)for(let s of t)s.apply(this,i);return this.element&&this.element.dispatchEvent(this.makeEvent("dropzone:"+e,{args:i})),this}makeEvent(e,i){let t={bubbles:!0,cancelable:!0,detail:i};if(typeof window.CustomEvent=="function")return new CustomEvent(e,t);var s=document.createEvent("CustomEvent");return s.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),s}off(e,i){if(!this._callbacks||arguments.length===0)return this._callbacks={},this;let t=this._callbacks[e];if(!t)return this;if(arguments.length===1)return delete this._callbacks[e],this;for(let s=0;s<t.length;s++)if(t[s]===i){t.splice(s,1);break}return this}}var w={};w=`<div class="dz-preview dz-file-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" viewBox="0 0 54 54" fill="white" xmlns="http://www.w3.org/2000/svg">
      <path d="M10.2071 29.7929L14.2929 25.7071C14.6834 25.3166 15.3166 25.3166 15.7071 25.7071L21.2929 31.2929C21.6834 31.6834 22.3166 31.6834 22.7071 31.2929L38.2929 15.7071C38.6834 15.3166 39.3166 15.3166 39.7071 15.7071L43.7929 19.7929C44.1834 20.1834 44.1834 20.8166 43.7929 21.2071L22.7071 42.2929C22.3166 42.6834 21.6834 42.6834 21.2929 42.2929L10.2071 31.2071C9.81658 30.8166 9.81658 30.1834 10.2071 29.7929Z"></path>
    </svg>
  </div>
  <div class="dz-error-mark">
    <svg width="54" height="54" viewBox="0 0 54 54" fill="white" xmlns="http://www.w3.org/2000/svg">
      <path d="M26.2929 20.2929L19.2071 13.2071C18.8166 12.8166 18.1834 12.8166 17.7929 13.2071L13.2071 17.7929C12.8166 18.1834 12.8166 18.8166 13.2071 19.2071L20.2929 26.2929C20.6834 26.6834 20.6834 27.3166 20.2929 27.7071L13.2071 34.7929C12.8166 35.1834 12.8166 35.8166 13.2071 36.2071L17.7929 40.7929C18.1834 41.1834 18.8166 41.1834 19.2071 40.7929L26.2929 33.7071C26.6834 33.3166 27.3166 33.3166 27.7071 33.7071L34.7929 40.7929C35.1834 41.1834 35.8166 41.1834 36.2071 40.7929L40.7929 36.2071C41.1834 35.8166 41.1834 35.1834 40.7929 34.7929L33.7071 27.7071C33.3166 27.3166 33.3166 26.6834 33.7071 26.2929L40.7929 19.2071C41.1834 18.8166 41.1834 18.1834 40.7929 17.7929L36.2071 13.2071C35.8166 12.8166 35.1834 12.8166 34.7929 13.2071L27.7071 20.2929C27.3166 20.6834 26.6834 20.6834 26.2929 20.2929Z"></path>
    </svg>
  </div>
</div>
`;var L={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,acceptedMimeTypes: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 can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init(){},params(n,e,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(n,e){return e()},chunksUploaded:function(n,e){e()},binaryBody:!1,fallback(){let n;this.element.className=`${this.element.className} dz-browser-not-supported`;for(let i of this.element.getElementsByTagName("div"))if(/(^| )dz-message($| )/.test(i.className)){n=i,i.className="dz-message";break}n||(n=r.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(n));let e=n.getElementsByTagName("span")[0];return e&&(e.textContent!=null?e.textContent=this.options.dictFallbackMessage:e.innerText!=null&&(e.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(n,e,i,t){let s={srcX:0,srcY:0,srcWidth:n.width,srcHeight:n.height},l=n.width/n.height;e==null&&i==null?(e=s.srcWidth,i=s.srcHeight):e==null?e=i*l:i==null&&(i=e/l),e=Math.min(e,s.srcWidth),i=Math.min(i,s.srcHeight);let o=e/i;if(s.srcWidth>e||s.srcHeight>i)if(t==="crop")l>o?(s.srcHeight=n.height,s.srcWidth=s.srcHeight*o):(s.srcWidth=n.width,s.srcHeight=s.srcWidth/o);else if(t==="contain")l>o?i=e/l:e=i*l;else throw new Error(`Unknown resizeMethod '${t}'`);return s.srcX=(n.width-s.srcWidth)/2,s.srcY=(n.height-s.srcHeight)/2,s.trgWidth=e,s.trgHeight=i,s},transformFile(n,e){return(this.options.resizeWidth||this.options.resizeHeight)&&n.type.match(/image.*/)?this.resizeImage(n,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,e):e(n)},previewTemplate:z(w),drop(n){return this.element.classList.remove("dz-drag-hover")},dragstart(n){},dragend(n){return this.element.classList.remove("dz-drag-hover")},dragenter(n){return this.element.classList.add("dz-drag-hover")},dragover(n){return this.element.classList.add("dz-drag-hover")},dragleave(n){return this.element.classList.remove("dz-drag-hover")},paste(n){},reset(){return this.element.classList.remove("dz-started")},addedfile(n){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){n.previewElement=r.createElement(this.options.previewTemplate.trim()),n.previewTemplate=n.previewElement,this.previewsContainer.appendChild(n.previewElement);for(var e of n.previewElement.querySelectorAll("[data-dz-name]"))e.textContent=n.name;for(e of n.previewElement.querySelectorAll("[data-dz-size]"))e.innerHTML=this.filesize(n.size);this.options.addRemoveLinks&&(n._removeLink=r.createElement(`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`),n.previewElement.appendChild(n._removeLink));let i=t=>(t.preventDefault(),t.stopPropagation(),n.status===r.UPLOADING?r.confirm(this.options.dictCancelUploadConfirmation,()=>this.removeFile(n)):this.options.dictRemoveFileConfirmation?r.confirm(this.options.dictRemoveFileConfirmation,()=>this.removeFile(n)):this.removeFile(n));for(let t of n.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",i)}},removedfile(n){return n.previewElement!=null&&n.previewElement.parentNode!=null&&n.previewElement.parentNode.removeChild(n.previewElement),this._updateMaxFilesReachedClass()},thumbnail(n,e){if(n.previewElement){n.previewElement.classList.remove("dz-file-preview");for(let i of n.previewElement.querySelectorAll("[data-dz-thumbnail]"))i.alt=n.name,i.src=e;return setTimeout(()=>n.previewElement.classList.add("dz-image-preview"),1)}},error(n,e){if(n.previewElement){n.previewElement.classList.add("dz-error"),typeof e!="string"&&e.error&&(e=e.error);for(let i of n.previewElement.querySelectorAll("[data-dz-errormessage]"))i.textContent=e}},errormultiple(){},processing(n){if(n.previewElement&&(n.previewElement.classList.add("dz-processing"),n._removeLink))return n._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(n,e,i){if(n.previewElement)for(let t of n.previewElement.querySelectorAll("[data-dz-uploadprogress]"))t.nodeName==="PROGRESS"?t.value=e:t.style.width=`${e}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(n){if(n.previewElement)return n.previewElement.classList.add("dz-success")},successmultiple(){},canceled(n){return this.emit("error",n,this.options.dictUploadCanceled)},canceledmultiple(){},complete(n){if(n._removeLink&&(n._removeLink.innerHTML=this.options.dictRemoveFile),n.previewElement)return n.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class r extends E{static initClass(){this.prototype.Emitter=E,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}getAcceptedFiles(){return this.files.filter(e=>e.accepted).map(e=>e)}getRejectedFiles(){return this.files.filter(e=>!e.accepted).map(e=>e)}getFilesWithStatus(e){return this.files.filter(i=>i.status===e).map(i=>i)}getQueuedFiles(){return this.getFilesWithStatus(r.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(r.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(r.ADDED)}getActiveFiles(){return this.files.filter(e=>e.status===r.UPLOADING||e.status===r.QUEUED).map(e=>e)}init(){if(this.element.tagName==="form"&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(r.createElement(`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`)),this.clickableElements.length){let t=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(this.options.maxFiles===null||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",this.options.acceptedFiles!==null&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),this.options.capture!==null&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",r.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",()=>{let{files:s}=this.hiddenFileInput;if(s.length)for(let l of s)this.addFile(l);this.emit("addedfiles",s),t()})};t()}this.URL=window.URL!==null?window.URL:window.webkitURL;for(let t of this.events)this.on(t,this.options[t]);this.on("uploadprogress",()=>this.updateTotalUploadProgress()),this.on("removedfile",()=>this.updateTotalUploadProgress()),this.on("canceled",t=>this.emit("complete",t)),this.on("complete",t=>{if(this.getAddedFiles().length===0&&this.getUploadingFiles().length===0&&this.getQueuedFiles().length===0)return setTimeout(()=>this.emit("queuecomplete"),0)});const e=function(t){if(t.dataTransfer.types){for(var s=0;s<t.dataTransfer.types.length;s++)if(t.dataTransfer.types[s]==="Files")return!0}return!1};let i=function(t){if(!!e(t))return t.stopPropagation(),t.preventDefault?t.preventDefault():t.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:t=>this.emit("dragstart",t),dragenter:t=>(i(t),this.emit("dragenter",t)),dragover:t=>{let s;try{s=t.dataTransfer.effectAllowed}catch(l){}return t.dataTransfer.dropEffect=s==="move"||s==="linkMove"?"move":"copy",i(t),this.emit("dragover",t)},dragleave:t=>this.emit("dragleave",t),drop:t=>(i(t),this.drop(t)),dragend:t=>this.emit("dragend",t)}}],this.clickableElements.forEach(t=>this.listeners.push({element:t,events:{click:s=>((t!==this.element||s.target===this.element||r.elementInside(s.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}})),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,r.instances.splice(r.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,i=0,t=0;if(this.getActiveFiles().length){for(let l of this.getActiveFiles())i+=l.upload.bytesSent,t+=l.upload.total;e=100*i/t}else e=100;return this.emit("totaluploadprogress",e,t,i)}_getParamName(e){return typeof this.options.paramName=="function"?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return typeof this.options.renameFile!="function"?e.name:this.options.renameFile(e)}getFallbackForm(){let e,i;if(e=this.getExistingFallback())return e;let t='<div class="dz-fallback">';this.options.dictFallbackText&&(t+=`<p>${this.options.dictFallbackText}</p>`),t+=`<input type="file" name="${this._getParamName(0)}" ${this.options.uploadMultiple?'multiple="multiple"':void 0} /><input type="submit" value="Upload!"></div>`;let s=r.createElement(t);return this.element.tagName!=="FORM"?(i=r.createElement(`<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>`),i.appendChild(s)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),i!=null?i:s}getExistingFallback(){let e=function(t){for(let s of t)if(/(^| )fallback($| )/.test(s.className))return s};for(let t of["div","form"]){var i;if(i=e(this.element.getElementsByTagName(t)))return i}}setupEventListeners(){return this.listeners.map(e=>(()=>{let i=[];for(let t in e.events){let s=e.events[t];i.push(e.element.addEventListener(t,s,!1))}return i})())}removeEventListeners(){return this.listeners.map(e=>(()=>{let i=[];for(let t in e.events){let s=e.events[t];i.push(e.element.removeEventListener(t,s,!1))}return i})())}disable(){return this.clickableElements.forEach(e=>e.classList.remove("dz-clickable")),this.removeEventListeners(),this.disabled=!0,this.files.map(e=>this.cancelUpload(e))}enable(){return delete this.disabled,this.clickableElements.forEach(e=>e.classList.add("dz-clickable")),this.setupEventListeners()}filesize(e){let i=0,t="b";if(e>0){let s=["tb","gb","mb","kb","b"];for(let l=0;l<s.length;l++){let o=s[l],a=Math.pow(this.options.filesizeBase,4-l)/10;if(e>=a){i=e/Math.pow(this.options.filesizeBase,4-l),t=o;break}}i=Math.round(10*i)/10}return`<strong>${i}</strong> ${this.options.dictFileSizeUnits[t]}`}_updateMaxFilesReachedClass(){return this.options.maxFiles!=null&&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")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let i=[];for(let t=0;t<e.dataTransfer.files.length;t++)i[t]=e.dataTransfer.files[t];if(i.length){let{items:t}=e.dataTransfer;t&&t.length&&t[0].webkitGetAsEntry!=null?this._addFilesFromItems(t):this.handleFiles(i)}this.emit("addedfiles",i)}paste(e){if(U(e!=null?e.clipboardData:void 0,t=>t.items)==null)return;this.emit("paste",e);let{items:i}=e.clipboardData;if(i.length)return this._addFilesFromItems(i)}handleFiles(e){for(let i of e)this.addFile(i)}_addFilesFromItems(e){return(()=>{let i=[];for(let s of e){var t;s.webkitGetAsEntry!=null&&(t=s.webkitGetAsEntry())?t.isFile?i.push(this.addFile(s.getAsFile())):t.isDirectory?i.push(this._addFilesFromDirectory(t,t.name)):i.push(void 0):s.getAsFile!=null&&(s.kind==null||s.kind==="file")?i.push(this.addFile(s.getAsFile())):i.push(void 0)}return i})()}_addFilesFromDirectory(e,i){let t=e.createReader(),s=o=>M(console,"log",a=>a.log(o));var l=()=>t.readEntries(o=>{if(o.length>0){for(let a of o)a.isFile?a.file(u=>{if(!(this.options.ignoreHiddenFiles&&u.name.substring(0,1)==="."))return u.fullPath=`${i}/${u.name}`,this.addFile(u)}):a.isDirectory&&this._addFilesFromDirectory(a,`${i}/${a.name}`);l()}return null},s);return l()}accept(e,i){this.options.maxFilesize&&e.size>this.options.maxFilesize*1048576?i(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):r.isValidFile(e,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(i(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,i):i(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:r.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=r.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,i=>{i?(e.accepted=!1,this._errorProcessing([e],i)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()})}enqueueFiles(e){for(let i of e)this.enqueueFile(i);return null}enqueueFile(e){if(e.status===r.ADDED&&e.accepted===!0){if(e.status=r.QUEUED,this.options.autoProcessQueue)return setTimeout(()=>this.processQueue(),0)}else throw new Error("This file can't be queued because it has already been processed or was rejected.")}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=this.options.maxThumbnailFilesize*1048576)return this._thumbnailQueue.push(e),setTimeout(()=>this._processThumbnailQueue(),0)}_processThumbnailQueue(){if(this._processingThumbnail||this._thumbnailQueue.length===0)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,i=>(this.emit("thumbnail",e,i),this._processingThumbnail=!1,this._processThumbnailQueue()))}removeFile(e){if(e.status===r.UPLOADING&&this.cancelUpload(e),this.files=S(this.files,e),this.emit("removedfile",e),this.files.length===0)return this.emit("reset")}removeAllFiles(e){e==null&&(e=!1);for(let i of this.files.slice())(i.status!==r.UPLOADING||e)&&this.removeFile(i);return null}resizeImage(e,i,t,s,l){return this.createThumbnail(e,i,t,s,!0,(o,a)=>{if(a==null)return l(e);{let{resizeMimeType:u}=this.options;u==null&&(u=e.type);let d=a.toDataURL(u,this.options.resizeQuality);return(u==="image/jpeg"||u==="image/jpg")&&(d=k.restore(e.dataURL,d)),l(r.dataURItoBlob(d))}})}createThumbnail(e,i,t,s,l,o){let a=new FileReader;a.onload=()=>{if(e.dataURL=a.result,e.type==="image/svg+xml"){o!=null&&o(a.result);return}this.createThumbnailFromUrl(e,i,t,s,l,o)},a.readAsDataURL(e)}displayExistingFile(e,i,t,s,l=!0){if(this.emit("addedfile",e),this.emit("complete",e),!l)this.emit("thumbnail",e,i),t&&t();else{let o=a=>{this.emit("thumbnail",e,a),t&&t()};e.dataURL=i,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,s)}}createThumbnailFromUrl(e,i,t,s,l,o,a){let u=document.createElement("img");return a&&(u.crossOrigin=a),l=getComputedStyle(document.body).imageOrientation=="from-image"?!1:l,u.onload=()=>{let d=h=>h(1);return typeof EXIF!="undefined"&&EXIF!==null&&l&&(d=h=>EXIF.getData(u,function(){return h(EXIF.getTag(this,"Orientation"))})),d(h=>{e.width=u.width,e.height=u.height;let p=this.options.resize.call(this,e,i,t,s),c=document.createElement("canvas"),m=c.getContext("2d");switch(c.width=p.trgWidth,c.height=p.trgHeight,h>4&&(c.width=p.trgHeight,c.height=p.trgWidth),h){case 2:m.translate(c.width,0),m.scale(-1,1);break;case 3:m.translate(c.width,c.height),m.rotate(Math.PI);break;case 4:m.translate(0,c.height),m.scale(1,-1);break;case 5:m.rotate(.5*Math.PI),m.scale(1,-1);break;case 6:m.rotate(.5*Math.PI),m.translate(0,-c.width);break;case 7:m.rotate(.5*Math.PI),m.translate(c.height,-c.width),m.scale(-1,1);break;case 8:m.rotate(-.5*Math.PI),m.translate(-c.height,0);break}A(m,u,p.srcX!=null?p.srcX:0,p.srcY!=null?p.srcY:0,p.srcWidth,p.srcHeight,p.trgX!=null?p.trgX:0,p.trgY!=null?p.trgY:0,p.trgWidth,p.trgHeight);let D=c.toDataURL("image/png");if(o!=null)return o(D,c)})},o!=null&&(u.onerror=o),u.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,i=this.getUploadingFiles().length,t=i;if(i>=e)return;let s=this.getQueuedFiles();if(s.length>0){if(this.options.uploadMultiple)return this.processFiles(s.slice(0,e-i));for(;t<e;){if(!s.length)return;this.processFile(s.shift()),t++}}}processFile(e){return this.processFiles([e])}processFiles(e){for(let i of e)i.processing=!0,i.status=r.UPLOADING,this.emit("processing",i);return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}_getFilesWithXhr(e){let i;return i=this.files.filter(t=>t.xhr===e).map(t=>t)}cancelUpload(e){if(e.status===r.UPLOADING){let i=this._getFilesWithXhr(e.xhr);for(let t of i)t.status=r.CANCELED;typeof e.xhr!="undefined"&&e.xhr.abort();for(let t of i)this.emit("canceled",t);this.options.uploadMultiple&&this.emit("canceledmultiple",i)}else(e.status===r.ADDED||e.status===r.QUEUED)&&(e.status=r.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...i){return typeof e=="function"?e.apply(this,i):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,i=>{if(this.options.chunking){let t=i[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||t.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(t.size/this.options.chunkSize)}if(e[0].upload.chunked){let t=e[0],s=i[0],l=0;t.upload.chunks=[];let o=()=>{let a=0;for(;t.upload.chunks[a]!==void 0;)a++;if(a>=t.upload.totalChunkCount)return;l++;let u=a*this.options.chunkSize,d=Math.min(u+this.options.chunkSize,s.size),h={name:this._getParamName(0),data:s.webkitSlice?s.webkitSlice(u,d):s.slice(u,d),filename:t.upload.filename,chunkIndex:a};t.upload.chunks[a]={file:t,index:a,dataBlock:h,status:r.UPLOADING,progress:0,retries:0},this._uploadData(e,[h])};if(t.upload.finishedChunkUpload=(a,u)=>{let d=!0;a.status=r.SUCCESS,a.dataBlock=null,a.response=a.xhr.responseText,a.responseHeaders=a.xhr.getAllResponseHeaders(),a.xhr=null;for(let h=0;h<t.upload.totalChunkCount;h++){if(t.upload.chunks[h]===void 0)return o();t.upload.chunks[h].status!==r.SUCCESS&&(d=!1)}d&&this.options.chunksUploaded(t,()=>{this._finished(e,u,null)})},this.options.parallelChunkUploads)for(let a=0;a<t.upload.totalChunkCount;a++)o();else o()}else{let t=[];for(let s=0;s<e.length;s++)t[s]={name:this._getParamName(s),data:i[s],filename:e[s].upload.filename};this._uploadData(e,t)}})}_getChunk(e,i){for(let t=0;t<e.upload.totalChunkCount;t++)if(e.upload.chunks[t]!==void 0&&e.upload.chunks[t].xhr===i)return e.upload.chunks[t]}_uploadData(e,i){let t=new XMLHttpRequest;for(let d of e)d.xhr=t;e[0].upload.chunked&&(e[0].upload.chunks[i[0].chunkIndex].xhr=t);let s=this.resolveOption(this.options.method,e,i),l=this.resolveOption(this.options.url,e,i);t.open(s,l,!0),this.resolveOption(this.options.timeout,e)&&(t.timeout=this.resolveOption(this.options.timeout,e)),t.withCredentials=!!this.options.withCredentials,t.onload=d=>{this._finishedUploading(e,t,d)},t.ontimeout=()=>{this._handleUploadError(e,t,`Request timedout after ${this.options.timeout/1e3} seconds`)},t.onerror=()=>{this._handleUploadError(e,t)};let a=t.upload!=null?t.upload:t;a.onprogress=d=>this._updateFilesUploadProgress(e,t,d);let u=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(u["Content-Type"]=e[0].type),this.options.headers&&v(u,this.options.headers);for(let d in u){let h=u[d];h&&t.setRequestHeader(d,h)}if(this.options.binaryBody){for(let d of e)this.emit("sending",d,t);this.options.uploadMultiple&&this.emit("sendingmultiple",e,t),this.submitRequest(t,null,e)}else{let d=new FormData;if(this.options.params){let h=this.options.params;typeof h=="function"&&(h=h.call(this,e,t,e[0].upload.chunked?this._getChunk(e[0],t):null));for(let p in h){let c=h[p];if(Array.isArray(c))for(let m=0;m<c.length;m++)d.append(p,c[m]);else d.append(p,c)}}for(let h of e)this.emit("sending",h,t,d);this.options.uploadMultiple&&this.emit("sendingmultiple",e,t,d),this._addFormElementData(d);for(let h=0;h<i.length;h++){let p=i[h];d.append(p.name,p.data,p.filename)}this.submitRequest(t,d,e)}}_transformFiles(e,i){let t=[],s=0;for(let l=0;l<e.length;l++)this.options.transformFile.call(this,e[l],o=>{t[l]=o,++s===e.length&&i(t)})}_addFormElementData(e){if(this.element.tagName==="FORM")for(let i of this.element.querySelectorAll("input, textarea, select, button")){let t=i.getAttribute("name"),s=i.getAttribute("type");if(s&&(s=s.toLowerCase()),!(typeof t=="undefined"||t===null))if(i.tagName==="SELECT"&&i.hasAttribute("multiple"))for(let l of i.options)l.selected&&e.append(t,l.value);else(!s||s!=="checkbox"&&s!=="radio"||i.checked)&&e.append(t,i.value)}}_updateFilesUploadProgress(e,i,t){if(e[0].upload.chunked){let s=e[0],l=this._getChunk(s,i);t?(l.progress=100*t.loaded/t.total,l.total=t.total,l.bytesSent=t.loaded):(l.progress=100,l.bytesSent=l.total),s.upload.progress=0,s.upload.total=0,s.upload.bytesSent=0;for(let o=0;o<s.upload.totalChunkCount;o++)s.upload.chunks[o]&&typeof s.upload.chunks[o].progress!="undefined"&&(s.upload.progress+=s.upload.chunks[o].progress,s.upload.total+=s.upload.chunks[o].total,s.upload.bytesSent+=s.upload.chunks[o].bytesSent);s.upload.progress=s.upload.progress/s.upload.totalChunkCount,this.emit("uploadprogress",s,s.upload.progress,s.upload.bytesSent)}else for(let s of e)s.upload.total&&s.upload.bytesSent&&s.upload.bytesSent==s.upload.total||(t?(s.upload.progress=100*t.loaded/t.total,s.upload.total=t.total,s.upload.bytesSent=t.loaded):(s.upload.progress=100,s.upload.bytesSent=s.upload.total),this.emit("uploadprogress",s,s.upload.progress,s.upload.bytesSent))}_finishedUploading(e,i,t){let s;if(e[0].status!==r.CANCELED&&i.readyState===4){if(i.responseType!=="arraybuffer"&&i.responseType!=="blob"&&(s=i.responseText,i.getResponseHeader("content-type")&&~i.getResponseHeader("content-type").indexOf("application/json")))try{s=JSON.parse(s)}catch(l){t=l,s="Invalid JSON response from server."}this._updateFilesUploadProgress(e,i),200<=i.status&&i.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],i),s):this._finished(e,s,t):this._handleUploadError(e,i,s)}}_handleUploadError(e,i,t){if(e[0].status!==r.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){let s=this._getChunk(e[0],i);if(s.retries++<this.options.retryChunksLimit){this._uploadData(e,[s.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,t||this.options.dictResponseError.replace("{{statusCode}}",i.status),i)}}submitRequest(e,i,t){if(e.readyState!=1){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}if(this.options.binaryBody)if(t[0].upload.chunked){const s=this._getChunk(t[0],e);e.send(s.dataBlock.data)}else e.send(t[0]);else e.send(i)}_finished(e,i,t){for(let s of e)s.status=r.SUCCESS,this.emit("success",s,i,t),this.emit("complete",s);if(this.options.uploadMultiple&&(this.emit("successmultiple",e,i,t),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}_errorProcessing(e,i,t){for(let s of e)s.status=r.ERROR,this.emit("error",s,i,t),this.emit("complete",s);if(this.options.uploadMultiple&&(this.emit("errormultiple",e,i,t),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}static uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let i=Math.random()*16|0;return(e==="x"?i:i&3|8).toString(16)})}constructor(e,i){super();let t,s;if(this.element=e,this.clickableElements=[],this.listeners=[],this.files=[],typeof this.element=="string"&&(this.element=document.querySelector(this.element)),!this.element||this.element.nodeType==null)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");r.instances.push(this),this.element.dropzone=this;let l=(s=r.optionsForElement(this.element))!=null?s:{};if(this.options=v(!0,{},L,l,i!=null?i:{}),this.options.previewTemplate=this.options.previewTemplate.replace(/\n*/g,""),this.options.forceFallback||!r.isBrowserSupported())return this.options.fallback.call(this);if(this.options.url==null&&(this.options.url=this.element.getAttribute("action")),!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.uploadMultiple&&this.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");if(this.options.binaryBody&&this.options.uploadMultiple)throw new Error("You cannot set both: binaryBody and uploadMultiple.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.renameFilename!=null&&(this.options.renameFile=o=>this.options.renameFilename.call(this,o.name,o)),typeof this.options.method=="string"&&(this.options.method=this.options.method.toUpperCase()),(t=this.getExistingFallback())&&t.parentNode&&t.parentNode.removeChild(t),this.options.previewsContainer!==!1&&(this.options.previewsContainer?this.previewsContainer=r.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(this.options.clickable===!0?this.clickableElements=[this.element]:this.clickableElements=r.getElements(this.options.clickable,"clickable")),this.init()}}r.initClass(),r.options={},r.optionsForElement=function(n){if(n.getAttribute("id"))return r.options[T(n.getAttribute("id"))]},r.instances=[],r.forElement=function(n){if(typeof n=="string"&&(n=document.querySelector(n)),(n!=null?n.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 n.dropzone},r.discover=function(){let n;if(document.querySelectorAll)n=document.querySelectorAll(".dropzone");else{n=[];let e=i=>(()=>{let t=[];for(let s of i)/(^| )dropzone($| )/.test(s.className)?t.push(n.push(s)):t.push(void 0);return t})();e(document.getElementsByTagName("div")),e(document.getElementsByTagName("form"))}return(()=>{let e=[];for(let i of n)r.optionsForElement(i)!==!1?e.push(new r(i)):e.push(void 0);return e})()},r.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],r.isBrowserSupported=function(){let n=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))n=!1;else{r.blacklistedBrowsers!==void 0&&(r.blockedBrowsers=r.blacklistedBrowsers);for(let e of r.blockedBrowsers)if(e.test(navigator.userAgent)){n=!1;continue}}else n=!1;return n},r.dataURItoBlob=function(n){let e=atob(n.split(",")[1]),i=n.split(",")[0].split(":")[1].split(";")[0],t=new ArrayBuffer(e.length),s=new Uint8Array(t);for(let l=0,o=e.length,a=0<=o;a?l<=o:l>=o;a?l++:l--)s[l]=e.charCodeAt(l);return new Blob([t],{type:i})};const S=(n,e)=>n.filter(i=>i!==e).map(i=>i),T=n=>n.replace(/[\-_](\w)/g,e=>e.charAt(1).toUpperCase());r.createElement=function(n){let e=document.createElement("div");return e.innerHTML=n,e.childNodes[0]},r.elementInside=function(n,e){if(n===e)return!0;for(;n=n.parentNode;)if(n===e)return!0;return!1},r.getElement=function(n,e){let i;if(typeof n=="string"?i=document.querySelector(n):n.nodeType!=null&&(i=n),i==null)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector or a plain HTML element.`);return i},r.getElements=function(n,e){let i,t;if(n instanceof Array){t=[];try{for(i of n)t.push(this.getElement(i,e))}catch(s){t=null}}else if(typeof n=="string"){t=[];for(i of document.querySelectorAll(n))t.push(i)}else n.nodeType!=null&&(t=[n]);if(t==null||!t.length)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return t},r.confirm=function(n,e,i){if(window.confirm(n))return e();if(i!=null)return i()},r.isValidFile=function(n,e){if(!e)return!0;e=e.split(",");let i=n.type,t=i.replace(/\/.*$/,"");for(let s of e)if(s=s.trim(),s.charAt(0)==="."){if(n.name.toLowerCase().indexOf(s.toLowerCase(),n.name.length-s.length)!==-1)return!0}else if(/\/\*$/.test(s)){if(t===s.replace(/\/.*$/,""))return!0}else if(i===s)return!0;return!1},typeof jQuery!="undefined"&&jQuery!==null&&(jQuery.fn.dropzone=function(n){return this.each(function(){return new r(this,n)})}),r.ADDED="added",r.QUEUED="queued",r.ACCEPTED=r.QUEUED,r.UPLOADING="uploading",r.PROCESSING=r.UPLOADING,r.CANCELED="canceled",r.ERROR="error",r.SUCCESS="success";let x=function(n){let e=n.naturalWidth,i=n.naturalHeight,t=document.createElement("canvas");t.width=1,t.height=i;let s=t.getContext("2d");s.drawImage(n,0,0);let{data:l}=s.getImageData(1,0,1,i),o=0,a=i,u=i;for(;u>o;)l[(u-1)*4+3]===0?a=u:o=u,u=a+o>>1;let d=u/i;return d===0?1:d};var A=function(n,e,i,t,s,l,o,a,u,d){let h=x(e);return n.drawImage(e,i,t,s,l,o,a,u,d/h)};class k{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let i="",t,s,l="",o,a,u,d="",h=0;for(;t=e[h++],s=e[h++],l=e[h++],o=t>>2,a=(t&3)<<4|s>>4,u=(s&15)<<2|l>>6,d=l&63,isNaN(s)?u=d=64:isNaN(l)&&(d=64),i=i+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(u)+this.KEY_STR.charAt(d),t=s=l="",o=a=u=d="",h<e.length;);return i}static restore(e,i){if(!e.match("data:image/jpeg;base64,"))return i;let t=this.decode64(e.replace("data:image/jpeg;base64,","")),s=this.slice2Segments(t),l=this.exifManipulation(i,s);return`data:image/jpeg;base64,${this.encode64(l)}`}static exifManipulation(e,i){let t=this.getExifArray(i),s=this.insertExif(e,t);return new Uint8Array(s)}static getExifArray(e){let i,t=0;for(;t<e.length;){if(i=e[t],i[0]===255&i[1]===225)return i;t++}return[]}static insertExif(e,i){let t=e.replace("data:image/jpeg;base64,",""),s=this.decode64(t),l=s.indexOf(255,3),o=s.slice(0,l),a=s.slice(l),u=o;return u=u.concat(i),u=u.concat(a),u}static slice2Segments(e){let i=0,t=[];for(;;){var s;if(e[i]===255&e[i+1]===218)break;if(e[i]===255&e[i+1]===216)i+=2;else{s=e[i+2]*256+e[i+3];let l=i+s+2,o=e.slice(i,l);t.push(o),i=l}if(i>e.length)break}return t}static decode64(e){let i="",t,s,l="",o,a,u,d="",h=0,p=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn(`There were invalid base64 characters in the input text.
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
Expect errors in decoding.`),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");o=this.KEY_STR.indexOf(e.charAt(h++)),a=this.KEY_STR.indexOf(e.charAt(h++)),u=this.KEY_STR.indexOf(e.charAt(h++)),d=this.KEY_STR.indexOf(e.charAt(h++)),t=o<<2|a>>4,s=(a&15)<<4|u>>2,l=(u&3)<<6|d,p.push(t),u!==64&&p.push(s),d!==64&&p.push(l),t=s=l="",o=a=u=d="",h<e.length;);return p}}k.initClass();let I=function(n,e){let i=!1,t=!0,s=n.document,l=s.documentElement,o=s.addEventListener?"addEventListener":"attachEvent",a=s.addEventListener?"removeEventListener":"detachEvent",u=s.addEventListener?"":"on";var d=function(p){if(!(p.type==="readystatechange"&&s.readyState!=="complete")&&((p.type==="load"?n:s)[a](u+p.type,d,!1),!i&&(i=!0)))return e.call(n,p.type||p)},h=function(){try{l.doScroll("left")}catch(p){setTimeout(h,50);return}return d("poll")};if(s.readyState!=="complete"){if(s.createEventObject&&l.doScroll){try{t=!n.frameElement}catch(p){}t&&h()}return s[o](u+"DOMContentLoaded",d,!1),s[o](u+"readystatechange",d,!1),n[o](u+"load",d,!1)}};function U(n,e){return typeof n!="undefined"&&n!==null?e(n):void 0}function M(n,e,i){if(typeof n!="undefined"&&n!==null&&typeof n[e]=="function")return i(n,e)}}}]);
