From 2a4a721dcf8399a2c09f986a1b38eda895d12680 Mon Sep 17 00:00:00 2001 From: nao-pon Date: Mon, 17 Jul 2017 14:37:56 +0900 Subject: [PATCH] release elFinder version 2.1.26 --- Changelog | 19 +++++++++++++++++++ css/elfinder.full.css | 2 +- css/elfinder.min.css | 2 +- js/elfinder.full.js | 4 ++-- js/elfinder.min.js | 4 ++-- php/elFinder.class.php | 2 +- 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Changelog b/Changelog index 8bb3b3dfdd..c7adfa306c 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,22 @@ +2017-07-17 Naoki Sawada + + * elFinder (2.1.26): + - [php:core] Fixed #2069 add static method `elFinder::getApiFullVersion()` + - [js:core] Fixed #2073 auto loading of language files implemented in core + - [cmd:help] Fixed #2074 add the Preference tab + - [js:core] Fixed #2079 lost binded user functions with node.elfinder('reload') + - [cmd:help] Fixed #2076 problem of content area height synchronization + - [js:core] Fixed #2081 problem that updating of `uiCmdMap` + - [cmd:resize] Fixed #2085 "Save As" dose not work in 2.1.25 + - [cmd:rm] Fixed #2086 problem of cmd mode sync on the item selected + - [js:core] Fixed #2076 cancel full screen mode on `destroy` + - [cmd:rm] Fixed #2087 JavaScript error when hide `rm` icon in toolbar + - [cmd:netmount] Fixed #2088 problem of shows error dialog behind this dialog + - [cmd:rm] Fixed #2087 button icon label is wrong until boot up + - [php:connector] Supports X-Sendfile and similar file-download accelerators + - And some minor bug fixes + + 2017-06-23 Naoki Sawada * elFinder (2.1.25): diff --git a/css/elfinder.full.css b/css/elfinder.full.css index ac2651fdf0..531e264140 100644 --- a/css/elfinder.full.css +++ b/css/elfinder.full.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.25 (2017-07-17) + * Version 2.1.26 (2017-07-17) * http://elfinder.org * * Copyright 2009-2017, Studio 42 diff --git a/css/elfinder.min.css b/css/elfinder.min.css index 9114bbd785..39f3e46c00 100644 --- a/css/elfinder.min.css +++ b/css/elfinder.min.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.25 (2017-07-17) + * Version 2.1.26 (2017-07-17) * http://elfinder.org * * Copyright 2009-2017, Studio 42 diff --git a/js/elfinder.full.js b/js/elfinder.full.js index b8b1793aab..ff46c14ff2 100644 --- a/js/elfinder.full.js +++ b/js/elfinder.full.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.25 (2017-07-17) + * Version 2.1.26 (2017-07-17) * http://elfinder.org * * Copyright 2009-2017, Studio 42 @@ -8020,7 +8020,7 @@ if (!Object.assign) { * * @type String **/ -elFinder.prototype.version = '2.1.25'; +elFinder.prototype.version = '2.1.26'; diff --git a/js/elfinder.min.js b/js/elfinder.min.js index 7b45cee043..4a87e0df2b 100644 --- a/js/elfinder.min.js +++ b/js/elfinder.min.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.25 (2017-07-17) + * Version 2.1.26 (2017-07-17) * http://elfinder.org * * Copyright 2009-2017, Studio 42 @@ -9,7 +9,7 @@ !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 r,o,s,l,d,c=this,u=[],h=["button"],t=e(t),p=e.extend(!0,{},e._data(t.get(0),"events")),f=e("
").append(t.contents()).attr("class",t.attr("class")||"").attr("style",t.attr("style")||""),m=t.attr("id")||"",g="elfinder-"+(m?m:Math.random().toString().substr(2,7)),v="mousedown."+g,b="keydown."+g,y="keypress."+g,w=!0,k=!0,x=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],C="",T={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},z={},A={},I={},O=[],S={},U={},M=[],D={},E=[],F=[],P=new c.command(c),j="auto",R=400,H=null,N="./sounds/",q=e(document.createElement("audio")).hide().appendTo("body")[0],_=0,L="",W=null,$=function(n){var i,a,r,o,s,l,d={},u={};c.api>=2.1?(c.commandMap=n.options.uiCmdMap&&Object.keys(n.options.uiCmdMap).length?n.options.uiCmdMap:{},L!==JSON.stringify(c.commandMap)&&(L=JSON.stringify(c.commandMap))):c.options.sync=0,n.init?(A={},I={}):(l=C,i="elfinder-subtree-loaded "+c.res("class","navexpand"),s=c.res("class","navcollapse"),a=Object.keys(A),r=function(t){if(!A[t])return!0;var n="directory"===A[t].mime,a=A[t].phash;!(!n||d[a]||!u[a]&&e("#"+c.navHash2Id(A[t].hash)).is(":hidden")&&e("#"+c.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)||!n&&a===C||D[t]?n&&(u[a]=!0):(n&&!d[a]&&(d[a]=!0,e("#"+c.navHash2Id(a)).removeClass(i).next(".elfinder-navbar-subtree").empty()),G(A[t]))},o=function(){a.length&&(W&&W._abort(),W=c.asyncJob(r,a,{interval:20,numPerOnce:100}))},c.trigger("filesgc").one("filesgc",function(){a=[]}),c.one("opendone",function(){l!==C&&(t.data("lazycnt")?c.one("lazydone",o):o())})),c.sorters=[],C=n.cwd.hash,B(n.files),A[C]||B([n.cwd]),c.lastDir(C),c.autoSync()},B=function(t){var n,i,a={name:!0,perm:!0,date:!0,size:!0,kind:!0},r=0===c.sorters.length,o=t.length,s=function(t){var t=t||{};c.sorters=[],e.each(c.sortRules,function(e){(a[e]||"undefined"!=typeof t[e]||"mode"===e&&"undefined"!=typeof t.perm)&&c.sorters.push(e)})};for(i=0;o>i;i++)n=Object.assign({},t[i]),n.name&&n.hash&&n.mime&&(r&&n.phash===C&&(s(n),r=!1),n.isroot&&n.phash&&(c.leafRoots[n.phash]?-1===e.inArray(n.hash,c.leafRoots[n.phash])&&c.leafRoots[n.phash].push(n.hash):c.leafRoots[n.phash]=[n.hash],A[n.phash]&&(A[n.phash].dirs||(A[n.phash].dirs=1),n.ts&&(A[n.phash].ts||0) script[src$="js/elfinder.min.js"],script[src$="js/elfinder.full.js"]:first'),t.length&&(n=e('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length,n||(c.cssloaded=null),a=t.attr("src").replace(/js\/[^\/]+$/,""),a.match(/^(https?\/\/|\/)/)||(i=e("head > base[href]").attr("href"))&&(a=i.replace(/\/$/,"")+"/"+a)),""!==a?c.options.baseUrl=a:(c.options.baseUrl||(c.options.baseUrl="./"),a=c.options.baseUrl),a)}(),T.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(n){var i,a,r,o=c.baseUrl;null===c.cssloaded&&(i=e(""),e("head").append(i),c.loadCss([o+"css/elfinder.min.css",o+"css/theme.css"]),Array.isArray(c.options.cssAutoLoad)&&c.loadCss(c.options.cssAutoLoad),r=1e3,a=setInterval(function(){(--r<0||"hidden"!==t.css("visibility"))&&(clearInterval(a),i.remove(),c.cssloaded=!0,c.trigger("cssloaded"))},10)),c.options.cssAutoLoad=!1}(),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},n.ui&&(this.options.ui=n.ui),n.commands&&(this.options.commands=n.commands),n.uiOptions&&(n.uiOptions.toolbar&&Array.isArray(n.uiOptions.toolbar)&&(e.isPlainObject(n.uiOptions.toolbar[n.uiOptions.toolbar.length-1])&&Object.assign(this.options.uiOptions.toolbarExtra,n.uiOptions.toolbar.pop()),this.options.uiOptions.toolbar=n.uiOptions.toolbar),n.uiOptions.toolbarExtra&&e.isPlainObject(n.uiOptions.toolbarExtra)&&Object.assign(this.options.uiOptions.toolbarExtra,n.uiOptions.toolbarExtra),n.uiOptions.cwd&&n.uiOptions.cwd.listView&&(n.uiOptions.cwd.listView.columns&&(this.options.uiOptions.cwd.listView.columns=n.uiOptions.cwd.listView.columns),n.uiOptions.cwd.listView.columnsCustomName&&(this.options.uiOptions.cwd.listView.columnsCustomName=n.uiOptions.cwd.listView.columnsCustomName))),this.options.uiOptions.toolbar.push(this.options.uiOptions.toolbarExtra),delete this.options.uiOptions.toolbarExtra,n.contextmenu&&Object.assign(this.options.contextmenu,n.contextmenu),ee||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),""===this.baseUrl&&(this.baseUrl=this.options.baseUrl?this.options.baseUrl:""),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(c.options.debug,function(){t[this]=!0}),c.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(h,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(c.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){var t,i=document.createElement("a");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(window.location.host!==i.host||t&&window.location.host!==t.host)&&(c.isCORS=!0,e.isPlainObject(c.options.customHeaders)||(c.options.customHeaders={}),e.isPlainObject(c.options.xhrFields)||(c.options.xhrFields={}),c.options.requestType="post",c.options.customHeaders["X-Requested-With"]="XMLHttpRequest",c.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",o=Math.max(parseInt(this.options.requestMaxConn),1),this.customData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.id=m,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=g,this.today=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate()).getTime()/1e3,this.yesterday=this.today-86400,s=this.options.UTCDate?"UTC":"",this.getHours="get"+s+"Hours",this.getMinutes="get"+s+"Minutes",this.getSeconds="get"+s+"Seconds",this.getDate="get"+s+"Date",this.getDay="get"+s+"Day",this.getMonth="get"+s+"Month",this.getFullYear="get"+s+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?(c.UA.Safari&&(window.localStorage.setItem("elfstoragecheck",1),window.localStorage.removeItem("elfstoragecheck")),c.localStorage):c.cookie}catch(e){return c.cookie}}(),this.lang=this.storage("lang")||this.options.lang,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 c.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,r,o=e(this),s=e.map(n.helper.data("files")||[],function(e){return e||null}),l=[],d=[],u=[],h=n.helper.hasClass("elfinder-drag-helper-plus"),p="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==g||!c.insideWorkzone(t.pageX,t.pageY))return!1;for(a=o.hasClass(c.res(p,"cwdfile"))?c.cwdId2Hash(o.attr("id")):o.hasClass(c.res(p,"navdir"))?c.navId2Hash(o.attr("id")):C,i=s.length;i--;)r=s[i],r!=a&&A[r].phash!=a?l.push(r):(h&&r!==a&&A[a].write?d:u).push(r);return u.length?!1:(n.helper.data("droped",!0),d.length&&(n.helper.hide(),c.exec("duplicate",d)),void(l.length&&(n.helper.hide(),c.clipboard(l,!h),c.exec("paste",a,void 0,a).always(function(){c.clipboard([]),c.trigger("unlockfiles",{files:s})}),c.trigger("drop",{files:s}))))}},this.enabled=function(){return w&&this.visible()},this.visible=function(){return t[0].elfinder&&t.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||C;var i,a;if(!n&&(e.each(c.roots,function(e,n){return 0===t.indexOf(e)?(i=n,!1):void 0}),i))return i;for(i=A[t];i&&i.phash&&(n||!i.isroot);)i=A[i.phash];if(i)return i.hash;for(;a in A&&A.hasOwnProperty(a);)if(i=A[a],!i.phash&&"directory"==!i.mime&&i.read)return i.hash;return""},this.cwd=function(){return A[C]||{}},this.option=function(t,n){var i;return n=n||C,c.optionsByHashes[n]&&"undefined"!=typeof c.optionsByHashes[n][t]?c.optionsByHashes[n][t]:C!==n?(i="",e.each(c.volOptions,function(e,a){return 0===n.indexOf(e)?(i=a[t]||"",!1):void 0}),i):z[t]||""},this.getDisabledCmds=function(t){var n=["hidden"];return Array.isArray(t)||(t=[t]),e.each(t,function(t,i){var a=c.option("disabled",i);a&&e.each(a,function(t,i){-1===e.inArray(i,n)&&n.push(i)})}),n},this.file=function(e){return e?A[e]:void 0},this.files=function(t){var n={};return t?I[t]?(e.each(I[t],function(e){A[e]?n[e]=A[e]:delete I[t][e]}),Object.assign({},n)):{}:Object.assign({},A)},this.parents=function(e){for(var t,n=[];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=A[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=A[t]&&A[t].path?A[t].path:this.path2array(t,n).join(z.separator);if(i&&A[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var r,o=e.Deferred(),s=i.notify,l=!1,d=function(){c.request({data:{cmd:"parents",target:A[t].phash},notify:s,preventFail:!0}).done(u).fail(function(){o.reject()})},u=function(){c.one("parentsdone",function(){a=c.path(t,n),""===a&&l?(l=!1,d()):(s&&(clearTimeout(r),s.cnt=-parseInt(s.cnt||0),c.notify(s)),o.resolve(a))})};return a?o.resolve(a):(c.ui.tree?(s&&(r=setTimeout(function(){c.notify(s)},c.notifyDelay)),l=!0,u(!0)):d(),o)}return a},this.url=function(t,n){var i,a=A[t],n=n||{},r=n.async||!1,o=n.temporary||!1,s=r?e.Deferred():null,l=function(n){if(n)return n;if(a.url)return a.url;if(i=0===a.hash.indexOf(c.cwd().volumeid)?z.url:c.option("url",a.hash))return i+e.map(c.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var r=Object.assign({},c.customData,{cmd:"file",target:a.hash});return c.oldAPI&&(r.cmd="open",r.current=a.phash),c.options.url+(-1===c.options.url.indexOf("?")?"?":"&")+e.param(r,!0)};if(!a||!a.read)return r?s.resolve(""):"";if("1"==a.url)this.request({data:{cmd:"url",target:t,options:{temporary:o?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:o?"file":"url",cnt:1,hideCnt:!0}:{}}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&o&&(e=a.url,a.url="1"),r?void s.resolve(l(e)):l(e)});else{if(!r)return l();s.resolve(l())}return r?s:void 0},this.openUrl=function(t,n){var i=A[t],a="";if(!i||!i.read)return"";if(!n)if(i.url){if(1!=i.url)return i.url}else if(z.url&&0===i.hash.indexOf(c.cwd().volumeid))return z.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");return a=this.options.url,a=a+(-1===a.indexOf("?")?"?":"&")+(this.oldAPI?"cmd=open¤t="+i.phash:"cmd=file")+"&target="+i.hash,n&&(a+="&download=1"),e.each(this.options.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",r="";return e.isPlainObject(t)&&(c.searchStatus.state&&0!==t.hash.indexOf(c.cwd().volumeid)?(n=c.option("tmbUrl",t.hash),i=c.option("tmbCrop",t.hash)):(n=z.tmbUrl,i=z.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(r=c.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(c.oldAPI||n)&&t&&t.tmb&&1!=t.tmb&&(r=n+t.tmb),r)?{url:r,className:a}:!1},this.selected=function(){return O.slice(0)},this.selectedFiles=function(){return e.map(O,function(e){return A[e]?Object.assign({},A[e]):null})},this.fileByName=function(e,t){var n;for(n in A)if(A.hasOwnProperty(n)&&A[n].phash==t&&A[n].name==e)return A[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),1>e&&(e=0)),e},this.request=function(t){var n,i,a,r=this,s=this.options,l=e.Deferred(),d=Object.assign({},s.customData,{mimes:s.onlyMimes},t.data||t),c=d.cmd,u=!t.asNotOpen&&"open"===c,h=!(t.preventDefault||t.preventFail),p=!(t.preventDefault||t.preventDone),f=Object.assign({},t.notify),m=!!t.cancel,g=!!t.raw,v=t.syncOnFail,b=!!t.lazy,y=t.prepare,w=t.navigate,k=Object.assign({url:s.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:d,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),x=function(e){e.warning&&r.error(e.warning),u?$(e):r.updateCache(e),e.changed&&e.changed.length&&K(e.changed),r.lazy(function(){e.removed&&e.removed.length&&r.remove(e),e.added&&e.added.length&&r.add(e),e.changed&&e.changed.length&&r.change(e)}).then(function(){return r.lazy(function(){r.trigger(c,e)})}).then(function(){return r.lazy(function(){r.trigger(c+"done")})}).then(function(){e.sync&&r.sync()})},A=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&&(!C||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"===k.type)return k.type="post",void(l.xhr=e=r.transport.send(k).fail(n).done(I));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}r.trigger(c+"done"),l.reject(n,e,t)},I=function(t){var n=r.options.debug;if(r.currentReqCmd=c,!t.debug||n&&("all"===n||n["backend-error"])||(n||(r.options.debug={}),r.options.debug["backend-error"]=!0),g)return t&&t.debug&&r.debug("backend-debug",t),l.resolve(t);if(!t)return l.reject(["errResponse","errDataEmpty"],i,t);if(!e.isPlainObject(t))return l.reject(["errResponse","errDataNotJSON"],i,t);if(t.error)return l.reject(t.error,i,t);var a=function(){var n,a=function(n){r.leafRoots[d.target]&&t[n]&&e.each(r.leafRoots[d.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})};return u?a("files"):"tree"===c&&a("tree"),t=r.normalize(t),r.validResponse(c,t)?(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.options&&(z=Object.assign({},T,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),u&&d.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),"function"==typeof y&&y(t),w&&(n=w.target||"added",t[n]&&t[n].length&&r.one(c+"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,d=t.action?t.action.data:void 0;return(d||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,d=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,d||s,{_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};w.toast||(w.toast={}),!w.noselect&&r.trigger("selectfiles",{files:r.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(w.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),r.resources.blink(a,"lookme")),e.isPlainObject(w.toast.incwd)&&r.toast(l(w.toast.incwd))):e.isPlainObject(w.toast.inbuffer)&&r.toast(l(w.toast.inbuffer))})),l.resolve(t),void(t.debug&&r.debug("backend-debug",t))):l.reject(t.norError||"errResponse",i,t)};b?r.lazy(a):a()},O=function(e){i&&"pending"===i.state()&&(i.quiet=!0,i.abort(),e&&"unload"!=e.type&&"destroy"!=e.type&&r.autoSync())},S=function(e){if(r.trigger(c+"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;O(e)},U=function(){if(u){if(X)return l.reject();X=!0}if(J++,l.fail(function(e,t,n){O(),r.trigger(c+"fail",n),e&&(h?r.error(e):r.debug("error",r.i18n(e))),v&&r.sync()}),!c)return v=!1,l.reject("errCmdReq");if(r.maxTargets&&d.targets&&d.targets.length>r.maxTargets)return v=!1,l.reject(["errMaxTargets",r.maxTargets]);if(p&&l.done(x),f.type&&f.cnt&&(m&&(f.cancel=l),n=setTimeout(function(){r.notify(f),l.always(function(){f.cnt=-(parseInt(f.cnt)||0),r.notify(f)})},r.notifyDelay),l.always(function(){clearTimeout(n)})),u){for(;a=E.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort());if(C!==d.target)for(;a=F.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort())}return-1!==e.inArray(c,(r.cmdsToAdd+" autosync").split(" "))&&("autosync"!==c&&(r.autoSync("stop"),l.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete k.preventFail,l.xhr=i=r.transport.send(k).always(function(){--J,Y.length?Y.shift()():X=!1}).fail(A).done(I),u||d.compare&&"info"===c?(E.unshift(i),d.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",S),l.always(function(){var t=e.inArray(i,E);d.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",S),-1!==t&&E.splice(t,1)})):-1!==e.inArray(c,r.abortCmdsOnOpen)&&(F.unshift(i),l.always(function(){var t=e.inArray(i,F);-1!==t&&F.splice(t,1)})),r.bind("unload destroy",S),l.always(function(){r.unbind("unload destroy",S)}),l},M=function(){return u&&(X=!1),o>J?U():(u?Y.unshift(U):Y.push(U),l)},D={opts:t,result:!0};return r.trigger("request."+c,D,!0),D.result?"object"==typeof D.result&&D.result.promise?(D.result.done(M).fail(function(){r.trigger(c+"done"),l.reject()}),l):M():(r.trigger(c+"done"),l.reject())},this.cache=function(e){Array.isArray(e)||(e=[e]),B(e)},this.updateCache=function(t){e.isPlainObject(t)&&(t.files&&t.files.length&&B(t.files),t.tree&&t.tree.length&&B(t.tree),t.removed&&t.removed.length&&V(t.removed),t.added&&t.added.length&&B(t.added),t.changed&&t.changed.length&&K(t.changed))},this.diff=function(t,n,i){var a={},r=[],o=[],s=[],l=function(e){for(var t=s.length;t--;)if(s[t].hash==e)return!0};return e.each(t,function(e,t){a[t.hash]=t}),e.each(A,function(e,t){a[e]||n&&t.phash!==n||o.push(e)}),e.each(a,function(t,n){var a=A[t];a?e.each(n,function(t){return i&&-1!==e.inArray(t,i)||n[t]===a[t]?void 0:(s.push(n),!1)}):r.push(n)}),e.each(o,function(t,n){var i=A[n],r=i.phash;r&&"directory"==i.mime&&-1===e.inArray(r,o)&&a[r]&&!l(r)&&s.push(a[r])}),{added:r,removed:o,changed:s}},this.sync=function(t,n){this.autoSync("stop");var i=this,a=function(){var i="",a=0,r=0;return t&&n&&e.each(A,function(e,n){n.phash&&n.phash===t&&(++a,r=Math.max(r,n.ts)),i=a+":"+r}),i},r=a(),o=e.Deferred().done(function(){i.trigger("sync")}),s=[this.request({data:{cmd:"open",reload:1,target:C,tree:!t&&this.ui.tree?1:0,compare:r},preventDefault:!0})],l=function(){for(var e,t=[],n=i.file(i.root(C)),a=n?n.volumeid:null,r=i.cwd().phash;r;)(e=i.file(r))?(0!==r.indexOf(a)&&(t.push({target:r,cmd:"tree"}),i.isRoot(e)||t.push({target:r,cmd:"parents"}),n=i.file(i.root(r)),a=n?n.volumeid:null),r=e.phash):r=null;return t};return!t&&i.api>=2&&(C!==this.root()&&s.push(this.request({data:{cmd:"parents",target:C},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&&-1===e.inArray("errOpen",t)?o.reject(t&&0!=a.status?t:void 0):(o.reject(t),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&&r===e.cwd.compare)return o.reject();if(n={tree:[]},a=arguments.length,a>1)for(s=1;a>s;s++)arguments[s].tree&&arguments[s].tree.length&&n.tree.push.apply(n.tree,arguments[s].tree);if(i.api<2.1&&(n.tree||(n.tree=[]),n.tree.push(e.cwd)),e=i.normalize(e),!i.validResponse("open",e))return o.reject(e.norError||"errResponse");if(n=i.normalize(n),!i.validResponse("tree",n))return o.reject(n.norError||"errResponse");var l=i.diff(e.files.concat(n&&n.tree?n.tree:[]),t);return l.added.push(e.cwd),i.updateCache(l),l.removed.length&&i.remove(l),l.added.length&&i.add(l),l.changed.length&&i.change(l),o.resolve(l)}).always(function(){i.autoSync()}),o},this.upload=function(e){return this.transport.upload(e,this)},this.toUnbindEvents={},this.bind=function(e,t){var n,i;if("function"==typeof t)for(e=(""+e).toLowerCase().replace(/^\s+|\s+$/g,"").split(/\s+/),i=e.length,n=0;i>n;n++)void 0===S[e[n]]&&(S[e[n]]=[]),S[e[n]].push(t);return this},this.unbind=function(t,n){var i,a,r,o;for(t=(""+t).toLowerCase().split(/\s+/),a=t.length,i=0;a>i;i++)(r=S[t[i]])&&(o=e.inArray(n,r),o>-1&&r.splice(o,1));return n=null,this},this.trigger=function(t,n,i){var a,r,o,s,t=t.toLowerCase(),l="object"==typeof n,d=S[t]||[];if(this.debug("event-"+t,n),i=!0,r=d.length){for(s=e.Event(t),i&&(s.data=n),a=0;r>a;a++)if(d[a]){d[a].length&&(i||(l&&!o&&(o=JSON.stringify(n)),s.data=o?JSON.parse(o):n));try{if(d[a].call(s,s,this)===!1||s.isDefaultPrevented()){this.debug("event-stoped",s.type);break}}catch(u){window.console&&window.console.log&&window.console.log(u)}}this.toUnbindEvents[t]&&this.toUnbindEvents[t].length&&(e.each(this.toUnbindEvents[t],function(e,t){c.unbind(t.type,t.callback)}),delete this.toUnbindEvents[t])}return this},this.getListeners=function(e){return e?S[e.toLowerCase()]:S},this.shortcut=function(t){var n,i,a,r,o;if(this.options.allowShortcuts&&t.pattern&&e.isFunction(t.callback))for(n=t.pattern.toUpperCase().split(/\s+/),r=0;r0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!U[i]&&(U[i]={keyCode:a,altKey:-1!=e.inArray("ALT",o),ctrlKey:-1!=e.inArray("CTRL",o),shiftKey:-1!=e.inArray("SHIFT",o),type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(U,function(e,n){t.push([n.pattern,c.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(M,function(e){return e.hash})};return void 0!==t&&(M.length&&this.trigger("unlockfiles",{files:i()}),D={},M=e.map(t||[],function(e){var t=A[e];return t?(D[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:M.slice(0,M.length)}),n&&this.trigger("lockfiles",{files:i()})),M.slice(0,M.length)},this.isCommandEnabled=function(t,n){var i,a=c.cwd().volumeid||"";return!n&&c.searchStatus.state>1&&c.selected().length&&(n=c.selected()[0]),!n||a&&0===n.indexOf(a)?i=z.disabled:(i=c.option("disabled",n),i||(i=[])),this._commands[t]?-1===e.inArray(t,i):!1},this.exec=function(t,n,i,a){return"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command")},this.dialog=function(n,i){var a=e("
").append(n).appendTo(t).elfinderdialog(i,this),r=a.closest(".ui-dialog"),o=function(){!a.data("draged")&&a.is(":visible")&&a.elfinderdialog("posInit")};return r.length&&(c.bind("resize",o),r.on("remove",function(){c.unbind("resize",o)})),a},this.toast=function(t){return e('
').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(e){return this.ui[e]||t},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(n,i){var a,r=function(){for(var e=t.outerHeight(!0)-t.innerHeight(),n=t;n.get(0)!==H.get(0)&&(n=n.parent(),e+=n.outerHeight(!0)-n.innerHeight(),n.parent().length););return e},o=!t.hasClass("ui-resizable"),s=t.data("resizeSize")||{w:0,h:0},l={};H&&H.data("resizeTm")&&clearTimeout(H.data("resizeTm")),"string"==typeof i&&(a=i.match(/^([0-9.]+)%$/))&&(H&&H.length||(H=e(window)),H.data("marginToMyNode")||H.data("marginToMyNode",r()),H.data("fitToBaseFunc")||H.data("fitToBaseFunc",function(e){var n=H.data("resizeTm");e.preventDefault(),e.stopPropagation(),n&&clearTimeout(n),t.hasClass("elfinder-fullscreen")||H.data("resizeTm",setTimeout(function(){c.restoreSize()},50))}),i=H.height()*(a[1]/100)-H.data("marginToMyNode"),H.off("resize."+c.namespace,H.data("fitToBaseFunc")),o&&H.on("resize."+c.namespace,H.data("fitToBaseFunc"))),t.css({width:n,height:parseInt(i)}),l.w=t.width(),l.h=t.height(),t.data("resizeSize",l),l.w===s.w&&l.h===s.h||(t.trigger("resize"),this.trigger("resize",{width:l.w,height:l.h}))},this.restoreSize=function(){this.resize(j,R)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(k=w,w=!1),this.disable().trigger("hide"),t.hide()},this.lazy=function(n,i,a){var r=function(e){var n,i=t.data("lazycnt");e?(n=t.data("lazyrepaint")?!1:a.repaint,i?t.data("lazycnt",++i):t.data("lazycnt",1).addClass("elfinder-processing"),n&&t.data("lazyrepaint",!0).css("display")):i&&i>1?t.data("lazycnt",--i):(n=t.data("lazyrepaint"),t.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),n&&t.css("display"),c.trigger("lazydone"))},o=e.Deferred();return i=i||0,a=a||{},r(!0),setTimeout(function(){o.resolve(n.call(o)),r(!1)},i),o},this.destroy=function(){t&&t[0].elfinder&&(t.hasClass("elfinder-fullscreen")&&c.toggleFullscreen(t),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),M=[],O=[],S={},U={},e(window).off("."+g),e(document).off("."+g),c.trigger=function(){},e(q).remove(),t.off().removeData().empty().append(f.contents()).attr("class",f.attr("class")).attr("style",f.attr("style")),delete t[0].elfinder,e.each(p,function(n,i){e.each(i,function(e,n){t.on(n.type+(n.namespace?"."+n.namespace:""),n.selector,n.handler)})}))},this.autoSync=function(t){var n;if(c.options.sync>=1e3){if(r&&(clearTimeout(r),r=null,c.trigger("autosync",{action:"stop"})),"stop"===t?++_:_=Math.max(0,--_),_||"forcestop"===t||!c.options.syncStart)return;n=function(t){var i;z.syncMinMs&&(t||r)&&(t&&c.trigger("autosync",{action:"start"}),i=Math.max(c.options.sync,z.syncMinMs),r&&clearTimeout(r),r=setTimeout(function(){var t,a=!0,o=C;z.syncChkAsTs&&(t=A[o].ts)?c.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?c.sync(o).always(function(){i&&(A[o].ts=i),n()}):n()}).fail(function(t,a){t&&0!=a.status?(c.error(t),-1!==e.inArray("errOpen",t)&&c.request({data:{cmd:"open",target:c.lastDir("")||c.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):r=setTimeout(function(){n()},i)}):c.sync(C,!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(n){var i=t.children(":last");n=e(n),i.get(0)!==n.get(0)&&n.trigger("beforedommove").insertAfter(i).trigger("dommove")},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,padding:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(c.zIndex?c.zIndex+1:0,1e3)}},function(){ee&&c.UA.Fullscreen&&(c.UA.Fullscreen=!1,te&&"undefined"!=typeof te.attr("allowfullscreen")&&(c.UA.Fullscreen=!0));var n,i,a,r="elfinder-fullscreen",o="elfinder-fullscreen-native",s=function(){var n=0,i=0;e.each(t.children(".ui-dialog,.ui-draggable"),function(t,a){var r=e(a),o=r.position();o.top<0&&(r.css("top",n),n+=20),o.left<0&&(r.css("left",i),i+=20)})},l=c.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():!1}}:{fullElm:function(){var e;return t.hasClass(r)?t.get(0):(e=t.find("."+r),e.length?e.get(0):null)},exitFull:function(){var t;e(window).off("resize."+g,u),void 0!==i&&e("body").css("overflow",i),i=void 0,n&&(t=n.elm,d(t),e(t).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return i=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(c.getMaximizeCss()).addClass(r).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+g,u).trigger("resize"),!0}},d=function(t){n&&n.elm==t&&(e(t).removeClass(r+" "+o).attr("style",n.style),n=null)},u=function(t){var n;t.target===window&&(a&&clearTimeout(a),a=setTimeout(function(){(n=l.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})},100))};e(document).on("fullscreenchange."+g+" webkitfullscreenchange."+g+" mozfullscreenchange."+g+" MSFullscreenChange."+g,function(t){if(c.UA.Fullscreen){var i=l.fullElm(),h=e(window);a&&clearTimeout(a),null===i?(h.off("resize."+g,u),n&&(i=n.elm,d(i),e(i).trigger("resize",{fullscreen:"off"}))):(e(i).addClass(r+" "+o).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),h.on("resize."+g,u),s()),h.trigger("resize")}}),c.toggleFullscreen=function(t,i){var a=e(t).get(0),r=null;if(r=l.fullElm()){if(r==a){if(i===!0)return r}else if(i===!1)return r;return l.exitFull(),null}return i===!1?null:(n={elm:a,style:e(a).attr("style")},l.toFull(a)!==!1?a:(n=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&&clearTimeout(t),t=setTimeout(function(){n.trigger("resize",{maximize:"on"})},100)}},a=function(t){e(window).off("resize."+g,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"})},r=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(c.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+g,{elm:t},i),t.trigger("resize",{maximize:"on"})};c.toggleMaximize=function(t,i){var o=e(t),s=o.hasClass(n);if(s){if(i===!0)return;a(o)}else{if(i===!1)return;r(o)}}}(),e.fn.selectable&&e.fn.draggable&&e.fn.droppable?t.length?this.options.url?(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}),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 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=e.isFunction(this.options.rawStringDecoder)?this.options.rawStringDecoder:function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];n>t;t++)i.push(e.charCodeAt(t));return i},n=function(e){var n,i,a,r=[];for("string"==typeof e&&(e=t(e)),n=0,i=e.length;a=e[n],i>n;n++)a>=55296&&56319>=a?r.push((1023&a)+64<<10|1023&e[++n]):r.push(a);return r},i=function(e){var t,n,i,a,r=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],n>t;t++)a+=127>=i?r(i):223>=i&&i>=194?r((31&i)<<6|63&e[++t]):239>=i&&i>=224?r((15&i)<<12|(63&e[++t])<<6|63&e[++t]):247>=i&&i>=240?r(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):r(65533);return a};return i(n(e))},this.error=function(){var e=arguments[0],t=arguments[1]||null;return 1==arguments.length&&"function"==typeof e?c.bind("error",e):e===!0?this:c.trigger("error",{error:e,opts:t})},e.each(x,function(t,n){c[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?c.bind(n,t):c.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!w&&c.visible()&&c.ui.overlay.is(":hidden")&&!t.children(".elfinder-dialog").find("."+c.res("class","editing")).length&&(w=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){k=w,w=!1,t.addClass("elfinder-disabled")}).open(function(){O=[]}).select(function(t){var n=0,i=[];O=e.map(t.data.selected||t.data.value||[],function(e){return i.length||c.maxTargets&&++n>c.maxTargets?(i.push(e),null):A[e]?e:null}),i.length&&(c.trigger("unselectfiles",{files:i,inselect:!0}),c.toast({mode:"warning",msg:c.i18n(["errMaxTargets",c.maxTargets])}))}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:c.i18n(c.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[c.i18n(c.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&Object.assign(n,t.data.opts),c.dialog(''+c.i18n(t.data.error),n)}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){A[e]&&(A[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(c.searchStatus,e.data),c.searchStatus.state=1}).bind("search",function(e){c.searchStatus.state=2}).bind("searchend",function(){c.searchStatus.state=0,c.searchStatus.ininc=!1,c.searchStatus.mixed=!1}),!0===this.options.sound&&this.bind("playsound",function(t){var n=q.canPlayType&&q.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(q).html('')[0].play()}),e.each(this.options.handlers,function(e,t){c.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),-1!==e.inArray("*",this.options.commands)&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){c.uiAutoHide.length&&setTimeout(function(){c.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){c.uiAutoHide.length&&c.uiAutoHide.shift()()}),this.options.resizable&&e.fn.resizable&&t.resizable({resize:function(e,t){c.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),this.options.width&&(j=this.options.width),this.options.height&&(R=this.options.height),this.options.heightBase&&(H=e(this.options.heightBase)),this.options.soundPath&&(N=this.options.soundPath.replace(/\/+$/,"")+"/"),e(document).on("click."+g,function(n){w&&!c.options.enableAlways&&!e(n.target).closest(t).length&&c.disable()}).on(b+" "+y,Z),c.options.useBrowserHistory&&e(window).on("popstate."+g,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(c.files())&&c.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),function(){var n;e(window).on("resize."+g,function(e){e.target===this&&(n&&clearTimeout(n),n=setTimeout(function(){c.trigger("resize",{width:t.width(),height:t.height()})},100))}).on("beforeunload."+g,function(n){var i,a;return t.is(":visible")&&(c.ui.notify.children().length&&-1!==e.inArray("hasNotifyDialog",c.options.windowCloseConfirm)?i=c.i18n("ntfsmth"):t.find("."+c.res("class","editing")).length&&-1!==e.inArray("editingFile",c.options.windowCloseConfirm)?i=c.i18n("editingFile"):(a=Object.keys(c.selected()).length)&&-1!==e.inArray("hasSelectedItem",c.options.windowCloseConfirm)?i=c.i18n("hasSelected",""+a):(a=Object.keys(c.clipboard()).length)&&-1!==e.inArray("hasClipboardData",c.options.windowCloseConfirm)&&(i=c.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void c.trigger("unload")})}(),e(window).on("message."+g,function(e){var t,n,i=e.originalEvent||null;if(i&&0===c.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&c.trigger(t.bind+"fail",n),c.error(n.error)):(n.warning&&c.error(n.warning),c.updateCache(n),n.removed&&n.removed.length&&c.remove(n),n.added&&n.added.length&&c.add(n),n.changed&&n.changed.length&&c.change(n),t.bind&&(c.trigger(t.bind,n),c.trigger(t.bind+"done")),n.sync&&c.sync()))}catch(e){c.sync()}}),c.options.enableAlways?(e(window).on("focus."+g,function(e){e.target===this&&c.enable()}),ee&&e(window.top).on("focus."+g,function(){!c.enable()||te&&!te.is(":visible")||setTimeout(function(){e(window).focus()},10)})):ee&&e(window).on("blur."+g,function(e){w&&e.target===this&&c.disable()}),ee&&t.on("click",function(t){e(window).focus()}),this.options.enableByMouseOver&&t.on("mouseenter",function(t){ee&&e(window).focus(),!c.enabled()&&c.enable()}),t[0].elfinder=this,u.push(function(){var t=c.lang,n=c.baseUrl+"js/i18n/elfinder."+t+".js",i=e.Deferred().done(function(){c.i18[t]&&(c.lang=t),l="en"===c.lang?c.i18.en:e.extend(!0,{},c.i18.en,c.i18[c.lang]),c.storage("lang",c.lang)});return c.i18[t]?i.resolve():(c.lang="en","function"==typeof define&&define.amd?require([n],function(){i.resolve()},function(){i.resolve()}):c.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),d=function(){c.direction=l.direction,c.messages=l.messages,c.dateFormat=c.options.dateFormat||l.dateFormat,c.fancyFormat=c.options.fancyDateFormat||l.fancyDateFormat,c.nonameDateFormat=(c.options.nonameDateFormat||l.nonameDateFormat).replace(/[\/\\]/g,"_"),c.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==c.direction?"rtl":"ltr")+(c.UA.Touch?" elfinder-touch"+(c.options.resizable?" touch-punch":""):"")+(c.UA.Mobile?" elfinder-mobile":"")+" "+c.options.cssClass,t.addClass(c.cssClass).on(v,function(){!w&&c.enable()}),function(){var n,i,a,r,o=b+"draggable keyup."+g+"draggable";c.draggable={appendTo:t,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(o,s){var l,d,u=s.helper,h=e.map(u.data("files")||[],function(e){return e?(D[e]=!0,e):null}),p=!1;for(r=t.attr("style"),t.width(t.width()).height(t.height()),n="ltr"===c.direction,i=c.getUI("workzone").data("rectangle"),a=i.top+i.height,c.draggingUiHelper=u,l=h.length;l--;)if(d=h[l],A[d].locked){p=!0,u.data("locked",!0);break}!p&&c.trigger("lockfiles",{files:h}),u.data("autoScrTm",setInterval(function(){u.data("autoScr")&&c.autoScroll[u.data("autoScr")](u.data("autoScrVal"))},50))},drag:function(t,r){var o,s=r.helper;(o=i.top>t.pageY)||at.pageX?s.data("autoScr",(n?"navbar":"cwd")+(o?"Up":"Down")):s.data("autoScr",(n?"cwd":"navbar")+(o?"Up":"Down")),s.data("autoScrVal",Math.pow(o?i.top-t.pageY:t.pageY-a,1.3))):s.data("autoScr")&&s.data("refreshPositions",1).data("autoScr",null),s.data("refreshPositions")&&e(this).elfUiWidgetInstance("draggable")&&(s.data("refreshPositions")>0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),s.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),s.data("refreshPositions",null)))},stop:function(n,i){var a,s=i.helper;e(document).off(o),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),c.draggingUiHelper=null,c.trigger("focus").trigger("dragstop"),s.data("droped")||(a=e.map(s.data("files")||[],function(e){return e||null}),c.trigger("unlockfiles",{files:a}),c.trigger("selectfiles",{files:a})),c.enable(),t.attr("style",r),s.data("autoScrTm")&&clearInterval(s.data("autoScrTm"))},helper:function(t,n){var i,a,r,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
'),d=function(t){var n,i=t.mime,a=c.tmb(t);return n='
',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};return c.draggingUiHelper&&c.draggingUiHelper.stop(!0,!0),c.trigger("dragstart",{target:s[0],originalEvent:t}),i=s.hasClass(c.res("class","cwdfile"))?c.selected():[c.navId2Hash(s.attr("id"))],l.append(d(A[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",g).data("dropover",0),(a=i.length)>1&&l.append(d(A[i[a-1]])+''+a+""),e(document).on(o,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;r!==t&&(r=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",l.data("locked")?!0:r),c.trigger(r?"unlockfiles":"lockfiles",{files:i,helper:l})))}),l}}}(),c.commands.getfile&&("function"==typeof c.options.getFileCallback?(c.bind("dblclick",function(e){e.preventDefault(),c.exec("getfile").fail(function(){c.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),c.shortcut({pattern:"enter",description:c.i18n("cmdgetfile"),callback:function(){c.exec("getfile").fail(function(){c.exec("mac"==c.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:c.i18n("mac"==c.OS?"cmdrename":"cmdopen"),callback:function(){c.exec("mac"==c.OS?"rename":"open")}})):c.options.getFileCallback=null),e.each(c.commands,function(t,n){var i,a,r=Object.assign({},n.prototype);if(e.isFunction(n)&&!c._commands[t]&&(n.prototype.forceLoad||-1!==e.inArray(t,c.options.commands))){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(c.commands[i]))return!0;n.prototype=Object.assign({},P,new c.commands[i],n.prototype)}else n.prototype=Object.assign({},P,n.prototype);c._commands[t]=new n,n.prototype=r,a=c.options.commandsOptions[t]||{},i&&c.options.commandsOptions[i]&&(a=e.extend(!0,{},c.options.commandsOptions[i],a)),c._commands[t].setup(t,a),c._commands[t].linkedCmds.length&&e.each(c._commands[t].linkedCmds,function(t,n){var i=c.commands[n];e.isFunction(i)&&!c._commands[n]&&(i.prototype=P,c._commands[n]=new i,c._commands[n].setup(n,c.options.commandsOptions[n]||{}))})}}),c.ui={workzone:e("
").appendTo(t).elfinderworkzone(c),navbar:e("
").appendTo(t).elfindernavbar(c,c.options.uiOptions.navbar||{}),contextmenu:e("
").appendTo(t).elfindercontextmenu(c),overlay:e("
").appendTo(t).elfinderoverlay({show:function(){c.disable()},hide:function(){k&&c.enable()}}),cwd:e("
").appendTo(t).elfindercwd(c,c.options.uiOptions.cwd||{}),notify:c.dialog("",{cssClass:"elfinder-dialog-notify",position:c.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:" ",width:parseInt(c.options.notifyDialog.width)}),statusbar:e('
').hide().appendTo(t),toast:e('
').appendTo(t),bottomtray:e('
').appendTo(t)},e.each(c.options.ui||[],function(n,i){var a="elfinder"+i,r=c.options.uiOptions[i]||{};!c.ui[i]&&e.fn[a]&&(c.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t),c.ui[i][a](c,r))}),c.resize(j,R),function(){var e=c.getUI("navbar"),t=c.getUI("cwd").parent();c.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)}}}(),c.UA.Touch&&!function(){var n,i,a,r,o,s,l,d,u,h=c.getUI("navbar"),p=c.getUI("toolbar"),f="touchmove.stopscroll",m=function(e){e.preventDefault(),d&&clearTimeout(d)},g=function(){d=setTimeout(function(){t.off(f)},100)},v=50;t.on("touchstart touchmove touchend",function(d){if("touchend"===d.type)return n=!1,i=!1,void g();var b,y,w,k,x,C,T=d.originalEvent.touches||[{}],z=T[0].pageX||null,A=T[0].pageY||null,I="ltr"===c.direction;null===z||null===A||"touchstart"===d.type&&T.length>1||("touchstart"===d.type?(a=t.offset(),r=t.width(),h&&(n=!1,h.is(":hidden")?(u||(u=Math.max(50,r/10)),(I?z-a.left:r+a.left-z)a.left+r-s&&y+h.scrollLeft()-5<=s,w?(u=Math.max(50,r/10),n=z):n=!1)),p&&(l=p.height(),o=a.top,A-o<(p.is(":hidden")?v:l+30)?(i=A,t.on(f,m),g()):i=!1)):(h&&n!==!1&&(b=(I?n>z:z>n)?"navhide":"navshow",k=Math.abs(n-z),("navhide"===b&&k>.6*s||k>("navhide"===b?s/3:45)&&("navshow"===b||(I?za.left+r-20)))&&(c.getUI("navbar").trigger(b,{handleW:u}),n=!1)),p&&i!==!1&&(x=p.offset().top,Math.abs(i-A)>Math.min(45,l/3)&&(C=i>A?"slideUp":"slideDown",("slideDown"===C||x+20>A)&&(p.is("slideDown"===C?":hidden":":visible")&&(p.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),g()),i=!1)))))})}(),c.dragUpload&&!function(){var n,i,a=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},r="native-drag-enter",o="native-drag-disable",s="class",l=c.res(s,"navdir"),d=(c.res(s,"droppable"),c.res(s,"adroppable"),c.res(s,"navarrow"),c.res(s,"adroppable")),u=c.getUI("workzone"),h="ltr"===c.direction,p=function(){i&&clearTimeout(i),i=null};t.on("dragenter",function(e){p(),a(e)&&(e.preventDefault(),e.stopPropagation(),n=u.data("rectangle"))}).on("dragleave",function(e){p(),a(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var t;a(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",i||(i=setTimeout(function(){var a,r=n.top+n.height;((t=e.pageYr)&&(a=n.cwdEdge>e.pageX?(h?"navbar":"cwd")+(t?"Up":"Down"):(h?"cwd":"navbar")+(t?"Up":"Down"),c.autoScroll[a](Math.pow(t?n.top-e.pageY:e.pageY-r,1.3))),i=null},20))):p()}).on("drop",function(e){p(),a(e)&&(e.stopPropagation(),e.preventDefault())}),t.on("dragenter",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n,i=e(t.currentTarget),a=t.currentTarget.id||null,s=null;if(!a){s=c.cwd(),i.data(o,!1);try{e.each(t.originalEvent.dataTransfer.types,function(e,t){"elfinderfrom:"===t.substr(0,13)&&(n=t.substr(13).toLowerCase())})}catch(t){}}s&&(!s.write||n&&n===(window.location.href+s.hash).toLowerCase())?i.data(o,!0):(t.preventDefault(),t.stopPropagation(),i.data(r,!0),i.addClass(d))}}).on("dragleave",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.data(r)?n.data(r,!1):n.removeClass(d)}}).on("dragover",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),t.originalEvent.dataTransfer.dropEffect=n.data(o)?"none":"copy",n.data(r,!1)}}).on("drop",".native-droppable",function(t){if(t.originalEvent&&t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.removeClass(d),m=t.currentTarget.id?n.hasClass(l)?c.navId2Hash(t.currentTarget.id):c.cwdId2Hash(t.currentTarget.id):c.cwd().hash,t.originalEvent._target=m,c.exec("upload",{dropEvt:t.originalEvent,target:m},void 0,m)}})}(),c.cssloaded===!1&&(c.cssloaded=!0,c.trigger("cssloaded")),c.zIndexCalc(),c.trigger("init").request({data:{cmd:"open",target:c.startDir(),init:1,tree:c.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){c.trigger("fail").disable().lastDir(""),S={},U={},e(document).add(t).off("."+g),c.trigger=function(){}}).done(function(n){var i=function(e){var t=c.file(c.trashes[e]);c.options.debug;t&&t.volumeid&&delete c.volOptions[t.volumeid].trashHash,c.trashes[e]=!1,c.debug("backend-error",'Trash hash "'+e+'" was not found or not writable.')},a={};c.zIndexCalc(),c.load().debug("api",c.api),t.trigger("resize"),$(n),c.trigger("open",n),c.trigger("opendone"),ee&&c.options.enableAlways&&e(window).focus(),e.each(c.trashes,function(e){var t=c.file(e);t?"directory"===t.mime&&t.write||i(e):a[e]=!0}),Object.keys(a).length&&c.request({data:{cmd:"info",targets:Object.keys(a)},preventDefault:!0}).done(function(t){t&&t.files&&e.each(t.files,function(e,t){"directory"===t.mime&&t.write&&delete a[t.hash]})}).always(function(){e.each(a,i)})})},a&&"function"==typeof a&&(c.bootCallback=a,a.call(t.get(0),c,{dfrdsBeforeBootup:u})),void e.when.apply(null,u).done(function(){d()}).fail(function(e){c.error(e)})):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))};("undefined"==typeof n||n)&&(window.elFinder=i),i.prototype={uniqueid:0,res:function(e,t){return this.resources[e]&&this.resources[e][t]},OS:-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other",UA:function(){var e=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"WebkitAppearance"in document.documentElement.style;return{ltIE6:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:e&&window.chrome,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)}}(),currentReqCmd:"",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",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"},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;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(i){return{error:["errResponse","errDataNotJSON"]}}return n=this.normalize(n),this.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:response.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,checkExists:function(t,n,i,a){var r,o=e.Deferred(),s=[],l={},d=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},c=function(){o.resolve(s,l)},u=function(){var o=[],u=[],h=function(e){var n=e==u.length-1,r={title:i.i18n("cmdupload"),text:["errExists",u[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?c():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=u.length;e0&&delete r.reject,i.confirm(r)};return i.file(n).read?(r=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(r,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var a,s;t&&(t.error?d():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?o=t.list||[]:(a=[],o=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),null)}),a.length&&(o=o.concat(a)),l=t.list),u=e.map(r,function(t){return-1!==e.inArray(t.name,o)?t:null}),u.length&&o.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.map(o,function(t){return-1===e.inArray(t,s)?!0:null}).length&&i.sync()))),u.length>0?h(0):c()}).fail(function(e){d(),c(),e&&i.error(e)})):void c()};return i.api>=2.1&&"object"==typeof t[0]?u():c(),o},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r,o=e.Deferred(),s=[],l=[],d=0,c=[],u=function(e){var t,i,a,r=[],o=function(e){return Array.prototype.slice.call(e||[],0)},h=n.options.folderUploadExclude[n.OS]||null;a=e.length;for(var p=0;a>p;p++)if(i=e[p])if(i.isFile)d++,i.file(function(e){h&&e.name.match(h)||(l.push(i.fullPath||""),s.push(e)),d--});else if(i.isDirectory&&n.api>=2.1){d++,c.push(i.fullPath),t=i.createReader();var r=[],f=function(){t.readEntries(function(e){if(e.length)r=r.concat(o(e)),f();else{for(var t=0;t0?(n.uploads.checkExists(a,i,n,r).done(function(r,h){var p,f=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===r&&(t.overwrite=0,r=[]),a=e.map(a,function(t){var a,o,s,l;return t.isDirectory&&r.length&&(a=e.inArray(t.name,r),-1!==a&&(r.splice(a,1),o=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(h,function(e,n){return t.name==n?(s=e,!1):void 0}),s||(s=n.fileByName(t.name,i).hash),n.lockfiles({files:[s]}),l=n.request({data:{cmd:"rename",target:s,name:o},notify:{type:"rename",cnt:1}}).fail(function(e){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s]})}),f.push(l))),t._remove?null:t})),e.when.apply(e,f).done(function(){a.length>0?(p=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),u(a),setTimeout(function e(){d>0?setTimeout(e,10):(p&&clearTimeout(p),n.notify({type:"readdir",cnt:-1}),o.resolve([s,l,r,h,c]))},10)):o.reject()})}),o.promise()):o.reject()}var h=[],p=[],f=t.files[0];if("html"==t.type){var m,g=e("").append(e.parseHTML(f.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",g).each(function(){var n,i,a=e(this),r=a.closest("a");r&&r.attr("href")&&r.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=r.attr("href")),n=a.attr("_elfsrc"),n&&(i?(-1==e.inArray(i,h)&&h.push(i),-1==e.inArray(n,p)&&p.push(n)):-1==e.inArray(n,h)&&h.push(n)),1===h.length&&h[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),m=e("a[href]",g),m.each(function(){var t,n=function(e){var t=document.createElement("a");return t.href=e,t};e(this).text()&&(t=n(e(this).attr("href")),!t.href||1!==m.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||-1==e.inArray(t.href,h)&&-1==e.inArray(t.href,p)&&h.push(t.href)); })}else{var v,b,y;for(v=/(http[^<>"{}|\\^\[\]`\s]+)/gi;b=v.exec(f);)y=b[1].replace(/&/g,"&"),-1==e.inArray(y,h)&&h.push(y)}return h},xhr:function(t,n){var i=n?n:this,a=i.getUI(),r=new XMLHttpRequest,o=null,s=null,l=t.checked,d=t.isDataType||"data"==t.type,c=t.target||i.cwd().hash,u=t.dropEvt||null,h=-1!=i.option("uploadMaxConn",c),p=Math.min(5,Math.max(1,i.option("uploadMaxConn",c))),f=1e4,m=30,g=0,v=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?d?e[0][0]:e[0]:{})}):n.resolve(t.length?d?t[0][0]:t[0]:{}),n},b=e.Deferred().fail(function(e){i.uploads.xhrUploading&&v(w).done(function(e){e._cid&&(setTimeout(function(){i.sync()},5e3),y=new FormData,w=[{_chunkfail:!0}],y.append("chunk",e._chunk),y.append("cid",e._cid),d=!1,R(w))}),i.sync(),i.uploads.xhrUploading=!1,w=null,e&&i.error(e)}).done(function(e){r=null,i.uploads.xhrUploading=!1,w=null,e&&(i.currentReqCmd="upload",e.warning&&i.error(e.warning),i.updateCache(e),e.removed&&i.remove(e),e.added&&i.add(e),e.changed&&i.change(e),i.trigger("upload",e),i.trigger("uploaddone"),e.sync&&i.sync(),e.debug&&n.debug("backend-debug",e))}).always(function(){a.off("uploadabort",U),e(window).off("unload",U),o&&clearTimeout(o),s&&clearTimeout(s),l&&!t.multiupload&&S()&&i.notify({type:"upload",cnt:-k,progress:0,size:0}),j&&A.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),y=new FormData,w=t.input?t.input.files:i.uploads.checkFile(t,i,c),k=t.checked&&d?w[0].length:w.length,x=0,C=0,T=0,z=!1,A=i.ui.notify,I=!0,O=!1,S=function(){return z=z||A.children(".elfinder-notify-upload").length},U=function(){O=!0,r&&(r.quiet=!0,r.abort()),S()&&i.notify({type:"upload",cnt:-1*A.children(".elfinder-notify-upload").data("cnt"),progress:0,size:0})},M=function(e){A.children(".elfinder-notify-upload").children(".elfinder-notify-cancel")[e?"show":"hide"]()},D=function(e){return e||(e=T),setTimeout(function(){z=!0,i.notify({type:"upload",cnt:k,progress:x-C,size:e,cancel:function(){a.trigger("uploadabort"),b.resolve()}}),C=x,t.multiupload?I&&M(!0):M(I&&e>x)},i.options.notifyDelay)},E=function(){g++<=m?(S()&&C&&i.notify({type:"upload",cnt:0,progress:0,size:C}),r.quiet=!0,r.abort(),C=x=0,setTimeout(function(){O||(r.open("POST",i.uploadURL,!0),r.send(y))},f)):(a.trigger("uploadabort"),b.reject(["errAbort","errTimeout"]))},F=t.renames||null,P=t.hashes||null,j=!1;if(a.one("uploadabort",U),e(window).one("unload."+n.namespace,U),!j&&(C=x),!d&&!k)return b.reject(["errUploadNoFiles"]);r.addEventListener("error",function(){0==r.status?O?b.reject():!d&&t.files&&e.map(t.files,function(e){return e.type||e.size!==(i.UA.Safari?1802:0)?null:e}).length?(errors.push("errFolderUpload"),b.reject(["errAbort","errFolderUpload"])):t.input&&e.map(t.input.files,function(e){return e.type||e.size!==(i.UA.Safari?1802:0)?null:e}).length?b.reject(["errUploadNoFiles"]):E():(a.trigger("uploadabort"),b.reject("errConnect"))},!1),r.addEventListener("load",function(e){var n,l=r.status,c=0,u="";if(l>=400?u=l>500?"errResponse":["errResponse","errServerError"]:r.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),v(w).done(function(e){return b.reject(e._cid?null:u)})),x=T,S()&&(c=x-C)&&i.notify({type:"upload",cnt:0,progress:c,size:0}),n=i.parseUploadData(r.responseText),n._chunkmerged){y=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return j=!0,a.off("uploadabort",U),s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?R(h,w[1]):R(h))}n._multiupload=!!t.multiupload,n.error?(i.trigger("uploadfail",n),n._chunkfailure||n._multiupload?(O=!0,i.uploads.xhrUploading=!1,o&&clearTimeout(o),A.children(".elfinder-notify-upload").length?(i.notify({type:"upload",cnt:-k,progress:0,size:0}),b.reject(n.error)):b.reject()):b.reject(n.error)):b.resolve(n)},!1),r.upload.addEventListener("loadstart",function(e){!j&&e.lengthComputable&&(x=e.loaded,g&&(x=0),T=e.total,x||(x=parseInt(.05*T)),S()&&(i.notify({type:"upload",cnt:0,progress:x-C,size:t.multiupload?0:T}),C=x))},!1),r.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!j&&r.readyState<2&&(x=e.loaded,!t.checked&&x>0&&!o&&(o=D(r._totalSize-x)),T||(T=e.total,x||(x=parseInt(.05*T))),n=x-C,S()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),C=x),!t.multiupload&&x>=T&&(I=!1,M(!1)))},!1);var R=function(a,s){var f,m,g,v,w,x,C,T,z,A,U,E,j,R=0,H=1,N=[],q=0,_=k,L=0,W=[],$=(new Date).getTime().toString().substr(-9),B=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),V=h?!1:"",K=function(a,r){var s,l,h=[],p=0;if(!O){for(;a.length&&h.lengthf&&!O;f++)s=d?h[f][0][0]._cid||null:h[f][0]._cid||null,j[s]?E--:n.exec("upload",{type:t.type,isDataType:d,files:h[f],checked:!0,target:c,dropEvt:u,renames:F,hashes:P,multiupload:!0,overwrite:0===t.overwrite?0:void 0},void 0,c).fail(function(e){e&&"No such command"===e&&(O=!0,n.error(["errUpload","errPerm"])),s&&(j[s]=!0)}).always(function(t){t&&t.added&&(A=e.merge(A,t.added)),E<=++U&&(n.trigger("multiupload",{added:A}),o&&clearTimeout(o),S()&&i.notify({type:"upload",cnt:-k,progress:0,size:0})),a.length?K(a,1):--l<=1&&(I=!1,M(!1))})}}(h.length<1||O)&&(O?(o&&clearTimeout(o),s&&(j[s]=!0),b.reject()):(b.resolve(),i.uploads.xhrUploading=!1))},G=function(){i.uploads.xhrUploading?setTimeout(function(){G()},100):(i.uploads.xhrUploading=!0,K(N,p))};if(!l&&(d||"files"==t.type)){for((f=n.option("uploadMaxSize",c))||(f=0),v=0;v=2.1&&("slice"in T?V="slice":"mozSlice"in T?V="mozSlice":"webkitSlice"in T&&(V="webkitSlice")))}catch(J){k--,_--;continue}if(f&&m>f||!V&&n.uplMaxSize&&m>n.uplMaxSize)i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),k--,_--;else if(!T.type||i.uploadMimeCheck(T.type,c))if(V&&m>B){for(w=0,x=B,C=-1,_=Math.floor(m/B),g=T.lastModified?Math.round(T.lastModified/1e3):0,L+=m,W[$]=0;m>=w;)z=T[V](w,x),z._chunk=T.name+"."+ ++C+"_"+_+".part",z._cid=$,z._range=w+","+z.size+","+m,z._mtime=g,W[$]++,R&&q++,"undefined"==typeof N[q]&&(N[q]=[],d&&(N[q][0]=[],N[q][1]=[])),R=B,H=1,d?(N[q][0].push(z),N[q][1].push(s[v])):N[q].push(z),w=x,x=w+B;null==z?(i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),k--,_--):(_+=C,R=0,H=1,q++)}else(n.uplMaxSize&&R+m>=n.uplMaxSize||H>n.uplMaxFile)&&(R=0,H=1,q++),"undefined"==typeof N[q]&&(N[q]=[],d&&(N[q][0]=[],N[q][1]=[])),d?(N[q][0].push(T),N[q][1].push(s[v])):N[q].push(T),R+=m,L+=m,H++;else i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadMime")+" ("+i.escape(T.type)+")"),k--,_--}if(0==N.length)return t.checked=!0,!1;if(N.length>1)return o=D(L),A=[],U=0,E=N.length,j=[],G(),!0;d?(a=N[0][0],s=N[0][1]):a=N[0]}return l||(n.UA.Safari&&t.files?r._totalSize=L:o=D(L)),l=!0,a.length||b.reject(["errUploadNoFiles"]),r.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){r.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in r&&(r[e]=this)}),y.append("cmd","upload"),y.append(i.newAPI?"target":"current",c),F&&F.length&&(e.each(F,function(e,t){y.append("renames[]",t)}),y.append("suffix",n.options.backupSuffix)),P&&e.each(P,function(e,t){y.append("hashes["+e+"]",t)}),e.each(i.options.customData,function(e,t){y.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){y.append("mimes["+e+"]",t)}),e.each(a,function(e,i){i._chunkmerged?(y.append("chunk",i._chunkmerged),y.append("upload[]",i._name),y.append("mtime[]",i._mtime)):(i._chunkfail?(y.append("upload[]","chunkfail"),y.append("mimes","chunkfail")):(y.append("upload[]",i),t.clipdata&&(t.overwrite=0,y.append("name[]",n.date(n.nonameDateFormat)+".png")),n.UA.iOS&&"image.jpg"===i.name&&(t.overwrite=0,y.append("name[]",n.date(n.nonameDateFormat)+".jpg"))),i._chunk?(y.append("chunk",i._chunk),y.append("cid",i._cid),y.append("range",i._range),y.append("mtime[]",i._mtime)):y.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),d&&e.each(s,function(e,t){y.append("upload_path[]",t)}),0===t.overwrite&&y.append("overwrite",0),u&&y.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),r.send(y),!0};if(d)l?R(w[0],w[1]):w.done(function(t){if(F=[],k=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:c,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,b.reject(e))}).done(function(n){n.hashes&&(t[1]=e.map(t[1],function(e){return e=e.replace(/\/[^\/]*$/,""),""===e?c:n.hashes[e]}))}).always(function(e){p&&(F=t[2],P=t[3],R(t[0],t[1]))});t[1]=e.map(t[1],function(){return c}),F=t[2],P=t[3],R(t[0],t[1])}else b.reject(["errUploadNoFiles"])}).fail(function(){b.reject()});else if(w.length>0)if(t.clipdata||null!=F)R(w)||b.reject();else{var H=[],N=[],q=n.options.folderUploadExclude[n.OS]||null;e.each(w,function(t,n){var i=n.webkitRelativePath||n.relativePath||"";return i?(q&&n.name.match(q)?(n._remove=!0,i=void 0):(i=i.replace(/\/[^\/]*$/,""),i&&-1===e.inArray(i,H)&&H.push(i)),void N.push(i)):!1}),F=[],P={},H.length?!function(){var t=e.map(H,function(e){return-1===e.indexOf("/")?{name:e}:null}),i=[];n.uploads.checkExists(t,c,n,!0).done(function(a,r){var o,s,l,u=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",c)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.map(t,function(e){return e._remove?null:e})),i.length&&e.each(N.concat(),function(t,n){0===e.inArray(n,i)&&(w[t]._remove=!0,delete N[t])}),w=e.map(w,function(e){return e._remove?null:e}),N=e.map(N,function(e){return void 0===e?null:e}),t.length?(o=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(r,function(e,t){return a[0]==t?(l=e,!1):void 0}),l||(l=n.fileByName(a[0],c).hash),n.lockfiles({files:[l]}),u.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){b.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):u.push(null),e.when.apply(e,u).done(function(){n.request({data:{cmd:"mkdir",target:c,dirs:H},notify:{type:"mkdir",cnt:H.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,b.reject(e))}).done(function(t){t.hashes&&(N=e.map(N.concat(),function(e){return""===e?c:t.hashes["/"+e]}))}).always(function(e){p&&(d=!0,R(w,N)||b.reject())})})):b.reject()})}():n.uploads.checkExists(w,c,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",c)&&(null===i?t.overwrite=0:(F=i,P=a),w=e.map(w,function(e){return e._remove?null:e})),k=w.length,k>0?R(w)||b.reject():b.reject()})}else b.reject();return b},iframe:function(t,n){var i,a,r,o,s=n?n:this,l=t.input?t.input:!1,d=l?!1:s.uploads.checkFile(t,s),c=e.Deferred().fail(function(e){e&&s.error(e)}),u="iframe-"+n.namespace+ ++s.iframeCnt,h=e('
'),p=this.UA.IE,f=function(){o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){p&&e('