主要逻辑说明:文件页面(上传按钮),点击上传,弹出选择文件框(可以选择多个文件),点击确定会弹出来一个浮动层,显示已选择的文件列表,可以取消文件上传,上传结束前也可以取消上传,可以设置分片上传。基本满足本人使用纯js上传文件的组件,此组件功能比较强大,我只使用了其中一部分满足了需求。
fineuploader本身有哪些功能可以看官方文档:https://fineuploader.com/demos.html
https://docs.fineuploader.com/api/events.html
主要代码请参考upload.html页面的实现
当前支持的功能:
1.分片上传 2.判断重复上传(重复选择的文件会提示不能选择相同名字的文件上传) 3.上传文件过程中不能点击开始上传,全部上传完成后可以继续点击开始上传按钮
主要内容:
一、依赖
二、代码
一、依赖
fineuploader的js文件(all.fine-uploader.min.js)
// Fine Uploader 5.11.7 - (c) 2013-present Widen Enterprises, Inc. MIT licensed. http://fineuploader.com
!function(global){var qq=function(e){"use strict";return{hide:function(){return e.style.display="none",this},attach:function(t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n),function(){qq(e).detach(t,n)}},detach:function(t,n){return e.removeEventListener?e.removeEventListener(t,n,!1):e.attachEvent&&e.detachEvent("on"+t,n),this},contains:function(t){return!!t&&(e===t||(e.contains?e.contains(t):!!(8&t.compareDocumentPosition(e))))},insertBefore:function(t){return t.parentNode.insertBefore(e,t),this},remove:function(){return e.parentNode.removeChild(e),this},css:function(t){if(null==e.style)throw new qq.Error("Can't apply style to node as it is not on the HTMLElement prototype chain!");return null!=t.opacity&&"string"!=typeof e.style.opacity&&"undefined"!=typeof e.filters&&(t.filter="alpha(opacity="+Math.round(100*t.opacity)+")"),qq.extend(e.style,t),this},hasClass:function(t,n){var i=new RegExp("(^| )"+t+"( |$)");return i.test(e.className)||!(!n||!i.test(e.parentNode.className))},addClass:function(t){return qq(e).hasClass(t)||(e.className+=" "+t),this},removeClass:function(t){var n=new RegExp("(^| )"+t+"( |$)");return e.className=e.className.replace(n," ").replace(/^\s+|\s+$/g,""),this},getByClass:function(t,n){var i,o=[];return n&&e.querySelector?e.querySelector("."+t):e.querySelectorAll?e.querySelectorAll("."+t):(i=e.getElementsByTagName("*"),qq.each(i,function(e,n){qq(n).hasClass(t)&&o.push(n)}),n?o[0]:o)},getFirstByClass:function(t){return qq(e).getByClass(t,!0)},children:function(){for(var t=[],n=e.firstChild;n;)1===n.nodeType&&t.push(n),n=n.nextSibling;return t},setText:function(t){return e.innerText=t,e.textContent=t,this},clearText:function(){return qq(e).setText("")},hasAttribute:function(t){var n;return e.hasAttribute?!!e.hasAttribute(t)&&null==/^false$/i.exec(e.getAttribute(t)):(n=e[t],void 0!==n&&null==/^false$/i.exec(n))}}};!function(){"use strict";qq.canvasToBlob=function(e,t,n){return qq.dataUriToBlob(e.toDataURL(t,n))},qq.dataUriToBlob=function(e){var t,n,i,o,r=function(e,t){var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=n&&new n;return i?(i.append(e),i.getBlob(t)):new Blob([e],{type:t})};return n=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURI(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],t=new ArrayBuffer(n.length),i=new Uint8Array(t),qq.each(n,function(e,t){i[e]=t.charCodeAt(0)}),r(t,o)},qq.log=function(e,t){window.console&&(t&&"info"!==t?window.console[t]?window.console[t](e):window.console.log("<"+t+"> "+e):window.console.log(e))},qq.isObject=function(e){return e&&!e.nodeType&&"[object Object]"===Object.prototype.toString.call(e)},qq.isFunction=function(e){return"function"==typeof e},qq.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)||e&&window.ArrayBuffer&&e.buffer&&e.buffer.constructor===ArrayBuffer},qq.isItemList=function(e){return"[object DataTransferItemList]"===Object.prototype.toString.call(e)},qq.isNodeList=function(e){return"[object NodeList]"===Object.prototype.toString.call(e)||e.item&&e.namedItem},qq.isString=function(e){return"[object String]"===Object.prototype.toString.call(e)},qq.trimStr=function(e){return String.prototype.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},qq.format=function(e){var t=Array.prototype.slice.call(arguments,1),n=e,i=n.indexOf("{}");return qq.each(t,function(e,t){var o=n.substring(0,i),r=n.substring(i+2);if(n=o+t+r,i=n.indexOf("{}",i+t.length),i<0)return!1}),n},qq.isFile=function(e){return window.File&&"[object File]"===Object.prototype.toString.call(e)},qq.isFileList=function(e){return window.FileList&&"[object FileList]"===Object.prototype.toString.call(e)},qq.isFileOrInput=function(e){return qq.isFile(e)||qq.isInput(e)},qq.isInput=function(e,t){var n=function(e){var n=e.toLowerCase();return t?"file"!==n:"file"===n};return!!(window.HTMLInputElement&&"[object HTMLInputElement]"===Object.prototype.toString.call(e)&&e.type&&n(e.type))||!!(e.tagName&&"input"===e.tagName.toLowerCase()&&e.type&&n(e.type))},qq.isBlob=function(e){if(window.Blob&&"[object Blob]"===Object.prototype.toString.call(e))return!0},qq.isXhrUploadSupported=function(){var e=document.createElement("input");return e.type="file",void 0!==e.multiple&&"undefined"!=typeof File&&"undefined"!=typeof FormData&&"undefined"!=typeof qq.createXhrInstance().upload},qq.createXhrInstance=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){return qq.log("Neither XHR or ActiveX are supported!","error"),null}},qq.isFolderDropSupported=function(e){return e.items&&e.items.length>0&&e.items[0].webkitGetAsEntry},qq.isFileChunkingSupported=function(){return!qq.androidStock()&&qq.isXhrUploadSupported()&&(void 0!==File.prototype.slice||void 0!==File.prototype.webkitSlice||void 0!==File.prototype.mozSlice)},qq.sliceBlob=function(e,t,n){var i=e.slice||e.mozSlice||e.webkitSlice;return i.call(e,t,n)},qq.arrayBufferToHex=function(e){var t="",n=new Uint8Array(e);return qq.each(n,function(e,n){var i=n.toString(16);i.length<2&&(i="0"+i),t+=i}),t},qq.readBlobToHex=function(e,t,n){var i=qq.sliceBlob(e,t,t+n),o=new FileReader,r=new qq.Promise;return o.onload=function(){r.success(qq.arrayBufferToHex(o.result))},o.onerror=r.failure,o.readAsArrayBuffer(i),r},qq.extend=function(e,t,n){return qq.each(t,function(t,i){n&&qq.isObject(i)?(void 0===e[t]&&(e[t]={}),qq.extend(e[t],i,!0)):e[t]=i}),e},qq.override=function(e,t){var n={},i=t(n);return qq.each(i,function(t,i){void 0!==e[t]&&(n[t]=e[t]),e[t]=i}),e},qq.indexOf=function(e,t,n){if(e.indexOf)return e.indexOf(t,n);n=n||0;var i=e.length;for(n<0&&(n+=i);n<i;n+=1)if(e.hasOwnProperty(n)&&e[n]===t)return n;return-1},qq.getUniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"==e?t:3&t|8;return n.toString(16)})},qq.ie=function(){return navigator.userAgent.indexOf("MSIE")!==-1||navigator.userAgent.indexOf("Trident")!==-1},qq.ie7=function(){return navigator.userAgent.indexOf("MSIE 7")!==-1},qq.ie8=function(){return navigator.userAgent.indexOf("MSIE 8")!==-1},qq.ie10=function(){return navigator.userAgent.indexOf("MSIE 10")!==-1},qq.ie11=function(){return qq.ie()&&navigator.userAgent.indexOf("rv:11")!==-1},qq.edge=function(){return navigator.userAgent.indexOf("Edge")>=0},qq.safari=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Apple")!==-1},qq.chrome=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Google")!==-1},qq.opera=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Opera")!==-1},qq.firefox=function(){return!qq.edge()&&!qq.ie11()&&navigator.userAgent.indexOf("Mozilla")!==-1&&void 0!==navigator.vendor&&""===navigator.vendor},qq.windows=function(){return"Win32"===navigator.platform},qq.android=function(){return navigator.userAgent.toLowerCase().indexOf("android")!==-1},qq.androidStock=function(){return qq.android()&&navigator.userAgent.toLowerCase().indexOf("chrome")<0},qq.ios6=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 6_")!==-1},qq.ios7=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 7_")!==-1},qq.ios8=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 8_")!==-1},qq.ios800=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 8_0 ")!==-1},qq.ios=function(){return navigator.userAgent.indexOf("iPad")!==-1||navigator.userAgent.indexOf("iPod")!==-1||navigator.userAgent.indexOf("iPhone")!==-1},qq.iosChrome=function(){return qq.ios()&&navigator.userAgent.indexOf("CriOS")!==-1},qq.iosSafari=function(){return qq.ios()&&!qq.iosChrome()&&navigator.userAgent.indexOf("Safari")!==-1},qq.iosSafariWebView=function(){return qq.ios()&&!qq.iosChrome()&&!qq.iosSafari()},qq.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},qq.toElement=function(){var e=document.createElement("div");return function(t){e.innerHTML=t;var n=e.firstChild;return e.removeChild(n),n}}(),qq.each=function(e,t){var n,i;if(e)if(window.Storage&&e.constructor===window.Storage)for(n=0;n<e.length&&(i=t(e.key(n),e.getItem(e.key(n))),i!==!1);n++);else if(qq.isArray(e)||qq.isItemList(e)||qq.isNodeList(e))for(n=0;n<e.length&&(i=t(n,e[n]),i!==!1);n++);else if(qq.isString(e))for(n=0;n<e.length&&(i=t(n,e.charAt(n)),i!==!1);n++);else for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&(i=t(n,e[n]),i===!1))break},qq.bind=function(e,t){if(qq.isFunction(e)){var n=Array.prototype.slice.call(arguments,2);return function(){var i=qq.extend([],n);return arguments.length&&(i=i.concat(Array.prototype.slice.call(arguments))),e.apply(t,i)}}throw new Error("first parameter must be a function!")},qq.obj2url=function(e,t,n){var i=[],o="&",r=function(e,n){var o=t?/\[\]$/.test(t)?t:t+"["+n+"]":n;"undefined"!==o&&"undefined"!==n&&i.push("object"==typeof e?qq.obj2url(e,o,!0):"[object Function]"===Object.prototype.toString.call(e)?encodeURIComponent(o)+"="+encodeURIComponent(e()):encodeURIComponent(o)+"="+encodeURIComponent(e))};return!n&&t?(o=/\?/.test(t)?/\?$/.test(t)?"":"&":"?",i.push(t),i.push(qq.obj2url(e))):"[object Array]"===Object.prototype.toString.call(e)&&"undefined"!=typeof e?qq.each(e,function(e,t){r(t,e)}):"undefined"!=typeof e&&null!==e&&"object"==typeof e?qq.each(e,function(e,t){r(t,e)}):i.push(encodeURIComponent(t)+"="+encodeURIComponent(e)),t?i.join(o):i.join(o).replace(/^&/,"").replace(/%20/g,"+")},qq.obj2FormData=function(e,t,n){return t||(t=new FormData),qq.each(e,function(e,i){e=n?n+"["+e+"]":e,qq.isObject(i)?qq.obj2FormData(i,t,e):qq.isFunction(i)?t.append(e,i()):t.append(e,i)}),t},qq.obj2Inputs=function(e,t){var n;return t||(t=document.createElement("form")),qq.obj2FormData(e,{append:function(e,i){n=document.createElement("input"),n.setAttribute("name",e),n.setAttribute("value",i),t.appendChild(n)}}),t},qq.parseJson=function(json){return window.JSON&&qq.isFunction(JSON.parse)?JSON.parse(json):eval("("+json+")")},qq.getExtension=function(e){var t=e.lastIndexOf(".")+1;if(t>0)return e.substr(t,e.length-t)},qq.getFilename=function(e){return qq.isInput(e)?e.value.replace(/.*(\/|\\)/,""):qq.isFile(e)&&null!==e.fileName&&void 0!==e.fileName?e.fileName:e.name},qq.DisposeSupport=function(){var e=[];return{dispose:function(){var t;do t=e.shift(),t&&t();while(t)},attach:function(){var e=arguments;this.addDisposer(qq(e[0]).attach.apply(this,Array.prototype.slice.call(arguments,1)))},addDisposer:function(t){e.push(t)}}}}(),function(){"use strict";"function"==typeof define&&define.amd?define(function(){return qq}):"undefined"!=typeof module&&module.exports?module.exports=qq:global.qq=qq}(),function(){"use strict";qq.Error=function(e){this.message="[Fine Uploader "+qq.version+"] "+e},qq.Error.prototype=new Error}(),qq.version="5.11.7",qq.supportedFeatures=function(){"use strict";function e(){var e,t=!0;try{e=document.createElement("input"),e.type="file",qq(e).hide(),e.disabled&&(t=!1)}catch(e){t=!1}return t}function t(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/)}function n(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/)}function i(){if(window.XMLHttpRequest){var e=qq.createXhrInstance();return void 0!==e.withCredentials}return!1}function o(){return void 0!==window.XDomainRequest}function r(){return!!i()||o()}function s(){return void 0!==document.createElement("input").webkitdirectory}function a(){try{return!!window.localStorage&&qq.isFunction(window.localStorage.setItem)}catch(e){return!1}}function u(){var e=document.createElement("span");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&!qq.android()&&!qq.ios()}var l,c,d,p,q,h,f,m,g,_,v,b,S,y,w;return l=e(),p=l&&qq.isXhrUploadSupported(),c=p&&!qq.androidStock(),d=p&&u(),q=d&&t(),h=p&&qq.isFileChunkingSupported(),f=p&&h&&a(),m=p&&n(),g=l&&(void 0!==window.postMessage||p),v=i(),_=o(),b=r(),S=s(),y=p&&void 0!==window.FileReader,w=function(){return!!p&&(!qq.androidStock()&&!qq.iosChrome())}(),{ajaxUploading:p,blobUploading:c,canDetermineSize:p,chunking:h,deleteFileCors:b,deleteFileCorsXdr:_,deleteFileCorsXhr:v,dialogElement:!!window.HTMLDialogElement,fileDrop:d,folderDrop:q,folderSelection:S,imagePreviews:y,imageValidation:y,itemSizeValidation:p,pause:h,progressBar:w,resume:f,scaling:y&&c,tiffPreviews:qq.safari(),unlimitedScaledImageSize:!qq.ios(),uploading:l,uploadCors:g,uploadCustomHeaders:p,uploadNonMultipart:p,uploadViaPaste:m}}(),qq.isGenericPromise=function(e){"use strict";return!!(e&&e.then&&qq.isFunction(e.then))},qq.Promise=function(){"use strict";var e,t,n=[],i=[],o=[],r=0;qq.extend(this,{then:function(o,s){return 0===r?(o&&n.push(o),s&&i.push(s)):r===-1?s&&s.apply(null,t):o&&o.apply(null,e),this},done:function(n){return 0===r?o.push(n):n.apply(null,void 0===t?e:t),this},success:function(){return r=1,e=arguments,n.length&&qq.each(n,function(t,n){n.apply(null,e)}),o.length&&qq.each(o,function(t,n){n.apply(null,e)}),this},failure:function(){return r=-1,t=arguments,i.length&&qq.each(i,function(e,n){n.apply(null,t)}),o.length&&qq.each(o,function(e,n){n.apply(null,t)}),this}})},qq.BlobProxy=function(e,t){"use strict";qq.extend(this,{referenceBlob:e,create:function(){return t(e)}})},qq.UploadButton=function(e){"use strict";function t(){var e=document.createElement("input");return e.setAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME,i),e.setAttribute("title",s.title),o.setMultiple(s.multiple,e),s.folders&&qq.supportedFeatures.folderSelection&&e.setAttribute("webkitdirectory",""),s.acceptFiles&&e.setAttribute("accept",s.acceptFiles),e.setAttribute("type","file"),e.setAttribute("name",s.name),qq(e).css({position:"absolute",right:0,top:0,fontFamily:"Arial",fontSize:qq.ie()&&!qq.ie8()?"3500px":"118px",margin:0,padding:0,cursor:"pointer",opacity:0}),!qq.ie7()&&qq(e).css({height:"100%"}),s.element.appendChild(e),r.attach(e,"change",function(){s.onChange(e)}),r.attach(e,"mouseover",function(){qq(s.element).addClass(s.hoverClass)}),r.attach(e,"mouseout",function(){qq(s.element).removeClass(s.hoverClass)}),r.attach(e,"focus",function(){qq(s.element).addClass(s.focusClass)}),r.attach(e,"blur",function(){qq(s.element).removeClass(s.focusClass)}),e}var n,i,o=this,r=new qq.DisposeSupport,s={acceptFiles:null,element:null,focusClass:"qq-upload-button-focus",folders:!1,hoverClass:"qq-upload-button-hover",ios8BrowserCrashWorkaround:!1,multiple:!1,name:"qqfile",onChange:function(e){},title:null};qq.extend(s,e),i=qq.getUniqueId(),qq(s.element).css({position:"relative",overflow:"hidden",direction:"ltr"}),qq.extend(this,{getInput:function(){return n},getButtonId:function(){return i},setMultiple:function(e,t){var n=t||this.getInput();s.ios8BrowserCrashWorkaround&&qq.ios8()&&(qq.iosChrome()||qq.iosSafariWebView())?n.setAttribute("multiple",""):e?n.setAttribute("multiple",""):n.removeAttribute("multiple")},setAcceptFiles:function(e){e!==s.acceptFiles&&n.setAttribute("accept",e)},reset:function(){n.parentNode&&qq(n).remove(),qq(s.element).removeClass(s.focusClass),n=null,n=t()}}),n=t()},qq.UploadButton.BUTTON_ID_ATTR_NAME="qq-button-id",qq.UploadData=function(e){"use strict";function t(e){if(qq.isArray(e)){var t=[];return qq.each(e,function(e,n){t.push(o[n])}),t}return o[e]}function n(e){if(qq.isArray(e)){var t=[];return qq.each(e,function(e,n){t.push(o[r[n]])}),t}return o[r[e]]}function i(e){var t=[],n=[].concat(e);return qq.each(n,function(e,n){var i=s[n];void 0!==i&&qq.each(i,function(e,n){t.push(o[n])})}),t}var o=[],r={},s={},a={},u={};qq.extend(this,{addFile:function(t){var n=t.status||qq.status.SUBMITTING,i=o.push({name:t.name,originalName:t.name,uuid:t.uuid,size:null==t.size?-1:t.size,status:n})-1;return t.batchId&&(o[i].batchId=t.batchId,void 0===u[t.batchId]&&(u[t.batchId]=[]),u[t.batchId].push(i)),t.proxyGroupId&&(o[i].proxyGroupId=t.proxyGroupId,void 0===a[t.proxyGroupId]&&(a[t.proxyGroupId]=[]),a[t.proxyGroupId].push(i)),o[i].id=i,r[t.uuid]=i,void 0===s[n]&&(s[n]=[]),s[n].push(i),e.onStatusChange(i,null,n),i},retrieve:function(e){return qq.isObject(e)&&o.length?void 0!==e.id?t(e.id):void 0!==e.uuid?n(e.uuid):e.status?i(e.status):void 0:qq.extend([],o,!0)},reset:function(){o=[],r={},s={},u={}},setStatus:function(t,n){var i=o[t].status,r=qq.indexOf(s[i],t);s[i].splice(r,1),o[t].status=n,void 0===s[n]&&(s[n]=[]),s[n].push(t),e.onStatusChange(t,i,n)},uuidChanged:function(e,t){var n=o[e].uuid;o[e].uuid=t,r[t]=e,delete r[n]},updateName:function(e,t){o[e].name=t},updateSize:function(e,t){o[e].size=t},setParentId:function(e,t){o[e].parentId=t},getIdsInProxyGroup:function(e){var t=o[e].proxyGroupId;return t?a[t]:[]},getIdsInBatch:function(e){var t=o[e].batchId;return u[t]}})},qq.status={SUBMITTING:"submitting",SUBMITTED:"submitted",REJECTED:"rejected",QUEUED:"queued",CANCELED:"canceled",PAUSED:"paused",UPLOADING:"uploading",UPLOAD_RETRYING:"retrying upload",UPLOAD_SUCCESSFUL:"upload successful",UPLOAD_FAILED:"upload failed",DELETE_FAILED:"delete failed",DELETING:"deleting",DELETED:"deleted"},function(){"use strict";qq.basePublicApi={addBlobs:function(e,t,n){this.addFiles(e,t,n)},addInitialFiles:function(e){var t=this;qq.each(e,function(e,n){t._addCannedFile(n)})},addFiles:function(e,t,n){this._maybeHandleIos8SafariWorkaround();var i=0===this._storedIds.length?qq.getUniqueId():this._currentBatchId,o=qq.bind(function(e){this._handleNewFile({blob:e,name:this._options.blobs.defaultName},i,d)},this),r=qq.bind(function(e){this._handleNewFile(e,i,d)},this),s=qq.bind(function(e){var t=qq.canvasToBlob(e);this._handleNewFile({blob:t,name:this._options.blobs.defaultName+".png"},i,d)},this),a=qq.bind(function(e){var t=e.quality&&e.quality/100,n=qq.canvasToBlob(e.canvas,e.type,t);this._handleNewFile({blob:n,name:e.name},i,d)},this),u=qq.bind(function(e){if(qq.isInput(e)&&qq.supportedFeatures.ajaxUploading){var t=Array.prototype.slice.call(e.files),n=this;qq.each(t,function(e,t){n._handleNewFile(t,i,d)})}else this._handleNewFile(e,i,d)},this),l=function(){qq.isFileList(e)&&(e=Array.prototype.slice.call(e)),e=[].concat(e)},c=this,d=[];this._currentBatchId=i,e&&(l(),qq.each(e,function(e,t){qq.isFileOrInput(t)?u(t):qq.isBlob(t)?o(t):qq.isObject(t)?t.blob&&t.name?r(t):t.canvas&&t.name&&a(t):t.tagName&&"canvas"===t.tagName.toLowerCase()?s(t):c.log(t+" is not a valid file container! Ignoring!","warn")}),this.log("Received "+d.length+" files."),this._prepareItemsForUpload(d,t,n))},cancel:function(e){this._handler.cancel(e)},cancelAll:function(){var e=[],t=this;qq.extend(e,this._storedIds),qq.each(e,function(e,n){t.cancel(n)}),this._handler.cancelAll()},clearStoredFiles:function(){this._storedIds=[]},continueUpload:function(e){var t=this._uploadData.retrieve({id:e});return!(!qq.supportedFeatures.pause||!this._options.chunking.enabled)&&(t.status===qq.status.PAUSED?(this.log(qq.format("Paused file ID {} ({}) will be continued. Not paused.",e,this.getName(e))),this._uploadFile(e),!0):(this.log(qq.format("Ignoring continue for file ID {} ({}). Not paused.",e,this.getName(e)),"error"),!1))},deleteFile:function(e){return this._onSubmitDelete(e)},doesExist:function(e){return this._handler.isValid(e)},drawThumbnail:function(e,t,n,i,o){var r,s,a=new qq.Promise;return this._imageGenerator?(r=this._thumbnailUrls[e],s={customResizeFunction:o,maxSize:n>0?n:null,scale:n>0},!i&&qq.supportedFeatures.imagePreviews&&(r=this.getFile(e)),null==r?a.failure({container:t,error:"File or URL not found."}):this._imageGenerator.generate(r,t,s).then(function(e){a.success(e)},function(e,t){a.failure({container:e,error:t||"Problem generating thumbnail"})})):a.failure({container:t,error:"Missing image generator module"}),a},getButton:function(e){return this._getButton(this._buttonIdsForFileIds[e])},getEndpoint:function(e){return this._endpointStore.get(e)},getFile:function(e){return this._handler.getFile(e)||null},getInProgress:function(){return this._uploadData.retrieve({status:[qq.status.UPLOADING,qq.status.UPLOAD_RETRYING,qq.status.QUEUED]}).length},getName:function(e){return this._uploadData.retrieve({id:e}).name},getParentId:function(e){var t=this.getUploads({id:e}),n=null;return t&&void 0!==t.parentId&&(n=t.parentId),n},getResumableFilesData:function(){return this._handler.getResumableFilesData()},getSize:function(e){return this._uploadData.retrieve({id:e}).size},getNetUploads:function(){return this._netUploaded},getRemainingAllowedItems:function(){var e=this._currentItemLimit;return e>0?e-this._netUploadedOrQueued:null},getUploads:function(e){return this._uploadData.retrieve(e)},getUuid:function(e){return this._uploadData.retrieve({id:e}).uuid},log:function(e,t){!this._options.debug||t&&"info"!==t?t&&"info"!==t&&qq.log("[Fine Uploader "+qq.version+"] "+e,t):qq.log("[Fine Uploader "+qq.version+"] "+e)},pauseUpload:function(e){var t=this._uploadData.retrieve({id:e});if(!qq.supportedFeatures.pause||!this._options.chunking.enabled)return!1;if(qq.indexOf([qq.status.UPLOADING,qq.status.UPLOAD_RETRYING],t.status)>=0){if(this._handler.pause(e))return this._uploadData.setStatus(e,qq.status.PAUSED),!0;this.log(qq.format("Unable to pause file ID {} ({}).",e,this.getName(e)),"error")}else this.log(qq.format("Ignoring pause for file ID {} ({}). Not in progress.",e,this.getName(e)),"error");return!1},reset:function(){this.log("Resetting uploader..."),this._handler.reset(),this._storedIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._thumbnailUrls=[],qq.each(this._buttons,function(e,t){t.reset()}),this._paramsStore.reset(),this._endpointStore.reset(),this._netUploadedOrQueued=0,this._netUploaded=0,this._uploadData.reset(),this._buttonIdsForFileIds=[],this._pasteHandler&&this._pasteHandler.reset(),this._options.session.refreshOnReset&&this._refreshSessionData(),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[],this._totalProgress&&this._totalProgress.reset()},retry:function(e){return this._manualRetry(e)},scaleImage:function(e,t){var n=this;return qq.Scaler.prototype.scaleImage(e,t,{log:qq.bind(n.log,n),getFile:qq.bind(n.getFile,n),uploadData:n._uploadData})},setCustomHeaders:function(e,t){this._customHeadersStore.set(e,t)},setDeleteFileCustomHeaders:function(e,t){this._deleteFileCustomHeadersStore.set(e,t)},setDeleteFileEndpoint:function(e,t){this._deleteFileEndpointStore.set(e,t)},setDeleteFileParams:function(e,t){this._deleteFileParamsStore.set(e,t)},setEndpoint:function(e,t){this._endpointStore.set(e,t)},setForm:function(e){this._updateFormSupportAndParams(e)},setItemLimit:function(e){this._currentItemLimit=e},setName:function(e,t){this._uploadData.updateName(e,t)},setParams:function(e,t){this._paramsStore.set(e,t)},setUuid:function(e,t){return this._uploadData.uuidChanged(e,t)},uploadStoredFiles:function(){0===this._storedIds.length?this._itemError("noFilesError"):this._uploadStoredFiles()}},qq.basePrivateApi={_addCannedFile:function(e){var t=this._uploadData.addFile({uuid:e.uuid,name:e.name,size:e.size,status:qq.status.UPLOAD_SUCCESSFUL});return e.deleteFileEndpoint&&this.setDeleteFileEndpoint(e.deleteFileEndpoint,t),e.deleteFileParams&&this.setDeleteFileParams(e.deleteFileParams,t),e.thumbnailUrl&&(this._thumbnailUrls[t]=e.thumbnailUrl),this._netUploaded++,this._netUploadedOrQueued++,t},_annotateWithButtonId:function(e,t){qq.isFile(e)&&(e.qqButtonId=this._getButtonId(t))},_batchError:function(e){this._options.callbacks.onError(null,null,e,void 0)},_createDeleteHandler:function(){var e=this;return new qq.DeleteFileAjaxRequester({method:this._options.deleteFile.method.toUpperCase(),maxConnections:this._options.maxConnections,uuidParamName:this._options.request.uuidName,customHeaders:this._deleteFileCustomHeadersStore,paramsStore:this._deleteFileParamsStore,endpointStore:this._deleteFileEndpointStore,cors:this._options.cors,log:qq.bind(e.log,e),onDelete:function(t){e._onDelete(t),e._options.callbacks.onDelete(t)},onDeleteComplete:function(t,n,i){e._onDeleteComplete(t,n,i),e._options.callbacks.onDeleteComplete(t,n,i)}})},_createPasteHandler:function(){var e=this;return new qq.PasteSupport({targetElement:this._options.paste.targetElement,callbacks:{log:qq.bind(e.log,e),pasteReceived:function(t){e._handleCheckedCallback({name:"onPasteReceived",callback:qq.bind(e._options.callbacks.onPasteReceived,e,t),onSuccess:qq.bind(e._handlePasteSuccess,e,t),identifier:"pasted image"})}}})},_createStore:function(e,t){var n={},i=e,o={},r=t,s=function(e){return qq.isObject(e)?qq.extend({},e):e},a=function(){return qq.isFunction(r)?r():r},u=function(e,t){r&&qq.isObject(t)&&qq.extend(t,a()),o[e]&&qq.extend(t,o[e])};return{set:function(e,t){null==t?(n={},i=s(e)):n[t]=s(e)},get:function(e){var t;return t=null!=e&&n[e]?n[e]:s(i),u(e,t),s(t)},addReadOnly:function(e,t){qq.isObject(n)&&(null===e?qq.isFunction(t)?r=t:(r=r||{},qq.extend(r,t)):(o[e]=o[e]||{},qq.extend(o[e],t)))},remove:function(e){return delete n[e]},reset:function(){n={},o={},i=e}}},_createUploadDataTracker:function(){var e=this;return new qq.UploadData({getName:function(t){return e.getName(t)},getUuid:function(t){return e.getUuid(t)},getSize:function(t){return e.getSize(t)},onStatusChange:function(t,n,i){e._onUploadStatusChange(t,n,i),e._options.callbacks.onStatusChange(t,n,i),e._maybeAllComplete(t,i),e._totalProgress&&setTimeout(function(){e._totalProgress.onStatusChange(t,n,i)},0)}})},_createUploadButton:function(e){function t(){return!!qq.supportedFeatures.ajaxUploading&&(!(i._options.workarounds.iosEmptyVideos&&qq.ios()&&!qq.ios6()&&i._isAllowedExtension(r,".mov"))&&(void 0===e.multiple?i._options.multiple:e.multiple))}var n,i=this,o=e.accept||this._options.validation.acceptFiles,r=e.allowedExtensions||this._options.validation.allowedExtensions;return n=new qq.UploadButton({acceptFiles:o,element:e.element,focusClass:this._options.classes.buttonFocus,folders:e.folders,hoverClass:this._options.classes.buttonHover,ios8BrowserCrashWorkaround:this._options.workarounds.ios8BrowserCrash,multiple:t(),name:this._options.request.inputName,onChange:function(e){i._onInputChange(e)},title:null==e.title?this._options.text.fileInputTitle:e.title}),this._disposeSupport.addDisposer(function(){n.dispose()}),i._buttons.push(n),n},_createUploadHandler:function(e,t){var n=this,i={},o={debug:this._options.debug,maxConnections:this._options.maxConnections,cors:this._options.cors,paramsStore:this._paramsStore,endpointStore:this._endpointStore,chunking:this._options.chunking,resume:this._options.resume,blobs:this._options.blobs,log:qq.bind(n.log,n),preventRetryParam:this._options.retry.preventRetryResponseProperty,onProgress:function(e,t,o,r){o<0||r<0||(i[e]?i[e].loaded===o&&i[e].total===r||(n._onProgress(e,t,o,r),n._options.callbacks.onProgress(e,t,o,r)):(n._onProgress(e,t,o,r),n._options.callbacks.onProgress(e,t,o,r)),i[e]={loaded:o,total:r})},onComplete:function(e,t,o,r){delete i[e];var s,a=n.getUploads({id:e}).status;a!==qq.status.UPLOAD_SUCCESSFUL&&a!==qq.status.UPLOAD_FAILED&&(s=n._onComplete(e,t,o,r),s instanceof qq.Promise?s.done(function(){n._options.callbacks.onComplete(e,t,o,r)}):n._options.callbacks.onComplete(e,t,o,r))},onCancel:function(e,t,i){var o=new qq.Promise;return n._handleCheckedCallback({name:"onCancel",callback:qq.bind(n._options.callbacks.onCancel,n,e,t),onFailure:o.failure,onSuccess:function(){i.then(function(){n._onCancel(e,t)}),o.success()},identifier:e}),o},onUploadPrep:qq.bind(this._onUploadPrep,this),onUpload:function(e,t){n._onUpload(e,t),n._options.callbacks.onUpload(e,t)},onUploadChunk:function(e,t,i){n._onUploadChunk(e,i),n._options.callbacks.onUploadChunk(e,t,i)},onUploadChunkSuccess:function(e,t,i,o){n._options.callbacks.onUploadChunkSuccess.apply(n,arguments)},onResume:function(e,t,i){return n._options.callbacks.onResume(e,t,i)},onAutoRetry:function(e,t,i,o){return n._onAutoRetry.apply(n,arguments)},onUuidChanged:function(e,t){n.log("Server requested UUID change from '"+n.getUuid(e)+"' to '"+t+"'"),n.setUuid(e,t)},getName:qq.bind(n.getName,n),getUuid:qq.bind(n.getUuid,n),getSize:qq.bind(n.getSize,n),setSize:qq.bind(n._setSize,n),getDataByUuid:function(e){return n.getUploads({uuid:e})},isQueued:function(e){var t=n.getUploads({id:e}).status;return t===qq.status.QUEUED||t===qq.status.SUBMITTED||t===qq.status.UPLOAD_RETRYING||t===qq.status.PAUSED},getIdsInProxyGroup:n._uploadData.getIdsInProxyGroup,getIdsInBatch:n._uploadData.getIdsInBatch};return qq.each(this._options.request,function(e,t){o[e]=t}),o.customHeaders=this._customHeadersStore,e&&qq.each(e,function(e,t){o[e]=t}),new qq.UploadHandlerController(o,t)},_fileOrBlobRejected:function(e){this._netUploadedOrQueued--,this._uploadData.setStatus(e,qq.status.REJECTED)},_formatSize:function(e){var t=-1;do e/=1e3,t++;while(e>999);return Math.max(e,.1).toFixed(1)+this._options.text.sizeSymbols[t]},_generateExtraButtonSpecs:function(){var e=this;this._extraButtonSpecs={},qq.each(this._options.extraButtons,function(t,n){var i=n.multiple,o=qq.extend({},e._options.validation,!0),r=qq.extend({},n);void 0===i&&(i=e._options.multiple),r.validation&&qq.extend(o,n.validation,!0),qq.extend(r,{multiple:i,validation:o},!0),e._initExtraButton(r)})},_getButton:function(e){var t=this._extraButtonSpecs[e];return t?t.element:e===this._defaultButtonId?this._options.button:void 0},_getButtonId:function(e){var t,n,i=e;if(i instanceof qq.BlobProxy&&(i=i.referenceBlob),i&&!qq.isBlob(i)){if(qq.isFile(i))return i.qqButtonId;if("input"===i.tagName.toLowerCase()&&"file"===i.type.toLowerCase())return i.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME);if(t=i.getElementsByTagName("input"),qq.each(t,function(e,t){if("file"===t.getAttribute("type"))return n=t,!1}),n)return n.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME)}},_getNotFinished:function(){return this._uploadData.retrieve({status:[qq.status.UPLOADING,qq.status.UPLOAD_RETRYING,qq.status.QUEUED,qq.status.SUBMITTING,qq.status.SUBMITTED,qq.status.PAUSED]}).length},_getValidationBase:function(e){var t=this._extraButtonSpecs[e];return t?t.validation:this._options.validation},_getValidationDescriptor:function(e){return e.file instanceof qq.BlobProxy?{name:qq.getFilename(e.file.referenceBlob),size:e.file.referenceBlob.size}:{name:this.getUploads({id:e.id}).name,size:this.getUploads({id:e.id}).size}},_getValidationDescriptors:function(e){var t=this,n=[];return qq.each(e,function(e,i){n.push(t._getValidationDescriptor(i))}),n},_handleCameraAccess:function(){if(this._options.camera.ios&&qq.ios()){var e="image/*;capture=camera",t=this._options.camera.button,n=t?this._getButtonId(t):this._defaultButtonId,i=this._options;n&&n!==this._defaultButtonId&&(i=this._extraButtonSpecs[n]),i.multiple=!1,null===i.validation.acceptFiles?i.validation.acceptFiles=e:i.validation.acceptFiles+=","+e,qq.each(this._buttons,function(e,t){if(t.getButtonId()===n)return t.setMultiple(i.multiple),t.setAcceptFiles(i.acceptFiles),!1})}},_handleCheckedCallback:function(e){var t=this,n=e.callback();return qq.isGenericPromise(n)?(this.log(e.name+" - waiting for "+e.name+" promise to be fulfilled for "+e.identifier),n.then(function(n){t.log(e.name+" promise success for "+e.identifier),e.onSuccess(n)},function(){e.onFailure?(t.log(e.name+" promise failure for "+e.identifier),e.onFailure()):t.log(e.name+" promise failure for "+e.identifier)})):(n!==!1?e.onSuccess(n):e.onFailure?(this.log(e.name+" - return value was 'false' for "+e.identifier+". Invoking failure callback."),e.onFailure()):this.log(e.name+" - return value was 'false' for "+e.identifier+". Will not proceed."),n)},_handleNewFile:function(e,t,n){var i=this,o=qq.getUniqueId(),r=-1,s=qq.getFilename(e),a=e.blob||e,u=this._customNewFileHandler?this._customNewFileHandler:qq.bind(i._handleNewFileGeneric,i);!qq.isInput(a)&&a.size>=0&&(r=a.size),u(a,s,o,r,n,t,this._options.request.uuidName,{uploadData:i._uploadData,paramsStore:i._paramsStore,addFileToHandler:function(e,t){i._handler.add(e,t),i._netUploadedOrQueued++,i._trackButton(e)}})},_handleNewFileGeneric:function(e,t,n,i,o,r){
var s=this._uploadData.addFile({uuid:n,name:t,size:i,batchId:r});this._handler.add(s,e),this._trackButton(s),this._netUploadedOrQueued++,o.push({id:s,file:e})},_handlePasteSuccess:function(e,t){var n=e.type.split("/")[1],i=t;null==i&&(i=this._options.paste.defaultName),i+="."+n,this.addFiles({name:i,blob:e})},_initExtraButton:function(e){var t=this._createUploadButton({accept:e.validation.acceptFiles,allowedExtensions:e.validation.allowedExtensions,element:e.element,folders:e.folders,multiple:e.multiple,title:e.fileInputTitle});this._extraButtonSpecs[t.getButtonId()]=e},_initFormSupportAndParams:function(){this._formSupport=qq.FormSupport&&new qq.FormSupport(this._options.form,qq.bind(this.uploadStoredFiles,this),qq.bind(this.log,this)),this._formSupport&&this._formSupport.attachedToForm?(this._paramsStore=this._createStore(this._options.request.params,this._formSupport.getFormInputsAsObject),this._options.autoUpload=this._formSupport.newAutoUpload,this._formSupport.newEndpoint&&(this._options.request.endpoint=this._formSupport.newEndpoint)):this._paramsStore=this._createStore(this._options.request.params)},_isDeletePossible:function(){return!(!qq.DeleteFileAjaxRequester||!this._options.deleteFile.enabled)&&(!this._options.cors.expected||(!!qq.supportedFeatures.deleteFileCorsXhr||!(!qq.supportedFeatures.deleteFileCorsXdr||!this._options.cors.allowXdr)))},_isAllowedExtension:function(e,t){var n=!1;return!e.length||(qq.each(e,function(e,i){if(qq.isString(i)){var o=new RegExp("\\."+i+"$","i");if(null!=t.match(o))return n=!0,!1}}),n)},_itemError:function(e,t,n){function i(e,t){s=s.replace(e,t)}var o,r,s=this._options.messages[e],a=[],u=[].concat(t),l=u[0],c=this._getButtonId(n),d=this._getValidationBase(c);return qq.each(d.allowedExtensions,function(e,t){qq.isString(t)&&a.push(t)}),o=a.join(", ").toLowerCase(),i("{file}",this._options.formatFileName(l)),i("{extensions}",o),i("{sizeLimit}",this._formatSize(d.sizeLimit)),i("{minSizeLimit}",this._formatSize(d.minSizeLimit)),r=s.match(/(\{\w+\})/g),null!==r&&qq.each(r,function(e,t){i(t,u[e])}),this._options.callbacks.onError(null,l,s,void 0),s},_manualRetry:function(e,t){if(this._onBeforeManualRetry(e))return this._netUploadedOrQueued++,this._uploadData.setStatus(e,qq.status.UPLOAD_RETRYING),t?t(e):this._handler.retry(e),!0},_maybeAllComplete:function(e,t){var n=this,i=this._getNotFinished();t===qq.status.UPLOAD_SUCCESSFUL?this._succeededSinceLastAllComplete.push(e):t===qq.status.UPLOAD_FAILED&&this._failedSinceLastAllComplete.push(e),0===i&&(this._succeededSinceLastAllComplete.length||this._failedSinceLastAllComplete.length)&&setTimeout(function(){n._onAllComplete(n._succeededSinceLastAllComplete,n._failedSinceLastAllComplete)},0)},_maybeHandleIos8SafariWorkaround:function(){var e=this;if(this._options.workarounds.ios8SafariUploads&&qq.ios800()&&qq.iosSafari())throw setTimeout(function(){window.alert(e._options.messages.unsupportedBrowserIos8Safari)},0),new qq.Error(this._options.messages.unsupportedBrowserIos8Safari)},_maybeParseAndSendUploadError:function(e,t,n,i){if(!n.success)if(i&&200!==i.status&&!n.error)this._options.callbacks.onError(e,t,"XHR returned response code "+i.status,i);else{var o=n.error?n.error:this._options.text.defaultResponseError;this._options.callbacks.onError(e,t,o,i)}},_maybeProcessNextItemAfterOnValidateCallback:function(e,t,n,i,o){var r=this;if(t.length>n)if(e||!this._options.validation.stopOnFirstInvalidFile)setTimeout(function(){var e=r._getValidationDescriptor(t[n]),s=r._getButtonId(t[n].file),a=r._getButton(s);r._handleCheckedCallback({name:"onValidate",callback:qq.bind(r._options.callbacks.onValidate,r,e,a),onSuccess:qq.bind(r._onValidateCallbackSuccess,r,t,n,i,o),onFailure:qq.bind(r._onValidateCallbackFailure,r,t,n,i,o),identifier:"Item '"+e.name+"', size: "+e.size})},0);else if(!e)for(;n<t.length;n++)r._fileOrBlobRejected(t[n].id)},_onAllComplete:function(e,t){this._totalProgress&&this._totalProgress.onAllComplete(e,t,this._preventRetries),this._options.callbacks.onAllComplete(qq.extend([],e),qq.extend([],t)),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[]},_onAutoRetry:function(e,t,n,i,o){var r=this;if(r._preventRetries[e]=n[r._options.retry.preventRetryResponseProperty],r._shouldAutoRetry(e,t,n))return r._maybeParseAndSendUploadError.apply(r,arguments),r._options.callbacks.onAutoRetry(e,t,r._autoRetries[e]),r._onBeforeAutoRetry(e,t),r._retryTimeouts[e]=setTimeout(function(){r.log("Retrying "+t+"..."),r._uploadData.setStatus(e,qq.status.UPLOAD_RETRYING),o?o(e):r._handler.retry(e)},1e3*r._options.retry.autoAttemptDelay),!0},_onBeforeAutoRetry:function(e,t){this.log("Waiting "+this._options.retry.autoAttemptDelay+" seconds before retrying "+t+"...")},_onBeforeManualRetry:function(e){var t,n=this._currentItemLimit;return this._preventRetries[e]?(this.log("Retries are forbidden for id "+e,"warn"),!1):this._handler.isValid(e)?(t=this.getName(e),this._options.callbacks.onManualRetry(e,t)!==!1&&(n>0&&this._netUploadedOrQueued+1>n?(this._itemError("retryFailTooManyItems"),!1):(this.log("Retrying upload for '"+t+"' (id: "+e+")..."),!0))):(this.log("'"+e+"' is not a valid file ID","error"),!1)},_onCancel:function(e,t){this._netUploadedOrQueued--,clearTimeout(this._retryTimeouts[e]);var n=qq.indexOf(this._storedIds,e);!this._options.autoUpload&&n>=0&&this._storedIds.splice(n,1),this._uploadData.setStatus(e,qq.status.CANCELED)},_onComplete:function(e,t,n,i){return n.success?(n.thumbnailUrl&&(this._thumbnailUrls[e]=n.thumbnailUrl),this._netUploaded++,this._uploadData.setStatus(e,qq.status.UPLOAD_SUCCESSFUL)):(this._netUploadedOrQueued--,this._uploadData.setStatus(e,qq.status.UPLOAD_FAILED),n[this._options.retry.preventRetryResponseProperty]===!0&&(this._preventRetries[e]=!0)),this._maybeParseAndSendUploadError(e,t,n,i),!!n.success},_onDelete:function(e){this._uploadData.setStatus(e,qq.status.DELETING)},_onDeleteComplete:function(e,t,n){var i=this.getName(e);n?(this._uploadData.setStatus(e,qq.status.DELETE_FAILED),this.log("Delete request for '"+i+"' has failed.","error"),void 0===t.withCredentials?this._options.callbacks.onError(e,i,"Delete request failed",t):this._options.callbacks.onError(e,i,"Delete request failed with response code "+t.status,t)):(this._netUploadedOrQueued--,this._netUploaded--,this._handler.expunge(e),this._uploadData.setStatus(e,qq.status.DELETED),this.log("Delete request for '"+i+"' has succeeded."))},_onInputChange:function(e){var t;if(qq.supportedFeatures.ajaxUploading){for(t=0;t<e.files.length;t++)this._annotateWithButtonId(e.files[t],e);this.addFiles(e.files)}else e.value.length>0&&this.addFiles(e);qq.each(this._buttons,function(e,t){t.reset()})},_onProgress:function(e,t,n,i){this._totalProgress&&this._totalProgress.onIndividualProgress(e,n,i)},_onSubmit:function(e,t){},_onSubmitCallbackSuccess:function(e,t){this._onSubmit.apply(this,arguments),this._uploadData.setStatus(e,qq.status.SUBMITTED),this._onSubmitted.apply(this,arguments),this._options.autoUpload?(this._options.callbacks.onSubmitted.apply(this,arguments),this._uploadFile(e)):(this._storeForLater(e),this._options.callbacks.onSubmitted.apply(this,arguments))},_onSubmitDelete:function(e,t,n){var i,o=this.getUuid(e);return t&&(i=qq.bind(t,this,e,o,n)),this._isDeletePossible()?(this._handleCheckedCallback({name:"onSubmitDelete",callback:qq.bind(this._options.callbacks.onSubmitDelete,this,e),onSuccess:i||qq.bind(this._deleteHandler.sendDelete,this,e,o,n),identifier:e}),!0):(this.log("Delete request ignored for ID "+e+", delete feature is disabled or request not possible due to CORS on a user agent that does not support pre-flighting.","warn"),!1)},_onSubmitted:function(e){},_onTotalProgress:function(e,t){this._options.callbacks.onTotalProgress(e,t)},_onUploadPrep:function(e){},_onUpload:function(e,t){this._uploadData.setStatus(e,qq.status.UPLOADING)},_onUploadChunk:function(e,t){},_onUploadStatusChange:function(e,t,n){n===qq.status.PAUSED&&clearTimeout(this._retryTimeouts[e])},_onValidateBatchCallbackFailure:function(e){var t=this;qq.each(e,function(e,n){t._fileOrBlobRejected(n.id)})},_onValidateBatchCallbackSuccess:function(e,t,n,i,o){var r,s=this._currentItemLimit,a=this._netUploadedOrQueued;0===s||a<=s?t.length>0?this._handleCheckedCallback({name:"onValidate",callback:qq.bind(this._options.callbacks.onValidate,this,e[0],o),onSuccess:qq.bind(this._onValidateCallbackSuccess,this,t,0,n,i),onFailure:qq.bind(this._onValidateCallbackFailure,this,t,0,n,i),identifier:"Item '"+t[0].file.name+"', size: "+t[0].file.size}):this._itemError("noFilesError"):(this._onValidateBatchCallbackFailure(t),r=this._options.messages.tooManyItemsError.replace(/\{netItems\}/g,a).replace(/\{itemLimit\}/g,s),this._batchError(r))},_onValidateCallbackFailure:function(e,t,n,i){var o=t+1;this._fileOrBlobRejected(e[t].id,e[t].file.name),this._maybeProcessNextItemAfterOnValidateCallback(!1,e,o,n,i)},_onValidateCallbackSuccess:function(e,t,n,i){var o=this,r=t+1,s=this._getValidationDescriptor(e[t]);this._validateFileOrBlobData(e[t],s).then(function(){o._upload(e[t].id,n,i),o._maybeProcessNextItemAfterOnValidateCallback(!0,e,r,n,i)},function(){o._maybeProcessNextItemAfterOnValidateCallback(!1,e,r,n,i)})},_prepareItemsForUpload:function(e,t,n){if(0===e.length)return void this._itemError("noFilesError");var i=this._getValidationDescriptors(e),o=this._getButtonId(e[0].file),r=this._getButton(o);this._handleCheckedCallback({name:"onValidateBatch",callback:qq.bind(this._options.callbacks.onValidateBatch,this,i,r),onSuccess:qq.bind(this._onValidateBatchCallbackSuccess,this,i,e,t,n,r),onFailure:qq.bind(this._onValidateBatchCallbackFailure,this,e),identifier:"batch validation"})},_preventLeaveInProgress:function(){var e=this;this._disposeSupport.attach(window,"beforeunload",function(t){if(e.getInProgress())return t=t||window.event,t.returnValue=e._options.messages.onLeave,e._options.messages.onLeave})},_refreshSessionData:function(){var e=this,t=this._options.session;qq.Session&&null!=this._options.session.endpoint&&(this._session||(qq.extend(t,{cors:this._options.cors}),t.log=qq.bind(this.log,this),t.addFileRecord=qq.bind(this._addCannedFile,this),this._session=new qq.Session(t)),setTimeout(function(){e._session.refresh().then(function(t,n){e._sessionRequestComplete(),e._options.callbacks.onSessionRequestComplete(t,!0,n)},function(t,n){e._options.callbacks.onSessionRequestComplete(t,!1,n)})},0))},_sessionRequestComplete:function(){},_setSize:function(e,t){this._uploadData.updateSize(e,t),this._totalProgress&&this._totalProgress.onNewSize(e)},_shouldAutoRetry:function(e,t,n){var i=this._uploadData.retrieve({id:e});return!!(!this._preventRetries[e]&&this._options.retry.enableAuto&&i.status!==qq.status.PAUSED&&(void 0===this._autoRetries[e]&&(this._autoRetries[e]=0),this._autoRetries[e]<this._options.retry.maxAutoAttempts))&&(this._autoRetries[e]+=1,!0)},_storeForLater:function(e){this._storedIds.push(e)},_trackButton:function(e){var t;t=qq.supportedFeatures.ajaxUploading?this._handler.getFile(e).qqButtonId:this._getButtonId(this._handler.getInput(e)),t&&(this._buttonIdsForFileIds[e]=t)},_updateFormSupportAndParams:function(e){this._options.form.element=e,this._formSupport=qq.FormSupport&&new qq.FormSupport(this._options.form,qq.bind(this.uploadStoredFiles,this),qq.bind(this.log,this)),this._formSupport&&this._formSupport.attachedToForm&&(this._paramsStore.addReadOnly(null,this._formSupport.getFormInputsAsObject),this._options.autoUpload=this._formSupport.newAutoUpload,this._formSupport.newEndpoint&&this.setEndpoint(this._formSupport.newEndpoint))},_upload:function(e,t,n){var i=this.getName(e);t&&this.setParams(t,e),n&&this.setEndpoint(n,e),this._handleCheckedCallback({name:"onSubmit",callback:qq.bind(this._options.callbacks.onSubmit,this,e,i),onSuccess:qq.bind(this._onSubmitCallbackSuccess,this,e,i),onFailure:qq.bind(this._fileOrBlobRejected,this,e,i),identifier:e})},_uploadFile:function(e){this._handler.upload(e)||this._uploadData.setStatus(e,qq.status.QUEUED)},_uploadStoredFiles:function(){for(var e,t,n=this;this._storedIds.length;)e=this._storedIds.shift(),this._uploadFile(e);t=this.getUploads({status:qq.status.SUBMITTING}).length,t&&(qq.log("Still waiting for "+t+" files to clear submit queue. Will re-parse stored IDs array shortly."),setTimeout(function(){n._uploadStoredFiles()},1e3))},_validateFileOrBlobData:function(e,t){var n=this,i=function(){return e.file instanceof qq.BlobProxy?e.file.referenceBlob:e.file}(),o=t.name,r=t.size,s=this._getButtonId(e.file),a=this._getValidationBase(s),u=new qq.Promise;return u.then(function(){},function(){n._fileOrBlobRejected(e.id,o)}),qq.isFileOrInput(i)&&!this._isAllowedExtension(a.allowedExtensions,o)?(this._itemError("typeError",o,i),u.failure()):0===r?(this._itemError("emptyError",o,i),u.failure()):r>0&&a.sizeLimit&&r>a.sizeLimit?(this._itemError("sizeError",o,i),u.failure()):r>0&&r<a.minSizeLimit?(this._itemError("minSizeError",o,i),u.failure()):(qq.ImageValidation&&qq.supportedFeatures.imagePreviews&&qq.isFile(i)?new qq.ImageValidation(i,qq.bind(n.log,n)).validate(a.image).then(u.success,function(e){n._itemError(e+"ImageError",o,i),u.failure()}):u.success(),u)},_wrapCallbacks:function(){var e,t,n;e=this,t=function(t,n,i){var o;try{return n.apply(e,i)}catch(n){o=n.message||n.toString(),e.log("Caught exception in '"+t+"' callback - "+o,"error")}};for(n in this._options.callbacks)!function(){var i,o;i=n,o=e._options.callbacks[i],e._options.callbacks[i]=function(){return t(i,o,arguments)}}()}}}(),function(){"use strict";qq.FineUploaderBasic=function(e){var t=this;this._options={debug:!1,button:null,multiple:!0,maxConnections:3,disableCancelForFormUploads:!1,autoUpload:!0,request:{customHeaders:{},endpoint:"/server/upload",filenameParam:"qqfilename",forceMultipart:!0,inputName:"qqfile",method:"POST",params:{},paramsInBody:!0,totalFileSizeName:"qqtotalfilesize",uuidName:"qquuid"},validation:{allowedExtensions:[],sizeLimit:0,minSizeLimit:0,itemLimit:0,stopOnFirstInvalidFile:!0,acceptFiles:null,image:{maxHeight:0,maxWidth:0,minHeight:0,minWidth:0}},callbacks:{onSubmit:function(e,t){},onSubmitted:function(e,t){},onComplete:function(e,t,n,i){},onAllComplete:function(e,t){},onCancel:function(e,t){},onUpload:function(e,t){},onUploadChunk:function(e,t,n){},onUploadChunkSuccess:function(e,t,n,i){},onResume:function(e,t,n){},onProgress:function(e,t,n,i){},onTotalProgress:function(e,t){},onError:function(e,t,n,i){},onAutoRetry:function(e,t,n){},onManualRetry:function(e,t){},onValidateBatch:function(e){},onValidate:function(e){},onSubmitDelete:function(e){},onDelete:function(e){},onDeleteComplete:function(e,t,n){},onPasteReceived:function(e){},onStatusChange:function(e,t,n){},onSessionRequestComplete:function(e,t,n){}},messages:{typeError:"{file} has an invalid extension. Valid extension(s): {extensions}.",sizeError:"{file} is too large, maximum file size is {sizeLimit}.",minSizeError:"{file} is too small, minimum file size is {minSizeLimit}.",emptyError:"{file} is empty, please select files again without it.",noFilesError:"No files to upload.",tooManyItemsError:"Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}.",maxHeightImageError:"Image is too tall.",maxWidthImageError:"Image is too wide.",minHeightImageError:"Image is not tall enough.",minWidthImageError:"Image is not wide enough.",retryFailTooManyItems:"Retry failed - you have reached your file limit.",onLeave:"The files are being uploaded, if you leave now the upload will be canceled.",unsupportedBrowserIos8Safari:"Unrecoverable error - this browser does not permit file uploading of any kind due to serious bugs in iOS8 Safari. Please use iOS8 Chrome until Apple fixes these issues."},retry:{enableAuto:!1,maxAutoAttempts:3,autoAttemptDelay:5,preventRetryResponseProperty:"preventRetry"},classes:{buttonHover:"qq-upload-button-hover",buttonFocus:"qq-upload-button-focus"},chunking:{enabled:!1,concurrent:{enabled:!1},mandatory:!1,paramNames:{partIndex:"qqpartindex",partByteOffset:"qqpartbyteoffset",chunkSize:"qqchunksize",totalFileSize:"qqtotalfilesize",totalParts:"qqtotalparts"},partSize:2e6,success:{endpoint:null}},resume:{enabled:!1,recordsExpireIn:7,paramNames:{resuming:"qqresume"}},formatFileName:function(e){return e},text:{defaultResponseError:"Upload failure reason unknown",fileInputTitle:"file input",sizeSymbols:["kB","MB","GB","TB","PB","EB"]},deleteFile:{enabled:!1,method:"DELETE",endpoint:"/server/upload",customHeaders:{},params:{}},cors:{expected:!1,sendCredentials:!1,allowXdr:!1},blobs:{defaultName:"misc_data"},paste:{targetElement:null,defaultName:"pasted_image"},camera:{ios:!1,button:null},extraButtons:[],session:{endpoint:null,params:{},customHeaders:{},refreshOnReset:!0},form:{element:"qq-form",autoUpload:!1,interceptSubmit:!0},scaling:{customResizer:null,sendOriginal:!0,orient:!0,defaultType:null,defaultQuality:80,failureText:"Failed to scale",includeExif:!1,sizes:[]},workarounds:{iosEmptyVideos:!0,ios8SafariUploads:!0,ios8BrowserCrash:!1}},qq.extend(this._options,e,!0),this._buttons=[],this._extraButtonSpecs={},this._buttonIdsForFileIds=[],this._wrapCallbacks(),this._disposeSupport=new qq.DisposeSupport,this._storedIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._thumbnailUrls=[],this._netUploadedOrQueued=0,this._netUploaded=0,this._uploadData=this._createUploadDataTracker(),this._initFormSupportAndParams(),this._customHeadersStore=this._createStore(this._options.request.customHeaders),this._deleteFileCustomHeadersStore=this._createStore(this._options.deleteFile.customHeaders),this._deleteFileParamsStore=this._createStore(this._options.deleteFile.params),this._endpointStore=this._createStore(this._options.request.endpoint),this._deleteFileEndpointStore=this._createStore(this._options.deleteFile.endpoint),this._handler=this._createUploadHandler(),this._deleteHandler=qq.DeleteFileAjaxRequester&&this._createDeleteHandler(),this._options.button&&(this._defaultButtonId=this._createUploadButton({element:this._options.button,title:this._options.text.fileInputTitle}).getButtonId()),this._generateExtraButtonSpecs(),this._handleCameraAccess(),this._options.paste.targetElement&&(qq.PasteSupport?this._pasteHandler=this._createPasteHandler():this.log("Paste support module not found","error")),this._preventLeaveInProgress(),this._imageGenerator=qq.ImageGenerator&&new qq.ImageGenerator(qq.bind(this.log,this)),this._refreshSessionData(),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[],this._scaler=qq.Scaler&&new qq.Scaler(this._options.scaling,qq.bind(this.log,this))||{},this._scaler.enabled&&(this._customNewFileHandler=qq.bind(this._scaler.handleNewFile,this._scaler)),qq.TotalProgress&&qq.supportedFeatures.progressBar&&(this._totalProgress=new qq.TotalProgress(qq.bind(this._onTotalProgress,this),function(e){var n=t._uploadData.retrieve({id:e});return n&&n.size||0})),this._currentItemLimit=this._options.validation.itemLimit},qq.FineUploaderBasic.prototype=qq.basePublicApi,qq.extend(qq.FineUploaderBasic.prototype,qq.basePrivateApi)}(),qq.AjaxRequester=function(e){"use strict";function t(){return qq.indexOf(["GET","POST","HEAD"],y.method)>=0}function n(e){var t=!1;return qq.each(t,function(e,n){if(qq.indexOf(["Accept","Accept-Language","Content-Language","Content-Type"],n)<0)return t=!0,!1}),t}function i(e){return y.cors.expected&&void 0===e.withCredentials}function o(){var e;return(window.XMLHttpRequest||window.ActiveXObject)&&(e=qq.createXhrInstance(),void 0===e.withCredentials&&(e=new XDomainRequest,e.onload=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onprogress=function(){})),e}function r(e,t){var n=S[e].xhr;return n||(n=t?t:y.cors.expected?o():qq.createXhrInstance(),S[e].xhr=n),n}function s(e){var t,n=qq.indexOf(b,e),i=y.maxConnections;delete S[e],b.splice(n,1),b.length>=i&&n<i&&(t=b[i-1],l(t))}function a(e,t){var n=r(e),o=y.method,a=t===!0;s(e),a?_(o+" request for "+e+" has failed","error"):i(n)||m(n.status)||(a=!0,_(o+" request for "+e+" has failed - response code "+n.status,"error")),y.onComplete(e,n,a)}function u(e){var t,n=S[e].additionalParams,i=y.mandatedParams;return y.paramsStore.get&&(t=y.paramsStore.get(e)),n&&qq.each(n,function(e,n){t=t||{},t[e]=n}),i&&qq.each(i,function(e,n){t=t||{},t[e]=n}),t}function l(e,t){var n,o=r(e,t),s=y.method,a=u(e),l=S[e].payload;return y.onSend(e),n=c(e,a,S[e].additionalQueryParams),i(o)?(o.onload=q(e),o.onerror=h(e)):o.onreadystatechange=d(e),p(e),o.open(s,n,!0),y.cors.expected&&y.cors.sendCredentials&&!i(o)&&(o.withCredentials=!0),f(e),_("Sending "+s+" request for "+e),l?o.send(l):v||!a?o.send():a&&y.contentType&&y.contentType.toLowerCase().indexOf("application/x-www-form-urlencoded")>=0?o.send(qq.obj2url(a,"")):a&&y.contentType&&y.contentType.toLowerCase().indexOf("application/json")>=0?o.send(JSON.stringify(a)):o.send(a),o}function c(e,t,n){var i=y.endpointStore.get(e),o=S[e].addToPath;return void 0!=o&&(i+="/"+o),v&&t&&(i=qq.obj2url(t,i)),n&&(i=qq.obj2url(n,i)),i}function d(e){return function(){4===r(e).readyState&&a(e)}}function p(e){var t=y.onProgress;t&&(r(e).upload.onprogress=function(n){n.lengthComputable&&t(e,n.loaded,n.total)})}function q(e){return function(){a(e)}}function h(e){return function(){a(e,!0)}}function f(e){var o=r(e),s=y.customHeaders,a=S[e].additionalHeaders||{},u=y.method,l={};i(o)||(y.acceptHeader&&o.setRequestHeader("Accept",y.acceptHeader),y.allowXRequestedWithAndCacheControl&&(y.cors.expected&&t()&&!n(s)||(o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Cache-Control","no-cache"))),!y.contentType||"POST"!==u&&"PUT"!==u||o.setRequestHeader("Content-Type",y.contentType),qq.extend(l,qq.isFunction(s)?s(e):s),qq.extend(l,a),qq.each(l,function(e,t){o.setRequestHeader(e,t)}))}function m(e){return qq.indexOf(y.successfulResponseCodes[y.method],e)>=0}function g(e,t,n,i,o,r,s){S[e]={addToPath:n,additionalParams:i,additionalQueryParams:o,additionalHeaders:r,payload:s};var a=b.push(e);if(a<=y.maxConnections)return l(e,t)}var _,v,b=[],S={},y={acceptHeader:null,validMethods:["PATCH","POST","PUT"],method:"POST",contentType:"application/x-www-form-urlencoded",maxConnections:3,customHeaders:{},endpointStore:{},paramsStore:{},mandatedParams:{},allowXRequestedWithAndCacheControl:!0,successfulResponseCodes:{DELETE:[200,202,204],PATCH:[200,201,202,203,204],POST:[200,201,202,203,204],PUT:[200,201,202,203,204],GET:[200]},cors:{expected:!1,sendCredentials:!1},log:function(e,t){},onSend:function(e){},onComplete:function(e,t,n){},onProgress:null};if(qq.extend(y,e),_=y.log,qq.indexOf(y.validMethods,y.method)<0)throw new Error("'"+y.method+"' is not a supported method for this type of request!");v="GET"===y.method||"DELETE"===y.method,qq.extend(this,{initTransport:function(e){var t,n,i,o,r,s;return{withPath:function(e){return t=e,this},withParams:function(e){return n=e,this},withQueryParams:function(e){return s=e,this},withHeaders:function(e){return i=e,this},withPayload:function(e){return o=e,this},withCacheBuster:function(){return r=!0,this},send:function(a){return r&&qq.indexOf(["GET","DELETE"],y.method)>=0&&(n.qqtimestamp=(new Date).getTime()),g(e,a,t,n,s,i,o)}}},canceled:function(e){s(e)}})},qq.UploadHandler=function(e){"use strict";var t=e.proxy,n={},i=t.onCancel,o=t.getName;qq.extend(this,{add:function(e,t){n[e]=t,n[e].temp={}},cancel:function(e){var t=this,r=new qq.Promise,s=i(e,o(e),r);s.then(function(){t.isValid(e)&&(n[e].canceled=!0,t.expunge(e)),r.success()})},expunge:function(e){delete n[e]},getThirdPartyFileId:function(e){return n[e].key},isValid:function(e){return void 0!==n[e]},reset:function(){n={}},_getFileState:function(e){return n[e]},_setThirdPartyFileId:function(e,t){n[e].key=t},_wasCanceled:function(e){return!!n[e].canceled}})},qq.UploadHandlerController=function(e,t){"use strict";var n,i,o,r=this,s=!1,a=!1,u={paramsStore:{},maxConnections:3,chunking:{enabled:!1,multiple:{enabled:!1}},log:function(e,t){},onProgress:function(e,t,n,i){},onComplete:function(e,t,n,i){},onCancel:function(e,t){},onUploadPrep:function(e){},onUpload:function(e,t){},onUploadChunk:function(e,t,n){},onUploadChunkSuccess:function(e,t,n,i){},onAutoRetry:function(e,t,n,i){},onResume:function(e,t,n){},onUuidChanged:function(e,t){},getName:function(e){},setSize:function(e,t){},isQueued:function(e){},getIdsInProxyGroup:function(e){},getIdsInBatch:function(e){}},l={done:function(e,t,n,i){var r=o._getChunkData(e,t);o._getFileState(e).attemptingResume=!1,delete o._getFileState(e).temp.chunkProgress[t],o._getFileState(e).loaded+=r.size,u.onUploadChunkSuccess(e,o._getChunkDataForCallback(r),n,i)},finalize:function(e){var t=u.getSize(e),n=u.getName(e);i("All chunks have been uploaded for "+e+" - finalizing...."),o.finalizeChunks(e).then(function(r,s){i("Finalize successful for "+e);var a=p.normalizeResponse(r,!0);u.onProgress(e,n,t,t),o._maybeDeletePersistedChunkData(e),p.cleanup(e,a,s)},function(t,o){var r=p.normalizeResponse(t,!1);i("Problem finalizing chunks for file ID "+e+" - "+r.error,"error"),r.reset&&l.reset(e),u.onAutoRetry(e,n,r,o)||p.cleanup(e,r,o)})},hasMoreParts:function(e){return!!o._getFileState(e).chunking.remaining.length},nextPart:function(e){var t=o._getFileState(e).chunking.remaining.shift();return t>=o._getTotalChunks(e)&&(t=null),t},reset:function(e){i("Server or callback has ordered chunking effort to be restarted on next attempt for item ID "+e,"error"),o._maybeDeletePersistedChunkData(e),o.reevaluateChunking(e),o._getFileState(e).loaded=0},sendNext:function(e){var t=u.getSize(e),n=u.getName(e),r=l.nextPart(e),s=o._getChunkData(e,r),d=o._getFileState(e).attemptingResume,q=o._getFileState(e).chunking.inProgress||[];null==o._getFileState(e).loaded&&(o._getFileState(e).loaded=0),d&&u.onResume(e,n,s)===!1&&(l.reset(e),r=l.nextPart(e),s=o._getChunkData(e,r),d=!1),null==r&&0===q.length?l.finalize(e):(i(qq.format("Sending chunked upload request for item {}.{}, bytes {}-{} of {}.",e,r,s.start+1,s.end,t)),u.onUploadChunk(e,n,o._getChunkDataForCallback(s)),q.push(r),o._getFileState(e).chunking.inProgress=q,a&&c.open(e,r),a&&c.available()&&o._getFileState(e).chunking.remaining.length&&l.sendNext(e),o.uploadChunk(e,r,d).then(function(t,n){i("Chunked upload request succeeded for "+e+", chunk "+r),o.clearCachedChunk(e,r);var s=o._getFileState(e).chunking.inProgress||[],a=p.normalizeResponse(t,!0),u=qq.indexOf(s,r);i(qq.format("Chunk {} for file {} uploaded successfully.",r,e)),l.done(e,r,a,n),u>=0&&s.splice(u,1),o._maybePersistChunkedState(e),l.hasMoreParts(e)||0!==s.length?l.hasMoreParts(e)?l.sendNext(e):i(qq.format("File ID {} has no more chunks to send and these chunk indexes are still marked as in-progress: {}",e,JSON.stringify(s))):l.finalize(e)},function(t,s){i("Chunked upload request failed for "+e+", chunk "+r),o.clearCachedChunk(e,r);var d,q=p.normalizeResponse(t,!1);q.reset?l.reset(e):(d=qq.indexOf(o._getFileState(e).chunking.inProgress,r),d>=0&&(o._getFileState(e).chunking.inProgress.splice(d,1),o._getFileState(e).chunking.remaining.unshift(r))),o._getFileState(e).temp.ignoreFailure||(a&&(o._getFileState(e).temp.ignoreFailure=!0,i(qq.format("Going to attempt to abort these chunks: {}. These are currently in-progress: {}.",JSON.stringify(Object.keys(o._getXhrs(e))),JSON.stringify(o._getFileState(e).chunking.inProgress))),qq.each(o._getXhrs(e),function(t,n){i(qq.format("Attempting to abort file {}.{}. XHR readyState {}. ",e,t,n.readyState)),n.abort(),n._cancelled=!0}),o.moveInProgressToRemaining(e),c.free(e,!0)),u.onAutoRetry(e,n,q,s)||p.cleanup(e,q,s))}).done(function(){o.clearXhr(e,r)}))}},c={_open:[],_openChunks:{},_waiting:[],available:function(){var e=u.maxConnections,t=0,n=0;return qq.each(c._openChunks,function(e,i){t++,n+=i.length}),e-(c._open.length-t+n)},free:function(e,t){var n,r=!t,s=qq.indexOf(c._waiting,e),a=qq.indexOf(c._open,e);delete c._openChunks[e],p.getProxyOrBlob(e)instanceof qq.BlobProxy&&(i("Generated blob upload has ended for "+e+", disposing generated blob."),delete o._getFileState(e).file),s>=0?c._waiting.splice(s,1):r&&a>=0&&(c._open.splice(a,1),n=c._waiting.shift(),n>=0&&(c._open.push(n),p.start(n)))},getWaitingOrConnected:function(){var e=[];return qq.each(c._openChunks,function(t,n){n&&n.length&&e.push(parseInt(t))}),qq.each(c._open,function(t,n){c._openChunks[n]||e.push(parseInt(n))}),e=e.concat(c._waiting)},isUsingConnection:function(e){return qq.indexOf(c._open,e)>=0},open:function(e,t){return null==t&&c._waiting.push(e),!!c.available()&&(null==t?(c._waiting.pop(),c._open.push(e)):!function(){var n=c._openChunks[e]||[];n.push(t),c._openChunks[e]=n}(),!0)},reset:function(){c._waiting=[],c._open=[]}},d={send:function(e,t){o._getFileState(e).loaded=0,i("Sending simple upload request for "+e),o.uploadFile(e).then(function(n,o){i("Simple upload request succeeded for "+e);var r=p.normalizeResponse(n,!0),s=u.getSize(e);u.onProgress(e,t,s,s),p.maybeNewUuid(e,r),p.cleanup(e,r,o)},function(n,o){i("Simple upload request failed for "+e);var r=p.normalizeResponse(n,!1);u.onAutoRetry(e,t,r,o)||p.cleanup(e,r,o)})}},p={cancel:function(e){i("Cancelling "+e),u.paramsStore.remove(e),c.free(e)},cleanup:function(e,t,n){var i=u.getName(e);u.onComplete(e,i,t,n),o._getFileState(e)&&o._clearXhrs&&o._clearXhrs(e),c.free(e)},getProxyOrBlob:function(e){return o.getProxy&&o.getProxy(e)||o.getFile&&o.getFile(e)},initHandler:function(){var e=t?qq[t]:qq.traditional,n=qq.supportedFeatures.ajaxUploading?"Xhr":"Form";o=new e[n+"UploadHandler"](u,{getDataByUuid:u.getDataByUuid,getName:u.getName,getSize:u.getSize,getUuid:u.getUuid,log:i,onCancel:u.onCancel,onProgress:u.onProgress,onUuidChanged:u.onUuidChanged}),o._removeExpiredChunkingRecords&&o._removeExpiredChunkingRecords()},isDeferredEligibleForUpload:function(e){return u.isQueued(e)},maybeDefer:function(e,t){return t&&!o.getFile(e)&&t instanceof qq.BlobProxy?(u.onUploadPrep(e),i("Attempting to generate a blob on-demand for "+e),t.create().then(function(t){i("Generated an on-demand blob for "+e),o.updateBlob(e,t),u.setSize(e,t.size),o.reevaluateChunking(e),p.maybeSendDeferredFiles(e)},function(t){var o={};t&&(o.error=t),i(qq.format("Failed to generate blob for ID {}. Error message: {}.",e,t),"error"),u.onComplete(e,u.getName(e),qq.extend(o,n),null),p.maybeSendDeferredFiles(e),c.free(e)}),!1):p.maybeSendDeferredFiles(e)},maybeSendDeferredFiles:function(e){var t=u.getIdsInProxyGroup(e),n=!1;return t&&t.length?(i("Maybe ready to upload proxy group file "+e),qq.each(t,function(t,i){if(p.isDeferredEligibleForUpload(i)&&o.getFile(i))n=i===e,p.now(i);else if(p.isDeferredEligibleForUpload(i))return!1})):(n=!0,p.now(e)),n},maybeNewUuid:function(e,t){void 0!==t.newUuid&&u.onUuidChanged(e,t.newUuid)},normalizeResponse:function(e,t){var n=e;return qq.isObject(e)||(n={},qq.isString(e)&&!t&&(n.error=e)),n.success=t,n},now:function(e){var t=u.getName(e);if(!r.isValid(e))throw new qq.Error(e+" is not a valid file ID to upload!");u.onUpload(e,t),s&&o._shouldChunkThisFile(e)?l.sendNext(e):d.send(e,t)},start:function(e){var t=p.getProxyOrBlob(e);return t?p.maybeDefer(e,t):(p.now(e),!0)}};qq.extend(this,{add:function(e,t){o.add.apply(this,arguments)},upload:function(e){return!!c.open(e)&&p.start(e)},retry:function(e){return a&&(o._getFileState(e).temp.ignoreFailure=!1),c.isUsingConnection(e)?p.start(e):r.upload(e)},cancel:function(e){var t=o.cancel(e);qq.isGenericPromise(t)?t.then(function(){p.cancel(e)}):t!==!1&&p.cancel(e)},cancelAll:function(){var e,t=c.getWaitingOrConnected();if(t.length)for(e=t.length-1;e>=0;e--)r.cancel(t[e]);c.reset()},getFile:function(e){return o.getProxy&&o.getProxy(e)?o.getProxy(e).referenceBlob:o.getFile&&o.getFile(e)},isProxied:function(e){return!(!o.getProxy||!o.getProxy(e))},getInput:function(e){if(o.getInput)return o.getInput(e)},reset:function(){i("Resetting upload handler"),r.cancelAll(),c.reset(),o.reset()},expunge:function(e){if(r.isValid(e))return o.expunge(e)},isValid:function(e){return o.isValid(e)},getResumableFilesData:function(){
return o.getResumableFilesData?o.getResumableFilesData():[]},getThirdPartyFileId:function(e){if(r.isValid(e))return o.getThirdPartyFileId(e)},pause:function(e){return!!(r.isResumable(e)&&o.pause&&r.isValid(e)&&o.pause(e))&&(c.free(e),o.moveInProgressToRemaining(e),!0)},isResumable:function(e){return!!o.isResumable&&o.isResumable(e)}}),qq.extend(u,e),i=u.log,s=u.chunking.enabled&&qq.supportedFeatures.chunking,a=s&&u.chunking.concurrent.enabled,n=function(){var e={};return e[u.preventRetryParam]=!0,e}(),p.initHandler()},qq.WindowReceiveMessage=function(e){"use strict";var t={log:function(e,t){}},n={};qq.extend(t,e),qq.extend(this,{receiveMessage:function(e,t){var i=function(e){t(e.data)};window.postMessage?n[e]=qq(window).attach("message",i):log("iframe message passing not supported in this browser!","error")},stopReceivingMessages:function(e){if(window.postMessage){var t=n[e];t&&t()}}})},qq.FormUploadHandler=function(e){"use strict";function t(e){delete c[e],p&&(clearTimeout(d[e]),delete d[e],m.stopReceivingMessages(e));var t=document.getElementById(s._getIframeName(e));t&&(t.setAttribute("src","javascript:false;"),qq(t).remove())}function n(e){return e.split("_")[0]}function i(e){var t=qq.toElement("<iframe src='javascript:false;' name='"+e+"' />");return t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),t}function o(e,t){var i=e.id,o=n(i),r=h(o);l[r]=t,c[o]=qq(e).attach("load",function(){s.getInput(o)&&(f("Received iframe load event for CORS upload request (iframe name "+i+")"),d[i]=setTimeout(function(){var e="No valid message received from loaded iframe for iframe name "+i;f(e,"error"),t({error:e})},1e3))}),m.receiveMessage(i,function(e){f("Received the following window message: '"+e+"'");var t,o=(n(i),s._parseJsonResponse(e)),r=o.uuid;r&&l[r]?(f("Handling response for iframe name "+i),clearTimeout(d[i]),delete d[i],s._detachLoadEvent(i),t=l[r],delete l[r],m.stopReceivingMessages(i),t(o)):r||f("'"+e+"' does not contain a UUID - ignoring.")})}var r=e.options,s=this,a=e.proxy,u=qq.getUniqueId(),l={},c={},d={},p=r.isCors,q=r.inputName,h=a.getUuid,f=a.log,m=new qq.WindowReceiveMessage({log:f});qq.extend(this,new qq.UploadHandler(e)),qq.override(this,function(e){return{add:function(t,n){e.add(t,{input:n}),n.setAttribute("name",q),n.parentNode&&qq(n).remove()},expunge:function(n){t(n),e.expunge(n)},isValid:function(t){return e.isValid(t)&&void 0!==s._getFileState(t).input}}}),qq.extend(this,{getInput:function(e){return s._getFileState(e).input},_attachLoadEvent:function(e,t){var n;p?o(e,t):c[e.id]=qq(e).attach("load",function(){if(f("Received response for "+e.id),e.parentNode){try{if(e.contentDocument&&e.contentDocument.body&&"false"==e.contentDocument.body.innerHTML)return}catch(e){f("Error when attempting to access iframe during handling of upload response ("+e.message+")","error"),n={success:!1}}t(n)}})},_createIframe:function(e){var t=s._getIframeName(e);return i(t)},_detachLoadEvent:function(e){void 0!==c[e]&&(c[e](),delete c[e])},_getIframeName:function(e){return e+"_"+u},_initFormForUpload:function(e){var t=e.method,n=e.endpoint,i=e.params,o=e.paramsInBody,r=e.targetName,s=qq.toElement("<form method='"+t+"' enctype='multipart/form-data'></form>"),a=n;return o?qq.obj2Inputs(i,s):a=qq.obj2url(i,n),s.setAttribute("action",a),s.setAttribute("target",r),s.style.display="none",document.body.appendChild(s),s},_parseJsonResponse:function(e){var t={};try{t=qq.parseJson(e)}catch(e){f("Error when attempting to parse iframe upload response ("+e.message+")","error")}return t}})},qq.XhrUploadHandler=function(e){"use strict";function t(e){qq.each(n._getXhrs(e),function(t,i){var o=n._getAjaxRequester(e,t);i.onreadystatechange=null,i.upload.onprogress=null,i.abort(),o&&o.canceled&&o.canceled(e)})}var n=this,i=e.options.namespace,o=e.proxy,r=e.options.chunking,s=e.options.resume,a=r&&e.options.chunking.enabled&&qq.supportedFeatures.chunking,u=s&&e.options.resume.enabled&&a&&qq.supportedFeatures.resume,l=o.getName,c=o.getSize,d=o.getUuid,p=o.getEndpoint,q=o.getDataByUuid,h=o.onUuidChanged,f=o.onProgress,m=o.log;qq.extend(this,new qq.UploadHandler(e)),qq.override(this,function(e){return{add:function(t,i){if(qq.isFile(i)||qq.isBlob(i))e.add(t,{file:i});else{if(!(i instanceof qq.BlobProxy))throw new Error("Passed obj is not a File, Blob, or proxy");e.add(t,{proxy:i})}n._initTempState(t),u&&n._maybePrepareForResume(t)},expunge:function(i){t(i),n._maybeDeletePersistedChunkData(i),n._clearXhrs(i),e.expunge(i)}}}),qq.extend(this,{clearCachedChunk:function(e,t){delete n._getFileState(e).temp.cachedChunks[t]},clearXhr:function(e,t){var i=n._getFileState(e).temp;i.xhrs&&delete i.xhrs[t],i.ajaxRequesters&&delete i.ajaxRequesters[t]},finalizeChunks:function(e,t){var i=n._getTotalChunks(e)-1,o=n._getXhr(e,i);return t?(new qq.Promise).success(t(o),o):(new qq.Promise).success({},o)},getFile:function(e){return n.isValid(e)&&n._getFileState(e).file},getProxy:function(e){return n.isValid(e)&&n._getFileState(e).proxy},getResumableFilesData:function(){var e=[];return n._iterateResumeRecords(function(t,i){n.moveInProgressToRemaining(null,i.chunking.inProgress,i.chunking.remaining);var o={name:i.name,remaining:i.chunking.remaining,size:i.size,uuid:i.uuid};i.key&&(o.key=i.key),e.push(o)}),e},isResumable:function(e){return!!r&&n.isValid(e)&&!n._getFileState(e).notResumable},moveInProgressToRemaining:function(e,t,i){var o=t||n._getFileState(e).chunking.inProgress,r=i||n._getFileState(e).chunking.remaining;o&&(m(qq.format("Moving these chunks from in-progress {}, to remaining.",JSON.stringify(o))),o.reverse(),qq.each(o,function(e,t){r.unshift(t)}),o.length=0)},pause:function(e){if(n.isValid(e))return m(qq.format("Aborting XHR upload for {} '{}' due to pause instruction.",e,l(e))),n._getFileState(e).paused=!0,t(e),!0},reevaluateChunking:function(e){if(r&&n.isValid(e)){var t,i,o=n._getFileState(e);if(delete o.chunking,o.chunking={},t=n._getTotalChunks(e),t>1||r.mandatory){for(o.chunking.enabled=!0,o.chunking.parts=t,o.chunking.remaining=[],i=0;i<t;i++)o.chunking.remaining.push(i);n._initTempState(e)}else o.chunking.enabled=!1}},updateBlob:function(e,t){n.isValid(e)&&(n._getFileState(e).file=t)},_clearXhrs:function(e){var t=n._getFileState(e).temp;qq.each(t.ajaxRequesters,function(e){delete t.ajaxRequesters[e]}),qq.each(t.xhrs,function(e){delete t.xhrs[e]})},_createXhr:function(e,t){return n._registerXhr(e,t,qq.createXhrInstance())},_getAjaxRequester:function(e,t){var i=null==t?-1:t;return n._getFileState(e).temp.ajaxRequesters[i]},_getChunkData:function(e,t){var i=r.partSize,o=c(e),s=n.getFile(e),a=i*t,u=a+i>=o?o:a+i,l=n._getTotalChunks(e),d=this._getFileState(e).temp.cachedChunks,p=d[t]||qq.sliceBlob(s,a,u);return d[t]=p,{part:t,start:a,end:u,count:l,blob:p,size:u-a}},_getChunkDataForCallback:function(e){return{partIndex:e.part,startByte:e.start+1,endByte:e.end,totalParts:e.count}},_getLocalStorageId:function(e){var t="5.0",n=l(e),o=c(e),s=r.partSize,a=p(e);return qq.format("qq{}resume{}-{}-{}-{}-{}",i,t,n,o,s,a)},_getMimeType:function(e){return n.getFile(e).type},_getPersistableData:function(e){return n._getFileState(e).chunking},_getTotalChunks:function(e){if(r){var t=c(e),n=r.partSize;return Math.ceil(t/n)}},_getXhr:function(e,t){var i=null==t?-1:t;return n._getFileState(e).temp.xhrs[i]},_getXhrs:function(e){return n._getFileState(e).temp.xhrs},_iterateResumeRecords:function(e){u&&qq.each(localStorage,function(t,n){if(0===t.indexOf(qq.format("qq{}resume",i))){var o=JSON.parse(n);e(t,o)}})},_initTempState:function(e){n._getFileState(e).temp={ajaxRequesters:{},chunkProgress:{},xhrs:{},cachedChunks:{}}},_markNotResumable:function(e){n._getFileState(e).notResumable=!0},_maybeDeletePersistedChunkData:function(e){var t;return!!(u&&n.isResumable(e)&&(t=n._getLocalStorageId(e),t&&localStorage.getItem(t)))&&(localStorage.removeItem(t),!0)},_maybePrepareForResume:function(e){var t,i,o=n._getFileState(e);u&&void 0===o.key&&(t=n._getLocalStorageId(e),i=localStorage.getItem(t),i&&(i=JSON.parse(i),q(i.uuid)?n._markNotResumable(e):(m(qq.format("Identified file with ID {} and name of {} as resumable.",e,l(e))),h(e,i.uuid),o.key=i.key,o.chunking=i.chunking,o.loaded=i.loaded,o.attemptingResume=!0,n.moveInProgressToRemaining(e))))},_maybePersistChunkedState:function(e){var t,i,o=n._getFileState(e);if(u&&n.isResumable(e)){t=n._getLocalStorageId(e),i={name:l(e),size:c(e),uuid:d(e),key:o.key,chunking:o.chunking,loaded:o.loaded,lastUpdated:Date.now()};try{localStorage.setItem(t,JSON.stringify(i))}catch(t){m(qq.format("Unable to save resume data for '{}' due to error: '{}'.",e,t.toString()),"warn")}}},_registerProgressHandler:function(e,t,i){var o=n._getXhr(e,t),r=l(e),s={simple:function(t,n){var i=c(e);t===n?f(e,r,i,i):f(e,r,t>=i?i-1:t,i)},chunked:function(o,s){var a=n._getFileState(e).temp.chunkProgress,u=n._getFileState(e).loaded,l=o,d=s,p=c(e),q=l-(d-i),h=u;a[t]=q,qq.each(a,function(e,t){h+=t}),f(e,r,h,p)}};o.upload.onprogress=function(e){if(e.lengthComputable){var t=null==i?"simple":"chunked";s[t](e.loaded,e.total)}}},_registerXhr:function(e,t,i,o){var r=null==t?-1:t,s=n._getFileState(e).temp;return s.xhrs=s.xhrs||{},s.ajaxRequesters=s.ajaxRequesters||{},s.xhrs[r]=i,o&&(s.ajaxRequesters[r]=o),i},_removeExpiredChunkingRecords:function(){var e=s.recordsExpireIn;n._iterateResumeRecords(function(t,n){var i=new Date(n.lastUpdated);i.setDate(i.getDate()+e),i.getTime()<=Date.now()&&(m("Removing expired resume record with key "+t),localStorage.removeItem(t))})},_shouldChunkThisFile:function(e){var t=n._getFileState(e);return t.chunking||n.reevaluateChunking(e),t.chunking.enabled}})},qq.DeleteFileAjaxRequester=function(e){"use strict";function t(){return"POST"===i.method.toUpperCase()?{_method:"DELETE"}:{}}var n,i={method:"DELETE",uuidParamName:"qquuid",endpointStore:{},maxConnections:3,customHeaders:function(e){return{}},paramsStore:{},cors:{expected:!1,sendCredentials:!1},log:function(e,t){},onDelete:function(e){},onDeleteComplete:function(e,t,n){}};qq.extend(i,e),n=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["POST","DELETE"],method:i.method,endpointStore:i.endpointStore,paramsStore:i.paramsStore,mandatedParams:t(),maxConnections:i.maxConnections,customHeaders:function(e){return i.customHeaders.get(e)},log:i.log,onSend:i.onDelete,onComplete:i.onDeleteComplete,cors:i.cors})),qq.extend(this,{sendDelete:function(e,t,o){var r=o||{};i.log("Submitting delete file request for "+e),"DELETE"===i.method?n.initTransport(e).withPath(t).withParams(r).send():(r[i.uuidParamName]=t,n.initTransport(e).withParams(r).send())}})},function(){function e(e){var t,n=e.naturalWidth,i=e.naturalHeight,o=document.createElement("canvas");return n*i>1048576&&(o.width=o.height=1,t=o.getContext("2d"),t.drawImage(e,-n+1,0),0===t.getImageData(0,0,1,1).data[3])}function t(e,t,n){var i,o,r,s,a=document.createElement("canvas"),u=0,l=n,c=n;for(a.width=1,a.height=n,i=a.getContext("2d"),i.drawImage(e,0,0),o=i.getImageData(0,0,1,n).data;c>u;)r=o[4*(c-1)+3],0===r?l=c:u=c,c=l+u>>1;return s=c/n,0===s?1:s}function n(e,t,n,i){var r=document.createElement("canvas"),s=n.mime||"image/jpeg",a=new qq.Promise;return o(e,t,r,n,i).then(function(){a.success(r.toDataURL(s,n.quality||.8))}),a}function i(e){var t=5241e3;if(!qq.ios())throw new qq.Error("Downsampled dimensions can only be reliably calculated for iOS!");if(e.origHeight*e.origWidth>t)return{newHeight:Math.round(Math.sqrt(t*(e.origHeight/e.origWidth))),newWidth:Math.round(Math.sqrt(t*(e.origWidth/e.origHeight)))}}function o(n,o,a,u,l){var c,d=n.naturalWidth,p=n.naturalHeight,q=u.width,h=u.height,f=a.getContext("2d"),m=new qq.Promise;return f.save(),u.resize?r({blob:o,canvas:a,image:n,imageHeight:p,imageWidth:d,orientation:u.orientation,resize:u.resize,targetHeight:h,targetWidth:q}):(qq.supportedFeatures.unlimitedScaledImageSize||(c=i({origWidth:q,origHeight:h}),c&&(qq.log(qq.format("Had to reduce dimensions due to device limitations from {}w / {}h to {}w / {}h",q,h,c.newWidth,c.newHeight),"warn"),q=c.newWidth,h=c.newHeight)),s(a,q,h,u.orientation),qq.ios()?!function(){e(n)&&(d/=2,p/=2);var i,o,r,s=1024,a=document.createElement("canvas"),u=l?t(n,d,p):1,c=Math.ceil(s*q/d),m=Math.ceil(s*h/p/u),g=0,_=0;for(a.width=a.height=s,i=a.getContext("2d");g<p;){for(o=0,r=0;o<d;)i.clearRect(0,0,s,s),i.drawImage(n,-o,-g),f.drawImage(a,0,0,s,s,r,_,c,m),o+=s,r+=c;g+=s,_+=m}f.restore(),a=i=null}():f.drawImage(n,0,0,q,h),a.qqImageRendered&&a.qqImageRendered(),m.success(),m)}function r(e){var t=e.blob,n=e.image,i=e.imageHeight,o=e.imageWidth,r=e.orientation,a=new qq.Promise,u=e.resize,l=document.createElement("canvas"),c=l.getContext("2d"),d=e.canvas,p=e.targetHeight,q=e.targetWidth;return s(l,o,i,r),d.height=p,d.width=q,c.drawImage(n,0,0),u({blob:t,height:p,image:n,sourceCanvas:l,targetCanvas:d,width:q}).then(function(){d.qqImageRendered&&d.qqImageRendered(),a.success()},a.failure),a}function s(e,t,n,i){switch(i){case 5:case 6:case 7:case 8:e.width=n,e.height=t;break;default:e.width=t,e.height=n}var o=e.getContext("2d");switch(i){case 2:o.translate(t,0),o.scale(-1,1);break;case 3:o.translate(t,n),o.rotate(Math.PI);break;case 4:o.translate(0,n),o.scale(1,-1);break;case 5:o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:o.rotate(.5*Math.PI),o.translate(0,-n);break;case 7:o.rotate(.5*Math.PI),o.translate(t,-n),o.scale(-1,1);break;case 8:o.rotate(-.5*Math.PI),o.translate(-t,0)}}function a(e,t){var n=this;window.Blob&&e instanceof Blob&&!function(){var t=new Image,i=window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;if(!i)throw Error("No createObjectURL function found to create blob url");t.src=i.createObjectURL(e),n.blob=e,e=t}(),e.naturalWidth||e.naturalHeight||(e.onload=function(){var e=n.imageLoadListeners;e&&(n.imageLoadListeners=null,setTimeout(function(){for(var t=0,n=e.length;t<n;t++)e[t]()},0))},e.onerror=t,this.imageLoadListeners=[]),this.srcImage=e}a.prototype.render=function(e,t){t=t||{};var i,r=this,s=this.srcImage.naturalWidth,a=this.srcImage.naturalHeight,u=t.width,l=t.height,c=t.maxWidth,d=t.maxHeight,p=!this.blob||"image/jpeg"===this.blob.type,q=e.tagName.toLowerCase();return this.imageLoadListeners?void this.imageLoadListeners.push(function(){r.render(e,t)}):(u&&!l?l=a*u/s<<0:l&&!u?u=s*l/a<<0:(u=s,l=a),c&&u>c&&(u=c,l=a*u/s<<0),d&&l>d&&(l=d,u=s*l/a<<0),i={width:u,height:l},qq.each(t,function(e,t){i[e]=t}),"img"===q?!function(){var t=e.src;n(r.srcImage,r.blob,i,p).then(function(n){e.src=n,t===e.src&&e.onload()})}():"canvas"===q&&o(this.srcImage,this.blob,e,i,p),void("function"==typeof this.onrender&&this.onrender(e)))},qq.MegaPixImage=a}(),qq.ImageGenerator=function(e){"use strict";function t(e){return"img"===e.tagName.toLowerCase()}function n(e){return"canvas"===e.tagName.toLowerCase()}function i(){return void 0!==(new Image).crossOrigin}function o(){var e=document.createElement("canvas");return e.getContext&&e.getContext("2d")}function r(e){var t=e.split("/"),n=t[t.length-1].split("?")[0],i=qq.getExtension(n);switch(i=i&&i.toLowerCase()){case"jpeg":case"jpg":return"image/jpeg";case"png":return"image/png";case"bmp":return"image/bmp";case"gif":return"image/gif";case"tiff":case"tif":return"image/tiff"}}function s(e){var t,n,i,o=document.createElement("a");return o.href=e,t=o.protocol,i=o.port,n=o.hostname,t.toLowerCase()!==window.location.protocol.toLowerCase()||(n.toLowerCase()!==window.location.hostname.toLowerCase()||i!==window.location.port&&!qq.ie())}function a(t,n){t.onload=function(){t.onload=null,t.onerror=null,n.success(t)},t.onerror=function(){t.onload=null,t.onerror=null,e("Problem drawing thumbnail!","error"),n.failure(t,"Problem drawing thumbnail!")}}function u(e,t){e.qqImageRendered=function(){t.success(e)}}function l(i,o){var r=t(i)||n(i);return t(i)?a(i,o):n(i)?u(i,o):(o.failure(i),e(qq.format("Element container of type {} is not supported!",i.tagName),"error")),r}function c(t,n,i){var o=new qq.Promise,r=new qq.Identify(t,e),s=i.maxSize,a=null==i.orient||i.orient,u=function(){n.onerror=null,n.onload=null,e("Could not render preview, file may be too large!","error"),o.failure(n,"Browser cannot render image!")};return r.isPreviewable().then(function(r){var c={parse:function(){return(new qq.Promise).success()}},d=a?new qq.Exif(t,e):c,p=new qq.MegaPixImage(t,u);l(n,o)&&d.parse().then(function(e){var t=e&&e.Orientation;p.render(n,{maxWidth:s,maxHeight:s,orientation:t,mime:r,resize:i.customResizeFunction})},function(t){e(qq.format("EXIF data could not be parsed ({}). Assuming orientation = 1.",t)),p.render(n,{maxWidth:s,maxHeight:s,mime:r,resize:i.customResizeFunction})})},function(){e("Not previewable"),o.failure(n,"Not previewable")}),o}function d(e,t,n,i,o){var a=new Image,u=new qq.Promise;l(a,u),s(e)&&(a.crossOrigin="anonymous"),a.src=e,u.then(function(){l(t,n);var s=new qq.MegaPixImage(a);s.render(t,{maxWidth:i,maxHeight:i,mime:r(e),resize:o})},n.failure)}function p(e,t,n,i){l(t,n),qq(t).css({maxWidth:i+"px",maxHeight:i+"px"}),t.src=e}function q(e,r,a){var u=new qq.Promise,c=a.scale,q=c?a.maxSize:null;return c&&t(r)?o()?s(e)&&!i()?p(e,r,u,q):d(e,r,u,q):p(e,r,u,q):n(r)?d(e,r,u,q):l(r,u)&&(r.src=e),u}qq.extend(this,{generate:function(t,n,i){return qq.isString(t)?(e("Attempting to update thumbnail based on server response."),q(t,n,i||{})):(e("Attempting to draw client-side image preview."),c(t,n,i||{}))}}),this._testing={},this._testing.isImg=t,this._testing.isCanvas=n,this._testing.isCrossOrigin=s,this._testing.determineMimeOfFileName=r},qq.Exif=function(e,t){"use strict";function n(e){for(var t=0,n=0;e.length>0;)t+=parseInt(e.substring(0,2),16)*Math.pow(2,n),e=e.substring(2,e.length),n+=8;return t}function i(t,n){var o=t,r=n;return void 0===o&&(o=2,r=new qq.Promise),qq.readBlobToHex(e,o,4).then(function(e){var t,n=/^ffe([0-9])/.exec(e);n?"1"!==n[1]?(t=parseInt(e.slice(4,8),16),i(o+t+2,r)):r.success(o):r.failure("No EXIF header to be found!")}),r}function o(){var t=new qq.Promise;return qq.readBlobToHex(e,0,6).then(function(e){0!==e.indexOf("ffd8")?t.failure("Not a valid JPEG!"):i().then(function(e){t.success(e)},function(e){t.failure(e)})}),t}function r(t){var n=new qq.Promise;return qq.readBlobToHex(e,t+10,2).then(function(e){n.success("4949"===e)}),n}function s(t,i){var o=new qq.Promise;return qq.readBlobToHex(e,t+18,2).then(function(e){return i?o.success(n(e)):void o.success(parseInt(e,16))}),o}function a(t,n){var i=t+20,o=12*n;return qq.readBlobToHex(e,i,o)}function u(e){for(var t=[],n=0;n+24<=e.length;)t.push(e.slice(n,n+24)),n+=24;return t}function l(e,t){var i=16,o=qq.extend([],c),r={};return qq.each(t,function(t,s){var a,u,l,c=s.slice(0,4),p=e?n(c):parseInt(c,16),q=o.indexOf(p);if(q>=0&&(u=d[p].name,l=d[p].bytes,a=s.slice(i,i+2*l),r[u]=e?n(a):parseInt(a,16),o.splice(q,1)),0===o.length)return!1}),r}var c=[274],d={274:{name:"Orientation",bytes:2}};qq.extend(this,{parse:function(){var n=new qq.Promise,i=function(e){t(qq.format("EXIF header parse failed: '{}' ",e)),n.failure(e)};return o().then(function(o){t(qq.format("Moving forward with EXIF header parsing for '{}'",void 0===e.name?"blob":e.name)),r(o).then(function(e){t(qq.format("EXIF Byte order is {} endian",e?"little":"big")),s(o,e).then(function(r){t(qq.format("Found {} APP1 directory entries",r)),a(o,r).then(function(i){var o=u(i),r=l(e,o);t("Successfully parsed some EXIF tags"),n.success(r)},i)},i)},i)},i),n}}),this._testing={},this._testing.parseLittleEndian=n},qq.Identify=function(e,t){"use strict";function n(e,t){var n=!1,i=[].concat(e);return qq.each(i,function(e,i){if(0===t.indexOf(i))return n=!0,!1}),n}qq.extend(this,{isPreviewable:function(){var i=this,o=new qq.Promise,r=!1,s=void 0===e.name?"blob":e.name;return t(qq.format("Attempting to determine if {} can be rendered in this browser",s)),t("First pass: check type attribute of blob object."),this.isPreviewableSync()?(t("Second pass: check for magic bytes in file header."),qq.readBlobToHex(e,0,4).then(function(e){qq.each(i.PREVIEWABLE_MIME_TYPES,function(t,i){if(n(i,e))return("image/tiff"!==t||qq.supportedFeatures.tiffPreviews)&&(r=!0,o.success(t)),!1}),t(qq.format("'{}' is {} able to be rendered in this browser",s,r?"":"NOT")),r||o.failure()},function(){t("Error reading file w/ name '"+s+"'. Not able to be rendered in this browser."),o.failure()})):o.failure(),o},isPreviewableSync:function(){var n=e.type,i=qq.indexOf(Object.keys(this.PREVIEWABLE_MIME_TYPES),n)>=0,o=!1,r=void 0===e.name?"blob":e.name;return i&&(o="image/tiff"!==n||qq.supportedFeatures.tiffPreviews),!o&&t(r+" is not previewable in this browser per the blob's type attr"),o}})},qq.Identify.prototype.PREVIEWABLE_MIME_TYPES={"image/jpeg":"ffd8ff","image/gif":"474946","image/png":"89504e","image/bmp":"424d","image/tiff":["49492a00","4d4d002a"]},qq.Identify=function(e,t){"use strict";function n(e,t){var n=!1,i=[].concat(e);return qq.each(i,function(e,i){if(0===t.indexOf(i))return n=!0,!1}),n}qq.extend(this,{isPreviewable:function(){var i=this,o=new qq.Promise,r=!1,s=void 0===e.name?"blob":e.name;return t(qq.format("Attempting to determine if {} can be rendered in this browser",s)),t("First pass: check type attribute of blob object."),this.isPreviewableSync()?(t("Second pass: check for magic bytes in file header."),qq.readBlobToHex(e,0,4).then(function(e){qq.each(i.PREVIEWABLE_MIME_TYPES,function(t,i){if(n(i,e))return("image/tiff"!==t||qq.supportedFeatures.tiffPreviews)&&(r=!0,o.success(t)),!1}),t(qq.format("'{}' is {} able to be rendered in this browser",s,r?"":"NOT")),r||o.failure()},function(){t("Error reading file w/ name '"+s+"'. Not able to be rendered in this browser."),o.failure()})):o.failure(),o},isPreviewableSync:function(){var n=e.type,i=qq.indexOf(Object.keys(this.PREVIEWABLE_MIME_TYPES),n)>=0,o=!1,r=void 0===e.name?"blob":e.name;return i&&(o="image/tiff"!==n||qq.supportedFeatures.tiffPreviews),!o&&t(r+" is not previewable in this browser per the blob's type attr"),o}})},qq.Identify.prototype.PREVIEWABLE_MIME_TYPES={"image/jpeg":"ffd8ff","image/gif":"474946","image/png":"89504e","image/bmp":"424d","image/tiff":["49492a00","4d4d002a"]},qq.ImageValidation=function(e,t){"use strict";function n(e){var t=!1;return qq.each(e,function(e,n){if(n>0)return t=!0,!1}),t}function i(){var n=new qq.Promise;return new qq.Identify(e,t).isPreviewable().then(function(){var i=new Image,o=window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;o?(i.onerror=function(){t("Cannot determine dimensions for image. May be too large.","error"),n.failure()},i.onload=function(){n.success({width:this.width,height:this.height})},i.src=o.createObjectURL(e)):(t("No createObjectURL function available to generate image URL!","error"),n.failure())},n.failure),n}function o(e,t){var n;return qq.each(e,function(e,i){if(i>0){var o=/(max|min)(Width|Height)/.exec(e),r=o[2].charAt(0).toLowerCase()+o[2].slice(1),s=t[r];switch(o[1]){case"min":if(s<i)return n=e,!1;break;case"max":if(s>i)return n=e,!1}}}),n}this.validate=function(e){var r=new qq.Promise;return t("Attempting to validate image."),n(e)?i().then(function(t){var n=o(e,t);n?r.failure(n):r.success()},r.success):r.success(),r}},qq.Session=function(e){"use strict";function t(e){return!!qq.isArray(e)||void i.log("Session response is not an array.","error")}function n(e,n,o,r){var s=!1;n=n&&t(e),n&&qq.each(e,function(e,t){if(null==t.uuid)s=!0,i.log(qq.format("Session response item {} did not include a valid UUID - ignoring.",e),"error");else if(null==t.name)s=!0,i.log(qq.format("Session response item {} did not include a valid name - ignoring.",e),"error");else try{return i.addFileRecord(t),!0}catch(e){s=!0,i.log(e.message,"error")}return!1}),r[n&&!s?"success":"failure"](e,o)}var i={endpoint:null,params:{},customHeaders:{},cors:{},addFileRecord:function(e){},log:function(e,t){}};qq.extend(i,e,!0),this.refresh=function(){var e=new qq.Promise,t=function(t,i,o){n(t,i,o,e)},o=qq.extend({},i),r=new qq.SessionAjaxRequester(qq.extend(o,{onComplete:t}));return r.queryServer(),e}},qq.SessionAjaxRequester=function(e){"use strict";function t(e,t,n){var o=null;if(null!=t.responseText)try{o=qq.parseJson(t.responseText)}catch(e){i.log("Problem parsing session response: "+e.message,"error"),n=!0}i.onComplete(o,!n,t)}var n,i={endpoint:null,customHeaders:{},params:{},cors:{expected:!1,sendCredentials:!1},onComplete:function(e,t,n){},log:function(e,t){}};qq.extend(i,e),n=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["GET"],method:"GET",endpointStore:{get:function(){return i.endpoint}},customHeaders:i.customHeaders,log:i.log,onComplete:t,cors:i.cors})),qq.extend(this,{queryServer:function(){var e=qq.extend({},i.params);i.log("Session query request."),n.initTransport("sessionRefresh").withParams(e).withCacheBuster().send()}})},qq.Scaler=function(e,t){"use strict";var n=e.customResizer,i=e.sendOriginal,o=e.orient,r=e.defaultType,s=e.defaultQuality/100,a=e.failureText,u=e.includeExif,l=this._getSortedSizes(e.sizes);qq.extend(this,{enabled:qq.supportedFeatures.scaling&&l.length>0,getFileRecords:function(e,c,d){var p=this,q=[],h=d.blob?d.blob:d,f=new qq.Identify(h,t);return f.isPreviewableSync()?(qq.each(l,function(e,i){var l=p._determineOutputType({defaultType:r,requestedType:i.type,refType:h.type});q.push({uuid:qq.getUniqueId(),name:p._getName(c,{name:i.name,type:l,refType:h.type}),blob:new qq.BlobProxy(h,qq.bind(p._generateScaledImage,p,{customResizeFunction:n,maxSize:i.maxSize,orient:o,type:l,quality:s,failedText:a,includeExif:u,log:t}))})}),q.push({uuid:e,name:c,size:h.size,blob:i?h:null})):q.push({uuid:e,name:c,size:h.size,blob:h}),q},handleNewFile:function(e,t,n,i,o,r,s,a){var u=this,l=(e.qqButtonId||e.blob&&e.blob.qqButtonId,[]),c=null,d=a.addFileToHandler,p=a.uploadData,q=a.paramsStore,h=qq.getUniqueId();qq.each(u.getFileRecords(n,t,e),function(e,t){var n,i=t.size;t.blob instanceof qq.BlobProxy&&(i=-1),n=p.addFile({uuid:t.uuid,name:t.name,size:i,batchId:r,proxyGroupId:h}),t.blob instanceof qq.BlobProxy?l.push(n):c=n,t.blob?(d(n,t.blob),o.push({id:n,file:t.blob})):p.setStatus(n,qq.status.REJECTED)}),null!==c&&(qq.each(l,function(e,t){var n={qqparentuuid:p.retrieve({id:c}).uuid,qqparentsize:p.retrieve({id:c}).size};n[s]=p.retrieve({id:t}).uuid,p.setParentId(t,c),q.addReadOnly(t,n)}),l.length&&!function(){var e={};e[s]=p.retrieve({id:c}).uuid,q.addReadOnly(c,e)}())}})},qq.extend(qq.Scaler.prototype,{scaleImage:function(e,t,n){"use strict";if(!qq.supportedFeatures.scaling)throw new qq.Error("Scaling is not supported in this browser!");var i=new qq.Promise,o=n.log,r=n.getFile(e),s=n.uploadData.retrieve({id:e}),a=s&&s.name,u=s&&s.uuid,l={customResizer:t.customResizer,sendOriginal:!1,orient:t.orient,defaultType:t.type||null,defaultQuality:t.quality,failedToScaleText:"Unable to scale",sizes:[{name:"",maxSize:t.maxSize}]},c=new qq.Scaler(l,o);return qq.Scaler&&qq.supportedFeatures.imagePreviews&&r?qq.bind(function(){var t=c.getFileRecords(u,a,r)[0];t&&t.blob instanceof qq.BlobProxy?t.blob.create().then(i.success,i.failure):(o(e+" is not a scalable image!","error"),i.failure())},this)():(i.failure(),o("Could not generate requested scaled image for "+e+". Scaling is either not possible in this browser, or the file could not be located.","error")),i},_determineOutputType:function(e){"use strict";var t=e.requestedType,n=e.defaultType,i=e.refType;return n||t?t&&qq.indexOf(Object.keys(qq.Identify.prototype.PREVIEWABLE_MIME_TYPES),t)>=0?"image/tiff"===t?qq.supportedFeatures.tiffPreviews?t:n:t:n:"image/jpeg"!==i?"image/png":i},_getName:function(e,t){"use strict";var n=e.lastIndexOf("."),i=t.type||"image/png",o=t.refType,r="",s=qq.getExtension(e),a="";return t.name&&t.name.trim().length&&(a=" ("+t.name+")"),n>=0?(r=e.substr(0,n),o!==i&&(s=i.split("/")[1]),r+=a+"."+s):r=e+a,r},_getSortedSizes:function(e){"use strict";return e=qq.extend([],e),e.sort(function(e,t){return e.maxSize>t.maxSize?1:e.maxSize<t.maxSize?-1:0})},_generateScaledImage:function(e,t){"use strict";var n=this,i=e.customResizeFunction,o=e.log,r=e.maxSize,s=e.orient,a=e.type,u=e.quality,l=e.failedText,c=e.includeExif&&"image/jpeg"===t.type&&"image/jpeg"===a,d=new qq.Promise,p=new qq.ImageGenerator(o),q=document.createElement("canvas");return o("Attempting to generate scaled version for "+t.name),p.generate(t,q,{maxSize:r,orient:s,customResizeFunction:i}).then(function(){var e=q.toDataURL(a,u),i=function(){o("Success generating scaled version for "+t.name);var n=qq.dataUriToBlob(e);d.success(n)};c?n._insertExifHeader(t,e,o).then(function(t){e=t,i()},function(){o("Problem inserting EXIF header into scaled image. Using scaled image w/out EXIF data.","error"),i()}):i()},function(){o("Failed attempt to generate scaled version for "+t.name,"error"),d.failure(l)}),d},_insertExifHeader:function(e,t,n){"use strict";var i=new FileReader,o=new qq.Promise,r="";return i.onload=function(){r=i.result,o.success(qq.ExifRestorer.restore(r,t))},i.onerror=function(){n("Problem reading "+e.name+" during attempt to transfer EXIF data to scaled version.","error"),o.failure()},i.readAsDataURL(e),o},_dataUriToBlob:function(e){"use strict";var t,n,i,o;return t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURI(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),o=new Uint8Array(i),qq.each(t,function(e,t){o[e]=t.charCodeAt(0)}),this._createBlob(i,n)},_createBlob:function(e,t){"use strict";var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=n&&new n;return i?(i.append(e),i.getBlob(t)):new Blob([e],{type:t})}}),qq.ExifRestorer=function(){var e={};return e.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e.encode64=function(e){var t,n,i,o,r,s="",a="",u="",l=0;do t=e[l++],n=e[l++],a=e[l++],i=t>>2,o=(3&t)<<4|n>>4,r=(15&n)<<2|a>>6,u=63&a,isNaN(n)?r=u=64:isNaN(a)&&(u=64),s=s+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(u),t=n=a="",i=o=r=u="";while(l<e.length);return s},e.restore=function(e,t){var n="data:image/jpeg;base64,";if(!e.match(n))return t;var i=this.decode64(e.replace(n,"")),o=this.slice2Segments(i),r=this.exifManipulation(t,o);return n+this.encode64(r)},e.exifManipulation=function(e,t){var n=this.getExifArray(t),i=this.insertExif(e,n),o=new Uint8Array(i);return o},e.getExifArray=function(e){for(var t,n=0;n<e.length;n++)if(t=e[n],255==t[0]&225==t[1])return t;return[]},e.insertExif=function(e,t){var n=e.replace("data:image/jpeg;base64,",""),i=this.decode64(n),o=i.indexOf(255,3),r=i.slice(0,o),s=i.slice(o),a=r;return a=a.concat(t),a=a.concat(s)},e.slice2Segments=function(e){for(var t=0,n=[];;){if(255==e[t]&218==e[t+1])break;if(255==e[t]&216==e[t+1])t+=2;else{var i=256*e[t+2]+e[t+3],o=t+i+2,r=e.slice(t,o);n.push(r),t=o}if(t>e.length)break}return n},e.decode64=function(e){var t,n,i,o,r,s="",a="",u=0,l=[],c=/[^A-Za-z0-9\+\/\=]/g;if(c.exec(e))throw new Error("There were invalid base64 characters in the input text. Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='");e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do i=this.KEY_STR.indexOf(e.charAt(u++)),o=this.KEY_STR.indexOf(e.charAt(u++)),r=this.KEY_STR.indexOf(e.charAt(u++)),a=this.KEY_STR.indexOf(e.charAt(u++)),t=i<<2|o>>4,n=(15&o)<<4|r>>2,s=(3&r)<<6|a,l.push(t),64!=r&&l.push(n),64!=a&&l.push(s),t=n=s="",i=o=r=a="";while(u<e.length);return l},e}(),qq.TotalProgress=function(e,t){"use strict";var n={},i=0,o=0,r=-1,s=-1,a=function(t,n){t===r&&n===s||e(t,n),r=t,s=n},u=function(e,t){var n=!0;return qq.each(e,function(e,i){if(qq.indexOf(t,i)>=0)return n=!1,!1}),n},l=function(e){p(e,-1,-1),delete n[e]},c=function(e,t,n){(0===t.length||u(t,n))&&(a(o,o),this.reset())},d=function(e){var i=t(e);i>0&&(p(e,0,i),n[e]={loaded:0,total:i})},p=function(e,t,r){var s=n[e]?n[e].loaded:0,u=n[e]?n[e].total:0;t===-1&&r===-1?(i-=s,o-=u):(t&&(i+=t-s),r&&(o+=r-u)),a(i,o)};qq.extend(this,{onAllComplete:c,
onStatusChange:function(e,t,n){n===qq.status.CANCELED||n===qq.status.REJECTED?l(e):n===qq.status.SUBMITTING&&d(e)},onIndividualProgress:function(e,t,i){p(e,t,i),n[e]={loaded:t,total:i}},onNewSize:function(e){d(e)},reset:function(){n={},i=0,o=0}})},qq.PasteSupport=function(e){"use strict";function t(e){return e.type&&0===e.type.indexOf("image/")}function n(){r=qq(o.targetElement).attach("paste",function(e){var n=e.clipboardData;n&&qq.each(n.items,function(e,n){if(t(n)){var i=n.getAsFile();o.callbacks.pasteReceived(i)}})})}function i(){r&&r()}var o,r;o={targetElement:null,callbacks:{log:function(e,t){},pasteReceived:function(e){}}},qq.extend(o,e),n(),qq.extend(this,{reset:function(){i()}})},qq.FormSupport=function(e,t,n){"use strict";function i(e){e.getAttribute("action")&&(a.newEndpoint=e.getAttribute("action"))}function o(e,t){return!(e.checkValidity&&!e.checkValidity())||(n("Form did not pass validation checks - will not upload.","error"),void t())}function r(e){var n=e.submit;qq(e).attach("submit",function(i){i=i||window.event,i.preventDefault?i.preventDefault():i.returnValue=!1,o(e,n)&&t()}),e.submit=function(){o(e,n)&&t()}}function s(e){return e&&(qq.isString(e)&&(e=document.getElementById(e)),e&&(n("Attaching to form element."),i(e),u&&r(e))),e}var a=this,u=e.interceptSubmit,l=e.element,c=e.autoUpload;qq.extend(this,{newEndpoint:null,newAutoUpload:c,attachedToForm:!1,getFormInputsAsObject:function(){return null==l?null:a._form2Obj(l)}}),l=s(l),this.attachedToForm=!!l},qq.extend(qq.FormSupport.prototype,{_form2Obj:function(e){"use strict";var t={},n=function(e){var t=["button","image","reset","submit"];return qq.indexOf(t,e.toLowerCase())<0},i=function(e){return qq.indexOf(["checkbox","radio"],e.toLowerCase())>=0},o=function(e){return!(!i(e.type)||e.checked)||e.disabled&&"hidden"!==e.type.toLowerCase()},r=function(e){var t=null;return qq.each(qq(e).children(),function(e,n){if("option"===n.tagName.toLowerCase()&&n.selected)return t=n.value,!1}),t};return qq.each(e.elements,function(e,i){if(!qq.isInput(i,!0)&&"textarea"!==i.tagName.toLowerCase()||!n(i.type)||o(i)){if("select"===i.tagName.toLowerCase()&&!o(i)){var s=r(i);null!==s&&(t[i.name]=s)}}else t[i.name]=i.value}),t}}),qq.traditional=qq.traditional||{},qq.traditional.FormUploadHandler=function(e,t){"use strict";function n(e,t){var n,i,r;try{i=t.contentDocument||t.contentWindow.document,r=i.body.innerHTML,a("converting iframe's innerHTML to JSON"),a("innerHTML = "+r),r&&r.match(/^<pre/i)&&(r=i.body.firstChild.firstChild.nodeValue),n=o._parseJsonResponse(r)}catch(e){a("Error when attempting to parse form upload response ("+e.message+")","error"),n={success:!1}}return n}function i(t,n){var i=e.paramsStore.get(t),a="get"===e.method.toLowerCase()?"GET":"POST",u=e.endpointStore.get(t),l=r(t);return i[e.uuidName]=s(t),i[e.filenameParam]=l,o._initFormForUpload({method:a,endpoint:u,params:i,paramsInBody:e.paramsInBody,targetName:n.name})}var o=this,r=t.getName,s=t.getUuid,a=t.log;this.uploadFile=function(t){var r,s=o.getInput(t),u=o._createIframe(t),l=new qq.Promise;return r=i(t,u),r.appendChild(s),o._attachLoadEvent(u,function(i){a("iframe loaded");var r=i?i:n(t,u);o._detachLoadEvent(t),e.cors.expected||qq(u).remove(),r.success?l.success(r):l.failure(r)}),a("Sending upload request for "+t),r.submit(),qq(r).remove(),l},qq.extend(this,new qq.FormUploadHandler({options:{isCors:e.cors.expected,inputName:e.inputName},proxy:{onCancel:e.onCancel,getName:r,getUuid:s,log:a}}))},qq.traditional=qq.traditional||{},qq.traditional.XhrUploadHandler=function(e,t){"use strict";var n=this,i=t.getName,o=t.getSize,r=t.getUuid,s=t.log,a=e.forceMultipart||e.paramsInBody,u=function(t,n,r){var s=o(t),u=i(t);n[e.chunking.paramNames.partIndex]=r.part,n[e.chunking.paramNames.partByteOffset]=r.start,n[e.chunking.paramNames.chunkSize]=r.size,n[e.chunking.paramNames.totalParts]=r.count,n[e.totalFileSizeName]=s,a&&(n[e.filenameParam]=u)},l=new qq.traditional.AllChunksDoneAjaxRequester({cors:e.cors,endpoint:e.chunking.success.endpoint,log:s}),c=function(e,t){var n=new qq.Promise;return t.onreadystatechange=function(){if(4===t.readyState){var i=q(e,t);i.success?n.success(i.response,t):n.failure(i.response,t)}},n},d=function(t){var s=e.paramsStore.get(t),a=i(t),u=o(t);return s[e.uuidName]=r(t),s[e.filenameParam]=a,s[e.totalFileSizeName]=u,s[e.chunking.paramNames.totalParts]=n._getTotalChunks(t),s},p=function(e,t){return qq.indexOf([200,201,202,203,204],e.status)<0||!t.success||t.reset},q=function(e,t){var n;return s("xhr - server response received for "+e),s("responseText = "+t.responseText),n=h(!0,t),{success:!p(t,n),response:n}},h=function(e,t){var n={};try{s(qq.format("Received response status {} with body: {}",t.status,t.responseText)),n=qq.parseJson(t.responseText)}catch(t){e&&s("Error when attempting to parse xhr response text ("+t.message+")","error")}return n},f=function(t){var i=new qq.Promise;return l.complete(t,n._createXhr(t),d(t),e.customHeaders.get(t)).then(function(e){i.success(h(!1,e),e)},function(e){i.failure(h(!1,e),e)}),i},m=function(t,n,s,u){var l=new FormData,c=e.method,d=e.endpointStore.get(u),p=i(u),q=o(u);return t[e.uuidName]=r(u),t[e.filenameParam]=p,a&&(t[e.totalFileSizeName]=q),e.paramsInBody||(a||(t[e.inputName]=p),d=qq.obj2url(t,d)),n.open(c,d,!0),e.cors.expected&&e.cors.sendCredentials&&(n.withCredentials=!0),a?(e.paramsInBody&&qq.obj2FormData(t,l),l.append(e.inputName,s),l):s},g=function(t,i){var o=e.customHeaders.get(t),r=n.getFile(t);i.setRequestHeader("Accept","application/json"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.setRequestHeader("Cache-Control","no-cache"),a||(i.setRequestHeader("Content-Type","application/octet-stream"),i.setRequestHeader("X-Mime-Type",r.type)),qq.each(o,function(e,t){i.setRequestHeader(e,t)})};qq.extend(this,{uploadChunk:function(t,i,r){var s,a,l,d=n._getChunkData(t,i),p=n._createXhr(t,i);o(t);return s=c(t,p),n._registerProgressHandler(t,i,d.size),l=e.paramsStore.get(t),u(t,l,d),r&&(l[e.resume.paramNames.resuming]=!0),a=m(l,p,d.blob,t),g(t,p),p.send(a),s},uploadFile:function(t){var i,o,r,s,a=n.getFile(t);return o=n._createXhr(t),n._registerProgressHandler(t),i=c(t,o),r=e.paramsStore.get(t),s=m(r,o,a,t),g(t,o),o.send(s),i}}),qq.extend(this,new qq.XhrUploadHandler({options:qq.extend({namespace:"traditional"},e),proxy:qq.extend({getEndpoint:e.endpointStore.get},t)})),qq.override(this,function(t){return{finalizeChunks:function(n){return e.chunking.success.endpoint?f(n):t.finalizeChunks(n,qq.bind(h,this,!0))}}})},qq.traditional.AllChunksDoneAjaxRequester=function(e){"use strict";var t,n="POST",i={cors:{allowXdr:!1,expected:!1,sendCredentials:!1},endpoint:null,log:function(e,t){}},o={},r={get:function(e){return i.endpoint}};qq.extend(i,e),t=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:[n],method:n,endpointStore:r,allowXRequestedWithAndCacheControl:!1,cors:i.cors,log:i.log,onComplete:function(e,t,n){var i=o[e];delete o[e],n?i.failure(t):i.success(t)}})),qq.extend(this,{complete:function(e,n,r,s){var a=new qq.Promise;return i.log("Submitting All Chunks Done request for "+e),o[e]=a,t.initTransport(e).withParams(r).withHeaders(s).send(n),a}})},qq.DragAndDrop=function(e){"use strict";function t(e,t){var n=Array.prototype.slice.call(e);l.callbacks.dropLog("Grabbed "+e.length+" dropped files."),t.dropDisabled(!1),l.callbacks.processingDroppedFilesComplete(n,t.getElement())}function n(e){var t=new qq.Promise;return e.isFile?e.file(function(n){var i=e.name,o=e.fullPath,r=o.indexOf(i);o=o.substr(0,r),"/"===o.charAt(0)&&(o=o.substr(1)),n.qqPath=o,q.push(n),t.success()},function(n){l.callbacks.dropLog("Problem parsing '"+e.fullPath+"'. FileError code "+n.code+".","error"),t.failure()}):e.isDirectory&&i(e).then(function(e){var i=e.length;qq.each(e,function(e,o){n(o).done(function(){i-=1,0===i&&t.success()})}),e.length||t.success()},function(n){l.callbacks.dropLog("Problem parsing '"+e.fullPath+"'. FileError code "+n.code+".","error"),t.failure()}),t}function i(e,t,n,o){var r=o||new qq.Promise,s=t||e.createReader();return s.readEntries(function(t){var o=n?n.concat(t):t;t.length?setTimeout(function(){i(e,s,o,r)},0):r.success(o)},r.failure),r}function o(e,t){var i=[],o=new qq.Promise;return l.callbacks.processingDroppedFiles(),t.dropDisabled(!0),e.files.length>1&&!l.allowMultipleItems?(l.callbacks.processingDroppedFilesComplete([]),l.callbacks.dropError("tooManyFilesError",""),t.dropDisabled(!1),o.failure()):(q=[],qq.isFolderDropSupported(e)?qq.each(e.items,function(e,t){var r=t.webkitGetAsEntry();r&&(r.isFile?q.push(t.getAsFile()):i.push(n(r).done(function(){i.pop(),0===i.length&&o.success()})))}):q=e.files,0===i.length&&o.success()),o}function r(e){var n=new qq.UploadDropZone({HIDE_ZONES_EVENT_NAME:c,element:e,onEnter:function(t){qq(e).addClass(l.classes.dropActive),t.stopPropagation()},onLeaveNotDescendants:function(t){qq(e).removeClass(l.classes.dropActive)},onDrop:function(e){o(e.dataTransfer,n).then(function(){t(q,n)},function(){l.callbacks.dropLog("Drop event DataTransfer parsing failed. No files will be uploaded.","error")})}});return h.addDisposer(function(){n.dispose()}),qq(e).hasAttribute(d)&&qq(e).hide(),p.push(n),n}function s(e){var t;return qq.each(e.dataTransfer.types,function(e,n){if("Files"===n)return t=!0,!1}),t}function a(e){return qq.firefox()?!e.relatedTarget:qq.safari()?e.x<0||e.y<0:0===e.x&&0===e.y}function u(){var e=l.dropZoneElements,t=function(){setTimeout(function(){qq.each(e,function(e,t){qq(t).hasAttribute(d)&&qq(t).hide(),qq(t).removeClass(l.classes.dropActive)})},10)};qq.each(e,function(t,n){var i=r(n);e.length&&qq.supportedFeatures.fileDrop&&h.attach(document,"dragenter",function(t){!i.dropDisabled()&&s(t)&&qq.each(e,function(e,t){t instanceof HTMLElement&&qq(t).hasAttribute(d)&&qq(t).css({display:"block"})})})}),h.attach(document,"dragleave",function(e){a(e)&&t()}),h.attach(qq(document).children()[0],"mouseenter",function(e){t()}),h.attach(document,"drop",function(e){e.preventDefault(),t()}),h.attach(document,c,t)}var l,c="qq-hidezones",d="qq-hide-dropzone",p=[],q=[],h=new qq.DisposeSupport;l={dropZoneElements:[],allowMultipleItems:!0,classes:{dropActive:null},callbacks:new qq.DragAndDrop.callbacks},qq.extend(l,e,!0),u(),qq.extend(this,{setupExtraDropzone:function(e){l.dropZoneElements.push(e),r(e)},removeDropzone:function(e){var t,n=l.dropZoneElements;for(t in n)if(n[t]===e)return n.splice(t,1)},dispose:function(){h.dispose(),qq.each(p,function(e,t){t.dispose()})}})},qq.DragAndDrop.callbacks=function(){"use strict";return{processingDroppedFiles:function(){},processingDroppedFilesComplete:function(e,t){},dropError:function(e,t){qq.log("Drag & drop error code '"+e+" with these specifics: '"+t+"'","error")},dropLog:function(e,t){qq.log(e,t)}}},qq.UploadDropZone=function(e){"use strict";function t(){return qq.safari()||qq.firefox()&&qq.windows()}function n(e){c||(t?d.attach(document,"dragover",function(e){e.preventDefault()}):d.attach(document,"dragover",function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="none",e.preventDefault())}),c=!0)}function i(e){if(!qq.supportedFeatures.fileDrop)return!1;var t,n=e.dataTransfer,i=qq.safari();return t=!(!qq.ie()||!qq.supportedFeatures.fileDrop)||"none"!==n.effectAllowed,n&&t&&(n.files||!i&&n.types.contains&&n.types.contains("Files"))}function o(e){return void 0!==e&&(l=e),l}function r(){function e(){t=document.createEvent("Event"),t.initEvent(a.HIDE_ZONES_EVENT_NAME,!0,!0)}var t;if(window.CustomEvent)try{t=new CustomEvent(a.HIDE_ZONES_EVENT_NAME)}catch(t){e()}else e();document.dispatchEvent(t)}function s(){d.attach(u,"dragover",function(e){if(i(e)){var t=qq.ie()&&qq.supportedFeatures.fileDrop?null:e.dataTransfer.effectAllowed;"move"===t||"linkMove"===t?e.dataTransfer.dropEffect="move":e.dataTransfer.dropEffect="copy",e.stopPropagation(),e.preventDefault()}}),d.attach(u,"dragenter",function(e){if(!o()){if(!i(e))return;a.onEnter(e)}}),d.attach(u,"dragleave",function(e){if(i(e)){a.onLeave(e);var t=document.elementFromPoint(e.clientX,e.clientY);qq(this).contains(t)||a.onLeaveNotDescendants(e)}}),d.attach(u,"drop",function(e){if(!o()){if(!i(e))return;e.preventDefault(),e.stopPropagation(),a.onDrop(e),r()}})}var a,u,l,c,d=new qq.DisposeSupport;a={element:null,onEnter:function(e){},onLeave:function(e){},onLeaveNotDescendants:function(e){},onDrop:function(e){}},qq.extend(a,e),u=a.element,n(),s(),qq.extend(this,{dropDisabled:function(e){return o(e)},dispose:function(){d.dispose()},getElement:function(){return u}})},function(){"use strict";qq.uiPublicApi={addInitialFiles:function(e){this._parent.prototype.addInitialFiles.apply(this,arguments),this._templating.addCacheToDom()},clearStoredFiles:function(){this._parent.prototype.clearStoredFiles.apply(this,arguments),this._templating.clearFiles()},addExtraDropzone:function(e){this._dnd&&this._dnd.setupExtraDropzone(e)},removeExtraDropzone:function(e){if(this._dnd)return this._dnd.removeDropzone(e)},getItemByFileId:function(e){if(!this._templating.isHiddenForever(e))return this._templating.getFileContainer(e)},reset:function(){this._parent.prototype.reset.apply(this,arguments),this._templating.reset(),!this._options.button&&this._templating.getButton()&&(this._defaultButtonId=this._createUploadButton({element:this._templating.getButton(),title:this._options.text.fileInputTitle}).getButtonId()),this._dnd&&(this._dnd.dispose(),this._dnd=this._setupDragAndDrop()),this._totalFilesInBatch=0,this._filesInBatchAddedToUi=0,this._setupClickAndEditEventHandlers()},setName:function(e,t){var n=this._options.formatFileName(t);this._parent.prototype.setName.apply(this,arguments),this._templating.updateFilename(e,n)},pauseUpload:function(e){var t=this._parent.prototype.pauseUpload.apply(this,arguments);return t&&this._templating.uploadPaused(e),t},continueUpload:function(e){var t=this._parent.prototype.continueUpload.apply(this,arguments);return t&&this._templating.uploadContinued(e),t},getId:function(e){return this._templating.getFileId(e)},getDropTarget:function(e){var t=this.getFile(e);return t.qqDropTarget}},qq.uiPrivateApi={_getButton:function(e){var t=this._parent.prototype._getButton.apply(this,arguments);return t||e===this._defaultButtonId&&(t=this._templating.getButton()),t},_removeFileItem:function(e){this._templating.removeFile(e)},_setupClickAndEditEventHandlers:function(){this._fileButtonsClickHandler=qq.FileButtonsClickHandler&&this._bindFileButtonsClickEvent(),this._focusinEventSupported=!qq.firefox(),this._isEditFilenameEnabled()&&(this._filenameClickHandler=this._bindFilenameClickEvent(),this._filenameInputFocusInHandler=this._bindFilenameInputFocusInEvent(),this._filenameInputFocusHandler=this._bindFilenameInputFocusEvent())},_setupDragAndDrop:function(){var e=this,t=this._options.dragAndDrop.extraDropzones,n=this._templating,i=n.getDropZone();return i&&t.push(i),new qq.DragAndDrop({dropZoneElements:t,allowMultipleItems:this._options.multiple,classes:{dropActive:this._options.classes.dropActive},callbacks:{processingDroppedFiles:function(){n.showDropProcessing()},processingDroppedFilesComplete:function(t,i){n.hideDropProcessing(),qq.each(t,function(e,t){t.qqDropTarget=i}),t.length&&e.addFiles(t,null,null)},dropError:function(t,n){e._itemError(t,n)},dropLog:function(t,n){e.log(t,n)}}})},_bindFileButtonsClickEvent:function(){var e=this;return new qq.FileButtonsClickHandler({templating:this._templating,log:function(t,n){e.log(t,n)},onDeleteFile:function(t){e.deleteFile(t)},onCancel:function(t){e.cancel(t)},onRetry:function(t){e.retry(t)},onPause:function(t){e.pauseUpload(t)},onContinue:function(t){e.continueUpload(t)},onGetName:function(t){return e.getName(t)}})},_isEditFilenameEnabled:function(){return this._templating.isEditFilenamePossible()&&!this._options.autoUpload&&qq.FilenameClickHandler&&qq.FilenameInputFocusHandler&&qq.FilenameInputFocusHandler},_filenameEditHandler:function(){var e=this,t=this._templating;return{templating:t,log:function(t,n){e.log(t,n)},onGetUploadStatus:function(t){return e.getUploads({id:t}).status},onGetName:function(t){return e.getName(t)},onSetName:function(t,n){e.setName(t,n)},onEditingStatusChange:function(e,n){var i=qq(t.getEditInput(e)),o=qq(t.getFileContainer(e));n?(i.addClass("qq-editing"),t.hideFilename(e),t.hideEditIcon(e)):(i.removeClass("qq-editing"),t.showFilename(e),t.showEditIcon(e)),o.addClass("qq-temp").removeClass("qq-temp")}}},_onUploadStatusChange:function(e,t,n){this._parent.prototype._onUploadStatusChange.apply(this,arguments),this._isEditFilenameEnabled()&&this._templating.getFileContainer(e)&&n!==qq.status.SUBMITTED&&(this._templating.markFilenameEditable(e),this._templating.hideEditIcon(e)),n===qq.status.UPLOAD_RETRYING?(this._templating.hideRetry(e),this._templating.setStatusText(e),qq(this._templating.getFileContainer(e)).removeClass(this._classes.retrying)):n===qq.status.UPLOAD_FAILED&&this._templating.hidePause(e)},_bindFilenameInputFocusInEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameInputFocusInHandler(e)},_bindFilenameInputFocusEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameInputFocusHandler(e)},_bindFilenameClickEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameClickHandler(e)},_storeForLater:function(e){this._parent.prototype._storeForLater.apply(this,arguments),this._templating.hideSpinner(e)},_onAllComplete:function(e,t){this._parent.prototype._onAllComplete.apply(this,arguments),this._templating.resetTotalProgress()},_onSubmit:function(e,t){var n=this.getFile(e);n&&n.qqPath&&this._options.dragAndDrop.reportDirectoryPaths&&this._paramsStore.addReadOnly(e,{qqpath:n.qqPath}),this._parent.prototype._onSubmit.apply(this,arguments),this._addToList(e,t)},_onSubmitted:function(e){this._isEditFilenameEnabled()&&(this._templating.markFilenameEditable(e),this._templating.showEditIcon(e),this._focusinEventSupported||this._filenameInputFocusHandler.addHandler(this._templating.getEditInput(e)))},_onProgress:function(e,t,n,i){this._parent.prototype._onProgress.apply(this,arguments),this._templating.updateProgress(e,n,i),100===Math.round(n/i*100)?(this._templating.hideCancel(e),this._templating.hidePause(e),this._templating.hideProgress(e),this._templating.setStatusText(e,this._options.text.waitingForResponse),this._displayFileSize(e)):this._displayFileSize(e,n,i)},_onTotalProgress:function(e,t){this._parent.prototype._onTotalProgress.apply(this,arguments),this._templating.updateTotalProgress(e,t)},_onComplete:function(e,t,n,i){function o(t){a&&(s.setStatusText(e),qq(a).removeClass(u._classes.retrying),s.hideProgress(e),u.getUploads({id:e}).status!==qq.status.UPLOAD_FAILED&&s.hideCancel(e),s.hideSpinner(e),t.success?u._markFileAsSuccessful(e):(qq(a).addClass(u._classes.fail),s.showCancel(e),s.isRetryPossible()&&!u._preventRetries[e]&&(qq(a).addClass(u._classes.retryable),s.showRetry(e)),u._controlFailureTextDisplay(e,t)))}var r=this._parent.prototype._onComplete.apply(this,arguments),s=this._templating,a=s.getFileContainer(e),u=this;return r instanceof qq.Promise?r.done(function(e){o(e)}):o(n),r},_markFileAsSuccessful:function(e){var t=this._templating;this._isDeletePossible()&&t.showDeleteButton(e),qq(t.getFileContainer(e)).addClass(this._classes.success),this._maybeUpdateThumbnail(e)},_onUploadPrep:function(e){this._parent.prototype._onUploadPrep.apply(this,arguments),this._templating.showSpinner(e)},_onUpload:function(e,t){var n=this._parent.prototype._onUpload.apply(this,arguments);return this._templating.showSpinner(e),n},_onUploadChunk:function(e,t){this._parent.prototype._onUploadChunk.apply(this,arguments),t.partIndex>0&&this._handler.isResumable(e)&&this._templating.allowPause(e)},_onCancel:function(e,t){this._parent.prototype._onCancel.apply(this,arguments),this._removeFileItem(e),0===this._getNotFinished()&&this._templating.resetTotalProgress()},_onBeforeAutoRetry:function(e){var t,n,i;this._parent.prototype._onBeforeAutoRetry.apply(this,arguments),this._showCancelLink(e),this._options.retry.showAutoRetryNote&&(t=this._autoRetries[e],n=this._options.retry.maxAutoAttempts,i=this._options.retry.autoRetryNote.replace(/\{retryNum\}/g,t),i=i.replace(/\{maxAuto\}/g,n),this._templating.setStatusText(e,i),qq(this._templating.getFileContainer(e)).addClass(this._classes.retrying))},_onBeforeManualRetry:function(e){return this._parent.prototype._onBeforeManualRetry.apply(this,arguments)?(this._templating.resetProgress(e),qq(this._templating.getFileContainer(e)).removeClass(this._classes.fail),this._templating.setStatusText(e),this._templating.showSpinner(e),this._showCancelLink(e),!0):(qq(this._templating.getFileContainer(e)).addClass(this._classes.retryable),this._templating.showRetry(e),!1)},_onSubmitDelete:function(e){var t=qq.bind(this._onSubmitDeleteSuccess,this);this._parent.prototype._onSubmitDelete.call(this,e,t)},_onSubmitDeleteSuccess:function(e,t,n){this._options.deleteFile.forceConfirm?this._showDeleteConfirm.apply(this,arguments):this._sendDeleteRequest.apply(this,arguments)},_onDeleteComplete:function(e,t,n){this._parent.prototype._onDeleteComplete.apply(this,arguments),this._templating.hideSpinner(e),n?(this._templating.setStatusText(e,this._options.deleteFile.deletingFailedText),this._templating.showDeleteButton(e)):this._removeFileItem(e)},_sendDeleteRequest:function(e,t,n){this._templating.hideDeleteButton(e),this._templating.showSpinner(e),this._templating.setStatusText(e,this._options.deleteFile.deletingStatusText),this._deleteHandler.sendDelete.apply(this,arguments)},_showDeleteConfirm:function(e,t,n){var i,o=this.getName(e),r=this._options.deleteFile.confirmMessage.replace(/\{filename\}/g,o),s=(this.getUuid(e),arguments),a=this;i=this._options.showConfirm(r),qq.isGenericPromise(i)?i.then(function(){a._sendDeleteRequest.apply(a,s)}):i!==!1&&a._sendDeleteRequest.apply(a,s)},_addToList:function(e,t,n){var i,o,r=0,s=this._handler.isProxied(e)&&this._options.scaling.hideScaled;this._options.display.prependFiles&&(this._totalFilesInBatch>1&&this._filesInBatchAddedToUi>0&&(r=this._filesInBatchAddedToUi-1),i={index:r}),n||(this._options.disableCancelForFormUploads&&!qq.supportedFeatures.ajaxUploading&&this._templating.disableCancel(),this._options.multiple||(o=this.getUploads({id:e}),this._handledProxyGroup=this._handledProxyGroup||o.proxyGroupId,o.proxyGroupId===this._handledProxyGroup&&o.proxyGroupId||(this._handler.cancelAll(),this._clearList(),this._handledProxyGroup=null))),n?(this._templating.addFileToCache(e,this._options.formatFileName(t),i,s),this._templating.updateThumbnail(e,this._thumbnailUrls[e],!0,this._options.thumbnails.customResizer)):(this._templating.addFile(e,this._options.formatFileName(t),i,s),this._templating.generatePreview(e,this.getFile(e),this._options.thumbnails.customResizer)),this._filesInBatchAddedToUi+=1,(n||this._options.display.fileSizeOnSubmit&&qq.supportedFeatures.ajaxUploading)&&this._displayFileSize(e)},_clearList:function(){this._templating.clearFiles(),this.clearStoredFiles()},_displayFileSize:function(e,t,n){var i=this.getSize(e),o=this._formatSize(i);i>=0&&(void 0!==t&&void 0!==n&&(o=this._formatProgress(t,n)),this._templating.updateSize(e,o))},_formatProgress:function(e,t){function n(e,t){i=i.replace(e,t)}var i=this._options.text.formatProgress;return n("{percent}",Math.round(e/t*100)),n("{total_size}",this._formatSize(t)),i},_controlFailureTextDisplay:function(e,t){var n,i,o;n=this._options.failedUploadTextDisplay.mode,i=this._options.failedUploadTextDisplay.responseProperty,"custom"===n?(o=t[i],o||(o=this._options.text.failUpload),this._templating.setStatusText(e,o),this._options.failedUploadTextDisplay.enableTooltip&&this._showTooltip(e,o)):"default"===n?this._templating.setStatusText(e,this._options.text.failUpload):"none"!==n&&this.log("failedUploadTextDisplay.mode value of '"+n+"' is not valid","warn")},_showTooltip:function(e,t){this._templating.getFileContainer(e).title=t},_showCancelLink:function(e){this._options.disableCancelForFormUploads&&!qq.supportedFeatures.ajaxUploading||this._templating.showCancel(e)},_itemError:function(e,t,n){var i=this._parent.prototype._itemError.apply(this,arguments);this._options.showMessage(i)},_batchError:function(e){this._parent.prototype._batchError.apply(this,arguments),this._options.showMessage(e)},_setupPastePrompt:function(){var e=this;this._options.callbacks.onPasteReceived=function(){var t=e._options.paste.namePromptMessage,n=e._options.paste.defaultName;return e._options.showPrompt(t,n)}},_fileOrBlobRejected:function(e,t){this._totalFilesInBatch-=1,this._parent.prototype._fileOrBlobRejected.apply(this,arguments)},_prepareItemsForUpload:function(e,t,n){this._totalFilesInBatch=e.length,this._filesInBatchAddedToUi=0,this._parent.prototype._prepareItemsForUpload.apply(this,arguments)},_maybeUpdateThumbnail:function(e){var t=this._thumbnailUrls[e],n=this.getUploads({id:e}).status;n===qq.status.DELETED||!t&&!this._options.thumbnails.placeholders.waitUntilResponse&&qq.supportedFeatures.imagePreviews||this._templating.updateThumbnail(e,t,this._options.thumbnails.customResizer)},_addCannedFile:function(e){var t=this._parent.prototype._addCannedFile.apply(this,arguments);return this._addToList(t,this.getName(t),!0),this._templating.hideSpinner(t),this._templating.hideCancel(t),this._markFileAsSuccessful(t),t},_setSize:function(e,t){this._parent.prototype._setSize.apply(this,arguments),this._templating.updateSize(e,this._formatSize(t))},_sessionRequestComplete:function(){this._templating.addCacheToDom(),this._parent.prototype._sessionRequestComplete.apply(this,arguments)}}}(),qq.FineUploader=function(e,t){"use strict";var n=this;this._parent=t?qq[t].FineUploaderBasic:qq.FineUploaderBasic,this._parent.apply(this,arguments),qq.extend(this._options,{element:null,button:null,listElement:null,dragAndDrop:{extraDropzones:[],reportDirectoryPaths:!1},text:{formatProgress:"{percent}% of {total_size}",failUpload:"Upload failed",waitingForResponse:"Processing...",paused:"Paused"},template:"qq-template",classes:{retrying:"qq-upload-retrying",retryable:"qq-upload-retryable",success:"qq-upload-success",fail:"qq-upload-fail",editable:"qq-editable",hide:"qq-hide",dropActive:"qq-upload-drop-area-active"},failedUploadTextDisplay:{mode:"default",responseProperty:"error",enableTooltip:!0},messages:{tooManyFilesError:"You may only drop one file",unsupportedBrowser:"Unrecoverable error - this browser does not permit file uploading of any kind."},retry:{showAutoRetryNote:!0,autoRetryNote:"Retrying {retryNum}/{maxAuto}..."},deleteFile:{forceConfirm:!1,confirmMessage:"Are you sure you want to delete {filename}?",deletingStatusText:"Deleting...",deletingFailedText:"Delete failed"},display:{fileSizeOnSubmit:!1,prependFiles:!1},paste:{promptForName:!1,namePromptMessage:"Please name this image"},thumbnails:{customResizer:null,maxCount:0,placeholders:{waitUntilResponse:!1,notAvailablePath:null,waitingPath:null},timeBetweenThumbs:750},scaling:{hideScaled:!1},showMessage:function(e){return n._templating.hasDialog("alert")?n._templating.showDialog("alert",e):void setTimeout(function(){window.alert(e)},0)},showConfirm:function(e){return n._templating.hasDialog("confirm")?n._templating.showDialog("confirm",e):window.confirm(e)},showPrompt:function(e,t){return n._templating.hasDialog("prompt")?n._templating.showDialog("prompt",e,t):window.prompt(e,t)}},!0),qq.extend(this._options,e,!0),this._templating=new qq.Templating({log:qq.bind(this.log,this),templateIdOrEl:this._options.template,containerEl:this._options.element,fileContainerEl:this._options.listElement,button:this._options.button,imageGenerator:this._imageGenerator,classes:{hide:this._options.classes.hide,editable:this._options.classes.editable},limits:{maxThumbs:this._options.thumbnails.maxCount,timeBetweenThumbs:this._options.thumbnails.timeBetweenThumbs},placeholders:{waitUntilUpdate:this._options.thumbnails.placeholders.waitUntilResponse,thumbnailNotAvailable:this._options.thumbnails.placeholders.notAvailablePath,waitingForThumbnail:this._options.thumbnails.placeholders.waitingPath},text:this._options.text}),this._options.workarounds.ios8SafariUploads&&qq.ios800()&&qq.iosSafari()?this._templating.renderFailure(this._options.messages.unsupportedBrowserIos8Safari):!qq.supportedFeatures.uploading||this._options.cors.expected&&!qq.supportedFeatures.uploadCors?this._templating.renderFailure(this._options.messages.unsupportedBrowser):(this._wrapCallbacks(),this._templating.render(),this._classes=this._options.classes,!this._options.button&&this._templating.getButton()&&(this._defaultButtonId=this._createUploadButton({element:this._templating.getButton(),title:this._options.text.fileInputTitle}).getButtonId()),this._setupClickAndEditEventHandlers(),qq.DragAndDrop&&qq.supportedFeatures.fileDrop&&(this._dnd=this._setupDragAndDrop()),this._options.paste.targetElement&&this._options.paste.promptForName&&(qq.PasteSupport?this._setupPastePrompt():this.log("Paste support module not found.","error")),this._totalFilesInBatch=0,this._filesInBatchAddedToUi=0)},qq.extend(qq.FineUploader.prototype,qq.basePublicApi),qq.extend(qq.FineUploader.prototype,qq.basePrivateApi),qq.extend(qq.FineUploader.prototype,qq.uiPublicApi),qq.extend(qq.FineUploader.prototype,qq.uiPrivateApi),qq.Templating=function(e){"use strict";var t,n,i,o,r,s,a,u,l="qq-file-id",c="qq-file-id-",d="qq-max-size",p="qq-server-scale",q="qq-hide-dropzone",h="qq-drop-area-text",f="qq-in-progress",m="qq-hidden-forever",g={content:document.createDocumentFragment(),map:{}},_=!1,v=0,b=!1,S=[],y=-1,w={log:null,limits:{maxThumbs:0,timeBetweenThumbs:750},templateIdOrEl:"qq-template",containerEl:null,fileContainerEl:null,button:null,imageGenerator:null,classes:{hide:"qq-hide",editable:"qq-editable"},placeholders:{waitUntilUpdate:!1,thumbnailNotAvailable:null,waitingForThumbnail:null},text:{paused:"Paused"}},C={button:"qq-upload-button-selector",alertDialog:"qq-alert-dialog-selector",dialogCancelButton:"qq-cancel-button-selector",confirmDialog:"qq-confirm-dialog-selector",dialogMessage:"qq-dialog-message-selector",dialogOkButton:"qq-ok-button-selector",promptDialog:"qq-prompt-dialog-selector",uploader:"qq-uploader-selector",drop:"qq-upload-drop-area-selector",list:"qq-upload-list-selector",progressBarContainer:"qq-progress-bar-container-selector",progressBar:"qq-progress-bar-selector",totalProgressBarContainer:"qq-total-progress-bar-container-selector",totalProgressBar:"qq-total-progress-bar-selector",file:"qq-upload-file-selector",spinner:"qq-upload-spinner-selector",size:"qq-upload-size-selector",cancel:"qq-upload-cancel-selector",pause:"qq-upload-pause-selector",continueButton:"qq-upload-continue-selector",deleteButton:"qq-upload-delete-selector",retry:"qq-upload-retry-selector",statusText:"qq-upload-status-text-selector",editFilenameInput:"qq-edit-filename-selector",editNameIcon:"qq-edit-filename-icon-selector",dropText:"qq-upload-drop-area-text-selector",dropProcessing:"qq-drop-processing-selector",dropProcessingSpinner:"qq-drop-processing-spinner-selector",thumbnail:"qq-thumbnail-selector"},x={},E=new qq.Promise,P=new qq.Promise,F=function(){var e=w.placeholders.thumbnailNotAvailable,n=w.placeholders.waitingForThumbnail,i={maxSize:y,scale:u};a&&(e?w.imageGenerator.generate(e,new Image,i).then(function(e){E.success(e)},function(){E.failure(),t("Problem loading 'not available' placeholder image at "+e,"error")}):E.failure(),n?w.imageGenerator.generate(n,new Image,i).then(function(e){P.success(e)},function(){P.failure(),t("Problem loading 'waiting for thumbnail' placeholder image at "+n,"error")}):P.failure())},A=function(e){var t=new qq.Promise;return P.then(function(n){K(n,e),e.src?t.success():(e.src=n.src,e.onload=function(){e.onload=null,te(e),t.success()})},function(){W(e),t.success()}),t},T=function(e,n,i){var o=X(e);return t("Generating new thumbnail for "+e),n.qqThumbnailId=e,w.imageGenerator.generate(n,o,i).then(function(){v++,te(o),
x[e].success()},function(){x[e].failure(),w.placeholders.waitUntilUpdate||J(e,o)})},I=function(){if(S.length){b=!0;var e=S.shift();e.update?$(e):Z(e)}else b=!1},R=function(e){return G(H(e),C.cancel)},U=function(e){return G(H(e),C.continueButton)},D=function(e){return G(r,C[e+"Dialog"])},k=function(e){return G(H(e),C.deleteButton)},B=function(){return G(r,C.dropProcessing)},N=function(e){return G(H(e),C.editNameIcon)},H=function(e){return g.map[e]||qq(s).getFirstByClass(c+e)},O=function(e){return G(H(e),C.file)},M=function(e){return G(H(e),C.pause)},L=function(e){return null==e?G(r,C.totalProgressBarContainer)||G(r,C.totalProgressBar):G(H(e),C.progressBarContainer)||G(H(e),C.progressBar)},z=function(e){return G(H(e),C.retry)},j=function(e){return G(H(e),C.size)},V=function(e){return G(H(e),C.spinner)},G=function(e,t){return e&&qq(e).getFirstByClass(t)},X=function(e){return a&&G(H(e),C.thumbnail)},W=function(e){e&&qq(e).addClass(w.classes.hide)},K=function(e,t){var n=e.style.maxWidth,i=e.style.maxHeight;i&&n&&!t.style.maxWidth&&!t.style.maxHeight&&qq(t).css({maxWidth:n,maxHeight:i})},J=function(e,t){var n=x[e]||(new qq.Promise).failure(),i=new qq.Promise;return E.then(function(e){n.then(function(){i.success()},function(){K(e,t),t.onload=function(){t.onload=null,i.success()},t.src=e.src,te(t)})}),i},Y=function(){var e,o,r,s,l,c,f,m,g,_,v;if(t("Parsing template"),null==w.templateIdOrEl)throw new Error("You MUST specify either a template element or ID!");if(qq.isString(w.templateIdOrEl)){if(e=document.getElementById(w.templateIdOrEl),null===e)throw new Error(qq.format("Cannot find template script at ID '{}'!",w.templateIdOrEl));o=e.innerHTML}else{if(void 0===w.templateIdOrEl.innerHTML)throw new Error("You have specified an invalid value for the template option! It must be an ID or an Element.");o=w.templateIdOrEl.innerHTML}if(o=qq.trimStr(o),s=document.createElement("div"),s.appendChild(qq.toElement(o)),v=qq(s).getFirstByClass(C.uploader),w.button&&(c=qq(s).getFirstByClass(C.button),c&&qq(c).remove()),qq.DragAndDrop&&qq.supportedFeatures.fileDrop||(g=qq(s).getFirstByClass(C.dropProcessing),g&&qq(g).remove()),f=qq(s).getFirstByClass(C.drop),f&&!qq.DragAndDrop&&(t("DnD module unavailable.","info"),qq(f).remove()),qq.supportedFeatures.fileDrop?qq(v).hasAttribute(h)&&f&&(_=qq(f).getFirstByClass(C.dropText),_&&qq(_).remove()):(v.removeAttribute(h),f&&qq(f).hasAttribute(q)&&qq(f).css({display:"none"})),m=qq(s).getFirstByClass(C.thumbnail),a?m&&(y=parseInt(m.getAttribute(d)),y=y>0?y:null,u=qq(m).hasAttribute(p)):m&&qq(m).remove(),a=a&&m,n=qq(s).getByClass(C.editFilenameInput).length>0,i=qq(s).getByClass(C.retry).length>0,r=qq(s).getFirstByClass(C.list),null==r)throw new Error("Could not find the file list container in the template!");return l=r.innerHTML,r.innerHTML="",s.getElementsByTagName("DIALOG").length&&document.createElement("dialog"),t("Template parsing complete"),{template:qq.trimStr(s.innerHTML),fileTemplate:qq.trimStr(l)}},Q=function(e,t,n){var i=n,o=i.firstChild;t>0&&(o=qq(i).children()[t].nextSibling),i.insertBefore(e,o)},Z=function(e){var t=e.id,n=e.optFileOrBlob,i=n&&n.qqThumbnailId,o=X(t),r={customResizeFunction:e.customResizeFunction,maxSize:y,orient:!0,scale:!0};qq.supportedFeatures.imagePreviews?o?w.limits.maxThumbs&&w.limits.maxThumbs<=v?(J(t,o),I()):A(o).done(function(){x[t]=new qq.Promise,x[t].done(function(){setTimeout(I,w.limits.timeBetweenThumbs)}),null!=i?ne(t,i):T(t,n,r)}):I():o&&(A(o),I())},$=function(e){var t=e.id,n=e.thumbnailUrl,i=e.showWaitingImg,o=X(t),r={customResizeFunction:e.customResizeFunction,scale:u,maxSize:y};if(o)if(n){if(!(w.limits.maxThumbs&&w.limits.maxThumbs<=v))return i&&A(o),w.imageGenerator.generate(n,o,r).then(function(){te(o),v++,setTimeout(I,w.limits.timeBetweenThumbs)},function(){J(t,o),setTimeout(I,w.limits.timeBetweenThumbs)});J(t,o),I()}else J(t,o),I()},ee=function(e,t){var n=L(e),i=null==e?C.totalProgressBar:C.progressBar;n&&!qq(n).hasClass(i)&&(n=qq(n).getFirstByClass(i)),n&&(qq(n).css({width:t+"%"}),n.setAttribute("aria-valuenow",t))},te=function(e){e&&qq(e).removeClass(w.classes.hide)},ne=function(e,n){var i=X(e),o=X(n);t(qq.format("ID {} is the same file as ID {}. Will use generated thumbnail from ID {} instead.",e,n,n)),x[n].then(function(){v++,x[e].success(),t(qq.format("Now using previously generated thumbnail created for ID {} on ID {}.",n,e)),i.src=o.src,te(i)},function(){x[e].failure(),w.placeholders.waitUntilUpdate||J(e,i)})};qq.extend(w,e),t=w.log,qq.supportedFeatures.imagePreviews||(w.limits.timeBetweenThumbs=0,w.limits.maxThumbs=0),r=w.containerEl,a=void 0!==w.imageGenerator,o=Y(),F(),qq.extend(this,{render:function(){t("Rendering template in DOM."),v=0,r.innerHTML=o.template,W(B()),this.hideTotalProgress(),s=w.fileContainerEl||G(r,C.list),t("Template rendering complete")},renderFailure:function(e){var t=qq.toElement(e);r.innerHTML="",r.appendChild(t)},reset:function(){this.render()},clearFiles:function(){s.innerHTML=""},disableCancel:function(){_=!0},addFile:function(e,t,n,i,a){var u,d=qq.toElement(o.fileTemplate),p=G(d,C.file),q=G(r,C.uploader),f=a?g.content:s;a&&(g.map[e]=d),qq(d).addClass(c+e),q.removeAttribute(h),p&&(qq(p).setText(t),p.setAttribute("title",t)),d.setAttribute(l,e),n?Q(d,n.index,f):f.appendChild(d),i?(d.style.display="none",qq(d).addClass(m)):(W(L(e)),W(j(e)),W(k(e)),W(z(e)),W(M(e)),W(U(e)),_&&this.hideCancel(e),u=X(e),u&&!u.src&&P.then(function(e){u.src=e.src,e.style.maxHeight&&e.style.maxWidth&&qq(u).css({maxHeight:e.style.maxHeight,maxWidth:e.style.maxWidth}),te(u)}))},addFileToCache:function(e,t,n,i){this.addFile(e,t,n,i,!0)},addCacheToDom:function(){s.appendChild(g.content),g.content=document.createDocumentFragment(),g.map={}},removeFile:function(e){qq(H(e)).remove()},getFileId:function(e){var t=e;if(t){for(;null==t.getAttribute(l);)t=t.parentNode;return parseInt(t.getAttribute(l))}},getFileList:function(){return s},markFilenameEditable:function(e){var t=O(e);t&&qq(t).addClass(w.classes.editable)},updateFilename:function(e,t){var n=O(e);n&&(qq(n).setText(t),n.setAttribute("title",t))},hideFilename:function(e){W(O(e))},showFilename:function(e){te(O(e))},isFileName:function(e){return qq(e).hasClass(C.file)},getButton:function(){return w.button||G(r,C.button)},hideDropProcessing:function(){W(B())},showDropProcessing:function(){te(B())},getDropZone:function(){return G(r,C.drop)},isEditFilenamePossible:function(){return n},hideRetry:function(e){W(z(e))},isRetryPossible:function(){return i},showRetry:function(e){te(z(e))},getFileContainer:function(e){return H(e)},showEditIcon:function(e){var t=N(e);t&&qq(t).addClass(w.classes.editable)},isHiddenForever:function(e){return qq(H(e)).hasClass(m)},hideEditIcon:function(e){var t=N(e);t&&qq(t).removeClass(w.classes.editable)},isEditIcon:function(e){return qq(e).hasClass(C.editNameIcon,!0)},getEditInput:function(e){return G(H(e),C.editFilenameInput)},isEditInput:function(e){return qq(e).hasClass(C.editFilenameInput,!0)},updateProgress:function(e,t,n){var i,o=L(e);o&&n>0&&(i=Math.round(t/n*100),100===i?W(o):te(o),ee(e,i))},updateTotalProgress:function(e,t){this.updateProgress(null,e,t)},hideProgress:function(e){var t=L(e);t&&W(t)},hideTotalProgress:function(){this.hideProgress()},resetProgress:function(e){ee(e,0),this.hideTotalProgress(e)},resetTotalProgress:function(){this.resetProgress()},showCancel:function(e){if(!_){var t=R(e);t&&qq(t).removeClass(w.classes.hide)}},hideCancel:function(e){W(R(e))},isCancel:function(e){return qq(e).hasClass(C.cancel,!0)},allowPause:function(e){te(M(e)),W(U(e))},uploadPaused:function(e){this.setStatusText(e,w.text.paused),this.allowContinueButton(e),W(V(e))},hidePause:function(e){W(M(e))},isPause:function(e){return qq(e).hasClass(C.pause,!0)},isContinueButton:function(e){return qq(e).hasClass(C.continueButton,!0)},allowContinueButton:function(e){te(U(e)),W(M(e))},uploadContinued:function(e){this.setStatusText(e,""),this.allowPause(e),te(V(e))},showDeleteButton:function(e){te(k(e))},hideDeleteButton:function(e){W(k(e))},isDeleteButton:function(e){return qq(e).hasClass(C.deleteButton,!0)},isRetry:function(e){return qq(e).hasClass(C.retry,!0)},updateSize:function(e,t){var n=j(e);n&&(te(n),qq(n).setText(t))},setStatusText:function(e,t){var n=G(H(e),C.statusText);n&&(null==t?qq(n).clearText():qq(n).setText(t))},hideSpinner:function(e){qq(H(e)).removeClass(f),W(V(e))},showSpinner:function(e){qq(H(e)).addClass(f),te(V(e))},generatePreview:function(e,t,n){this.isHiddenForever(e)||(S.push({id:e,customResizeFunction:n,optFileOrBlob:t}),!b&&I())},updateThumbnail:function(e,t,n,i){this.isHiddenForever(e)||(S.push({customResizeFunction:i,update:!0,id:e,thumbnailUrl:t,showWaitingImg:n}),!b&&I())},hasDialog:function(e){return qq.supportedFeatures.dialogElement&&!!D(e)},showDialog:function(e,t,n){var i=D(e),o=G(i,C.dialogMessage),r=i.getElementsByTagName("INPUT")[0],s=G(i,C.dialogCancelButton),a=G(i,C.dialogOkButton),u=new qq.Promise,l=function(){s.removeEventListener("click",c),a&&a.removeEventListener("click",d),u.failure()},c=function(){s.removeEventListener("click",c),i.close()},d=function(){i.removeEventListener("close",l),a.removeEventListener("click",d),i.close(),u.success(r&&r.value)};return i.addEventListener("close",l),s.addEventListener("click",c),a&&a.addEventListener("click",d),r&&(r.value=n),o.textContent=t,i.showModal(),u}})},qq.UiEventHandler=function(e,t){"use strict";function n(e){i.attach(e,o.eventType,function(e){e=e||window.event;var t=e.target||e.srcElement;o.onHandled(t,e)})}var i=new qq.DisposeSupport,o={eventType:"click",attachTo:null,onHandled:function(e,t){}};qq.extend(this,{addHandler:function(e){n(e)},dispose:function(){i.dispose()}}),qq.extend(t,{getFileIdFromItem:function(e){return e.qqFileId},getDisposeSupport:function(){return i}}),qq.extend(o,e),o.attachTo&&n(o.attachTo)},qq.FileButtonsClickHandler=function(e){"use strict";function t(e,t){qq.each(o,function(n,o){var r,s=n.charAt(0).toUpperCase()+n.slice(1);if(i.templating["is"+s](e))return r=i.templating.getFileId(e),qq.preventDefault(t),i.log(qq.format("Detected valid file button click event on file '{}', ID: {}.",i.onGetName(r),r)),o(r),!1})}var n={},i={templating:null,log:function(e,t){},onDeleteFile:function(e){},onCancel:function(e){},onRetry:function(e){},onPause:function(e){},onContinue:function(e){},onGetName:function(e){}},o={cancel:function(e){i.onCancel(e)},retry:function(e){i.onRetry(e)},deleteButton:function(e){i.onDeleteFile(e)},pause:function(e){i.onPause(e)},continueButton:function(e){i.onContinue(e)}};qq.extend(i,e),i.eventType="click",i.onHandled=t,i.attachTo=i.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(i,n))},qq.FilenameClickHandler=function(e){"use strict";function t(e,t){if(i.templating.isFileName(e)||i.templating.isEditIcon(e)){var o=i.templating.getFileId(e),r=i.onGetUploadStatus(o);r===qq.status.SUBMITTED&&(i.log(qq.format("Detected valid filename click event on file '{}', ID: {}.",i.onGetName(o),o)),qq.preventDefault(t),n.handleFilenameEdit(o,e,!0))}}var n={},i={templating:null,log:function(e,t){},classes:{file:"qq-upload-file",editNameIcon:"qq-edit-filename-icon"},onGetUploadStatus:function(e){},onGetName:function(e){}};qq.extend(i,e),i.eventType="click",i.onHandled=t,qq.extend(this,new qq.FilenameEditHandler(i,n))},qq.FilenameInputFocusInHandler=function(e,t){"use strict";function n(e,n){if(i.templating.isEditInput(e)){var o=i.templating.getFileId(e),r=i.onGetUploadStatus(o);r===qq.status.SUBMITTED&&(i.log(qq.format("Detected valid filename input focus event on file '{}', ID: {}.",i.onGetName(o),o)),t.handleFilenameEdit(o,e))}}var i={templating:null,onGetUploadStatus:function(e){},log:function(e,t){}};t||(t={}),i.eventType="focusin",i.onHandled=n,qq.extend(i,e),qq.extend(this,new qq.FilenameEditHandler(i,t))},qq.FilenameInputFocusHandler=function(e){"use strict";e.eventType="focus",e.attachTo=null,qq.extend(this,new qq.FilenameInputFocusInHandler(e,{}))},qq.FilenameEditHandler=function(e,t){"use strict";function n(e){var t=a.onGetName(e),n=t.lastIndexOf(".");return n>0&&(t=t.substr(0,n)),t}function i(e){var t=a.onGetName(e);return qq.getExtension(t)}function o(e,t){var n,o=e.value;void 0!==o&&qq.trimStr(o).length>0&&(n=i(t),void 0!==n&&(o=o+"."+n),a.onSetName(t,o)),a.onEditingStatusChange(t,!1)}function r(e,n){t.getDisposeSupport().attach(e,"blur",function(){o(e,n)})}function s(e,n){t.getDisposeSupport().attach(e,"keyup",function(t){var i=t.keyCode||t.which;13===i&&o(e,n)})}var a={templating:null,log:function(e,t){},onGetUploadStatus:function(e){},onGetName:function(e){},onSetName:function(e,t){},onEditingStatusChange:function(e,t){}};qq.extend(a,e),a.attachTo=a.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(a,t)),qq.extend(t,{handleFilenameEdit:function(e,t,i){var o=a.templating.getEditInput(e);a.onEditingStatusChange(e,!0),o.value=n(e),i&&o.focus(),r(o,e),s(o,e)}})},qq.CryptoJS=function(e,t){var n={},i=n.lib={},o=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),r=i.WordArray=o.extend({init:function(e,n){e=this.words=e||[],n!=t?this.sigBytes=n:this.sigBytes=4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var r=0;r<o;r++){var s=n[r>>>2]>>>24-r%4*8&255;t[i+r>>>2]|=s<<24-(i+r)%4*8}else if(n.length>65535)for(var r=0;r<o;r+=4)t[i+r>>>2]=n[r>>>2];else t.push.apply(t,n);return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i<t;i+=4)n.push(4294967296*e.random()|0);return new r.init(n,t)}}),s=n.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var r=t[o>>>2]>>>24-o%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new r.init(n,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var r=t[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new r.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},c=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=4*s,u=o/a;u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0);var l=u*s,c=e.min(4*l,o);if(l){for(var d=0;d<l;d+=s)this._doProcessBlock(i,d);var p=i.splice(0,l);n.sigBytes-=c}return new r.init(p,c)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),d=(i.Hasher=c.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}}),n.algo={});return n}(Math),function(){var e=qq.CryptoJS,t=e.lib,n=t.WordArray,i=e.enc;i.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp();for(var o=[],r=0;r<n;r+=3)for(var s=t[r>>>2]>>>24-r%4*8&255,a=t[r+1>>>2]>>>24-(r+1)%4*8&255,u=t[r+2>>>2]>>>24-(r+2)%4*8&255,l=s<<16|a<<8|u,c=0;c<4&&r+.75*c<n;c++)o.push(i.charAt(l>>>6*(3-c)&63));var d=i.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e){var t=e.length,i=this._map,o=i.charAt(64);if(o){var r=e.indexOf(o);r!=-1&&(t=r)}for(var s=[],a=0,u=0;u<t;u++)if(u%4){var l=i.indexOf(e.charAt(u-1))<<u%4*2,c=i.indexOf(e.charAt(u))>>>6-u%4*2;s[a>>>2]|=(l|c)<<24-a%4*8,a++}return n.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(){var e=qq.CryptoJS,t=e.lib,n=t.Base,i=e.enc,o=i.Utf8,r=e.algo;r.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),s=this._iKey=t.clone(),a=r.words,u=s.words,l=0;l<n;l++)a[l]^=1549556828,u[l]^=909522486;r.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);t.reset();var i=t.finalize(this._oKey.clone().concat(n));return i}})}(),function(){var e=qq.CryptoJS,t=e.lib,n=t.WordArray,i=t.Hasher,o=e.algo,r=[],s=o.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],u=n[4],l=0;l<80;l++){if(l<16)r[l]=0|e[t+l];else{var c=r[l-3]^r[l-8]^r[l-14]^r[l-16];r[l]=c<<1|c>>>31}var d=(i<<5|i>>>27)+u+r[l];d+=l<20?(o&s|~o&a)+1518500249:l<40?(o^s^a)+1859775393:l<60?(o&s|o&a|s&a)-1894007588:(o^s^a)-899497514,u=a,a=s,s=o<<30|o>>>2,o=i,i=d}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[(i+64>>>9<<4)+14]=Math.floor(n/4294967296),t[(i+64>>>9<<4)+15]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),function(e){var t=qq.CryptoJS,n=t.lib,i=n.WordArray,o=n.Hasher,r=t.algo,s=[],a=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var i=2,o=0;o<64;)t(i)&&(o<8&&(s[o]=n(e.pow(i,.5))),a[o]=n(e.pow(i,1/3)),o++),i++}();var u=[],l=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],r=n[2],s=n[3],l=n[4],c=n[5],d=n[6],p=n[7],q=0;q<64;q++){if(q<16)u[q]=0|e[t+q];else{var h=u[q-15],f=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,m=u[q-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[q]=f+u[q-7]+g+u[q-16]}var _=l&c^~l&d,v=i&o^i&r^o&r,b=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),S=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),y=p+S+_+a[q]+u[q],w=b+v;p=d,d=c,c=l,l=s+y|0,s=r,r=o,o=i,i=y+w|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+r|0,n[3]=n[3]+s|0,n[4]=n[4]+l|0,n[5]=n[5]+c|0,n[6]=n[6]+d|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[(o+64>>>9<<4)+14]=e.floor(i/4294967296),n[(o+64>>>9<<4)+15]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),function(){if("function"==typeof ArrayBuffer){var e=qq.CryptoJS,t=e.lib,n=t.WordArray,i=n.init,o=n.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;i.call(this,n,t)}else i.apply(this,arguments)};o.prototype=n}}(),qq.s3=qq.s3||{},qq.s3.util=qq.s3.util||function(){"use strict";return{ALGORITHM_PARAM_NAME:"x-amz-algorithm",AWS_PARAM_PREFIX:"x-amz-meta-",CREDENTIAL_PARAM_NAME:"x-amz-credential",DATE_PARAM_NAME:"x-amz-date",REDUCED_REDUNDANCY_PARAM_NAME:"x-amz-storage-class",REDUCED_REDUNDANCY_PARAM_VALUE:"REDUCED_REDUNDANCY",SERVER_SIDE_ENCRYPTION_PARAM_NAME:"x-amz-server-side-encryption",SERVER_SIDE_ENCRYPTION_PARAM_VALUE:"AES256",SESSION_TOKEN_PARAM_NAME:"x-amz-security-token",V4_ALGORITHM_PARAM_VALUE:"AWS4-HMAC-SHA256",V4_SIGNATURE_PARAM_NAME:"x-amz-signature",CASE_SENSITIVE_PARAM_NAMES:["Cache-Control","Content-Disposition","Content-Encoding","Content-MD5"],UNSIGNABLE_REST_HEADER_NAMES:["Cache-Control","Content-Disposition","Content-Encoding","Content-MD5"],UNPREFIXED_PARAM_NAMES:["Cache-Control","Content-Disposition","Content-Encoding","Content-MD5","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],getBucket:function(e){var t,n=[/^(?:https?:\/\/)?([a-z0-9.\-_]+)\.s3(?:-[a-z0-9\-]+)?\.amazonaws\.com/i,/^(?:https?:\/\/)?s3(?:-[a-z0-9\-]+)?\.amazonaws\.com\/([a-z0-9.\-_]+)/i,/^(?:https?:\/\/)?([a-z0-9.\-_]+)/i];return qq.each(n,function(n,i){var o=i.exec(e);if(o)return t=o[1],!1}),t},_getPrefixedParamName:function(e){return qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES,e)>=0?e:qq.s3.util.AWS_PARAM_PREFIX+e},getPolicy:function(e){var t={},n=[],i=e.bucket,o=e.date,r=e.clockDrift,s=e.key,a=e.accessKey,u=e.acl,l=e.type,c=e.expectedStatus,d=e.sessionToken,p=e.params,q=qq.s3.util.getSuccessRedirectAbsoluteUrl(e.successRedirectUrl),h=e.minFileSize,f=e.maxFileSize,m=e.reducedRedundancy,g=e.region,_=e.serverSideEncryption,v=e.signatureVersion;return t.expiration=qq.s3.util.getPolicyExpirationDate(o,r),n.push({acl:u}),n.push({bucket:i}),l&&n.push({"Content-Type":l}),c&&n.push({success_action_status:c.toString()}),q&&n.push({success_action_redirect:q}),m&&(n.push({}),n[n.length-1][qq.s3.util.REDUCED_REDUNDANCY_PARAM_NAME]=qq.s3.util.REDUCED_REDUNDANCY_PARAM_VALUE),d&&(n.push({}),n[n.length-1][qq.s3.util.SESSION_TOKEN_PARAM_NAME]=d),_&&(n.push({}),n[n.length-1][qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_NAME]=qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_VALUE),2===v?n.push({key:s}):4===v&&(n.push({}),n[n.length-1][qq.s3.util.ALGORITHM_PARAM_NAME]=qq.s3.util.V4_ALGORITHM_PARAM_VALUE,n.push({}),n[n.length-1].key=s,n.push({}),n[n.length-1][qq.s3.util.CREDENTIAL_PARAM_NAME]=qq.s3.util.getV4CredentialsString({date:o,key:a,region:g}),n.push({}),n[n.length-1][qq.s3.util.DATE_PARAM_NAME]=qq.s3.util.getV4PolicyDate(o,r)),qq.each(p,function(e,t){var i=qq.s3.util._getPrefixedParamName(e),o={};qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES,i)>=0?o[i]=t:o[i]=encodeURIComponent(t),n.push(o)}),t.conditions=n,qq.s3.util.enforceSizeLimits(t,h,f),t},refreshPolicyCredentials:function(e,t){var n=!1;qq.each(e.conditions,function(e,i){qq.each(i,function(e,o){e===qq.s3.util.SESSION_TOKEN_PARAM_NAME&&(i[e]=t,n=!0)})}),n||(e.conditions.push({}),e.conditions[e.conditions.length-1][qq.s3.util.SESSION_TOKEN_PARAM_NAME]=t)},generateAwsParams:function(e,t){var n,i={},o=e.params,r=new qq.Promise,s=e.sessionToken,a=e.clockDrift,u=e.type,l=e.key,c=e.accessKey,d=e.acl,p=e.expectedStatus,q=qq.s3.util.getSuccessRedirectAbsoluteUrl(e.successRedirectUrl),h=e.reducedRedundancy,f=e.region,m=e.serverSideEncryption,g=e.signatureVersion,_=new Date,v=e.log;return e.date=_,n=qq.s3.util.getPolicy(e),i.key=l,u&&(i["Content-Type"]=u),p&&(i.success_action_status=p),q&&(i.success_action_redirect=q),h&&(i[qq.s3.util.REDUCED_REDUNDANCY_PARAM_NAME]=qq.s3.util.REDUCED_REDUNDANCY_PARAM_VALUE),m&&(i[qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_NAME]=qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_VALUE),s&&(i[qq.s3.util.SESSION_TOKEN_PARAM_NAME]=s),i.acl=d,qq.each(o,function(e,t){var n=qq.s3.util._getPrefixedParamName(e);qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES,n)>=0?i[n]=t:i[n]=encodeURIComponent(t)}),2===g?i.AWSAccessKeyId=c:4===g&&(i[qq.s3.util.ALGORITHM_PARAM_NAME]=qq.s3.util.V4_ALGORITHM_PARAM_VALUE,i[qq.s3.util.CREDENTIAL_PARAM_NAME]=qq.s3.util.getV4CredentialsString({date:_,key:c,region:f}),i[qq.s3.util.DATE_PARAM_NAME]=qq.s3.util.getV4PolicyDate(_,a)),t(n).then(function(t,n,o){i.policy=t.policy,2===e.signatureVersion?(i.signature=t.signature,n&&(i.AWSAccessKeyId=n)):4===e.signatureVersion&&(i[qq.s3.util.V4_SIGNATURE_PARAM_NAME]=t.signature),o&&(i[qq.s3.util.SESSION_TOKEN_PARAM_NAME]=o),r.success(i)},function(e){e=e||"Can't continue further with request to S3 as we did not receive a valid signature and policy from the server.",v("Policy signing failed. "+e,"error"),r.failure(e)}),r},enforceSizeLimits:function(e,t,n){var i=t<0?0:t,o=n<=0?9007199254740992:n;(t>0||n>0)&&e.conditions.push(["content-length-range",i.toString(),o.toString()])},getPolicyExpirationDate:function(e,t){var n=new Date(e.getTime()+t);return qq.s3.util.getPolicyDate(n,5)},getCredentialsDate:function(e){return e.getUTCFullYear()+""+("0"+(e.getUTCMonth()+1)).slice(-2)+("0"+e.getUTCDate()).slice(-2)},getPolicyDate:function(e,t){var n,i,o=t||0;return e.setMinutes(e.getMinutes()+(o||0)),Date.prototype.toISOString?e.toISOString():(n=function(e){return i=String(e),1===i.length&&(i="0"+i),i},e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z")},parseIframeResponse:function(e){var t=e.contentDocument||e.contentWindow.document,n=t.location.search,i=/bucket=(.+)&key=(.+)&etag=(.+)/.exec(n);if(i)return{bucket:i[1],key:i[2],etag:i[3].replace(/%22/g,"")}},getSuccessRedirectAbsoluteUrl:function(e){if(e){var t,n=document.createElement("div");return qq.ie7()?(n.innerHTML="<a href='"+e+"'></a>",t=n.firstChild,t.href):(t=document.createElement("a"),t.href=e,t.href=t.href,t.href)}},getV4CredentialsString:function(e){return e.key+"/"+qq.s3.util.getCredentialsDate(e.date)+"/"+e.region+"/s3/aws4_request"},getV4PolicyDate:function(e,t){var n=new Date(e.getTime()+t);return qq.s3.util.getCredentialsDate(n)+"T"+("0"+n.getUTCHours()).slice(-2)+("0"+n.getUTCMinutes()).slice(-2)+("0"+n.getUTCSeconds()).slice(-2)+"Z"},encodeQueryStringParam:function(e){var t=encodeURIComponent(e);return t=t.replace(/[!'()]/g,escape),t=t.replace(/\*/g,"%2A"),t.replace(/%20/g,"+")}}}(),function(){"use strict";qq.nonTraditionalBasePublicApi={setUploadSuccessParams:function(e,t){this._uploadSuccessParamsStore.set(e,t)},setUploadSuccessEndpoint:function(e,t){this._uploadSuccessEndpointStore.set(e,t)}},qq.nonTraditionalBasePrivateApi={_onComplete:function(e,t,n,i){var o,r,s=!!n.success,a=this,u=arguments,l=this._uploadSuccessEndpointStore.get(e),c=this._options.uploadSuccess.customHeaders,d=this._options.uploadSuccess.method,p=this._options.cors,q=new qq.Promise,h=this._uploadSuccessParamsStore.get(e),f=this._paramsStore.get(e),m=function(t){delete a._failedSuccessRequestCallbacks[e],qq.extend(n,t),qq.FineUploaderBasic.prototype._onComplete.apply(a,u),q.success(t)},g=function(r){var s=o;qq.extend(n,r),n&&n.reset&&(s=null),s?a._failedSuccessRequestCallbacks[e]=s:delete a._failedSuccessRequestCallbacks[e],a._onAutoRetry(e,t,n,i,s)||(qq.FineUploaderBasic.prototype._onComplete.apply(a,u),q.failure(r))};return s&&l?(r=new qq.UploadSuccessAjaxRequester({endpoint:l,method:d,customHeaders:c,cors:p,log:qq.bind(this.log,this)}),qq.extend(h,a._getEndpointSpecificParams(e,n,i),!0),f&&qq.extend(h,f,!0),o=qq.bind(function(){r.sendSuccessRequest(e,h).then(m,g)},a),o(),q):qq.FineUploaderBasic.prototype._onComplete.apply(this,arguments)},_manualRetry:function(e){var t=this._failedSuccessRequestCallbacks[e];return qq.FineUploaderBasic.prototype._manualRetry.call(this,e,t)}}}(),function(){"use strict";qq.s3.FineUploaderBasic=function(e){var t={request:{accessKey:null,clockDrift:0},objectProperties:{acl:"private",bucket:qq.bind(function(e){return qq.s3.util.getBucket(this.getEndpoint(e))},this),host:qq.bind(function(e){return/(?:http|https):\/\/(.+)(?:\/.+)?/.exec(this._endpointStore.get(e))[1]},this),key:"uuid",reducedRedundancy:!1,region:"us-east-1",serverSideEncryption:!1},credentials:{accessKey:null,secretKey:null,expiration:null,sessionToken:null},signature:{customHeaders:{},endpoint:null,version:2},uploadSuccess:{endpoint:null,method:"POST",params:{},customHeaders:{}},iframeSupport:{localBlankPagePath:null},chunking:{partSize:5242880},cors:{allowXdr:!0},callbacks:{onCredentialsExpired:function(){}}};qq.extend(t,e,!0),this.setCredentials(t.credentials,!0)||(this._currentCredentials.accessKey=t.request.accessKey),this._aclStore=this._createStore(t.objectProperties.acl),qq.FineUploaderBasic.call(this,t),this._uploadSuccessParamsStore=this._createStore(this._options.uploadSuccess.params),this._uploadSuccessEndpointStore=this._createStore(this._options.uploadSuccess.endpoint),this._failedSuccessRequestCallbacks={},this._cannedKeys={},this._cannedBuckets={},this._buckets={},this._hosts={}},qq.extend(qq.s3.FineUploaderBasic.prototype,qq.basePublicApi),qq.extend(qq.s3.FineUploaderBasic.prototype,qq.basePrivateApi),qq.extend(qq.s3.FineUploaderBasic.prototype,qq.nonTraditionalBasePublicApi),qq.extend(qq.s3.FineUploaderBasic.prototype,qq.nonTraditionalBasePrivateApi),qq.extend(qq.s3.FineUploaderBasic.prototype,{getBucket:function(e){return null==this._cannedBuckets[e]?this._buckets[e]:this._cannedBuckets[e]},getKey:function(e){return null==this._cannedKeys[e]?this._handler.getThirdPartyFileId(e):this._cannedKeys[e]},reset:function(){qq.FineUploaderBasic.prototype.reset.call(this),this._failedSuccessRequestCallbacks=[],this._buckets={},this._hosts={}},setCredentials:function(e,t){if(e&&e.secretKey){if(!e.accessKey)throw new qq.Error("Invalid credentials: no accessKey");if(!e.expiration)throw new qq.Error("Invalid credentials: no expiration");return this._currentCredentials=qq.extend({},e),qq.isString(e.expiration)&&(this._currentCredentials.expiration=new Date(e.expiration)),!0}if(!t)throw new qq.Error("Invalid credentials parameter!");this._currentCredentials={}},setAcl:function(e,t){this._aclStore.set(e,t)},_createUploadHandler:function(){var e=this,t={aclStore:this._aclStore,getBucket:qq.bind(this._determineBucket,this),getHost:qq.bind(this._determineHost,this),getKeyName:qq.bind(this._determineKeyName,this),iframeSupport:this._options.iframeSupport,objectProperties:this._options.objectProperties,signature:this._options.signature,clockDrift:this._options.request.clockDrift,validation:{minSizeLimit:this._options.validation.minSizeLimit,maxSizeLimit:this._options.validation.sizeLimit}};return qq.override(this._endpointStore,function(e){return{get:function(t){var n=e.get(t);return n.indexOf("http")<0?"http://"+n:n}}}),qq.override(this._paramsStore,function(e){return{get:function(t){var n=e.get(t),i={};return qq.each(n,function(e,t){var n=e;qq.indexOf(qq.s3.util.CASE_SENSITIVE_PARAM_NAMES,n)<0&&(n=n.toLowerCase()),i[n]=qq.isFunction(t)?t():t}),i}}}),t.signature.credentialsProvider={get:function(){return e._currentCredentials},onExpired:function(){var t=new qq.Promise,n=e._options.callbacks.onCredentialsExpired();return qq.isGenericPromise(n)?n.then(function(n){try{e.setCredentials(n),t.success()}catch(n){e.log("Invalid credentials returned from onCredentialsExpired callback! ("+n.message+")","error"),t.failure("onCredentialsExpired did not return valid credentials.")}},function(n){e.log("onCredentialsExpired callback indicated failure! ("+n+")","error"),t.failure("onCredentialsExpired callback failed.")}):(e.log("onCredentialsExpired callback did not return a promise!","error"),
t.failure("Unexpected return value for onCredentialsExpired.")),t}},qq.FineUploaderBasic.prototype._createUploadHandler.call(this,t,"s3")},_determineObjectPropertyValue:function(e,t){var n=this._options.objectProperties[t],i=new qq.Promise,o=this;return qq.isFunction(n)?(n=n(e),qq.isGenericPromise(n)?i=n:i.success(n)):qq.isString(n)&&i.success(n),i.then(function(n){o["_"+t+"s"][e]=n},function(n){qq.log("Problem determining "+t+" for ID "+e+" ("+n+")","error")}),i},_determineBucket:function(e){return this._determineObjectPropertyValue(e,"bucket")},_determineHost:function(e){return this._determineObjectPropertyValue(e,"host")},_determineKeyName:function(e,t){var n=new qq.Promise,i=this._options.objectProperties.key,o=qq.getExtension(t),r=n.failure,s=function(e,t){var i=e;void 0!==t&&(i+="."+t),n.success(i)};switch(i){case"uuid":s(this.getUuid(e),o);break;case"filename":s(t);break;default:qq.isFunction(i)?this._handleKeynameFunction(i,e,s,r):(this.log(i+" is not a valid value for the s3.keyname option!","error"),r())}return n},_handleKeynameFunction:function(e,t,n,i){var o=this,r=function(e){n(e)},s=function(e){o.log(qq.format("Failed to retrieve key name for {}. Reason: {}",t,e||"null"),"error"),i(e)},a=e.call(this,t);qq.isGenericPromise(a)?a.then(r,s):null==a?s():r(a)},_getEndpointSpecificParams:function(e,t,n){var i={key:this.getKey(e),uuid:this.getUuid(e),name:this.getName(e),bucket:this.getBucket(e)};return n&&n.getResponseHeader("ETag")?i.etag=n.getResponseHeader("ETag"):t.etag&&(i.etag=t.etag),i},_onSubmitDelete:function(e,t){var n={key:this.getKey(e),bucket:this.getBucket(e)};return qq.FineUploaderBasic.prototype._onSubmitDelete.call(this,e,t,n)},_addCannedFile:function(e){var t;if(null==e.s3Key)throw new qq.Error("Did not find s3Key property in server session response. This is required!");return t=qq.FineUploaderBasic.prototype._addCannedFile.apply(this,arguments),this._cannedKeys[t]=e.s3Key,this._cannedBuckets[t]=e.s3Bucket,t}})}(),window.Uint8ClampedArray||(window.Uint8ClampedArray=function(){}),qq.s3.RequestSigner=function(e){"use strict";function t(e,t,n){var i,o,r=t.responseText,s=l[e],a=s.promise,u=s.signatureConstructor;if(delete l[e],r)try{o=qq.parseJson(r)}catch(e){c.log("Error attempting to parse signature response: "+e,"error")}o&&o.invalid?(n=!0,i="Invalid policy document or request headers!"):o?c.expectingPolicy&&!o.policy?(n=!0,i="Response does not include the base64 encoded policy!"):o.signature||(n=!0,i="Response does not include the signature!"):(n=!0,i="Received an empty or invalid response from the server!"),n?(i&&c.log(i,"error"),a.failure(i)):u?d(u,o.signature,a):a.success(o)}function n(e,t,n){var i,o,r,s=new qq.Promise,a="POST",l=[],d="",h=new Date,f=function(e){var n,s=[];return qq.each(e.headers,function(e){l.push(e)}),l.sort(),qq.each(l,function(t,i){qq.indexOf(qq.s3.util.UNSIGNABLE_REST_HEADER_NAMES,i)<0?d+=i.toLowerCase()+":"+e.headers[i].trim()+"\n":"Content-MD5"===i?n=e.headers[i]:s.unshift(t)}),qq.each(s,function(e,t){l.splice(t,1)}),o={bucket:e.bucket,contentMd5:n,contentType:e.contentType,date:h,drift:c.signatureSpec.drift,endOfUrl:i,hashedContent:e.hashedContent,headerNames:l,headersStr:d,method:a},r=2===t?p.getStringToSign(o):q.getStringToSign(o),{date:h,endOfUrl:i,signedHeaders:4===t?q.getSignedHeaders(o.headerNames):null,toSign:4===t?r.hashed:r,toSignRaw:4===t?r.raw:r}};switch(n.type){case u.REQUEST_TYPE.MULTIPART_ABORT:a="DELETE",i=qq.format("uploadId={}",n.uploadId);break;case u.REQUEST_TYPE.MULTIPART_INITIATE:i="uploads";break;case u.REQUEST_TYPE.MULTIPART_COMPLETE:i=qq.format("uploadId={}",n.uploadId);break;case u.REQUEST_TYPE.MULTIPART_UPLOAD:a="PUT",i=qq.format("partNumber={}&uploadId={}",n.partNum,n.uploadId)}return i=n.key+"?"+i,4===t?q.getEncodedHashedPayload(n.content).then(function(e){n.headers["x-amz-content-sha256"]=e,n.headers.Host=n.host,n.headers["x-amz-date"]=qq.s3.util.getV4PolicyDate(h,c.signatureSpec.drift),n.hashedContent=e,s.success(f(n))}):s.success(f(n)),s}function i(e,t,n,i,s){var a;t.signatureConstructor?(s&&(a=t.signatureConstructor.getHeaders(),a[qq.s3.util.SESSION_TOKEN_PARAM_NAME]=s,t.signatureConstructor.withHeaders(a)),t.signatureConstructor.getToSign(e).then(function(e){r(t.signatureConstructor,e.stringToSign,n)})):(s&&qq.s3.util.refreshPolicyCredentials(t,s),o(t,n,i,s))}function o(e,t,n,i){4===c.signatureSpec.version?q.signPolicy(e,t,n,i):p.signPolicy(e,t,n,i)}function r(e,t,n){4===c.signatureSpec.version?q.signApiRequest(e,t,n):p.signApiRequest(e,t,n)}var s,a,u=this,l={},c={expectingPolicy:!1,method:"POST",signatureSpec:{drift:0,credentialsProvider:{},endpoint:null,customHeaders:{},version:2},maxConnections:3,endpointStore:{},paramsStore:{},cors:{expected:!1,sendCredentials:!1},log:function(e,t){}},d=function(e,t,n){var i=e.getHeaders();4===c.signatureSpec.version?i.Authorization=qq.s3.util.V4_ALGORITHM_PARAM_VALUE+" Credential="+c.signatureSpec.credentialsProvider.get().accessKey+"/"+qq.s3.util.getCredentialsDate(e.getRequestDate())+"/"+c.signatureSpec.region+"/s3/aws4_request,SignedHeaders="+e.getSignedHeaders()+",Signature="+t:i.Authorization="AWS "+c.signatureSpec.credentialsProvider.get().accessKey+":"+t,n.success(i,e.getEndOfUrl())},p={getStringToSign:function(e){return qq.format("{}\n{}\n{}\n\n{}/{}/{}",e.method,e.contentMd5||"",e.contentType||"",e.headersStr||"\n",e.bucket,e.endOfUrl)},signApiRequest:function(e,t,n){var i=qq.CryptoJS.enc.Utf8.parse(t),o=qq.CryptoJS.HmacSHA1(i,a.get().secretKey),r=qq.CryptoJS.enc.Base64.stringify(o);d(e,r,n)},signPolicy:function(e,t,n,i){var o=JSON.stringify(e),r=qq.CryptoJS.enc.Utf8.parse(o),s=qq.CryptoJS.enc.Base64.stringify(r),u=qq.CryptoJS.HmacSHA1(s,a.get().secretKey),l=qq.CryptoJS.enc.Base64.stringify(u);t.success({policy:s,signature:l},n,i)}},q={getCanonicalQueryString:function(e){var t,n,i,o=e.indexOf("?"),r="";return o>=0&&(t={},i=e.substr(o+1).split("&"),qq.each(i,function(e,n){var i=n.split("="),o=i[1];null==o&&(o=""),t[encodeURIComponent(i[0])]=encodeURIComponent(o)}),n=Object.keys(t).sort(),n.forEach(function(e,i){r+=e+"="+t[e],i<n.length-1&&(r+="&")})),r},getCanonicalRequest:function(e){return qq.format("{}\n{}\n{}\n{}\n{}\n{}",e.method,q.getCanonicalUri(e.endOfUrl),q.getCanonicalQueryString(e.endOfUrl),e.headersStr||"\n",q.getSignedHeaders(e.headerNames),e.hashedContent)},getCanonicalUri:function(e){var t=e,n=e.indexOf("?");return n>0&&(t=e.substr(0,n)),escape("/"+decodeURIComponent(t))},getEncodedHashedPayload:function(e){var t,n=new qq.Promise;return qq.isBlob(e)?(t=new FileReader,t.onloadend=function(e){if(e.target.readyState===FileReader.DONE)if(e.target.error)n.failure(e.target.error);else{var t=qq.CryptoJS.lib.WordArray.create(e.target.result);n.success(qq.CryptoJS.SHA256(t).toString())}},t.readAsArrayBuffer(e)):(e=e||"",n.success(qq.CryptoJS.SHA256(e).toString())),n},getScope:function(e,t){return qq.s3.util.getCredentialsDate(e)+"/"+t+"/s3/aws4_request"},getStringToSign:function(e){var t=q.getCanonicalRequest(e),n=qq.s3.util.getV4PolicyDate(e.date,e.drift),i=qq.CryptoJS.SHA256(t).toString(),o=q.getScope(e.date,c.signatureSpec.region),r="AWS4-HMAC-SHA256\n{}\n{}\n{}";return{hashed:qq.format(r,n,o,i),raw:qq.format(r,n,o,t)}},getSignedHeaders:function(e){var t="";return e.forEach(function(n,i){t+=n.toLowerCase(),i<e.length-1&&(t+=";")}),t},signApiRequest:function(e,t,n){var i,o,r,s,u=a.get().secretKey,l=/.+\n.+\n(\d+)\/(.+)\/s3\/.+\n(.+)/,c=l.exec(t);i=qq.CryptoJS.HmacSHA256(c[1],"AWS4"+u),o=qq.CryptoJS.HmacSHA256(c[2],i),r=qq.CryptoJS.HmacSHA256("s3",o),s=qq.CryptoJS.HmacSHA256("aws4_request",r),d(e,qq.CryptoJS.HmacSHA256(t,s),n)},signPolicy:function(e,t,n,i){var o,r,s,u,l,c=JSON.stringify(e),d=qq.CryptoJS.enc.Utf8.parse(c),p=qq.CryptoJS.enc.Base64.stringify(d),q=a.get().secretKey,h=/.+\/(.+)\/(.+)\/s3\/aws4_request/,f=function(){var t=null;return qq.each(e.conditions,function(e,n){var i=n["x-amz-credential"];if(i)return t=i,!1}),t}();o=h.exec(f),r=qq.CryptoJS.HmacSHA256(o[1],"AWS4"+q),s=qq.CryptoJS.HmacSHA256(o[2],r),u=qq.CryptoJS.HmacSHA256("s3",s),l=qq.CryptoJS.HmacSHA256("aws4_request",u),t.success({policy:p,signature:qq.CryptoJS.HmacSHA256(p,l).toString()},n,i)}};qq.extend(c,e,!0),a=c.signatureSpec.credentialsProvider,s=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",method:c.method,contentType:"application/json; charset=utf-8",endpointStore:{get:function(){return c.signatureSpec.endpoint}},paramsStore:c.paramsStore,maxConnections:c.maxConnections,customHeaders:c.signatureSpec.customHeaders,log:c.log,onComplete:t,cors:c.cors})),qq.extend(this,{getSignature:function(e,t){var n,o=t,r=t.signatureConstructor,u=new qq.Promise;return 4===c.signatureSpec.version&&(n={v4:!0}),a.get().secretKey&&qq.CryptoJS?a.get().expiration.getTime()>Date.now()?i(e,t,u):a.onExpired().then(function(){i(e,t,u,a.get().accessKey,a.get().sessionToken)},function(e){c.log("Attempt to update expired credentials apparently failed! Unable to sign request. ","error"),u.failure("Unable to sign request - expired credentials.")}):(c.log("Submitting S3 signature request for "+e),r?r.getToSign(e).then(function(t){o={headers:t.stringToSignRaw},s.initTransport(e).withParams(o).withQueryParams(n).send()}):s.initTransport(e).withParams(o).withQueryParams(n).send(),l[e]={promise:u,signatureConstructor:r}),u},constructStringToSign:function(e,t,i,o){var r,s,u,l,d,p={};return{withHeaders:function(e){return p=e,this},withUploadId:function(e){return r=e,this},withContent:function(e){return s=e,this},withContentType:function(e){return u=e,this},withPartNum:function(e){return l=e,this},getToSign:function(q){var h=a.get().sessionToken,f=new qq.Promise,m=new Date(Date.now()+c.signatureSpec.drift);return p["x-amz-date"]=m.toUTCString(),h&&(p[qq.s3.util.SESSION_TOKEN_PARAM_NAME]=h),n(q,c.signatureSpec.version,{bucket:t,content:s,contentType:u,headers:p,host:i,key:o,partNum:l,type:e,uploadId:r}).then(function(e){d=e,f.success({headers:function(){return u&&(p["Content-Type"]=u),delete p.Host,p}(),date:d.date,endOfUrl:d.endOfUrl,signedHeaders:d.signedHeaders,stringToSign:d.toSign,stringToSignRaw:d.toSignRaw})}),f},getHeaders:function(){return qq.extend({},p)},getEndOfUrl:function(){return d&&d.endOfUrl},getRequestDate:function(){return d&&d.date},getSignedHeaders:function(){return d&&d.signedHeaders}}}})},qq.s3.RequestSigner.prototype.REQUEST_TYPE={MULTIPART_INITIATE:"multipart_initiate",MULTIPART_COMPLETE:"multipart_complete",MULTIPART_ABORT:"multipart_abort",MULTIPART_UPLOAD:"multipart_upload"},qq.UploadSuccessAjaxRequester=function(e){"use strict";function t(e,t,n){var r,s=i[e],a=t.responseText,u={success:!0},l={success:!1};delete i[e],o.log(qq.format("Received the following response body to an upload success request for id {}: {}",e,a));try{r=qq.parseJson(a),n||r&&(r.error||r.success===!1)?(o.log("Upload success request was rejected by the server.","error"),s.failure(qq.extend(r,l))):(o.log("Upload success was acknowledged by the server."),s.success(qq.extend(r,u)))}catch(t){n?(o.log(qq.format("Your server indicated failure in its upload success request response for id {}!",e),"error"),s.failure(l)):(o.log("Upload success was acknowledged by the server."),s.success(u))}}var n,i=[],o={method:"POST",endpoint:null,maxConnections:3,customHeaders:{},paramsStore:{},cors:{expected:!1,sendCredentials:!1},log:function(e,t){}};qq.extend(o,e),n=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",method:o.method,endpointStore:{get:function(){return o.endpoint}},paramsStore:o.paramsStore,maxConnections:o.maxConnections,customHeaders:o.customHeaders,log:o.log,onComplete:t,cors:o.cors})),qq.extend(this,{sendSuccessRequest:function(e,t){var r=new qq.Promise;return o.log("Submitting upload success request/notification for "+e),n.initTransport(e).withParams(t).send(),i[e]=r,r}})},qq.s3.InitiateMultipartAjaxRequester=function(e){"use strict";function t(e){var t,n=s.getBucket(e),i=s.getHost(e),r={},a=new qq.Promise,u=s.getKey(e);return r["x-amz-acl"]=s.aclStore.get(e),s.reducedRedundancy&&(r[qq.s3.util.REDUCED_REDUNDANCY_PARAM_NAME]=qq.s3.util.REDUCED_REDUNDANCY_PARAM_VALUE),s.serverSideEncryption&&(r[qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_NAME]=qq.s3.util.SERVER_SIDE_ENCRYPTION_PARAM_VALUE),r[qq.s3.util.AWS_PARAM_PREFIX+s.filenameParam]=encodeURIComponent(s.getName(e)),qq.each(s.paramsStore.get(e),function(e,t){qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES,e)>=0?r[e]=t:r[qq.s3.util.AWS_PARAM_PREFIX+e]=encodeURIComponent(t)}),t=o.constructStringToSign(o.REQUEST_TYPE.MULTIPART_INITIATE,n,i,u).withContentType(s.getContentType(e)).withHeaders(r),o.getSignature(e,{signatureConstructor:t}).then(a.success,a.failure),a}function n(e,t,n){var i,o,a,u,l,c=r[e],d=new DOMParser,p=d.parseFromString(t.responseText,"application/xml");delete r[e],n?(l=t.status,o=p.getElementsByTagName("Message"),o.length>0&&(u=o[0].textContent)):(i=p.getElementsByTagName("UploadId"),i.length>0?a=i[0].textContent:u="Upload ID missing from request"),void 0===a?(u?s.log(qq.format("Specific problem detected initiating multipart upload request for {}: '{}'.",e,u),"error"):s.log(qq.format("Unexplained error with initiate multipart upload request for {}. Status code {}.",e,l),"error"),c.failure("Problem initiating upload request.",t)):(s.log(qq.format("Initiate multipart upload request successful for {}. Upload ID is {}",e,a)),c.success(a,t))}var i,o,r={},s={filenameParam:"qqfilename",method:"POST",endpointStore:null,paramsStore:null,signatureSpec:null,aclStore:null,reducedRedundancy:!1,serverSideEncryption:!1,maxConnections:3,getContentType:function(e){},getBucket:function(e){},getHost:function(e){},getKey:function(e){},getName:function(e){},log:function(e,t){}};qq.extend(s,e),o=new qq.s3.RequestSigner({endpointStore:s.endpointStore,signatureSpec:s.signatureSpec,cors:s.cors,log:s.log}),i=qq.extend(this,new qq.AjaxRequester({method:s.method,contentType:null,endpointStore:s.endpointStore,maxConnections:s.maxConnections,allowXRequestedWithAndCacheControl:!1,log:s.log,onComplete:n,successfulResponseCodes:{POST:[200]}})),qq.extend(this,{send:function(e){var n=new qq.Promise;return t(e).then(function(t,o){s.log("Submitting S3 initiate multipart upload request for "+e),r[e]=n,i.initTransport(e).withPath(o).withHeaders(t).send()},n.failure),n}})},qq.s3.CompleteMultipartAjaxRequester=function(e){"use strict";function t(e,t,n){var i=new qq.Promise,o=a.getBucket(e),s=a.getHost(e),u=r.constructStringToSign(r.REQUEST_TYPE.MULTIPART_COMPLETE,o,s,a.getKey(e)).withUploadId(t).withContent(n).withContentType("application/xml; charset=UTF-8");return r.getSignature(e,{signatureConstructor:u}).then(i.success,i.failure),i}function n(e,t,n){var i=s[e],o=new DOMParser,r=a.getBucket(e),u=(a.getKey(e),o.parseFromString(t.responseText,"application/xml")),l=u.getElementsByTagName("Bucket"),c=u.getElementsByTagName("Key");delete s[e],a.log(qq.format("Complete response status {}, body = {}",t.status,t.responseText)),n?a.log(qq.format("Complete Multipart Upload request for {} failed with status {}.",e,t.status),"error"):l.length&&c.length?l[0].textContent!==r&&(n=!0,a.log(qq.format("Wrong bucket in response to Complete Multipart Upload request for {}.",e),"error")):(n=!0,a.log(qq.format("Missing bucket and/or key in response to Complete Multipart Upload request for {}.",e),"error")),n?i.failure("Problem combining the file parts!",t):i.success({},t)}function i(e){var t=document.implementation.createDocument(null,"CompleteMultipartUpload",null);return e.sort(function(e,t){return e.part-t.part}),qq.each(e,function(e,n){var i=n.part,o=n.etag,r=t.createElement("Part"),s=t.createElement("PartNumber"),a=t.createTextNode(i),u=t.createTextNode(o),l=t.createElement("ETag");l.appendChild(u),s.appendChild(a),r.appendChild(s),r.appendChild(l),qq(t).children()[0].appendChild(r)}),(new XMLSerializer).serializeToString(t)}var o,r,s={},a={method:"POST",contentType:"text/xml",endpointStore:null,signatureSpec:null,maxConnections:3,getBucket:function(e){},getHost:function(e){},getKey:function(e){},log:function(e,t){}};qq.extend(a,e),r=new qq.s3.RequestSigner({endpointStore:a.endpointStore,signatureSpec:a.signatureSpec,cors:a.cors,log:a.log}),o=qq.extend(this,new qq.AjaxRequester({method:a.method,contentType:"application/xml; charset=UTF-8",endpointStore:a.endpointStore,maxConnections:a.maxConnections,allowXRequestedWithAndCacheControl:!1,log:a.log,onComplete:n,successfulResponseCodes:{POST:[200]}})),qq.extend(this,{send:function(e,n,r){var u=new qq.Promise,l=i(r);return t(e,n,l).then(function(t,n){a.log("Submitting S3 complete multipart upload request for "+e),s[e]=u,delete t["Content-Type"],o.initTransport(e).withPath(n).withHeaders(t).withPayload(l).send()},u.failure),u}})},qq.s3.AbortMultipartAjaxRequester=function(e){"use strict";function t(e,t){var n=new qq.Promise,i=r.getBucket(e),s=r.getHost(e),a=o.constructStringToSign(o.REQUEST_TYPE.MULTIPART_ABORT,i,s,r.getKey(e)).withUploadId(t);return o.getSignature(e,{signatureConstructor:a}).then(n.success,n.failure),n}function n(e,t,n){var i,o=new DOMParser,s=o.parseFromString(t.responseText,"application/xml"),a=s.getElementsByTagName("Error");r.log(qq.format("Abort response status {}, body = {}",t.status,t.responseText)),n?r.log(qq.format("Abort Multipart Upload request for {} failed with status {}.",e,t.status),"error"):a.length?(n=!0,i=s.getElementsByTagName("Message")[0].textContent,r.log(qq.format("Failed to Abort Multipart Upload request for {}. Error: {}",e,i),"error")):r.log(qq.format("Abort MPU request succeeded for file ID {}.",e))}var i,o,r={method:"DELETE",endpointStore:null,signatureSpec:null,maxConnections:3,getBucket:function(e){},getHost:function(e){},getKey:function(e){},log:function(e,t){}};qq.extend(r,e),o=new qq.s3.RequestSigner({endpointStore:r.endpointStore,signatureSpec:r.signatureSpec,cors:r.cors,log:r.log}),i=qq.extend(this,new qq.AjaxRequester({validMethods:["DELETE"],method:r.method,contentType:null,endpointStore:r.endpointStore,maxConnections:r.maxConnections,allowXRequestedWithAndCacheControl:!1,log:r.log,onComplete:n,successfulResponseCodes:{DELETE:[204]}})),qq.extend(this,{send:function(e,n){t(e,n).then(function(t,n){r.log("Submitting S3 Abort multipart upload request for "+e),i.initTransport(e).withPath(n).withHeaders(t).send()})}})},qq.s3.XhrUploadHandler=function(e,t){"use strict";var n=t.getName,i=t.log,o=e.clockDrift,r=200,s=e.getBucket,a=e.getHost,u=e.getKeyName,l=e.filenameParam,c=e.paramsStore,d=e.endpointStore,p=e.aclStore,q=e.objectProperties.reducedRedundancy,h=e.objectProperties.region,f=e.objectProperties.serverSideEncryption,m=e.validation,g=qq.extend({region:h,drift:o},e.signature),_=this,v=e.signature.credentialsProvider,b={combine:function(e){var t=_._getPersistableData(e).uploadId,n=_._getPersistableData(e).etags,i=new qq.Promise;return S.completeMultipart.send(e,t,n).then(i.success,function(t,n){i.failure(w.done(e,n).response,n)}),i},done:function(e,t,n){var i,o=w.response.parse(e,t);o.success&&(i=t.getResponseHeader("ETag"),_._getPersistableData(e).etags||(_._getPersistableData(e).etags=[]),_._getPersistableData(e).etags.push({part:n+1,etag:i}))},initHeaders:function(e,t,n){var i=w.bucket.getName(e),o=w.host.getName(e),r=w.key.urlSafe(e),s=new qq.Promise,a=S.restSignature.constructStringToSign(S.restSignature.REQUEST_TYPE.MULTIPART_UPLOAD,i,o,r).withPartNum(t+1).withContent(n).withUploadId(_._getPersistableData(e).uploadId);return S.restSignature.getSignature(e+"."+t,{signatureConstructor:a}).then(s.success,s.failure),s},put:function(t,n){var o=_._createXhr(t,n),r=_._getChunkData(t,n),s=e.endpointStore.get(t),a=new qq.Promise;return b.initHeaders(t,n,r.blob).then(function(e,u){if(o._cancelled)i(qq.format("Upload of item {}.{} cancelled. Upload will not start after successful signature request.",t,n)),a.failure({error:"Chunk upload cancelled"});else{var l=s+"/"+u;_._registerProgressHandler(t,n,r.size),w.track(t,o,n).then(a.success,a.failure),o.open("PUT",l,!0),qq.each(e,function(e,t){o.setRequestHeader(e,t)}),o.send(r.blob)}},function(){a.failure({error:"Problem signing the chunk!"},o)}),a},send:function(e,t){var n=new qq.Promise;return b.setup(e).then(function(){b.put(e,t).then(n.success,n.failure)},function(e,t){n.failure({error:e},t)}),n},setup:function(e){var t=new qq.Promise,n=_._getPersistableData(e).uploadId,i=new qq.Promise;return n?n instanceof qq.Promise?n.then(function(e){t.success(e)}):t.success(n):(_._getPersistableData(e).uploadId=i,S.initiateMultipart.send(e).then(function(n){_._getPersistableData(e).uploadId=n,i.success(n),t.success(n)},function(n,o){_._getPersistableData(e).uploadId=null,t.failure(n,o),i.failure(n,o)})),t}},S={abortMultipart:new qq.s3.AbortMultipartAjaxRequester({endpointStore:d,signatureSpec:g,cors:e.cors,log:i,getBucket:function(e){return w.bucket.getName(e)},getHost:function(e){return w.host.getName(e)},getKey:function(e){return w.key.urlSafe(e)}}),completeMultipart:new qq.s3.CompleteMultipartAjaxRequester({endpointStore:d,signatureSpec:g,cors:e.cors,log:i,getBucket:function(e){return w.bucket.getName(e)},getHost:function(e){return w.host.getName(e)},getKey:function(e){return w.key.urlSafe(e)}}),initiateMultipart:new qq.s3.InitiateMultipartAjaxRequester({filenameParam:l,endpointStore:d,paramsStore:c,signatureSpec:g,aclStore:p,reducedRedundancy:q,serverSideEncryption:f,cors:e.cors,log:i,getContentType:function(e){return _._getMimeType(e)},getBucket:function(e){return w.bucket.getName(e)},getHost:function(e){return w.host.getName(e)},getKey:function(e){return w.key.urlSafe(e)},getName:function(e){return n(e)}}),policySignature:new qq.s3.RequestSigner({expectingPolicy:!0,signatureSpec:g,cors:e.cors,log:i}),restSignature:new qq.s3.RequestSigner({endpointStore:d,signatureSpec:g,cors:e.cors,log:i})},y={initParams:function(e){var t=c.get(e);return t[l]=n(e),qq.s3.util.generateAwsParams({endpoint:d.get(e),clockDrift:o,params:t,type:_._getMimeType(e),bucket:w.bucket.getName(e),key:_.getThirdPartyFileId(e),accessKey:v.get().accessKey,sessionToken:v.get().sessionToken,acl:p.get(e),expectedStatus:r,minFileSize:m.minSizeLimit,maxFileSize:m.maxSizeLimit,reducedRedundancy:q,region:h,serverSideEncryption:f,signatureVersion:g.version,log:i},qq.bind(S.policySignature.getSignature,this,e))},send:function(e){var t=new qq.Promise,n=_._createXhr(e),o=_.getFile(e);return _._registerProgressHandler(e),w.track(e,n).then(t.success,t.failure),y.setup(e,n,o).then(function(t){i("Sending upload request for "+e),n.send(t)},t.failure),t},setup:function(e,t,n){var i=new FormData,o=d.get(e),r=o,s=new qq.Promise;return y.initParams(e).then(function(e){t.open("POST",r,!0),qq.obj2FormData(e,i),i.append("file",n),s.success(i)},function(e){s.failure({error:e})}),s}},w={bucket:{promise:function(e){var t=new qq.Promise,n=_._getFileState(e).bucket;return n?t.success(n):s(e).then(function(n){_._getFileState(e).bucket=n,t.success(n)},t.failure),t},getName:function(e){return _._getFileState(e).bucket}},host:{promise:function(e){var t=new qq.Promise,n=_._getFileState(e).host;return n?t.success(n):a(e).then(function(n){_._getFileState(e).host=n,t.success(n)},t.failure),t},getName:function(e){return _._getFileState(e).host}},done:function(e,t){var n=w.response.parse(e,t),o=n.success!==!0;return o&&w.response.shouldReset(n.code)&&(i("This is an unrecoverable error, we must restart the upload entirely on the next retry attempt.","error"),n.reset=!0),{success:!o,response:n}},key:{promise:function(e){var t=new qq.Promise,i=_.getThirdPartyFileId(e);return null==i?(_._setThirdPartyFileId(e,t),u(e,n(e)).then(function(n){_._setThirdPartyFileId(e,n),t.success(n)},function(n){_._setThirdPartyFileId(e,null),t.failure(n)})):qq.isGenericPromise(i)?i.then(t.success,t.failure):t.success(i),t},urlSafe:function(e){var t=encodeURIComponent(_.getThirdPartyFileId(e));return t.replace(/%2F/g,"/")}},response:{parse:function(e,t){var n,o={};try{i(qq.format("Received response status {} with body: {}",t.status,t.responseText)),t.status===r?o.success=!0:(n=w.response.parseError(t.responseText),n&&(o.error=n.message,o.code=n.code))}catch(e){i("Error when attempting to parse xhr response text ("+e.message+")","error")}return o},parseError:function(e){var t,n,i=new DOMParser,o=i.parseFromString(e,"application/xml"),r=o.getElementsByTagName("Error"),s={};if(r.length)return t=o.getElementsByTagName("Code"),n=o.getElementsByTagName("Message"),n.length&&(s.message=n[0].textContent),t.length&&(s.code=t[0].textContent),s},shouldReset:function(e){return"EntityTooSmall"===e||"InvalidPart"===e||"InvalidPartOrder"===e||"NoSuchUpload"===e}},start:function(e,t){var n=new qq.Promise;return w.key.promise(e).then(function(){w.bucket.promise(e).then(function(){w.host.promise(e).then(function(){null==t?y.send(e).then(n.success,n.failure):b.send(e,t).then(n.success,n.failure)})})},function(e){n.failure({error:e})}),n},track:function(e,t,n){var i=new qq.Promise;return t.onreadystatechange=function(){if(4===t.readyState){var o;null==n?(o=w.done(e,t),i[o.success?"success":"failure"](o.response,t)):(b.done(e,t,n),o=w.done(e,t),i[o.success?"success":"failure"](o.response,t))}},i}};qq.extend(this,{uploadChunk:w.start,uploadFile:w.start}),qq.extend(this,new qq.XhrUploadHandler({options:qq.extend({namespace:"s3"},e),proxy:qq.extend({getEndpoint:e.endpointStore.get},t)})),qq.override(this,function(e){return{expunge:function(t){var n=_._getPersistableData(t)&&_._getPersistableData(t).uploadId,i=_._maybeDeletePersistedChunkData(t);void 0!==n&&i&&S.abortMultipart.send(t,n),e.expunge(t)},finalizeChunks:function(e){return b.combine(e)},_getLocalStorageId:function(t){var n=e._getLocalStorageId(t),i=w.bucket.getName(t);return n+"-"+i}}})},qq.s3.FormUploadHandler=function(e,t){"use strict";function n(t,n){var i,o,r,s=(e.endpointStore.get(t),a._getFileState(t).bucket);try{if(i=n.contentDocument||n.contentWindow.document,o=i.body.innerHTML,r=qq.s3.util.parseIframeResponse(n),r.bucket===s&&r.key===qq.s3.util.encodeQueryStringParam(a.getThirdPartyFileId(t)))return!0;p("Response from AWS included an unexpected bucket or key name.","error")}catch(e){p("Error when attempting to parse form upload response ("+e.message+")","error")}return!1}function i(e){var t=m.get(e);return t[f]=c(e),qq.s3.util.generateAwsParams({endpoint:g.get(e),clockDrift:u,params:t,bucket:a._getFileState(e).bucket,key:a.getThirdPartyFileId(e),accessKey:x.get().accessKey,sessionToken:x.get().sessionToken,acl:_.get(e),minFileSize:y.minSizeLimit,maxFileSize:y.maxSizeLimit,successRedirectUrl:C,reducedRedundancy:v,region:b,serverSideEncryption:S,signatureVersion:w.version,log:p},qq.bind(E.getSignature,this,e))}function o(t,n){var o=new qq.Promise,r="POST",u=e.endpointStore.get(t),l=c(t);return i(t).then(function(e){var t=a._initFormForUpload({method:r,endpoint:u,params:e,paramsInBody:!0,targetName:n.name});o.success(t)},function(e){o.failure(e),s(t,n,l,{error:e})}),o}function r(e){var t=a._createIframe(e),i=a.getInput(e),r=new qq.Promise;return o(e,t).then(function(o){o.appendChild(i),a._attachLoadEvent(t,function(i){p("iframe loaded"),i?i.success===!1&&(p("Amazon likely rejected the upload request","error"),r.failure(i)):(i={},i.success=n(e,t),i.success===!1?(p("A success response was received by Amazon, but it was invalid in some way.","error"),r.failure(i)):(qq.extend(i,qq.s3.util.parseIframeResponse(t)),r.success(i))),s(e,t)}),p("Sending upload request for "+e),o.submit(),qq(o).remove()},r.failure),r}function s(e,t){a._detachLoadEvent(e),t&&qq(t).remove()}var a=this,u=e.clockDrift,l=t.onUuidChanged,c=t.getName,d=t.getUuid,p=t.log,q=e.getBucket,h=e.getKeyName,f=e.filenameParam,m=e.paramsStore,g=e.endpointStore,_=e.aclStore,v=e.objectProperties.reducedRedundancy,b=e.objectProperties.region,S=e.objectProperties.serverSideEncryption,y=e.validation,w=e.signature,C=e.iframeSupport.localBlankPagePath,x=e.signature.credentialsProvider,E=new qq.s3.RequestSigner({signatureSpec:w,cors:e.cors,log:p});if(void 0===C)throw new Error("successRedirectEndpoint MUST be defined if you intend to use browsers that do not support the File API!");qq.extend(this,new qq.FormUploadHandler({options:{isCors:!1,inputName:"file"},proxy:{onCancel:e.onCancel,onUuidChanged:l,getName:c,getUuid:d,log:p}})),qq.extend(this,{uploadFile:function(e){var t=c(e),n=new qq.Promise;return a.getThirdPartyFileId(e)?a._getFileState(e).bucket?r(e).then(n.success,n.failure):q(e).then(function(t){a._getFileState(e).bucket=t,r(e).then(n.success,n.failure)}):h(e,t).then(function(t){q(e).then(function(i){a._getFileState(e).bucket=i,a._setThirdPartyFileId(e,t),r(e).then(n.success,n.failure)},function(e){n.failure({error:e})})},function(e){n.failure({error:e})}),n}})},function(){"use strict";qq.s3.FineUploader=function(e){var t={failedUploadTextDisplay:{mode:"custom"}};qq.extend(t,e,!0),qq.FineUploader.call(this,t,"s3"),qq.supportedFeatures.ajaxUploading||void 0!==t.iframeSupport.localBlankPagePath||(this._options.element.innerHTML="<div>You MUST set the <code>localBlankPagePath</code> property of the <code>iframeSupport</code> option since this browser does not support the File API!</div>")},qq.extend(qq.s3.FineUploader.prototype,qq.s3.FineUploaderBasic.prototype),qq.extend(qq.s3.FineUploader.prototype,qq.uiPublicApi),qq.extend(qq.s3.FineUploader.prototype,qq.uiPrivateApi)}(),qq.azure=qq.azure||{},qq.azure.util=qq.azure.util||function(){"use strict";return{AZURE_PARAM_PREFIX:"x-ms-meta-",_paramNameMatchesAzureParameter:function(e){switch(e){case"Cache-Control":case"Content-Disposition":case"Content-Encoding":case"Content-MD5":case"x-ms-blob-content-encoding":case"x-ms-blob-content-disposition":case"x-ms-blob-content-md5":case"x-ms-blob-cache-control":return!0;default:return!1}},_getPrefixedParamName:function(e){return qq.azure.util._paramNameMatchesAzureParameter(e)?e:qq.azure.util.AZURE_PARAM_PREFIX+e},getParamsAsHeaders:function(e){var t={};return qq.each(e,function(e,n){var i=qq.azure.util._getPrefixedParamName(e),o=null;qq.isFunction(n)?o=String(n()):qq.isObject(n)?qq.extend(t,qq.azure.util.getParamsAsHeaders(n)):o=String(n),null!==o&&(qq.azure.util._paramNameMatchesAzureParameter(e)?t[i]=o:t[i]=encodeURIComponent(o))}),t},parseAzureError:function(e,t){var n,i,o=new DOMParser,r=o.parseFromString(e,"application/xml"),s=r.getElementsByTagName("Error")[0],a={};if(t("Received error response: "+e,"error"),s)return i=s.getElementsByTagName("Message")[0],i&&(a.message=i.textContent),n=s.getElementsByTagName("Code")[0],n&&(a.code=n.textContent),t("Parsed Azure error: "+JSON.stringify(a),"error"),a}}}(),function(){"use strict";qq.nonTraditionalBasePublicApi={setUploadSuccessParams:function(e,t){this._uploadSuccessParamsStore.set(e,t)},setUploadSuccessEndpoint:function(e,t){this._uploadSuccessEndpointStore.set(e,t)}},qq.nonTraditionalBasePrivateApi={_onComplete:function(e,t,n,i){var o,r,s=!!n.success,a=this,u=arguments,l=this._uploadSuccessEndpointStore.get(e),c=this._options.uploadSuccess.customHeaders,d=this._options.uploadSuccess.method,p=this._options.cors,q=new qq.Promise,h=this._uploadSuccessParamsStore.get(e),f=this._paramsStore.get(e),m=function(t){delete a._failedSuccessRequestCallbacks[e],qq.extend(n,t),qq.FineUploaderBasic.prototype._onComplete.apply(a,u),q.success(t)},g=function(r){var s=o;qq.extend(n,r),n&&n.reset&&(s=null),s?a._failedSuccessRequestCallbacks[e]=s:delete a._failedSuccessRequestCallbacks[e],a._onAutoRetry(e,t,n,i,s)||(qq.FineUploaderBasic.prototype._onComplete.apply(a,u),q.failure(r))};return s&&l?(r=new qq.UploadSuccessAjaxRequester({endpoint:l,method:d,customHeaders:c,cors:p,log:qq.bind(this.log,this)}),qq.extend(h,a._getEndpointSpecificParams(e,n,i),!0),f&&qq.extend(h,f,!0),o=qq.bind(function(){r.sendSuccessRequest(e,h).then(m,g)},a),o(),q):qq.FineUploaderBasic.prototype._onComplete.apply(this,arguments)},_manualRetry:function(e){var t=this._failedSuccessRequestCallbacks[e];return qq.FineUploaderBasic.prototype._manualRetry.call(this,e,t)}}}(),function(){"use strict";qq.azure.FineUploaderBasic=function(e){
if(!qq.supportedFeatures.ajaxUploading)throw new qq.Error("Uploading directly to Azure is not possible in this browser.");var t={signature:{endpoint:null,customHeaders:{}},blobProperties:{name:"uuid"},uploadSuccess:{endpoint:null,method:"POST",params:{},customHeaders:{}},chunking:{partSize:4e6,minFileSize:4000001}};qq.extend(t,e,!0),qq.FineUploaderBasic.call(this,t),this._uploadSuccessParamsStore=this._createStore(this._options.uploadSuccess.params),this._uploadSuccessEndpointStore=this._createStore(this._options.uploadSuccess.endpoint),this._failedSuccessRequestCallbacks={},this._cannedBlobNames={}},qq.extend(qq.azure.FineUploaderBasic.prototype,qq.basePublicApi),qq.extend(qq.azure.FineUploaderBasic.prototype,qq.basePrivateApi),qq.extend(qq.azure.FineUploaderBasic.prototype,qq.nonTraditionalBasePublicApi),qq.extend(qq.azure.FineUploaderBasic.prototype,qq.nonTraditionalBasePrivateApi),qq.extend(qq.azure.FineUploaderBasic.prototype,{getBlobName:function(e){return null==this._cannedBlobNames[e]?this._handler.getThirdPartyFileId(e):this._cannedBlobNames[e]},_getEndpointSpecificParams:function(e){return{blob:this.getBlobName(e),uuid:this.getUuid(e),name:this.getName(e),container:this._endpointStore.get(e)}},_createUploadHandler:function(){return qq.FineUploaderBasic.prototype._createUploadHandler.call(this,{signature:this._options.signature,onGetBlobName:qq.bind(this._determineBlobName,this),deleteBlob:qq.bind(this._deleteBlob,this,!0)},"azure")},_determineBlobName:function(e){var t=this._options.blobProperties.name,n=this.getUuid(e),i=this.getName(e),o=qq.getExtension(i),r=n;if(!qq.isString(t))return t.call(this,e);switch(t){case"uuid":return void 0!==o&&(r+="."+o),(new qq.Promise).success(r);case"filename":return(new qq.Promise).success(i);default:return new qq.Promise.failure("Invalid blobName option value - "+t)}},_addCannedFile:function(e){var t;if(null==e.blobName)throw new qq.Error("Did not find blob name property in server session response. This is required!");return t=qq.FineUploaderBasic.prototype._addCannedFile.apply(this,arguments),this._cannedBlobNames[t]=e.blobName,t},_deleteBlob:function(e,t){var n=this,i={},o={get:function(e){return n._endpointStore.get(e)+"/"+n.getBlobName(e)}},r={get:function(e){return i[e]}},s=function(e,t){i[e]=t,u.send(e)},a=function(t,i,o){e?(n.log("Will cancel upload, but cannot remove uncommitted parts from Azure due to issue retrieving SAS","error"),qq.FineUploaderBasic.prototype._onCancel.call(n,t,n.getName(t))):(n._onDeleteComplete(t,o,!0),n._options.callbacks.onDeleteComplete(t,o,!0))},u=new qq.azure.DeleteBlob({endpointStore:r,log:qq.bind(n.log,n),onDelete:function(e){n._onDelete(e),n._options.callbacks.onDelete(e)},onDeleteComplete:function(t,o,r){delete i[t],r&&(e?n.log("Will cancel upload, but failed to remove uncommitted parts from Azure.","error"):qq.azure.util.parseAzureError(o.responseText,qq.bind(n.log,n))),e?(qq.FineUploaderBasic.prototype._onCancel.call(n,t,n.getName(t)),n.log("Deleted uncommitted blob chunks for "+t)):(n._onDeleteComplete(t,o,r),n._options.callbacks.onDeleteComplete(t,o,r))}}),l=new qq.azure.GetSas({cors:this._options.cors,endpointStore:{get:function(){return n._options.signature.endpoint}},restRequestVerb:u.method,log:qq.bind(n.log,n)});l.request(t,o.get(t)).then(qq.bind(s,n,t),qq.bind(a,n,t))},_createDeleteHandler:function(){var e=this;return{sendDelete:function(t,n){e._deleteBlob(!1,t)}}}})}(),qq.azure.XhrUploadHandler=function(e,t){"use strict";function n(e){var t=new qq.Promise;return o(e).then(function(n){var i=s._getMimeType(e),o=s._getPersistableData(e).blockIdEntries;v.putBlockList.send(e,n,o,i,function(t){s._registerXhr(e,null,t,v.putBlockList)}).then(function(n){a("Success combining chunks for id "+e),t.success({},n)},function(n){a("Attempt to combine chunks failed for id "+e,"error"),r(n,t)})},t.failure),t}function i(e){var t=l.get(e),n=new qq.Promise,i=function(i){s._setThirdPartyFileId(e,i),n.success(t+"/"+i)},o=function(e){n.failure(e)};return f(e).then(i,o),n}function o(e,t){var n=null==t?e:e+"."+t,o=new qq.Promise,r=function(e){a("GET SAS request succeeded."),o.success(e)},s=function(e,t){a("GET SAS request failed: "+e,"error"),o.failure({error:"Problem communicating with local server"},t)},u=function(e){v.getSasForPutBlobOrBlock.request(n,e).then(r,s)},l=function(t){a(qq.format("Failed to determine blob name for ID {} - {}",e,t),"error"),o.failure({error:t})};return i(e).then(u,l),o}function r(e,t){var n=qq.azure.util.parseAzureError(e.responseText,a),i="Problem sending file to Azure";t.failure({error:i,azureError:n&&n.message,reset:403===e.status})}var s=this,a=t.log,u=e.cors,l=e.endpointStore,c=e.paramsStore,d=e.signature,p=e.filenameParam,q=e.chunking.minFileSize,h=e.deleteBlob,f=e.onGetBlobName,m=t.getName,g=t.getSize,_=function(e){var t=c.get(e);return t[p]=m(e),t},v={putBlob:new qq.azure.PutBlob({getBlobMetadata:_,log:a}),putBlock:new qq.azure.PutBlock({log:a}),putBlockList:new qq.azure.PutBlockList({getBlobMetadata:_,log:a}),getSasForPutBlobOrBlock:new qq.azure.GetSas({cors:u,customHeaders:d.customHeaders,endpointStore:{get:function(){return d.endpoint}},log:a,restRequestVerb:"PUT"})};qq.extend(this,{uploadChunk:function(e,t){var n=new qq.Promise;return o(e,t).then(function(i){var o=s._createXhr(e,t),u=s._getChunkData(e,t);s._registerProgressHandler(e,t,u.size),s._registerXhr(e,t,o,v.putBlock),v.putBlock.upload(e+"."+t,o,i,t,u.blob).then(function(t){s._getPersistableData(e).blockIdEntries||(s._getPersistableData(e).blockIdEntries=[]),s._getPersistableData(e).blockIdEntries.push(t),a("Put Block call succeeded for "+e),n.success({},o)},function(){a(qq.format("Put Block call failed for ID {} on part {}",e,t),"error"),r(o,n)})},n.failure),n},uploadFile:function(e){var t=new qq.Promise,n=s.getFile(e);return o(e).then(function(i){var o=s._createXhr(e);s._registerProgressHandler(e),v.putBlob.upload(e,o,i,n).then(function(){a("Put Blob call succeeded for "+e),t.success({},o)},function(){a("Put Blob call failed for "+e,"error"),r(o,t)})},t.failure),t}}),qq.extend(this,new qq.XhrUploadHandler({options:qq.extend({namespace:"azure"},e),proxy:qq.extend({getEndpoint:e.endpointStore.get},t)})),qq.override(this,function(e){return{expunge:function(t){var n=s._wasCanceled(t),i=s._getPersistableData(t),o=i&&i.blockIdEntries||[];n&&o.length>0&&h(t),e.expunge(t)},finalizeChunks:function(e){return n(e)},_shouldChunkThisFile:function(t){var n=e._shouldChunkThisFile(t);return n&&g(t)>=q}}})},qq.azure.GetSas=function(e){"use strict";function t(e,t,n){var i=o[e];n?i.failure("Received response code "+t.status,t):t.responseText.length?i.success(t.responseText):i.failure("Empty response.",t),delete o[e]}var n,i={cors:{expected:!1,sendCredentials:!1},customHeaders:{},restRequestVerb:"PUT",endpointStore:null,log:function(e,t){}},o={};qq.extend(i,e),n=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["GET"],method:"GET",successfulResponseCodes:{GET:[200]},contentType:null,customHeaders:i.customHeaders,endpointStore:i.endpointStore,cors:i.cors,log:i.log,onComplete:t})),qq.extend(this,{request:function(e,t){var r=new qq.Promise,s=i.restRequestVerb;return i.log(qq.format("Submitting GET SAS request for a {} REST request related to file ID {}.",s,e)),o[e]=r,n.initTransport(e).withParams({bloburi:t,_method:s}).withCacheBuster().send(),r}})},qq.UploadSuccessAjaxRequester=function(e){"use strict";function t(e,t,n){var r,s=i[e],a=t.responseText,u={success:!0},l={success:!1};delete i[e],o.log(qq.format("Received the following response body to an upload success request for id {}: {}",e,a));try{r=qq.parseJson(a),n||r&&(r.error||r.success===!1)?(o.log("Upload success request was rejected by the server.","error"),s.failure(qq.extend(r,l))):(o.log("Upload success was acknowledged by the server."),s.success(qq.extend(r,u)))}catch(t){n?(o.log(qq.format("Your server indicated failure in its upload success request response for id {}!",e),"error"),s.failure(l)):(o.log("Upload success was acknowledged by the server."),s.success(u))}}var n,i=[],o={method:"POST",endpoint:null,maxConnections:3,customHeaders:{},paramsStore:{},cors:{expected:!1,sendCredentials:!1},log:function(e,t){}};qq.extend(o,e),n=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",method:o.method,endpointStore:{get:function(){return o.endpoint}},paramsStore:o.paramsStore,maxConnections:o.maxConnections,customHeaders:o.customHeaders,log:o.log,onComplete:t,cors:o.cors})),qq.extend(this,{sendSuccessRequest:function(e,t){var r=new qq.Promise;return o.log("Submitting upload success request/notification for "+e),n.initTransport(e).withParams(t).send(),i[e]=r,r}})},qq.azure.DeleteBlob=function(e){"use strict";var t,n="DELETE",i={endpointStore:{},onDelete:function(e){},onDeleteComplete:function(e,t,n){},log:function(e,t){}};qq.extend(i,e),t=qq.extend(this,new qq.AjaxRequester({validMethods:[n],method:n,successfulResponseCodes:function(){var e={};return e[n]=[202],e}(),contentType:null,endpointStore:i.endpointStore,allowXRequestedWithAndCacheControl:!1,cors:{expected:!0},log:i.log,onSend:i.onDelete,onComplete:i.onDeleteComplete})),qq.extend(this,{method:n,send:function(e){return i.log("Submitting Delete Blob request for "+e),t.initTransport(e).send()}})},qq.azure.PutBlob=function(e){"use strict";var t,n="PUT",i={getBlobMetadata:function(e){},log:function(e,t){}},o={},r={},s={get:function(e){return o[e]}};qq.extend(i,e),t=qq.extend(this,new qq.AjaxRequester({validMethods:[n],method:n,successfulResponseCodes:function(){var e={};return e[n]=[201],e}(),contentType:null,customHeaders:function(e){var t=i.getBlobMetadata(e),n=qq.azure.util.getParamsAsHeaders(t);return n["x-ms-blob-type"]="BlockBlob",n},endpointStore:s,allowXRequestedWithAndCacheControl:!1,cors:{expected:!0},log:i.log,onComplete:function(e,t,n){var i=r[e];delete o[e],delete r[e],n?i.failure():i.success()}})),qq.extend(this,{method:n,upload:function(e,n,s,a){var u=new qq.Promise;return i.log("Submitting Put Blob request for "+e),r[e]=u,o[e]=s,t.initTransport(e).withPayload(a).withHeaders({"Content-Type":a.type}).send(n),u}})},qq.azure.PutBlock=function(e){"use strict";function t(e){var t=5,n=new Array(t+1).join("0"),i=(n+e).slice(-t);return btoa(i)}var n,i="PUT",o={},r={},s={log:function(e,t){}},a={},u={get:function(e){return a[e]}};qq.extend(s,e),n=qq.extend(this,new qq.AjaxRequester({validMethods:[i],method:i,successfulResponseCodes:function(){var e={};return e[i]=[201],e}(),contentType:null,endpointStore:u,allowXRequestedWithAndCacheControl:!1,cors:{expected:!0},log:s.log,onComplete:function(e,t,n){var i=r[e],s=o[e];delete a[e],delete r[e],delete o[e],n?i.failure():i.success(s)}})),qq.extend(this,{method:i,upload:function(e,i,u,l,c){var d=new qq.Promise,p=t(l);return r[e]=d,s.log(qq.format("Submitting Put Block request for {} = part {}",e,l)),a[e]=qq.format("{}&comp=block&blockid={}",u,encodeURIComponent(p)),o[e]={part:l,id:p},n.initTransport(e).withPayload(c).send(i),d}})},qq.azure.PutBlockList=function(e){"use strict";function t(e){var t=document.implementation.createDocument(null,"BlockList",null);return e.sort(function(e,t){return e.part-t.part}),qq.each(e,function(e,n){var i=t.createElement("Latest"),o=t.createTextNode(n.id);i.appendChild(o),qq(t).children()[0].appendChild(i)}),(new XMLSerializer).serializeToString(t)}var n,i="PUT",o={},r={getBlobMetadata:function(e){},log:function(e,t){}},s={},a={get:function(e){return s[e]}};qq.extend(r,e),n=qq.extend(this,new qq.AjaxRequester({validMethods:[i],method:i,successfulResponseCodes:function(){var e={};return e[i]=[201],e}(),customHeaders:function(e){var t=r.getBlobMetadata(e);return qq.azure.util.getParamsAsHeaders(t)},contentType:"text/plain",endpointStore:a,allowXRequestedWithAndCacheControl:!1,cors:{expected:!0},log:r.log,onSend:function(){},onComplete:function(e,t,n){var i=o[e];delete s[e],delete o[e],n?i.failure(t):i.success(t)}})),qq.extend(this,{method:i,send:function(e,i,a,u,l){var c,d=new qq.Promise,p=t(a);return o[e]=d,r.log(qq.format("Submitting Put Block List request for {}",e)),s[e]=qq.format("{}&comp=blocklist",i),c=n.initTransport(e).withPayload(p).withHeaders({"x-ms-blob-content-type":u}).send(),l(c),d}})},function(){"use strict";qq.azure.FineUploader=function(e){var t={failedUploadTextDisplay:{mode:"custom"}};qq.extend(t,e,!0),qq.FineUploader.call(this,t,"azure")},qq.extend(qq.azure.FineUploader.prototype,qq.azure.FineUploaderBasic.prototype),qq.extend(qq.azure.FineUploader.prototype,qq.uiPublicApi),qq.extend(qq.azure.FineUploader.prototype,qq.uiPrivateApi),qq.extend(qq.azure.FineUploader.prototype,{})}()}(window);
//# sourceMappingURL=all.fine-uploader.min.js.map
fineuploader的css文件(fine-uploader-new.min.css)
.qq-btn,.qq-upload-button{box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 1px 0 rgba(0,0,0,.36),0 -2px 12px rgba(0,0,0,.08) inset}.qq-btn{padding:3px 4px;border:1px solid #CCC;border-radius:2px;color:inherit;background-color:#FFF}.qq-upload-delete{background-color:#e65c47;color:#FAFAFA;border-color:#dc523d;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-delete:hover{background-color:#f56b56}.qq-upload-cancel{background-color:#F5D7D7;border-color:#e6c8c8}.qq-upload-cancel:hover{background-color:#ffe1e1}.qq-upload-retry{background-color:#EBF6E0;border-color:#d2ddc7}.qq-upload-retry:hover{background-color:#f7ffec}.qq-upload-continue,.qq-upload-pause{background-color:#00ABC7;color:#FAFAFA;border-color:#2dadc2;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-continue:hover,.qq-upload-pause:hover{background-color:#0fbad6}.qq-upload-button{display:inline;width:105px;margin-bottom:10px;padding:7px 10px;text-align:center;float:left;background:#00ABC7;color:#FFF;border-radius:2px;border:1px solid #2dadc2}.qq-upload-button-hover{background:#33B6CC}.qq-upload-button-focus{outline:#000 dotted 1px}.qq-uploader{position:relative;min-height:200px;max-height:490px;overflow-y:hidden;width:inherit;border-radius:6px;background-color:#FDFDFD;border:1px dashed #CCC;padding:20px}.qq-uploader:before{content:attr(qq-drop-area-text) " ";position:absolute;font-size:200%;left:0;width:100%;text-align:center;top:45%;opacity:.25}.qq-upload-drop-area,.qq-upload-extra-drop-area{position:absolute;top:0;left:0;width:100%;height:100%;min-height:30px;z-index:2;background:#F9F9F9;border-radius:4px;border:1px dashed #CCC;text-align:center}.qq-upload-drop-area span{display:block;position:absolute;top:50%;width:100%;margin-top:-8px;font-size:16px}.qq-upload-extra-drop-area{position:relative;margin-top:50px;font-size:16px;padding-top:30px;height:20px;min-height:40px}.qq-upload-drop-area-active{background:#FDFDFD;border-radius:4px;border:1px dashed #CCC}.qq-upload-list{margin:0;padding:0;list-style:none;max-height:450px;overflow-y:auto;box-shadow:0 1px 0 rgba(15,15,50,.14);clear:both}.qq-upload-list li{margin:0;padding:9px;line-height:15px;font-size:16px;color:#424242;background-color:#F6F6F6;border-top:1px solid #FFF;border-bottom:1px solid #DDD}.qq-upload-list li:first-child{border-top:none}.qq-upload-list li:last-child{border-bottom:none}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-failed-text,.qq-upload-file,.qq-upload-pause,.qq-upload-retry,.qq-upload-size,.qq-upload-spinner{margin-right:12px;display:inline}.qq-upload-file{vertical-align:middle;display:inline-block;width:300px;text-overflow:ellipsis;white-space:nowrap;overflow-x:hidden;height:18px}.qq-upload-spinner{display:inline-block;background:url(loading.gif);width:15px;height:15px;vertical-align:text-bottom}.qq-drop-processing{display:block}.qq-drop-processing-spinner{display:inline-block;background:url(processing.gif);width:24px;height:24px;vertical-align:text-bottom}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-pause,.qq-upload-retry,.qq-upload-size{font-size:12px;font-weight:400;cursor:pointer;vertical-align:middle}.qq-upload-status-text{font-size:14px;font-weight:700;display:block}.qq-upload-failed-text{display:none;font-style:italic;font-weight:700}.qq-upload-failed-icon{display:none;width:15px;height:15px;vertical-align:text-bottom}.qq-upload-fail .qq-upload-failed-text,.qq-upload-retrying .qq-upload-failed-text{display:inline}.qq-upload-list li.qq-upload-success{background-color:#EBF6E0;color:#424242;border-bottom:1px solid #D3DED1;border-top:1px solid #F7FFF5}.qq-upload-list li.qq-upload-fail{background-color:#F5D7D7;color:#424242;border-bottom:1px solid #DECACA;border-top:1px solid #FCE6E6}.qq-progress-bar{display:block;background:#00abc7;width:0;height:15px;border-radius:6px;margin-bottom:3px}.qq-total-progress-bar{height:25px;border-radius:9px}.qq-total-progress-bar-container{margin-left:9px;display:inline;float:right;width:500px}INPUT.qq-edit-filename{position:absolute;opacity:0;filter:alpha(opacity=0);z-index:-1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"}.qq-upload-file.qq-editable{cursor:pointer;margin-right:4px}.qq-edit-filename-icon.qq-editable{display:inline-block;cursor:pointer}.qq-hide,.qq-uploader DIALOG{display:none}INPUT.qq-edit-filename.qq-editing{position:static;height:28px;padding:0 8px;margin-right:10px;margin-bottom:-5px;border:1px solid #ccc;border-radius:2px;font-size:16px;opacity:1;filter:alpha(opacity=100);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"}.qq-edit-filename-icon{display:none;background:url(edit.gif);width:15px;height:15px;vertical-align:text-bottom;margin-right:16px}.qq-thumbnail-selector{vertical-align:middle;margin-right:12px}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG .qq-dialog-buttons{text-align:center;padding-top:10px}.qq-uploader DIALOG .qq-dialog-buttons BUTTON{margin-left:5px;margin-right:5px}.qq-uploader DIALOG .qq-dialog-message-selector{padding-bottom:10px}.qq-uploader DIALOG::backdrop{background-color:rgba(0,0,0,.7)}/*# sourceMappingURL=fine-uploader-new.min.css.map */
3.jquery.js文件(2.x版本)
二、使用
1.文件页面主要布局代码
<div class="upload-file-dialog" style="border-radius:20px;z-index: 19891015;display:none;width: 500px;height: 370px;position: fixed;top: 48.5px;left: 610px;border:1px solid #ccc;background-color:white">
<div>
<div class="tctop disflex flex_lmr flex_center" style="height:30px;font-size:13px;border-radius:10px;padding-left:5px;padding-right:5px;">
<h3 class="ftwt_none"><i class="layui-icon layui-icon-upload-drag" style="display:inline-block;"></i>上传文件</h3>
<div class="disflex flex_center">
<!--<i class="tc_close tc_close_scwj tc_close_scwj_sx mr10"><img class="disblock" src="/static/images/sx_03.png"/></i>-->
<i class="layui-icon layui-icon-close tc_close_scwj" style="display:inline-block;font-size:17px;"></i>
<!--<i class="tc_close tc_close_scwj"><img class="disblock" src="/static/images/close_03.png" style="width:12px;"/></i>-->
</div>
</div>
<div style="position:relative;top:-8px;left:0;background-color:#464aaa;height:10px;"></div>
<div class="tcbox1" style="padding-top: 0;margin-top:10px;">
</div>
</div>
</div>
<script src="/static/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/js/pan/index.js"></script>
2.调用的js代码 此js包含了upload.js页面(这个页面是fineuploader的主体,包含了html也js代码)
$('.upload-file-dialog .tcbox1').load('/application/inc/pan/upload.html', function() {
$('.scwj').click(function() {
if (paths.length == 0) {
layer.msg('根目录不能上传文件', {icon:5});
return false;
}
initUpload();
});
});
$(".tc_close_scwj").click(function(){
window.location.reload();
//$('.upload-file-dialog').hide();
});
3.upload.html页面(id为:qq-template的script块很重要用于内容的呈现)
<script src="/static/fineuploader/all.fine-uploader.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/static/fineuploader/fine-uploader-new.min.css"/>
<style>
#fine-uploader{
overflow-y:auto;
height:260px;
}
.qq-upload-list li{
background-color:#fff;
border-bottom:1px solid #eee;
padding:15px 9px;
}
.qq-upload-list{
box-shadow:0px;
}
.qq-uploader{
border:0px;
}
.qq-upload-cancel {
background-color: #464aaa;
border-color: #e6c8c8;
color: white;
border: 0px;
}
.qq-upload-list li.qq-upload-success {
background-color:#fff;
border:0px;
border-bottom:1px solid #eee;
padding:15px 9px;
height:63px;
}
::-webkit-scrollbar {
/*滚动条整体样式*/
width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px;
box-shadow: inset 0 0 5px rgba(97, 184, 179, 0.1);
background: #78b4b4;
}
::-webkit-scrollbar-track {
/*滚动条里面轨道*/
box-shadow: inset 0 0 5px rgba(87, 175, 187, 0.1);
border-radius: 10px;
background: #ededed;
}
</style>
<script type="text/template" id="qq-template">
<div class="qq-uploader-selector qq-uploader" qq-drop-area-text="Drop files here">
<!--<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar" style="display:none;"></div>
</div>-->
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span class="qq-upload-drop-area-text-selector"></span>
</div>
<div class="qq-upload-button-selector qq-upload-button" style="display:none;">
<div>上传文件</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul>
<li style="font-weight:bold">
<!--<div style="display:inline-block;width:80px">图标</div>-->
<div style="display:inline-block;width:200px">文件名</div>
<div style="display:inline-block;width:195px">进度</div>
<div style="display:inline-block;">操作</div>
</li>
</ul>
<ul class="qq-upload-list-selector qq-upload-list" aria-live="polite" aria-relevant="additions removals">
<li>
<!--<div style="display:inline-block;width:80px;">
<img class="qq-thumbnail-selector" qq-max-size="70" qq-server-scale>
</div>-->
<span style="display:inline-block;width:180px;" class="qq-upload-file-selector qq-upload-file"></span>
<!--<span class="qq-edit-filename-icon-selector qq-edit-filename-icon" aria-label="Edit filename"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">-->
<div class="qq-progress-bar-container-selector" style="display:inline-block;width:80px;height:10px;border-radius:10px;background-color:#eee;">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="height:10px" class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="progress-status" style="height:30px;width:50px;line-height:30px;display:inline-block;"></span>
<span class="progress-status-finish" style="display:none;width:80px;text-align:center;"><img src="/static/images/scico_ac_03.png" /></span>
<div style="display:inline-block;width:50px;"><span class="qq-upload-spinner-selector qq-upload-spinner"></span></div>
<!--<span class="qq-upload-size-selector qq-upload-size"></span>-->
<button type="button" class="qq-btn qq-upload-cancel-selector qq-upload-cancel">取消</button>
<button type="button" class="qq-btn qq-upload-retry-selector qq-upload-retry">Retry</button>
<!--<button type="button" class="qq-btn qq-upload-delete-selector qq-upload-delete">Delete</button>-->
<!--<span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>-->
</li>
</ul>
<!--<dialog class="qq-alert-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">关闭</button>
</div>
</dialog>-->
<dialog class="qq-confirm-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">No</button>
<button type="button" class="qq-ok-button-selector">Yes</button>
</div>
</dialog>
<dialog class="qq-prompt-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<input type="text">
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">Cancel</button>
<button type="button" class="qq-ok-button-selector">Ok</button>
</div>
</dialog>
</div>
</script>
<div id="fine-uploader"></div>
<div style="text-align:right;margin:10px 20px;">
<button class="layui-btn layui-btn-radius layui-btn-sm" id="triggerUpload">开始上传</button>
</div>
<script type="text/javascript">
var url = {
'upload' : base_url + 'file/upload',
};
var param = {};
function initUpload(param)
{
$('input[name=qqfile]').click();
}
$("#triggerUpload").click(function() { //手动提交
if (file_names.length == 0 || file_names.length == has_file_names.length) {
layui.layer.msg('请选择要上传的文件');
return false;
}
if ($(this).hasClass('layui-btn-disabled')) {
return false;
}
uploader.uploadStoredFiles();
$(this).addClass('layui-btn-disabled');
});
var file_names = [];
var has_file_names = [];
var uploader = new qq.FineUploader({
debug: false,
element: document.getElementById('fine-uploader'),
request: {
endpoint: url.upload,
},
allowXdr: true,// 此参数目前不知道有啥用
expected: true,
sendCredentials: true,
autoUpload:false,
text: {
uploadButton: '选择上传文件' //上传按钮的文字
},
deleteFile: {
enabled: true,
endpoint: ''
},
retry: {
enableAuto: true
},
resume:{
enable:true,
},
chunking: {
enabled: true,
partSize: 30000, // 分组大小,默认为 2M
concurrent: {
enabled: true // 开启并发分组上传,默认并发3个
},
success: {
endpoint: url.upload // 分组上传完成后处理
}
},
callbacks:{
onComplete: function(id, name, responseJSON) {
has_file_names.push(name);
console.log(id,name,'完成');
//$('.qq-file-id-'+id).find('.progress-status').html('<img src="/static/images/scico_ac_03.png" />');
$('.qq-file-id-'+id).find('.progress-status-finish').css({'display':'inline-block'});
$('.qq-file-id-'+id).find('.progress-status').hide();
if (file_names.length == has_file_names.length){
$('#triggerUpload').removeClass('layui-btn-disabled');
}
},
onSubmit: function(id,name) { //选择文件后
uploader.setParams({
token:yxjs.getToken(),
});
console.log(uploader.getFile(id));
$('.upload-file-dialog').show();
},
onValidate:function(data,buttonContainer) {
$('.upload-file-dialog').show();
if (file_names.includes(data.name)) {
layui.layer.msg('不能上传相同的文件',{icon:5});
return false;
}
file_names.push(data.name);
console.log(buttonContainer);
//return false;
},
onProgress:function(id, filename,loaded,total) {
console.log('正在进行中输出');
console.log(id, filename,loaded, total);
},
onError:function(event, id, filename,reason) {
console.log('输出错误');
console.log(event,id,filename,reason);
},
onCancel:function(id, name) {
console.log(file_names);
file_names.remove(name);
if (file_names.length == has_file_names.length) {
$('#triggerUpload').removeClass('layui-btn-disabled');
}
},
onProgress(id,name,uploadedBytes, totalBytes) {
console.log(id, name, uploadedBytes, totalBytes, Math.floor(uploadedBytes/totalBytes*100)+'%');
$('.qq-file-id-'+id).find('.progress-status').show();
$('.qq-file-id-'+id).find('.progress-status').html(Math.floor(uploadedBytes/totalBytes*100)+'%');
}
}
});
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
</script>
最后效果:
