/*! * elFinder - file manager for web * Version 2.1.43 (2018-11-24) * http://elfinder.org * * Copyright 2009-2018, Studio 42 * Licensed under a 3-clauses BSD license */ !function(e,t){if("function"==typeof define&&define.amd)define(["jquery","jquery-ui"],t);else if("undefined"!=typeof exports){var n,i;try{n=require("jquery"),i=require("jquery-ui")}catch(a){}module.exports=t(n,i)}else t(e.jQuery,e.jQuery.ui,!0)}(this,function(e,t,n){n=n||!1;var i=function(t,n,a){var o,r,s,l,c,d,p,u=this,h=[],f=["button","tooltip"],m=e(t),g=e.extend(!0,{},e._data(m.get(0),"events")),v=e("
").append(m.contents()).attr("class",m.attr("class")||"").attr("style",m.attr("style")||""),b=m.attr("id")||"",y="elfinder-"+(b?b:Math.random().toString().substr(2,7)),w="mousedown."+y,x="keydown."+y,k="keypress."+y,C="keyup."+y,z=!1,T=!1,A=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],I="",S={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},O={},j={},M={},F={},D=[],U={},E={},P=[],R={},q=[],H=[],_=new u.command(u),N="auto",L=400,W=null,$="sounds/",B="",K=e(document.createElement("audio")).hide().appendTo("body")[0],V=0,X="",G=null,J=function(t){var n,i,a,o,r,s,l,c={},d={};u.api>=2.1?(u.commandMap=t.options.uiCmdMap&&Object.keys(t.options.uiCmdMap).length?t.options.uiCmdMap:{},X!==JSON.stringify(u.commandMap)&&(X=JSON.stringify(u.commandMap))):u.options.sync=0,t.init?(j={},F={}):(s=I,n="elfinder-subtree-loaded "+u.res("class","navexpand"),r=u.res("class","navcollapse"),i=Object.keys(j),a=function(t){if(!j[t])return!0;var i="directory"===j[t].mime,a=j[t].phash;!(!i||c[a]||!d[a]&&e("#"+u.navHash2Id(j[t].hash)).is(":hidden")&&e("#"+u.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)||!i&&a===I||R[t]?i&&(d[a]=!0):(i&&!c[a]&&(c[a]=!0,e("#"+u.navHash2Id(a)).removeClass(n).next(".elfinder-navbar-subtree").empty()),ee(j[t]))},o=function(){i.length&&(G&&G._abort(),G=u.asyncJob(a,i,{interval:20,numPerOnce:100}).done(function(){var t=u.storage("hide")||{items:{}};Object.keys(M).length&&e.each(M,function(e){t.items[e]||delete M[e]})}))},u.trigger("filesgc").one("filesgc",function(){i=[]}),u.one("opendone",function(){s!==I&&(m.data("lazycnt")?u.one("lazydone",o):o())})),u.sorters={},I=t.cwd.hash,Y(t.files),j[I]||Y([t.cwd]),l=JSON.stringify(u.sorters),B!==l&&(u.trigger("sorterupdate"),B=l),u.lastDir(I),u.autoSync()},Y=function(t,n){var i,a,o,r,s={name:!0,perm:!0,date:!0,size:!0,kind:!0},l=!u.sorters._checked,c=t.length,d=function(t){var n=t||{},i=[];e.each(u.sortRules,function(e){(s[e]||"undefined"!=typeof n[e]||"mode"===e&&"undefined"!=typeof n.perm)&&i.push(e)}),u.sorters=u.arrayFlip(i,!0),u.sorters._checked=!0},p=["sizeInfo"],h={},f=u.storage("hide")||{},m=f.items||{};for(a=0;a script").each(function(){if(this.src&&this.src.match(/js\/elfinder(?:-[a-z0-9_-]+)?\.(?:min|full)\.js$/i))return t=e(this),!1}),t&&(n=e('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length,n||(u.cssloaded=null),a=t.attr("src").replace(/js\/[^\/]+$/,""),a.match(/^(https?\/\/|\/)/)||(i=e("head > base[href]").attr("href"))&&(a=i.replace(/\/$/,"")+"/"+a)),""!==a?u.options.baseUrl=a:(u.options.baseUrl||(u.options.baseUrl="./"),a=u.options.baseUrl),a)}(),this.i18nBaseUrl=(this.options.i18nBaseUrl||this.baseUrl+"js/i18n").replace(/\/$/,"")+"/",S.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(){var t=u.baseUrl;null===u.cssloaded&&(m.data("cssautoloadHide",e("")),e("head").append(m.data("cssautoloadHide")),u.loadCss([t+"css/elfinder.min.css",t+"css/theme.css"],{dfd:e.Deferred().always(function(){m.data("cssautoloadHide")&&(m.data("cssautoloadHide").remove(),m.removeData("cssautoloadHide"))}).done(function(){u.cssloaded||(u.cssloaded=!0,u.trigger("cssloaded"))}).fail(function(){u.cssloaded=!1,u.error(["errRead","CSS (elfinder or theme)"])})}),Array.isArray(u.options.cssAutoLoad)&&u.loadCss(u.options.cssAutoLoad)),u.options.cssAutoLoad=!1}(),u.changeTheme(u.storage("theme")||u.options.theme),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},re||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(u.options.debug,function(){t[this]=!0}),u.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(f,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(u.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){if("undefined"!=typeof u.options.cors&&null!==u.options.cors)u.isCORS=!!u.options.cors;else{var t,i=document.createElement("a"),a=window.location.protocol,o=function(e){return e=e&&":"!==e?e:a,"https:"===e?/\:443$/:/\:80$/},r=window.location.host.replace(o(a),"");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(r!==i.host.replace(o(i.protocol),"")||":"!==i.protocol&&""!==i.protocol&&a!==i.protocol||t&&(r!==t.host.replace(o(t.protocol),"")||":"!==t.protocol&&""!==t.protocol&&a!==t.protocol))&&(u.isCORS=!0)}u.isCORS&&(e.isPlainObject(u.options.customHeaders)||(u.options.customHeaders={}),e.isPlainObject(u.options.xhrFields)||(u.options.xhrFields={}),u.options.requestType="post",u.options.customHeaders["X-Requested-With"]="XMLHttpRequest",u.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",s=Math.max(parseInt(this.options.requestMaxConn),1),this.optsCustomData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customData=Object.assign({},this.optsCustomData),this.prevCustomData=null,this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.replaceXhrSend=function(){p||(p=XMLHttpRequest.prototype.send),XMLHttpRequest.prototype.send=function(){var t=this;return u.customHeaders&&e.each(u.customHeaders,function(e){t.setRequestHeader(e,this)}),u.xhrFields&&e.each(u.xhrFields,function(e){e in t&&(t[e]=this)}),p.apply(this,arguments)}},this.restoreXhrSend=function(){p&&(XMLHttpRequest.prototype.send=p)},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.navPrefix="nav"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",this.cwdPrefix=i.prototype.uniqueid?"cwd"+i.prototype.uniqueid+"-":"",++i.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=y,this.today=new Date(oe.getFullYear(),oe.getMonth(),oe.getDate()).getTime()/1e3,this.yesterday=this.today-86400,l=this.options.UTCDate?"UTC":"",this.getHours="get"+l+"Hours",this.getMinutes="get"+l+"Minutes",this.getSeconds="get"+l+"Seconds",this.getDate="get"+l+"Date",this.getDay="get"+l+"Day",this.getMonth="get"+l+"Month",this.getFullYear="get"+l+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.lang=this.storage("lang")||this.options.lang,"jp"===this.lang&&(this.lang=this.options.lang="ja"),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortAlsoTreeview=this.storage("sortAlsoTreeview"),null===this.sortAlsoTreeview?this.sortAlsoTreeview=!!this.options.sortAlsoTreeview:this.sortAlsoTreeview=!!this.sortAlsoTreeview,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete u.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,o,r=e(this),s=e.grep(n.helper.data("files")||[],function(e){return!!e}),l=[],c=[],d=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==y||!u.insideWorkzone(t.pageX,t.pageY))return!1;for(a=r.hasClass(u.res(h,"cwdfile"))?u.cwdId2Hash(r.attr("id")):r.hasClass(u.res(h,"navdir"))?u.navId2Hash(r.attr("id")):I,i=s.length;i--;)o=s[i],o!=a&&j[o].phash!=a?l.push(o):(p&&o!==a&&j[a].write?c:d).push(o);return!d.length&&(n.helper.data("droped",!0),c.length&&(n.helper.hide(),u.exec("duplicate",c,{_userAction:!0})),void(l.length&&(n.helper.hide(),u.clipboard(l,!p),u.exec("paste",a,{_userAction:!0},a).always(function(){u.clipboard([]),u.trigger("unlockfiles",{files:s})}),u.trigger("drop",{files:s}))))}},this.enabled=function(){return z&&this.visible()},this.visible=function(){return m[0].elfinder&&m.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||I;var i,a;if(!n&&(e.each(u.roots,function(e,n){if(0===t.indexOf(e))return i=n,!1}),i))return i;for(i=j[t];i&&i.phash&&(n||!i.isroot);)i=j[i.phash];if(i)return i.hash;for(;a in j&&j.hasOwnProperty(a);)if(i=j[a],"directory"===i.mime&&!i.phash&&i.read)return i.hash;return""},this.cwd=function(){return j[I]||{}},this.option=function(t,n){var i,a;return n=n||I,u.optionsByHashes[n]&&"undefined"!=typeof u.optionsByHashes[n][t]?u.optionsByHashes[n][t]:!u.hasVolOptions||I===n||(a=u.file(n))&&a.phash===I?O[t]||"":(i="",e.each(u.volOptions,function(e,a){if(0===n.indexOf(e))return i=a[t]||"",!1}),i)},this.getDisabledCmds=function(t,n){var i={hidden:!0};return Array.isArray(t)||(t=[t]),e.each(t,function(e,t){var n=u.option("disabledFlip",t);n&&Object.assign(i,n)}),n?i:Object.keys(i)},this.file=function(e,t){return e?j[e]||(t?M[e]:void 0):void 0},this.files=function(t){var n={};return t?F[t]?(e.each(F[t],function(e){j[e]?n[e]=j[e]:delete F[t][e]}),Object.assign({},n)):{}:Object.assign({},j)},this.parents=function(e){for(var t,n=[];e&&(t=this.file(e));)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e;){if(!(n=j[e])||!n.hash){i=[];break}i.unshift(t&&n.i18?n.i18:n.name),e=n.isroot?null:n.phash}return i},this.path=function(t,n,i){var a=j[t]&&j[t].path?j[t].path:this.path2array(t,n).join(O.separator);if(i&&j[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var o,r=e.Deferred(),s=i.notify,l=!1,c=function(){u.request({data:{cmd:"parents",target:j[t].phash},notify:s,preventFail:!0}).done(d).fail(function(){r.reject()})},d=function(){u.one("parentsdone",function(){a=u.path(t,n),""===a&&l?(l=!1,c()):(s&&(clearTimeout(o),s.cnt=-parseInt(s.cnt||0),u.notify(s)),r.resolve(a))})};return a?r.resolve(a):(u.ui.tree?(s&&(o=setTimeout(function(){u.notify(s)},u.notifyDelay)),l=!0,d(!0)):c(),r)}return a},this.url=function(t,n){var i,a=j[t],o=n||{},r=o.async||!1,s=o.temporary||!1,l=r?e.Deferred():null,c=function(n){if(n)return n;if(a.url)return a.url;if("undefined"==typeof i&&(i=u.option("url",!u.isRoot(a)&&a.phash||a.hash)),i)return i+e.map(u.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var o=Object.assign({},u.customData,{cmd:"file",target:a.hash});return u.oldAPI&&(o.cmd="open",o.current=a.phash),u.options.url+(u.options.url.indexOf("?")===-1?"?":"&")+e.param(o,!0)};if(!a||!a.read)return r?l.resolve(""):"";if("1"==a.url||s&&!a.url&&!(i=u.option("url",!u.isRoot(a)&&a.phash||a.hash)))this.request({data:{cmd:"url",target:t,options:{temporary:s?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:s?"file":"url",cnt:1,hideCnt:!0}:{}}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&s&&(e=a.url,a.url="1"),r?void l.resolve(c(e)):c(e)});else{if(!r)return c();l.resolve(c())}return r?l:void 0},this.openUrl=function(t,n){var i=j[t],a="";return i&&i.read?!n&&(i.url?1!=i.url&&(a=i.url):O.url&&0===i.hash.indexOf(u.cwd().volumeid)&&(a=O.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/")),a)?a+=(a.match(/\?/)?"&":"?")+"_".repeat((a.match(/[\?&](_+)t=/g)||["&t="]).sort().shift().match(/[\?&](_*)t=/)[1].length+1)+"t="+(i.ts||parseInt(+new Date/1e3)):(a=this.options.url,a=a+(a.indexOf("?")===-1?"?":"&")+(this.oldAPI?"cmd=open¤t="+i.phash:"cmd=file")+"&target="+i.hash+"&_t="+(i.ts||parseInt(+new Date/1e3)),n&&(a+="&download=1"),e.each(this.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a):""},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",o="";return!(!e.isPlainObject(t)||(u.searchStatus.state&&0!==t.hash.indexOf(u.cwd().volumeid)?(n=u.option("tmbUrl",t.hash),i=u.option("tmbCrop",t.hash)):(n=O.tmbUrl,i=O.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(o=u.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(u.oldAPI||n)&&t&&t.tmb&&1!=t.tmb?o=n+t.tmb:u.newAPI&&t&&t.tmb&&1!=t.tmb&&(o=t.tmb),!o))&&(t.ts&&"self"!==n&&(o+=(o.match(/\?/)?"&":"?")+"_t="+t.ts),{url:o,className:a})},this.selected=function(){return D.slice(0)},this.selectedFiles=function(){return e.map(D,function(e){return j[e]?Object.assign({},j[e]):null})},this.fileByName=function(e,t){var n;for(n in j)if(j.hasOwnProperty(n)&&j[n].phash==t&&j[n].name==e)return j[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),e<1&&(e=0)),e},this.request=function(t){var n,i,a,o,r=this,l=this.options,c=e.Deferred(),d=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),p=Object.assign({},r.customData,{mimes:l.onlyMimes},t.data||t),u=p.cmd,h="binary"===(t.options||{}).dataType,f=!t.asNotOpen&&"open"===u,m=!(h||t.preventDefault||t.preventFail),g=!(h||t.preventDefault||t.preventDone),v=Object.assign({},t.notify),b=!!t.cancel,y=h||!!t.raw,w=t.syncOnFail,x=!!t.lazy,k=t.prepare,C=t.navigate,z=(t.options||{}).cache,T=Object.assign({url:l.url,async:!0,type:this.requestType,dataType:"json",cache:r.api>=2.1029,data:p,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),A=function(t){t.warning&&r.error(t.warning),f?J(t):r.updateCache(t),t.changed&&t.changed.length&&Z(t.changed),r.lazy(function(){t.removed&&t.removed.length&&r.remove(t),t.added&&t.added.length&&r.add(t),t.changed&&t.changed.length&&r.change(t)}).then(function(){return r.lazy(function(){r.trigger(u,t,!1)})}).then(function(){return r.lazy(function(){r.trigger(u+"done")})}).then(function(){t.toasts&&Array.isArray(t.toasts)&&e.each(t.toasts,function(){this.msg&&r.toast(this)}),t.sync&&r.sync()})},j=function(e,t){var n,i,a=r.options.debug;switch(t){case"abort":n=e.quiet?"":["errConnect","errAbort"];break;case"timeout":n=["errConnect","errTimeout"];break;case"parsererror":n=["errResponse","errDataNotJSON"],e.responseText&&(!I||a&&("all"===a||a["backend-error"]))&&n.push(e.responseText);break;default:if(e.responseText)try{i=JSON.parse(e.responseText),i&&i.error&&(n=i.error)}catch(o){}if(!n)if(403==e.status)n=["errConnect","errAccess","HTTP error "+e.status];else if(404==e.status)n=["errConnect","errNotFound","HTTP error "+e.status];else if(e.status>=500)n=["errResponse","errServerError","HTTP error "+e.status];else{if(414==e.status&&"get"===T.type)return T.type="post",r.abortXHR(e),void(c.xhr=e=r.transport.send(T).fail(n).done(M));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}r.trigger(u+"done"),c.reject({error:n},e,t)},M=function(t){var n=r.options.debug;if(r.currentReqCmd=u,!t.debug||n&&"all"===n||(n||(n=r.options.debug={}),n["backend-error"]=!0,n.warning=!0),y)return r.abortXHR(i),t&&t.debug&&r.debug("backend-debug",t),c.resolve(t);if(!t)return c.reject({error:["errResponse","errDataEmpty"]},i,t);if(!e.isPlainObject(t))return c.reject({error:["errResponse","errDataNotJSON"]},i,t);if(t.error)return f&&e.each(r.leafRoots,function(t,n){r.leafRoots[t]=e.grep(n,function(e){return e!==p.target})}),c.reject({error:t.error},i,t);var a=function(){var n,a=function(n){r.leafRoots[p.target]&&t[n]&&e.each(r.leafRoots[p.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})},o=function(){r.textMimes={},e.each(r.res("mimes","text"),function(){r.textMimes[this.toLowerCase()]=!0})};return f?a("files"):"tree"===u&&a("tree"),t=r.normalize(t),r.validResponse(u,t)?(f&&(r.api||(r.api=t.api||1,"2.0"==r.api&&"undefined"!=typeof t.options.uploadMaxSize&&(r.api="2.1"),r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.textMimes&&Array.isArray(t.textMimes)&&(r.resources.mimes.text=t.textMimes,o()),!r.textMimes&&o(),t.options&&(O=Object.assign({},S,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),p.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?Math.max(parseInt(t.uplMaxFile),50):20)),"function"==typeof k&&k(t),C&&(n=C.target||"added",t[n]&&t[n].length&&r.one(u+"done",function(){var i=t[n],a=r.findCwdNodes(i),o=function(){var t=r.cwd().hash;return e.map(i,function(e){return e.phash&&t===e.phash?e.hash:null})},s=o(),l=function(t){var n,i,a,l=void 0,c=t.action?t.action.data:void 0;return(c||s.length)&&t.action&&(i=t.action.msg)&&(n=t.action.cmd)&&(!t.action.cwdNot||t.action.cwdNot!==r.cwd().hash)&&(a=t.action.done,c=t.action.data,l=e("
").append(e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){r.exec(n,c||s,{_userAction:!0,_currentType:"toast",_currentNode:e(this)}),a&&r.one(n+"done",function(){"function"==typeof a?a():"select"===a&&r.trigger("selectfiles",{files:o()})})}))),delete t.action,t.extNode=l,t};C.toast||(C.toast={}),!C.noselect&&r.trigger("selectfiles",{files:r.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(C.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),r.resources.blink(a,"lookme")),e.isPlainObject(C.toast.incwd)&&r.toast(l(C.toast.incwd))):e.isPlainObject(C.toast.inbuffer)&&r.toast(l(C.toast.inbuffer))})),c.resolve(t),void(t.debug&&r.debug("backend-debug",t))):c.reject({error:t.norError||"errResponse"},i,t)};r.abortXHR(i),x?r.lazy(a):a()},F=function(e){i&&"pending"===i.state()&&(r.abortXHR(i,{quiet:!0,abort:!0}),(!e||"unload"!==e.type&&"destroy"!==e.type)&&r.autoSync())},D=function(e){if(r.trigger(u+"done"),"autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;F(e)},U=function(t){var n=function(){w=!1,c.reject()};if(t&&"cmd"===t)return u;if(f){if(ie)return c.reject();ie=!0}if(c.always(function(){delete T.headers["X-elFinderReqid"]}).fail(function(t,n,i){var a={cmd:u,err:t,xhr:n,rc:i};0===t&&ne.length&&(ne=e.grep(ne,function(e){return e("cmd")!==u})),r.trigger("requestError",a),a._event&&a._event.isDefaultPrevented()&&(m=!1,w=!1,t&&(t.error="")),F(),f&&(o=r.file(p.target),o&&o.volumeid&&r.isRoot(o)&&delete r.volumeExpires[o.volumeid]),r.trigger(u+"fail",i),t&&(m?r.error(t):r.debug("error",r.i18n(t))),w&&r.sync()}),!u)return w=!1,c.reject({error:"errCmdReq"});if(r.maxTargets&&p.targets&&p.targets.length>r.maxTargets)return w=!1,c.reject({error:["errMaxTargets",r.maxTargets]});if(g&&c.done(A),f){for(;a=q.pop();)a.queueAbort();if(I!==p.target)for(;a=H.pop();)a.queueAbort()}return e.inArray(u,(r.cmdsToAdd+" autosync").split(" "))!==-1&&("autosync"!==u&&(r.autoSync("stop"),c.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete T.preventFail,r.api>=2.1029&&(z?T.headers["X-elFinderReqid"]=d:Object.assign(T.data,{reqid:d})),c.syncOnFail=function(e){w=!!e},te++,c.xhr=i=r.transport.send(T).always(function(){T._xhr&&"undefined"!=typeof T._xhr.responseURL&&(i.responseURL=T._xhr.responseURL||""),--te,ne.length?ne.shift()():ie=!1}).fail(j).done(M),r.api>=2.1029&&(i._requestId=d),f||p.compare&&"info"===u?(i.queueAbort=n,q.unshift(i),p.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",D),c.always(function(){var t=e.inArray(i,q);p.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",D),t!==-1&&q.splice(t,1)})):e.inArray(u,r.abortCmdsOnOpen)!==-1&&(i.queueAbort=n,H.unshift(i),c.always(function(){var t=e.inArray(i,H);t!==-1&&H.splice(t,1)})),r.bind("unload destroy",D),c.always(function(){r.unbind("unload destroy",D)}),c},E=function(){return v.type&&v.cnt&&(b&&(v.cancel=c,t.eachCancel&&(v.id=+new Date)),n=setTimeout(function(){r.notify(v),c.always(function(){v.cnt=-(parseInt(v.cnt)||0),r.notify(v)})},r.notifyDelay),c.always(function(){clearTimeout(n)})),f&&(ie=!1),te=2&&(I!==this.root()&&s.push(this.request({data:{cmd:"parents",target:I},preventDefault:!0})),e.each(l(),function(e,t){s.push(i.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,s).fail(function(t,a){n&&e.inArray("errOpen",t)===-1?r.reject(t&&0!=a.status?t:void 0):(r.reject(t),i.parseError(t)&&i.request({data:{cmd:"open",target:i.lastDir("")||i.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,a,s;if(e.cwd.compare&&o===e.cwd.compare)return r.reject();if(n={tree:[]},a=arguments.length,a>1)for(s=1;s-1&&o.splice(r,1));return n=null,this},this.trigger=function(t,n,i){var a,o,r,s,l=t.toLowerCase(),c="object"==typeof n,d=U[l]||[],p=[];if(this.debug("event-"+l,n),c&&"undefined"!=typeof i||(i=!0),o=d.length){for(s=e.Event(l),n&&(n._event=s),i&&(s.data=n),a=0;a0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!E[i]&&(E[i]={keyCode:a,altKey:e.inArray("ALT",r)!=-1,ctrlKey:e.inArray("CTRL",r)!=-1,shiftKey:e.inArray("SHIFT",r)!=-1,type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(E,function(e,n){t.push([n.pattern,u.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(P,function(e){return e.hash})};return void 0!==t&&(P.length&&this.trigger("unlockfiles",{files:i()}),R={},P=e.map(t||[],function(e){var t=j[e];return t?(R[e]=!0,{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:P.slice(0,P.length)}),n&&this.trigger("lockfiles",{files:i()})),P.slice(0,P.length)},this.isCommandEnabled=function(e,t){var n,i,a=u.cwd().volumeid||"";return!t&&u.searchStatus.state>1&&u.selected().length&&(t=u.selected()[0]),n=!t||a&&0===t.indexOf(a)?O.disabledFlip:u.option("disabledFlip",t),i=this._commands[e],!!i&&(i.alwaysEnabled||!n[e])},this.exec=function(t,n,i,a){var o,r;return!a&&this.commandMap[t]&&"hidden"!==this.commandMap[t]&&(t=this.commandMap[t]),"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),!a&&n&&(e.isArray(n)?n.length&&(a=n[0]):a=n),o=this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command"),r=typeof o,"object"===r&&o.promise||(u.debug("warning",'"cmd.exec()" should be returned "$.Deferred" but cmd "'+t+'" returned "'+r+'"'),o=e.Deferred().resolve()),this.trigger("exec",{dfrd:o,cmd:t, files:n,opts:i,dstHash:a}),o},this.dialog=function(t,n){var i=e("
").append(t).appendTo(m).elfinderdialog(n,u),a=i.closest(".ui-dialog"),o=function(){!i.data("draged")&&i.is(":visible")&&i.elfinderdialog("posInit")};return a.length&&(u.bind("resize",o),a.on("remove",function(){u.unbind("resize",o)})),i},this.toast=function(t){return e('
').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(t){return this.ui[t]||(t?e():m)},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(t,n){var i,a=function(){for(var e=m.outerHeight(!0)-m.innerHeight(),t=m;t.get(0)!==W.get(0)&&(t=t.parent(),e+=t.outerHeight(!0)-t.innerHeight(),t.parent().length););return e},o=!m.hasClass("ui-resizable"),r=m.data("resizeSize")||{w:0,h:0},s={};W&&W.data("resizeTm")&&clearTimeout(W.data("resizeTm")),"string"==typeof n&&(i=n.match(/^([0-9.]+)%$/))&&(W&&W.length||(W=e(window)),W.data("marginToMyNode")||W.data("marginToMyNode",a()),W.data("fitToBaseFunc")||W.data("fitToBaseFunc",function(e){var t=W.data("resizeTm");e.preventDefault(),e.stopPropagation(),t&&cancelAnimationFrame(t),m.hasClass("elfinder-fullscreen")||u.UA.Mobile&&W.data("rotated")===u.UA.Rotated||(W.data("rotated",u.UA.Rotated),W.data("resizeTm",requestAnimationFrame(function(){u.restoreSize()})))}),"undefined"==typeof W.data("rotated")&&W.data("rotated",u.UA.Rotated),n=W.height()*(i[1]/100)-W.data("marginToMyNode"),W.off("resize."+u.namespace,W.data("fitToBaseFunc")),o&&W.on("resize."+u.namespace,W.data("fitToBaseFunc"))),m.css({width:t,height:parseInt(n)}),s.w=Math.round(m.width()),s.h=Math.round(m.height()),m.data("resizeSize",s),s.w===r.w&&s.h===r.h||(m.trigger("resize"),this.trigger("resize",{width:s.w,height:s.h}))},this.restoreSize=function(){this.resize(N,L)},this.show=function(){m.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(T=z,z=!1),this.disable(),this.trigger("hide"),m.hide()},this.lazy=function(t,n,i){var a=function(e){var t,n=m.data("lazycnt");e?(t=!m.data("lazyrepaint")&&i.repaint,n?m.data("lazycnt",++n):m.data("lazycnt",1).addClass("elfinder-processing"),t&&m.data("lazyrepaint",!0).css("display")):n&&n>1?m.data("lazycnt",--n):(t=m.data("lazyrepaint"),m.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),t&&m.css("display"),u.trigger("lazydone"))},o=e.Deferred(),r=function(){o.resolve(t.call(o)),a(!1)};return n=n||0,i=i||{},a(!0),n?setTimeout(r,n):requestAnimationFrame(r),o},this.destroy=function(){m&&m[0].elfinder&&(m.hasClass("elfinder-fullscreen")&&u.toggleFullscreen(m),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),P=[],D=[],U={},E={},e(window).off("."+y),e(document).off("."+y),u.trigger=function(){},e(K).remove(),m.off().removeData().empty().append(v.contents()).attr("class",v.attr("class")).attr("style",v.attr("style")),delete m[0].elfinder,e.each(g,function(t,n){e.each(n,function(e,t){m.on(t.type+(t.namespace?"."+t.namespace:""),t.selector,t.handler)})}))},this.autoSync=function(t){var n;if(u.options.sync>=1e3){if(r&&(clearTimeout(r),r=null,u.trigger("autosync",{action:"stop"})),"stop"===t?++V:V=Math.max(0,--V),V||"forcestop"===t||!u.options.syncStart)return;n=function(t){var i;O.syncMinMs&&(t||r)&&(t&&u.trigger("autosync",{action:"start"}),i=Math.max(u.options.sync,O.syncMinMs),r&&clearTimeout(r),r=setTimeout(function(){var t,a=!0,o=I;O.syncChkAsTs&&j[o]&&(t=j[o].ts)?u.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;a=!0,e.compare&&(i=e.compare,i==t&&(a=!1)),a?u.sync(o).always(function(){i&&(j[o].ts=i),n()}):n()}).fail(function(t,a){var o=u.parseError(t);o&&0!=a.status?(u.error(o),Array.isArray(o)&&e.inArray("errOpen",o)!==-1&&u.request({data:{cmd:"open",target:u.lastDir("")||u.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):r=setTimeout(function(){n()},i)}):u.sync(I,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},this.toFront=function(t){var n=m.children(".ui-front").removeClass("elfinder-frontmost"),i=n.last();n.css("z-index",""),e(t).addClass("ui-front elfinder-frontmost").css("z-index",i.css("z-index")+1)},this.toHide=function(t,n){var i,a=e(t);!n&&a.hide(),a.hasClass("elfinder-frontmost")&&(a.removeClass("elfinder-frontmost"),i=m.children(".ui-front:visible:not(.elfinder-frontmost)").last(),i.length&&requestAnimationFrame(function(){m.children(".elfinder-frontmost:visible").length||(u.toFront(i),i.trigger("frontmost"))}))},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(u.zIndex?u.zIndex+1:0,1e3),maxWidth:"",maxHeight:""}},function(){re&&u.UA.Fullscreen&&(u.UA.Fullscreen=!1,se&&"undefined"!=typeof se.attr("allowfullscreen")&&(u.UA.Fullscreen=!0));var t,n,i,a="elfinder-fullscreen",o="elfinder-fullscreen-native",r=function(){var t=0,n=0;e.each(m.children(".ui-dialog,.ui-draggable"),function(i,a){var o=e(a),r=o.position();r.top<0&&(o.css("top",t),t+=20),r.left<0&&(o.css("left",n),n+=20)})},s=u.UA.Fullscreen?{fullElm:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null},exitFull:function(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():void 0},toFull:function(e){return e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():!!e.msRequestFullscreen&&e.msRequestFullscreen()}}:{fullElm:function(){var e;return m.hasClass(a)?m.get(0):(e=m.find("."+a),e.length?e.get(0):null)},exitFull:function(){var i;e(window).off("resize."+y,c),void 0!==n&&e("body").css("overflow",n),n=void 0,t&&(i=t.elm,l(i),e(i).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return n=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(u.getMaximizeCss()).addClass(a).trigger("resize",{fullscreen:"on"}),r(),e(window).on("resize."+y,c).trigger("resize"),!0}},l=function(n){t&&t.elm==n&&(e(n).removeClass(a+" "+o).attr("style",t.style),t=null)},c=function(t){var n;t.target===window&&(i&&cancelAnimationFrame(i),i=requestAnimationFrame(function(){(n=s.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})}))};e(document).on("fullscreenchange."+y+" webkitfullscreenchange."+y+" mozfullscreenchange."+y+" MSFullscreenChange."+y,function(n){if(u.UA.Fullscreen){var d=s.fullElm(),p=e(window);i&&cancelAnimationFrame(i),null===d?(p.off("resize."+y,c),t&&(d=t.elm,l(d),e(d).trigger("resize",{fullscreen:"off"}))):(e(d).addClass(a+" "+o).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+y,c),r()),p.trigger("resize")}}),u.toggleFullscreen=function(n,i){var a=e(n).get(0),o=null;if(o=s.fullElm()){if(o==a){if(i===!0)return o}else if(i===!1)return o;return s.exitFull(),null}return i===!1?null:(t={elm:a,style:e(a).attr("style")},s.toFull(a)!==!1?a:(t=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){if(e.target===window&&e.data&&e.data.elm){var n=e.data.elm;t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){n.trigger("resize",{maximize:"on"})})}},a=function(t){e(window).off("resize."+y,i),e("body").css("overflow",t.data("bodyOvf")),t.removeClass(n).attr("style",t.data("orgStyle")).removeData("bodyOvf").removeData("orgStyle"),t.trigger("resize",{maximize:"off"})},o=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(u.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+y,{elm:t},i),t.trigger("resize",{maximize:"on"})};u.toggleMaximize=function(t,i){var r=e(t),s=r.hasClass(n);if(s){if(i===!0)return;a(r)}else{if(i===!1)return;o(r)}}}(),Object.assign(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,DIG0:48,DIG1:49,DIG2:50,DIG3:51,DIG4:52,DIG5:53,DIG6:54,DIG7:55,DIG8:56,DIG9:57,NUM0:96,NUM1:97,NUM2:98,NUM3:99,NUM4:100,NUM5:101,NUM6:102,NUM7:103,NUM8:104,NUM9:105,CONTEXTMENU:93,DOT:190}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return u.UA.IE||(t._xhr=new XMLHttpRequest,t.xhr=function(){return t._xhr}),e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.decodeRawString=function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];t=55296&&a<=56319?o.push((1023&a)+64<<10|1023&e[++n]):o.push(a);return o},i=function(e){var t,n,i,a,o=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],t=194?o((31&i)<<6|63&e[++t]):i<=239&&i>=224?o((15&i)<<12|(63&e[++t])<<6|63&e[++t]):i<=247&&i>=240?o(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):o(65533);return a};return i(n(e))},this.getContents=function(t,n){var i,a,o=this,r=e.Deferred(),s=n||"arraybuffer";return r.fail(function(){a&&"pending"===a.state()&&a.reject()}),i=o.openUrl(t),o.isSameOrigin(i)||(i=o.openUrl(t,!0)),a=o.request({data:{cmd:"get"},options:{url:i,type:"get",cache:!0,dataType:"binary",responseType:s,processData:!1}}).fail(function(){r.reject()}).done(function(e){r.resolve(e)}),r},this.getMimetype=function(e,t){var n,i,a=t;return i=(e+"").match(/\.([^.]+)$/),i&&(n=i[1])&&(o||(o=u.arrayFlip(u.mimeTypes)),(a=o[n.toLowerCase()])||(a=t)),a},u.hashCheckers=[],function(t){var n={check:!0},i=function(e){var i,a=new n.SparkMD5.ArrayBuffer;return i=t.asyncJob(function(e){a.append(e)},e).done(function(){i._md5=a.end()})},a=function(i,a){var o,r;try{o=new n.jsSHA("SHA"+("3"===a.substr(0,1)?a:"-"+a),"ARRAYBUFFER"),r=t.asyncJob(function(e){o.update(e)},i).done(function(){r._sha=o.getHash("HEX")})}catch(s){r=e.Deferred.reject()}return r};t.options.cdns.sparkmd5&&t.hashCheckers.push("md5"),t.options.cdns.jssha&&(t.hashCheckers=t.hashCheckers.concat(["sha1","sha224","sha256","sha384","sha512","sha3-224","sha3-256","sha3-384","sha3-512","shake128","shake256"])),t.getContentsHashes=function(o,r){var s,l=e.Deferred(),c=t.arrayFlip(r||["md5"],!0),d=[],p=[],u={};if(l.fail(function(){s&&s.reject()}),n.check){delete n.check;var h=e.Deferred();window.ArrayBuffer&&t.options.cdns.sparkmd5&&(d.push(h),t.loadScript([t.options.cdns.sparkmd5],function(e){var t=e||window.SparkMD5;window.SparkMD5&&delete window.SparkMD5,h.resolve(),t&&(n.SparkMD5=t)},{tryRequire:!0,error:function(){h.reject()}}));var f=e.Deferred();window.ArrayBuffer&&t.options.cdns.jssha&&(d.push(f),t.loadScript([t.options.cdns.jssha],function(e){var t=e||window.jsSHA;window.jsSHA&&delete window.jsSHA,f.resolve(),t&&(n.jsSHA=t)},{tryRequire:!0,error:function(){f.reject()}}))}return e.when.apply(null,d).always(function(){Object.keys(n).length?s=t.getContents(o).done(function(r){var s=r instanceof ArrayBuffer&&r.byteLength>0&&t.sliceArrayBuffer(r,1048576);c.md5&&n.SparkMD5&&p.push(function(){var e=i(s).done(function(){var n;u.md5=e._md5,(n=t.file(o))&&(n.md5=e._md5),l.notify(u)});return l.fail(function(){e.reject()}),e}),n.jsSHA&&e.each(["1","224","256","384","512","3-224","3-256","3-384","3-512","ke128","ke256"],function(e,n){c["sha"+n]&&p.push(function(){var e=a(s,n).done(function(){var i;u["sha"+n]=e._sha,(i=t.file(o))&&(i["sha"+n]=e._sha),l.notify(u)});return e})}),p.length?t.sequence(p).always(function(){l.resolve(u)}):l.reject()}).fail(function(){l.reject()}):l.reject()}),l}}(this),this.parseError=function(t){var n=t;return e.isPlainObject(n)&&(n=n.error),n},this.error=function(){var e,t=arguments[0],n=arguments[1]||null;return 1==arguments.length&&"function"==typeof t?u.bind("error",t):(e=this.parseError(t),e!==!0&&e?u.trigger("error",{error:e,opts:n}):this)},e.each(A,function(t,n){u[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?u.bind(n,t):u.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!z&&u.api&&u.visible()&&u.ui.overlay.is(":hidden")&&!m.children(".elfinder-dialog."+u.res("class","editing")+":visible").length&&(z=!0,document.activeElement&&document.activeElement.blur(),m.removeClass("elfinder-disabled"))}).disable(function(){T=z,z=!1,m.addClass("elfinder-disabled")}).open(function(){D=[]}).select(function(t){var n=0,i=[];D=e.grep(t.data.selected||t.data.value||[],function(e){return i.length||u.maxTargets&&++n>u.maxTargets?(i.push(e),!1):!!j[e]}),i.length&&(u.trigger("unselectfiles",{files:i,inselect:!0}),u.toast({mode:"warning",msg:u.i18n(["errMaxTargets",u.maxTargets])}))}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:u.i18n(u.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[u.i18n(u.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&Object.assign(n,t.data.opts),u.dialog(''+u.i18n(t.data.error),n)}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){j[e]&&(j[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(u.searchStatus,e.data),u.searchStatus.state=1}).bind("search",function(e){u.searchStatus.state=2}).bind("searchend",function(){u.searchStatus.state=0,u.searchStatus.ininc=!1,u.searchStatus.mixed=!1}).bind("canMakeEmptyFile",function(t){var n=t.data,i={};n&&Array.isArray(n.mimes)&&(n.unshift||(i=u.mimesCanMakeEmpty),e.each(n.mimes,function(){i[this]||(i[this]=u.mimeTypes[this])}),n.unshift&&(u.mimesCanMakeEmpty=Object.assign(i,u.mimesCanMakeEmpty)))}).bind("themechange",function(){requestAnimationFrame(function(){u.trigger("uiresize")})}),!0===this.options.sound&&this.bind("playsound",function(t){var n=K.canPlayType&&K.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(K).html('')[0].play()}),e.each(this.options.handlers,function(e,t){u.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this.volumeExpires={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),e.inArray("*",this.options.commands)!==-1&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.hasVolOptions=!1,this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){u.uiAutoHide.length&&setTimeout(function(){u.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){u.uiAutoHide.length&&u.uiAutoHide.shift()()}),this.options.width&&(N=this.options.width),this.options.height&&(L=this.options.height),this.options.heightBase&&(W=e(this.options.heightBase)),$=this.options.soundPath?this.options.soundPath.replace(/\/+$/,"")+"/":this.baseUrl+$,u.one("opendone",function(){var t;e(document).on("click."+y,function(t){z&&!u.options.enableAlways&&!e(t.target).closest(m).length&&u.disable()}).on(x+" "+k+" "+C+" "+w,ae),u.options.useBrowserHistory&&e(window).on("popstate."+y,function(t){var n,i,a=t.originalEvent.state||{},o=!!a.thash,r=m.find(".elfinder-frontmost:visible"),s=m.find(".elfinder-navbar-dir,.elfinder-cwd-filename").find("input,textarea");o||(a={thash:u.cwd().hash},e("html,body").animate({scrollTop:m.offset().top})),r.length||s.length?(history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash),r.length?r.hasClass(u.res("class","preventback"))||(r.hasClass("elfinder-contextmenu")?e(document).trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1})):r.hasClass("elfinder-dialog")?r.elfinderdialog("close"):r.trigger("close")):s.trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))):o?!e.isEmptyObject(u.files())&&u.request({data:{cmd:"open",target:a.thash,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0}):(n=function(){i.trigger("click")},u.one("open",n,!0),i=u.toast({msg:u.i18n("pressAgainToExit"),onHidden:function(){u.unbind("open",n),history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash)}}))}),e(window).on("resize."+y,function(e){e.target===this&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=m.data("resizeSize")||{w:0,h:0},t={w:Math.round(m.width()),h:Math.round(m.height())};m.data("resizeSize",t),t.w===e.w&&t.h===e.h||(m.trigger("resize"),u.trigger("resize",{width:t.w,height:t.h}))}))}).on("beforeunload."+y,function(t){var n,i;return m.is(":visible")&&(u.ui.notify.children().length&&e.inArray("hasNotifyDialog",u.options.windowCloseConfirm)!==-1?n=u.i18n("ntfsmth"):m.find("."+u.res("class","editing")).length&&e.inArray("editingFile",u.options.windowCloseConfirm)!==-1?n=u.i18n("editingFile"):(i=Object.keys(u.selected()).length)&&e.inArray("hasSelectedItem",u.options.windowCloseConfirm)!==-1?n=u.i18n("hasSelected",""+i):(i=Object.keys(u.clipboard()).length)&&e.inArray("hasClipboardData",u.options.windowCloseConfirm)!==-1&&(n=u.i18n("hasClipboard",""+i)),n)?(t.returnValue=n,n):void u.trigger("unload")}),e(window).on("message."+y,function(e){var t,n,i=e.originalEvent||null;if(i&&0===u.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&u.trigger(t.bind+"fail",n),u.error(n.error)):(n.warning&&u.error(n.warning),u.updateCache(n),n.removed&&n.removed.length&&u.remove(n),n.added&&n.added.length&&u.add(n),n.changed&&n.changed.length&&u.change(n),t.bind&&(u.trigger(t.bind,n),u.trigger(t.bind+"done")),n.sync&&u.sync()))}catch(e){u.sync()}}),u.options.enableAlways?(e(window).on("focus."+y,function(e){e.target===this&&u.enable()}),re&&e(window.top).on("focus."+y,function(){!u.enable()||se&&!se.is(":visible")||requestAnimationFrame(function(){e(window).trigger("focus")})})):re&&e(window).on("blur."+y,function(e){z&&e.target===this&&u.disable()}),re&&m.on("click",function(t){e(window).trigger("focus")}),u.options.enableByMouseOver&&m.on("mouseenter touchstart",function(t){re&&e(window).trigger("focus"),!u.enabled()&&u.enable()})}),m[0].elfinder=this,h.push(function(){var t=u.lang,n=u.i18nBaseUrl+"elfinder."+t+".js",i=e.Deferred().done(function(){u.i18[t]&&(u.lang=t),u.trigger("i18load"),c="en"===u.lang?u.i18.en:e.extend(!0,{},u.i18.en,u.i18[u.lang])});return u.i18[t]?i.resolve():(u.lang="en",u.hasRequire?require([n],function(){i.resolve()},function(){i.resolve()}):u.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),d=function(){var t;return u.messages=c.messages,e.fn.selectable&&e.fn.draggable&&e.fn.droppable&&e.fn.resizable&&e.fn.slider?m.length?u.options.url?(t=Object.assign({name:u.i18n("name"),perm:u.i18n("perms"),date:u.i18n("modify"),size:u.i18n("size"),kind:u.i18n("kind"),modestr:u.i18n("mode"),modeoct:u.i18n("mode"),modeboth:u.i18n("mode")},u.options.uiOptions.cwd.listView.columnsCustomName),u.getColumnName=function(e){return t[e]||u.i18n(e)},u.direction=c.direction,u.dateFormat=u.options.dateFormat||c.dateFormat,u.fancyFormat=u.options.fancyDateFormat||c.fancyDateFormat,u.nonameDateFormat=(u.options.nonameDateFormat||c.nonameDateFormat).replace(/[\/\\]/g,"_"),u.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==u.direction?"rtl":"ltr")+(u.UA.Touch?" elfinder-touch"+(u.options.resizable?" touch-punch":""):"")+(u.UA.Mobile?" elfinder-mobile":"")+(u.UA.iOS?" elfinder-ios":"")+" "+u.options.cssClass,m.addClass(u.cssClass).on(w,function(){!z&&u.enable()}),function(){var t,n,i,a,o,r=x+"draggable keyup."+y+"draggable";u.draggable={appendTo:m,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(r,s){var l,c,d=s.helper,p=e.grep(d.data("files")||[],function(e){return!!e&&(R[e]=!0,!0)}),h=!1;for(o=m.attr("style"),m.width(m.width()).height(m.height()),t="ltr"===u.direction,n=u.getUI("workzone").data("rectangle"),i=n.top+n.height,a=i-u.getUI("navdock").outerHeight(!0),u.draggingUiHelper=d,l=p.length;l--;)if(c=p[l],j[c].locked){h=!0,d.data("locked",!0);break}!h&&u.trigger("lockfiles",{files:p}),d.data("autoScrTm",setInterval(function(){d.data("autoScr")&&u.autoScroll[d.data("autoScr")](d.data("autoScrVal"))},50))},drag:function(o,r){var s,l,c,d=r.helper;((l=n.top>o.pageY)||ao.pageX?(t?"navbar":"cwd")+(l?"Up":"Down"):(t?"cwd":"navbar")+(l?"Up":"Down"),l||("cwd"===s.substr(0,3)?i0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),d.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),d.data("refreshPositions",null)))},stop:function(t,n){var i,a=n.helper;e(document).off(r),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),u.draggingUiHelper=null,u.trigger("focus").trigger("dragstop"),a.data("droped")||(i=e.grep(a.data("files")||[],function(e){return!!e}),u.trigger("unlockfiles",{files:i}),u.trigger("selectfiles",{files:u.selected()})),u.enable(),m.attr("style",o),a.data("autoScrTm")&&clearInterval(a.data("autoScrTm"))},helper:function(t,n){var i,a,o,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
'),c=function(t){var n,i=t.mime,a=u.tmb(t);return n='
',a?n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML:t.icon&&(n=e(n).css(u.getIconStyle(t,!0)).get(0).outerHTML),t.csscls&&(n='
'+n+"
"),n};return u.draggingUiHelper&&u.draggingUiHelper.stop(!0,!0),u.trigger("dragstart",{target:s[0],originalEvent:t},!0),i=s.hasClass(u.res("class","cwdfile"))?u.selected():[u.navId2Hash(s.attr("id"))],l.append(c(j[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",y).data("dropover",0),(a=i.length)>1&&l.append(c(j[i[a-1]])+''+a+""),e(document).on(r,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;o!==t&&(o=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",!!l.data("locked")||o),u.trigger(o?"unlockfiles":"lockfiles",{files:i,helper:l})))}),l}}}(),u.commands.getfile&&("function"==typeof u.options.getFileCallback?(u.bind("dblclick",function(e){e.preventDefault(),u.exec("getfile").fail(function(){u.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),u.shortcut({pattern:"enter",description:u.i18n("cmdgetfile"),callback:function(){u.exec("getfile").fail(function(){u.exec("mac"==u.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:u.i18n("mac"==u.OS?"cmdrename":"cmdopen"),callback:function(){u.exec("mac"==u.OS?"rename":"open")}})):u.options.getFileCallback=null),e.each(u.commands,function(t,n){var i,a,o=Object.assign({},n.prototype);if(e.isFunction(n)&&!u._commands[t]&&(n.prototype.forceLoad||e.inArray(t,u.options.commands)!==-1)){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(u.commands[i]))return!0;n.prototype=Object.assign({},_,new u.commands[i],n.prototype)}else n.prototype=Object.assign({},_,n.prototype);u._commands[t]=new n,n.prototype=o,a=u.options.commandsOptions[t]||{},i&&u.options.commandsOptions[i]&&(a=e.extend(!0,{},u.options.commandsOptions[i],a)),u._commands[t].setup(t,a),u._commands[t].linkedCmds.length&&e.each(u._commands[t].linkedCmds,function(t,n){var i=u.commands[n];e.isFunction(i)&&!u._commands[n]&&(i.prototype=_,u._commands[n]=new i,u._commands[n].setup(n,u.options.commandsOptions[n]||{}))})}}),u.ui={workzone:e("
").appendTo(m).elfinderworkzone(u),navbar:e("
").appendTo(m).elfindernavbar(u,u.options.uiOptions.navbar||{}),navdock:e("
").appendTo(m).elfindernavdock(u,u.options.uiOptions.navdock||{}),contextmenu:e("
").appendTo(m).elfindercontextmenu(u),overlay:e("
").appendTo(m).elfinderoverlay({show:function(){u.disable()},hide:function(){T&&u.enable()}}),cwd:e("
").appendTo(m).elfindercwd(u,u.options.uiOptions.cwd||{}),notify:u.dialog("",{cssClass:"elfinder-dialog-notify",position:u.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:" ",width:u.options.notifyDialog.width?parseInt(u.options.notifyDialog.width):null,minHeight:null}),statusbar:e('
').hide().appendTo(m),toast:e('
').appendTo(m),bottomtray:e('
').appendTo(m)},u.trigger("uiready"),e.each(u.options.ui||[],function(t,n){var i="elfinder"+n,a=u.options.uiOptions[n]||{};!u.ui[n]&&e.fn[i]&&(u.ui[n]=e("<"+(a.tag||"div")+"/>").appendTo(m),u.ui[n][i](u,a))}),u.resize(N,L),u.options.resizable&&(m.resizable({resize:function(e,t){u.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),u.UA.Touch&&m.addClass("touch-punch")),function(){var e=u.getUI("navbar"),t=u.getUI("cwd").parent();u.autoScroll={navbarUp:function(t){e.scrollTop(Math.max(0,e.scrollTop()-t))},navbarDown:function(t){e.scrollTop(e.scrollTop()+t)},cwdUp:function(e){t.scrollTop(Math.max(0,t.scrollTop()-e))},cwdDown:function(e){t.scrollTop(t.scrollTop()+e)}}}(),u.UA.Touch&&!function(){var e,t,n,i,a,o,r,s,l,c=u.getUI("navbar"),d=u.getUI("toolbar"),p="touchmove.stopscroll",h=function(e){var n=e.originalEvent.touches||[{}],i=n[0].pageY||null;(!t||i1||("touchstart"===s.type?(n=m.offset(),i=m.width(),c&&(e=!1,c.is(":hidden")?(l||(l=Math.max(50,i/10)),(A?z-n.left:i+n.left-z)n.left+i-o,y?(l=Math.max(50,i/10),e=z):e=!1)),d&&(t=!1,s.originalEvent._preventSwipeY||(r=d.height(),a=n.top,T-a<(d.is(":hidden")?v:r+30)&&(t=T,m.on(p,d.is(":hidden")?f:h))))):(c&&e!==!1&&(b=(A?e>z:e.6*o||w>("navhide"===b?o/3:45)&&("navshow"===b||(A?zn.left+i-20)))&&(u.getUI("navbar").trigger(b,{handleW:l}),e=!1)),d&&t!==!1&&(x=d.offset().top,Math.abs(t-T)>Math.min(45,r/3)&&(k=t>T?"slideUp":"slideDown",("slideDown"===k||x+20>T)&&(d.is("slideDown"===k?":hidden":":visible")&&d.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),t=!1)))))})}(),u.dragUpload&&!function(){var t,n,i=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},a="native-drag-enter",o="native-drag-disable",r="class",s=u.res(r,"navdir"),l=(u.res(r,"droppable"),u.res(r,"adroppable"),u.res(r,"navarrow"),u.res(r,"adroppable")),c=u.getUI("workzone"),d="ltr"===u.direction,p=function(){n&&cancelAnimationFrame(n),n=null};m.on("dragenter",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation(),t=c.data("rectangle"))}).on("dragleave",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var a;i(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",n||(n=requestAnimationFrame(function(){var i,o=t.top+t.height,r=o-u.getUI("navdock").outerHeight(!0);((a=e.pageYr)&&(i=t.cwdEdge>e.pageX?(d?"navbar":"cwd")+(a?"Up":"Down"):(d?"cwd":"navbar")+(a?"Up":"Down"),a||"cwd"===i.substr(0,3)&&(o=11,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:t,Edge:!(!t||!window.msCredentials),Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen),Angle:0,Rotated:!1,CSS:function(){var e,t=document.createElement("a").style,n=document.createElement("p").style;return e="position:sticky;position:-webkit-sticky;",e+="width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;",t.cssText=e,{positionSticky:t.position.indexOf("sticky")!==-1,widthMaxContent:t.width.indexOf("max-content")!==-1,flex:"undefined"!=typeof n.flex}}()};return n}(),hasRequire:"function"==typeof define&&define.amd,currentReqCmd:"",keyState:{},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",nonameDateFormat:"ymd-His",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",group:"Selects",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},mimeTypes:{},rules:{defaults:function(e){return!(!e||e.added&&!Array.isArray(e.added)||e.removed&&!Array.isArray(e.removed)||e.changed&&!Array.isArray(e.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&Array.isArray(t.files)},tree:function(e){return e&&e.tree&&Array.isArray(e.tree)},parents:function(e){return e&&e.tree&&Array.isArray(e.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||Array.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||Array.isArray(t.added))},search:function(e){return e&&e.files&&Array.isArray(e.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n,i=this;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(a){return{error:["errResponse","errDataNotJSON"]}}return n=i.normalize(n),i.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return i.file(e.hash)?e.hash:null})),n):{error:response.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,failSyncTm:null,chunkfailReq:{},checkExists:function(t,n,i,a){var o,r=e.Deferred(),s=[],l={},c=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},d=function(){r.resolve(s,l)},p=function(){var r=[],p=[],u=n!==i.cwd().hash?i.path(n,!0)+i.option("separator",n):"",h=function(e){var n=e==p.length-1,o={cssClass:"elfinder-confirm-upload",title:i.i18n("cmdupload"),text:["errExists",u+p[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?d():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=p.length;e0&&delete o.reject,i.confirm(o)};return i.file(n).read?(o=e.map(t,function(e,t){return!e.name||i.UA.iOS&&"image.jpg"===e.name?null:{i:t,name:e.name}}),void i.request({data:{cmd:"ls",target:n,intersect:e.map(o,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(t){var a,s;t&&(t.error?c():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?r=t.list||[]:(a=[],r=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),!1)}),a.length&&(r=r.concat(a)),l=t.list),p=e.grep(o,function(t){return e.inArray(t.name,r)!==-1}),p.length&&r.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.grep(r,function(t){return e.inArray(t,s)===-1}).length&&i.sync()))),p.length>0?h(0):d()}).fail(function(e){c(),d(),e&&i.error(e)})):void d()};return i.api>=2.1&&"object"==typeof t[0]?p():d(),r},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,o,r=e.Deferred(),s=e.Deferred(),l=[],c=[],d=0,p=[],u=!1,h=function(e){return Array.prototype.slice.call(e||[],0)},f=function(e){var t,i,a=n.options.folderUploadExclude[n.OS]||null,o=e.length,r=function(){--d<1&&"pending"===s.state()&&s.resolve()},m=function(e){a&&e.name.match(a)||(c.push(t.fullPath||""),l.push(e)),r()},i=function(e){var t=[],n=function(){e.readEntries(function(e){if(u||!e.length){for(var i=0;i=2.1&&(d++,p.push(t.fullPath),i(t.createReader())))}return r(),s};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),e.each(a,function(e,t){if(t.isDirectory)return o=!0,!1}),a.length>0?(n.uploads.checkExists(a,i,n,o).done(function(o,s){var d=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===o&&(t.overwrite=0,o=[]),a=e.grep(a,function(t){var a,r,l,c;return t.isDirectory&&o.length&&(a=e.inArray(t.name,o),a!==-1&&(o.splice(a,1),r=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(s,function(e,n){if(t.name==n)return l=e,!1}),l||(l=n.fileByName(t.name,i).hash),n.lockfiles({files:[l]}),c=n.request({data:{cmd:"rename",target:l,name:r},notify:{type:"rename",cnt:1}}).fail(function(){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[l]})}),d.push(c))),!t._remove})),e.when.apply(e,d).done(function(){var e,t,i=+new Date;a.length>0?(t=n.escape(a[0].name),a.length>1&&(t+=" ... "+a.length+n.i18n("items")),e=setTimeout(function(){n.notify({type:"readdir",id:i,cnt:1,hideCnt:!0,msg:n.i18n("ntfreaddir")+" ("+t+")",cancel:function(){u=!0}})},n.options.notifyDelay),f(a).done(function(){e&&clearTimeout(e),n.notify({type:"readdir",id:i,cnt:-1}),u?r.reject():r.resolve([l,c,o,s,p])}).fail(function(){r.reject()})):r.reject()})}),r.promise()):r.reject()}var m=[],g=[],v=t.files[0];if("html"==t.type){var b,y=e("").append(e.parseHTML(v.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",y).each(function(){var n,i,a=e(this),o=a.closest("a");o&&o.attr("href")&&o.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=o.attr("href")),n=a.attr("_elfsrc"),n&&(i?(e.inArray(i,m)==-1&&m.push(i),e.inArray(n,g)==-1&&g.push(n)):e.inArray(n,m)==-1&&m.push(n)),1===m.length&&m[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),b=e("a[href]",y),b.each(function(){var t,n,i=function(e){var t=document.createElement("a");return t.href=e,t};(t=e(this).text())&&(n=i(e(this).attr("href")),n.href&&n.href.match(/^(?:ht|f)tp/i)&&(1===b.length||!n.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||e.trim(t).match(/\.[a-z0-9-]{1,10}$/i))&&e.inArray(n.href,m)==-1&&e.inArray(n.href,g)==-1&&m.push(n.href))})}else{var w,x,k;for(w=/(http[^<>"{}|\\^\[\]`\s]+)/gi;x=w.exec(v);)k=x[1].replace(/&/g,"&"),e.inArray(k,m)==-1&&m.push(k)}return m},xhr:function(t,n){var i=n?n:this,a=i.getUI(),o=new XMLHttpRequest,r=null,s=null,l=t.checked,c=t.isDataType||"data"==t.type,d=t.target||i.cwd().hash,p=t.dropEvt||null,u=t.extraData||null,h=i.option("uploadMaxConn",d)!=-1,f=Math.min(5,Math.max(1,i.option("uploadMaxConn",d))),m=1e4,g=30,v=0,b=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?c?e[0][0]:e[0]:{})}):n.resolve(t.length?c?t[0][0]:t[0]:{}),n},y=e.Deferred().fail(function(e){var t,a=i.parseError(e);"userabort"===a&&(t=!0,a=void 0),x&&(i.uploads.xhrUploading||t)&&b(x).done(function(e){e._cid?i.uploads.chunkfailReq[e._cid]||(i.uploads.chunkfailReq[e._cid]=!0,setTimeout(function(){n.request({data:{cmd:"upload",target:d,chunk:e._chunk,cid:e._cid,upload:["chunkfail"],mimes:"chunkfail"},options:{type:"post",url:i.uploadURL},preventDefault:!0}).always(function(){delete i.uploads.chunkfailReq[e._chunk]})},1e3)):(i.uploads.failSyncTm&&clearTimeout(i.uploads.failSyncTm),i.uploads.failSyncTm=setTimeout(function(){i.sync(d)},1e3))}),!t&&i.sync(),i.uploads.xhrUploading=!1,x=null,a&&i.error(a)}).done(function(t){i.uploads.xhrUploading=!1,x=null,t&&(i.currentReqCmd="upload",t.warning&&i.error(t.warning),i.updateCache(t),t.removed&&t.removed.length&&i.remove(t),t.added&&t.added.length&&i.add(t),t.changed&&t.changed.length&&i.change(t),i.trigger("upload",t,!1),i.trigger("uploaddone"),t.toasts&&Array.isArray(t.toasts)&&e.each(t.toasts,function(){this.msg&&i.toast(this)}),t.sync&&i.sync(),t.debug&&n.debug("backend-debug",t))}).always(function(){i.abortXHR(o),a.off("uploadabort",M),e(window).off("unload",M),r&&clearTimeout(r),s&&clearTimeout(s),l&&!t.multiupload&&j()&&i.notify({type:"upload",cnt:-k,progress:0,size:0}),q&&I.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),w=new FormData,x=t.input?t.input.files:i.uploads.checkFile(t,i,d),k=t.checked&&c?x[0].length:x.length,C=0,z=0,T=0,A=!1,I=i.ui.notify,S=!0,O=!1,j=function(){return!A&&(H=I.children(".elfinder-notify-upload")).length&&(A=!0),A},M=function(e,t){O=!0,i.abortXHR(o,{quiet:!0,abort:!0}),y.reject(t),j()&&i.notify({type:"upload",cnt:H.data("cnt")*-1,progress:0,size:0})},F=function(e){H.children(".elfinder-notify-cancel")[e?"show":"hide"]()},D=function(e){return e||(e=T),setTimeout(function(){A=!0,i.notify({type:"upload",cnt:k,progress:C-z,size:e,cancel:function(){a.trigger("uploadabort","userabort")}}),H=I.children(".elfinder-notify-upload"),z=C,t.multiupload?S&&F(!0):F(S&&C=2.1029&&(e=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),"function"==typeof w["delete"]&&w["delete"]("reqid"),w.append("reqid",e),o._requestId=e),o.send(w))},m)):a.trigger("uploadabort",["errAbort","errTimeout"])},E=function(){A&&y.notifyWith(H,[{cnt:H.data("cnt"),progress:H.data("progress"),total:H.data("total")}])},P=t.renames||null,R=t.hashes||null,q=!1,H=e();if(a.one("uploadabort",M),e(window).one("unload."+n.namespace,M),!q&&(z=C),!c&&!k)return y.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?O?y.reject():!c&&t.files&&e.grep(t.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?(errors.push("errFolderUpload"),y.reject(["errAbort","errFolderUpload"])):t.input&&e.grep(t.input.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?y.reject(["errUploadNoFiles"]):U():a.trigger("uploadabort","errConnect")},!1),o.addEventListener("load",function(e){var n,l,d=o.status,p=0,u="";if(d>=400?u=d>500?"errResponse":["errResponse","errServerError"]:o.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),b(x).done(function(e){return y.reject(e._cid?null:u)})),C=T,j()&&(p=C-z)&&(i.notify({type:"upload",cnt:0,progress:p,size:0}),E()),n=i.parseUploadData(o.responseText),n._chunkmerged){w=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return q=!0,a.off("uploadabort",M),s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(c?_(h,x[1]):_(h))}n._multiupload=!!t.multiupload,n.error?(l={cmd:"upload",err:n,xhr:o,rc:o.status},i.trigger("uploadfail",n),i.trigger("requestError",l),l._event&&l._event.isDefaultPrevented()&&(n.error=""),n._chunkfailure||n._multiupload?(O=!0,i.uploads.xhrUploading=!1,r&&clearTimeout(r),H.length?(i.notify({type:"upload",cnt:-k,progress:0,size:0}),y.reject(n)):y.reject()):y.reject(n)):y.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!q&&e.lengthComputable&&(C=e.loaded,v&&(C=0),T=e.total,C||(C=parseInt(.05*T)),j()&&(i.notify({type:"upload",cnt:0,progress:C-z,size:t.multiupload?0:T}),z=C,E()))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!q&&o.readyState<2&&(C=e.loaded,!t.checked&&C>0&&!r&&(r=D(o._totalSize-C)),T||(T=e.total,C||(C=parseInt(.05*T))),n=C-z,j()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),z=C,E()),!t.multiupload&&C>=T&&(S=!1,F(!1)))},!1);var _=function(a,s){var m,g,v,b,x,C,z,T,A,I,M,U,E,q,H=0,_=1,N=[],L=0,W=k,$=0,B=[],K=(new Date).getTime().toString().substr(-9),V=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),X=!h&&"",G=function(a,o){var s,l,u=[],h=0;if(!O){for(;a.length&&u.length=2.1&&("slice"in T?X="slice":"mozSlice"in T?X="mozSlice":"webkitSlice"in T&&(X="webkitSlice")))}catch(Y){k--,W--;continue}if(m&&g>m||!X&&n.uplMaxSize&&g>n.uplMaxSize)i.error(["errUploadFile",T.name,"errUploadFileSize"]),k--,W--;else if(!T.type||i.uploadMimeCheck(T.type,d))if(X&&g>V){for(x=0,C=V,z=-1,W=Math.floor((g-1)/V),v=T.lastModified?Math.round(T.lastModified/1e3):0,$+=g,B[K]=0;xn.uplMaxSize||_>n.uplMaxFile)&&(H=0,_=1,L++),"undefined"==typeof N[L]&&(N[L]=[],c&&(N[L][0]=[],N[L][1]=[])),c?(N[L][0].push(T),N[L][1].push(s[b])):N[L].push(T),H+=g,$+=g,_++;else i.error(["errUploadFile",T.name,"errUploadMime","("+T.type+")"]),k--,W--}if(0==N.length)return t.checked=!0,!1;if(N.length>1)return r=D($),I=[],M=0,U=N.length,E=[],J(),!0;c?(a=N[0][0],s=N[0][1]):a=N[0]}return l||(n.UA.Safari&&t.files?o._totalSize=$:r=D($)),l=!0,a.length||y.reject(["errUploadNoFiles"]),o.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),i.api>=2.1029&&(q=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),w.append("reqid",q),o._requestId=q),w.append("cmd","upload"),w.append(i.newAPI?"target":"current",d),P&&P.length&&(e.each(P,function(e,t){w.append("renames[]",t)}),w.append("suffix",n.options.backupSuffix)),R&&e.each(R,function(e,t){w.append("hashes["+e+"]",t)}),e.each(i.customData,function(e,t){w.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){w.append("mimes[]",t)}),e.each(a,function(e,i){i._chunkmerged?(w.append("chunk",i._chunkmerged),w.append("upload[]",i._name),w.append("mtime[]",i._mtime)):(i._chunkfail?(w.append("upload[]","chunkfail"),w.append("mimes","chunkfail")):(w.append("upload[]",i),t.clipdata&&(t.overwrite=0,w.append("name[]",n.date(n.nonameDateFormat)+".png")),i.name&&n.UA.iOS&&(i.name.match(/^image\.jpe?g$/i)?(t.overwrite=0,w.append("name[]",n.date(n.nonameDateFormat)+".jpg")):i.name.match(/^capturedvideo\.mov$/i)&&(t.overwrite=0,w.append("name[]",n.date(n.nonameDateFormat)+".mov")))),i._chunk?(w.append("chunk",i._chunk),w.append("cid",i._cid),w.append("range",i._range),w.append("mtime[]",i._mtime)):w.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),c&&e.each(s,function(e,t){w.append("upload_path[]",t)}),0===t.overwrite&&w.append("overwrite",0),p&&w.append("dropWith",parseInt((p.altKey?"1":"0")+(p.ctrlKey?"1":"0")+(p.metaKey?"1":"0")+(p.shiftKey?"1":"0"),2)),u&&e.each(u,function(e,t){w.append(e,t)}),o.send(w),!0};if(c)l?_(x[0],x[1]):x.done(function(t){if(P=[],k=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:d,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?f=1:(f=0,y.reject(e))}).done(function(n){var i=!1;n.hashes||(n.hashes={}),t[1]=e.map(t[1],function(e,a){return e=e.replace(/\/[^\/]*$/,""),""===e?d:n.hashes[e]?n.hashes[e]:(i=!0,t[0][a]._remove=!0,null)}),i&&(t[0]=e.grep(t[0],function(e){return!e._remove}))}).always(function(e){f&&(P=t[2],R=t[3],_(t[0],t[1]))});t[1]=e.map(t[1],function(){return d}),P=t[2],R=t[3],_(t[0],t[1])}else y.reject(["errUploadNoFiles"])}).fail(function(){y.reject()});else if(x.length>0)if(t.clipdata||null!=P)_(x)||y.reject();else{var N=[],L=[],W=n.options.folderUploadExclude[n.OS]||null;e.each(x,function(t,n){var i,a,o=n.webkitRelativePath||n.relativePath||"";return!!o&&(W&&n.name.match(W)?(n._remove=!0,o=void 0):(o="/"+o.replace(/\/[^\/]*$/,"").replace(/^\//,""),o&&e.inArray(o,N)===-1&&(N.push(o),i=o.substr(1).indexOf("/"),i!==-1&&(a=o.substr(0,i+1))&&e.inArray(a,N)===-1&&N.unshift(a))),void L.push(o))}),P=[],R={},N.length?!function(){var t=e.map(N,function(e){return e.substr(1).indexOf("/")===-1?{name:e.substr(1)}:null}),i=[];n.uploads.checkExists(t,d,n,!0).done(function(a,o){var r,s,l,p=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",d)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.grep(t,function(e){return!e._remove})),i.length&&e.each(L.concat(),function(t,n){0===e.inArray(n,i)&&(x[t]._remove=!0,L[t]=void 0)}),x=e.grep(x,function(e){return!e._remove}),L=e.grep(L,function(e){return void 0!==e}),t.length?(r=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(o,function(e,t){if(a[0]==t)return l=e,!1}),l||(l=n.fileByName(a[0],d).hash),n.lockfiles({files:[l]}),p.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){y.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):p.push(null),e.when.apply(e,p).done(function(){n.request({data:{cmd:"mkdir",target:d,dirs:N},notify:{type:"mkdir",cnt:N.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?f=1:(f=0,y.reject(e))}).done(function(t){var n=!1;t.hashes||(t.hashes={}),L=e.map(L.concat(),function(e,i){return"/"===e?d:t.hashes[e]?t.hashes[e]:(n=!0,x[i]._remove=!0,null)}),n&&(x=e.grep(x,function(e){return!e._remove}))}).always(function(e){f&&(c=!0,_(x,L)||y.reject())})})):y.reject()})}():n.uploads.checkExists(x,d,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",d)&&(R=a,null===i?t.overwrite=0:P=i,x=e.grep(x,function(e){return!e._remove})),k=x.length,k>0?_(x)||y.reject():y.reject()})}else y.reject();return y},iframe:function(t,n){var i,a,o,r,s=n?n:this,l=!!t.input&&t.input,c=!l&&s.uploads.checkFile(t,s),d=e.Deferred().fail(function(e){e&&s.error(e)}),p="iframe-"+n.namespace+ ++s.iframeCnt,u=e('
'),h=this.UA.IE,f=function(){r&&clearTimeout(r),o&&clearTimeout(o),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('