ave-cms/lib/redactor/elfinder/js/elfinder.min.js

21 lines
383 KiB
JavaScript
Raw Normal View History

2017-06-24 00:58:56 +03:00
/*!
* elFinder - file manager for web
2017-09-21 09:50:14 +03:00
* Version 2.1.25 (2017-06-23)
2017-06-24 00:58:56 +03:00
* http://elfinder.org
*
* Copyright 2009-2017, Studio 42
* Licensed under a 3-clauses BSD license
*/
2017-09-21 09:50:14 +03:00
!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){var a,r,o,s,l=this,d=["button"],t=e(t),c=e("<div/>").append(t.contents()).attr("class",t.attr("class")||"").attr("style",t.attr("style")||""),u=t.attr("id")||"",h="elfinder-"+(u?u:Math.random().toString().substr(2,7)),p="mousedown."+h,f="keydown."+h,m="keypress."+h,g=!0,v=!0,b=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],y="",w={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},k={},x={},C={},T=[],A={},z={},I=[],O={},S=[],U=[],M=new l.command(l),D="auto",E=400,F=null,P="./sounds/",j=e(document.createElement("audio")).hide().appendTo("body")[0],R=0,H="",N=null,q=function(n){var i,a,r,o,s,d,c={},u={};l.api>=2.1?n.options.uiCmdMap&&(l.commandMap=n.options.uiCmdMap&&Object.keys(n.options.uiCmdMap).length?n.options.uiCmdMap:{},H!==JSON.stringify(l.commandMap)&&(H=JSON.stringify(l.commandMap))):l.options.sync=0,n.init?(x={},C={}):(d=y,i="elfinder-subtree-loaded "+l.res("class","navexpand"),s=l.res("class","navcollapse"),a=Object.keys(x),r=function(t){if(!x[t])return!0;var n="directory"===x[t].mime,a=x[t].phash;!(!n||c[a]||!u[a]&&e("#"+l.navHash2Id(x[t].hash)).is(":hidden")&&e("#"+l.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)||!n&&a===y||O[t]?n&&(u[a]=!0):(n&&!c[a]&&(c[a]=!0,e("#"+l.navHash2Id(a)).removeClass(i).next(".elfinder-navbar-subtree").empty()),$(x[t]))},o=function(){a.length&&(N&&N._abort(),N=l.asyncJob(r,a,{interval:20,numPerOnce:100}))},l.trigger("filesgc").one("filesgc",function(){a=[]}),l.one("opendone",function(){d!==y&&(t.data("lazycnt")?l.one("lazydone",o):o())})),l.sorters=[],y=n.cwd.hash,_(n.files),x[y]||_([n.cwd]),l.lastDir(y),l.autoSync()},_=function(t){var n,i,a={name:!0,perm:!0,date:!0,size:!0,kind:!0},r=0===l.sorters.length,o=t.length,s=function(t){var t=t||{};l.sorters=[],e.each(l.sortRules,function(e){(a[e]||"undefined"!=typeof t[e]||"mode"===e&&"undefined"!=typeof t.perm)&&l.sorters.push(e)})};for(i=0;o>i;i++)n=Object.assign({},t[i]),n.name&&n.hash&&n.mime&&(r&&n.phash===y&&(s(n),r=!1),n.isroot&&n.phash&&(l.leafRoots[n.phash]?-1===e.inArray(n.hash,l.leafRoots[n.phash])&&l.leafRoots[n.phash].push(n.hash):l.leafRoots[n.phash]=[n.hash],x[n.phash]&&(x[n.phash].dirs||(x[n.phash].dirs=1),n.ts&&(x[n.phash].ts||0)<n.ts&&(x[n.phash].ts=n.ts))),x[n.hash]&&$(x[n.hash],!0),x[n.hash]=n,"directory"!==n.mime||C[n.hash]||(C[n.hash]={}),n.phash&&(C[n.phash]||(C[n.phash]={}),C[n.phash][n.hash]=!0));r&&s()},L=function(t){var n=t.length,i={},a=function(t){var n=x[t];n&&("directory"===n.mime&&(i[t]&&delete l.roots[i[t]],l.searchStatus.state<2&&e.each(x,function(e,n){n.phash==t&&a(e)})),$(x[t]))};for(e.each(l.roots,function(e,t){i[t]=e});n--;)a(t[n])},W=function(t){e.each(t,function(t,n){var i=n.hash;x[i]&&e.each(["locked","hidden","width","height"],function(e,t){x[i][t]&&!n[t]&&delete x[i][t]}),x[i]=x[i]?Object.assign(x[i],n):n})},$=function(e,t){var n=e.hash,i=e.phash;i&&C[i]&&delete C[i][n],t||(C[n]&&delete C[n],l.optionsByHashes[n]&&delete l.optionsByHashes[n]),delete x[n]},B=0,V=[],K=!1,G=function(n){var i,a=n.keyCode,r=!(!n.ctrlKey&&!n.metaKey);g&&(e.each(z,function(e,t){t.type==n.type&&t.keyCode==a&&t.shiftKey==n.shiftKey&&t.ctrlKey==r&&t.altKey==n.altKey&&(n.preventDefault(),n.stopPropagation(),t.callback(n,l),l.debug("shortcut-exec",e+" : "+t.description))}),a!=e.ui.keyCode.TAB||e(n.target).is(":input")||n.preventDefault(),"keydown"===n.type&&a==e.ui.keyCode.ESCAPE&&(t.find(".ui-widget:visible").length||l.clipboard().length&&l.clipboard([]),e.ui.ddmanager&&(i=e.ui.ddmanager.current,i&&i.helper&&i.cancel()),t.find(".ui-widget.e
t.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),n&&t.css("display"),l.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&&(this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),I=[],T=[],A={},z={},e(window).off("."+h),e(document).off("."+h),l.trigger=function(){},e(j).remove(),t.off().removeData().empty().append(c.contents()).attr("class",c.attr("class")).attr("style",c.attr("style")),delete t[0].elfinder)},this.autoSync=function(t){var n;if(l.options.sync>=1e3){if(a&&(clearTimeout(a),a=null,l.trigger("autosync",{action:"stop"})),"stop"===t?++R:R=Math.max(0,--R),R||"forcestop"===t||!l.options.syncStart)return;n=function(t){var i;k.syncMinMs&&(t||a)&&(t&&l.trigger("autosync",{action:"start"}),i=Math.max(l.options.sync,k.syncMinMs),a&&clearTimeout(a),a=setTimeout(function(){var t,r=!0,o=y;k.syncChkAsTs&&(t=x[o].ts)?l.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;r=!0,e.compare&&(i=e.compare,i==t&&(r=!1)),r?l.sync(o).always(function(){i&&(x[o].ts=i),n()}):n()}).fail(function(t,r){t&&0!=r.status?(l.error(t),-1!==e.inArray("errOpen",t)&&l.request({data:{cmd:"open",target:l.lastDir("")||l.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):a=setTimeout(function(){n()},i)}):l.sync(y,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(e<i.left+n||e>i.left+i.width+n||t<i.top+n||t>i.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(l.zIndex?l.zIndex+1:0,1e3)}},function(){Y&&l.UA.Fullscreen&&(l.UA.Fullscreen=!1,X&&"undefined"!=typeof X.attr("allowfullscreen")&&(l.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)})},d=l.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."+h,u),void 0!==i&&e("body").css("overflow",i),i=void 0,n&&(t=n.elm,c(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(l.getMaximizeCss()).addClass(r).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+h,u).trigger("resize"),!0}},c=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=d.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})},100))};e(document).on("fullscreenchange."+h+" webkitfullscreenchange."+h+" mozfullscreenchange."+h+" MSFullscreenChange."+h,function(t){if(l.UA.Fullscreen){var i=d.fullElm(),p=e(window);a&&clearTimeout(a),null===i?(p.off("resize."+h,u),n&&(i=n.elm,c(i),e(i).trigger("resize",{fullscreen:"off"}))):(e(i).addClass(r+" "+o).attr("style","width:100%; height:100%; margin:0;
}).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&&z.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,A=!1,z=i.ui.notify,I=!0,O=!1,S=function(){return A=A||z.children(".elfinder-notify-upload").length},U=function(){O=!0,r&&(r.quiet=!0,r.abort()),S()&&i.notify({type:"upload",cnt:-1*z.children(".elfinder-notify-upload").data("cnt"),progress:0,size:0})},M=function(e){z.children(".elfinder-notify-upload").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: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),z.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,A,z,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.length<r;)h.push(a.shift());if(p=h.length){l=p;for(var f=0;p>f&&!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&&(z=e.merge(z,t.added)),E<=++U&&(n.trigger("multiupload",{added:z}),o&&clearTimeout(o),S()&&i.notify({type:"upload",cnt:-k,progress:0,size:0})),a.leng
},6e4))}),d.data("funcexpup")()),r.reset)return void l.trigger("change","reset");d.parent().append(e('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+n.i18n("reAuth")+'">').on("click",function(){c.val("reauth"),l.trigger("change","reset")})),c.val(t),this.vars.mbtn.show(),r.folders&&s.call(this,n,o.path,r.folders),o.user.val("done"),o.pass.val("done"),o.offline.closest("tr").hide()}d.removeData("inrequest")},fail:function(t,n){e(this.inputs.host[0]).removeData("inrequest"),this.protocol.trigger("change","reset")}}},findCwdNodes:function(t,n){var i=this,a=this.getUI("cwd"),r=this.cwd().hash,o=e();return n=n||{},e.each(t,function(e,t){return(t.phash===r||i.searchStatus.state>1)&&(o=o.add(a.find("#"+i.cwdHash2Id(t.hash))),n.firstOnly)?!1:void 0}),o},convAbsUrl:function(e){if(e.match(/^http/i))return e;if("//"===e.substr(0,2))return window.location.protocol+e;var t,n=window.location.protocol+"//"+window.location.host,i=/[^\/]+\/\.\.\//;for(t="/"===e.substr(0,1)?n+e:n+window.location.pathname.replace(/\/[^\/]+$/,"/")+e,t=t.replace("/./","/");i.test(t);)t=t.replace(i,"");return t},navHash2Id:function(e){return this.navPrefix+e},navId2Hash:function(e){return"string"==typeof e?e.substr(this.navPrefix.length):!1},cwdHash2Id:function(e){return this.cwdPrefix+e},cwdId2Hash:function(e){return"string"==typeof e?e.substr(this.cwdPrefix.length):!1},isInWindow:function(e,t){var n,i;return(n=e.get(0))&&(t||null!==n.offsetParent)?(i=n.getBoundingClientRect(),!!document.elementFromPoint(i.left,i.top)):!1},zIndexCalc:function(){var t=this,n=this.getUI(),i=n.css("z-index");i&&"auto"!==i&&"inherit"!==i?t.zIndex=i:n.parents().each(function(n,i){var a=e(i).css("z-index");return"auto"!==a&&"inherit"!==a&&(a=parseInt(a))?(t.zIndex=a,!1):void 0})},loadScript:function(t,n,i,a){var r={dataType:"script",cache:!0},o=null;return e.isFunction(n)&&(o=function(){if(a)if("undefined"==typeof a.obj[a.name])var e=a.timeout?a.timeout/10:1e3,t=setInterval(function(){--e>0&&"undefined"!=typeof a.obj[a.name]&&(clearInterval(t),n())},10);else n();else n()}),i&&"tag"===i.loadType?(e.each(t,function(t,n){e("head").append(e('<script defer="defer">').attr("src",n))}),o()):(i=e.isPlainObject(i)?Object.assign(r,i):r,function s(){e.ajax(Object.assign(i,{url:t.shift(),success:t.length?s:o}))}()),this},loadCss:function(t){var n=this;return"string"==typeof t&&(t=[t]),e.each(t,function(t,i){i=n.convAbsUrl(i).replace(/^https?:/i,""),e("head > link[href='+url+']").length||e("head").append('<link rel="stylesheet" type="text/css" href="'+i+'" />')}),this},asyncJob:function(t,n,i){var a,r,o=e.Deferred().always(function(){o._abort=function(){}}),s=!1,l=Object.assign({interval:0,numPerOnce:1},i||{}),d=[],c=[],u=[];return o._abort=function(e){r&&clearTimeout(r),c=[],s=!0,"pending"===o.state()&&o[e?"resolve":"reject"](d)},"function"==typeof t&&Array.isArray(n)?(c=n.concat(),a=function(){s||(u=c.splice(0,l.numPerOnce),e.each(u,function(e,n){if(s)return!1;var i=t(n);null!==i&&d.push(i)}),s||(c.length?r=setTimeout(a,l.interval):o.resolve(d)))},c.length?r=setTimeout(a,0):o.resolve(d)):o.reject(),o},log:function(e){return window.console&&window.console.log&&window.console.log(e),this},debug:function(e,t){var n=this.options.debug;return n&&("all"===n||n[e])&&window.console&&window.console.log&&window.console.log("elfinder debug: ["+e+"] ["+this.id+"]",t),"backend-error"===e?(!this.cwd().hash||n&&("all"===n||n["backend-error"]))&&(t=Array.isArray(t)?t:[t],this.error(t)):"backend-debug"===e&&this.trigger("backenddebug",t),this},time:function(e){window.console&&window.console.time&&window.console.time(e)},timeEnd:function(e){window.console&&window.console.timeEnd&&window.console.timeEnd(e)}},Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=n.length;return function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on non-object");var
sortdate:"by date",sortFoldersFirst:"Folders first",sortperm:"by permission",sortmode:"by mode",sortowner:"by owner",sortgroup:"by group",sortAlsoTreeview:"Also Treeview","untitled file.txt":"NewFile.txt","untitled folder":"NewFolder",Archive:"NewArchive",confirmReq:"Confirmation required",confirmRm:"Are you sure you want to permanently remove items?<br/>This cannot be undone!",confirmRepl:"Replace old item with new one?",confirmRest:"Replace existing item with the item in trash?",confirmConvUTF8:"Not in UTF-8<br/>Convert to UTF-8?<br/>Contents become UTF-8 by saving after conversion.",confirmNonUTF8:"Character encoding of this file couldn't be detected. It need to temporarily convert to UTF-8 for editting.<br/>Please select character encoding of this file.",confirmNotSave:"It has been modified.<br/>Losing work if you do not save changes.",confirmTrash:"Are you sure you want to move items to trash bin?",apllyAll:"Apply to all",name:"Name",size:"Size",perms:"Permissions",modify:"Modified",kind:"Kind",read:"read",write:"write",noaccess:"no access",and:"and",unknown:"unknown",selectall:"Select all files",selectfiles:"Select file(s)",selectffile:"Select first file",selectlfile:"Select last file",viewlist:"List view",viewicons:"Icons view",places:"Places",calc:"Calculate",path:"Path",aliasfor:"Alias for",locked:"Locked",dim:"Dimensions",files:"Files",folders:"Folders",items:"Items",yes:"yes",no:"no",link:"Link",searcresult:"Search results",selected:"selected items",about:"About",shortcuts:"Shortcuts",help:"Help",webfm:"Web file manager",ver:"Version",protocolver:"protocol version",homepage:"Project home",docs:"Documentation",github:"Fork us on Github",twitter:"Follow us on twitter",facebook:"Join us on facebook",team:"Team",chiefdev:"chief developer",developer:"developer",contributor:"contributor",maintainer:"maintainer",translator:"translator",icons:"Icons",dontforget:"and don't forget to take your towel",shortcutsof:"Shortcuts disabled",dropFiles:"Drop files here",or:"or",selectForUpload:"Select files",moveFiles:"Move items",copyFiles:"Copy items",restoreFiles:"Restore items",rmFromPlaces:"Remove from places",aspectRatio:"Aspect ratio",scale:"Scale",width:"Width",height:"Height",resize:"Resize",crop:"Crop",rotate:"Rotate","rotate-cw":"Rotate 90 degrees CW","rotate-ccw":"Rotate 90 degrees CCW",degree:"°",netMountDialogTitle:"Mount network volume",protocol:"Protocol",host:"Host",port:"Port",user:"User",pass:"Password",confirmUnmount:"Are you unmount $1?",dropFilesBrowser:"Drop or Paste files from browser",dropPasteFiles:"Drop files, Paste URLs or images(clipboard) here",encoding:"Encoding",locale:"Locale",searchTarget:"Target: $1",searchMime:"Search by input MIME Type",owner:"Owner",group:"Group",other:"Other",execute:"Execute",perm:"Permission",mode:"Mode",emptyFolder:"Folder is empty",emptyFolderDrop:"Folder is empty\\A Drop to add items",emptyFolderLTap:"Folder is empty\\A Long tap to add items",quality:"Quality",autoSync:"Auto sync",moveUp:"Move up",getLink:"Get URL link",selectedItems:"Selected items ($1)",folderId:"Folder ID",offlineAccess:"Allow offline access",reAuth:"To re-authenticate",nowLoading:"Now loading...",openMulti:"Open multiple files",openMultiConfirm:"You are trying to open the $1 files. Are you sure you want to open in browser?",emptySearch:"Search results is empty in search target.",editingFile:"It is editing a file.",hasSelected:"You have selected $1 items.",hasClipboard:"You have $1 items in the clipboard.",incSearchOnly:"Incremental search is only from the current view.",reinstate:"Reinstate",complete:"$1 complete",contextmenu:"Context menu",pageTurning:"Page turning",volumeRoots:"Volume roots",reset:"Reset",bgcolor:"Background color",colorPicker:"Color picker","8pxgrid":"8px Grid",enabled:"Enabled",disabled:"Disabled",emptyIncSearch:"Search results is empty in current view.\\APress [Enter] to expand search target.",emptyLetSearch:"First letter search results is empty in current view.",textLabel:"Text label",minsLeft:"$1 mins left",openAsEncoding:"Reopen with selected encoding",saveAsEncoding:"Save
if(n=t.file(t.cwdId2Hash(i.attr("id"))),!i.hasClass("elfinder-cwd-parent")&&n&&t.compare(e,n)<0)return i;i=i.next("[id]")}},m=function(e){var n,i=J.length;for(n=0;i>n;n++)if(t.compare(e,J[n])<0)return n;return i||-1},g=!!e.htmlPrefilter,v=e(g?document.createDocumentFragment():"<div/>");if(h>re)we(),L=n.concat(),K();else{for(h&&Oe.removeClass("elfinder-cwd-wrapper-empty");h--;)o=n[h],s=o.hash,e("#"+t.cwdHash2Id(s)).length||((l=f(o))&&!l.length&&(l=null),!l&&(c=m(o))>=0?J.splice(c,0,o):(v.empty().append(H(o)),"directory"===o.mime&&!a&&ue(v),d=g?v:v.children(),l?l.before(d):u.append(d)),e("#"+t.cwdHash2Id(s)).length&&o.tmb&&(p[s]=o.tmb));de(),be(u),Object.keys(p).length&&Object.assign(Y.attachTmbs,p)}},me=function(n){var i,a,r,o,s=n.length,l=t.searchStatus.state>1,d=t.getCommand(t.currentReqCmd)||{};if(!t.cwd().hash&&!d.noChangeDirOnRemovedCwd)return o=t.files(),void e.each(C.reverse(),function(e,n){return o[n]?(t.one(t.currentReqCmd+"done",function(){!t.cwd().hash&&t.exec("open",n)}),!1):void 0});for(;s--;){if(i=n[s],(a=e("#"+t.cwdHash2Id(i))).length)try{a.remove(),--Y.renderd}catch(c){t.debug("error",c)}else-1!==(r=X(i))&&J.splice(r,1);l&&-1!==(r=e.inArray(i,T))&&T.splice(r,1)}l&&t.trigger("cwdhasheschange",T),de()},ge={name:t.i18n("name"),perm:t.i18n("perms"),date:t.i18n("modify"),size:t.i18n("size"),kind:t.i18n("kind"),modestr:t.i18n("mode"),modeoct:t.i18n("mode"),modeboth:t.i18n("mode")},ve=function(){for(var e="",i="",a=Object.assign({},ge,n.listView.columnsCustomName),r=0;r<z.length;r++)e="undefined"!=typeof a[z[r]]?a[z[r]]:t.i18n(z[r]),i+='<td class="elfinder-cwd-view-th-'+z[r]+' sortable-item">'+e+"</td>";return i},be=function(e,t){var n,i=1;e=e||(r?ke.find("tbody"):ke),J.length>0&&(e.css({height:"auto"}),n=e.height(),t&&(r||(i=Math.floor(e.width()/e.find("[id]:first").width()),t=Math.ceil(t/i)*i),Y.hpi=n/t,Y.row=Y.hpi*i),Ce.css({top:Y.hpi*J.length+n+"px"}).show())},ye={contextmenu:function(e){e.preventDefault(),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:e.pageX,y:e.pageY})},touchstart:function(e){e.originalEvent.touches.length>1||(ke.data("longtap",null),xe.data("touching",{x:e.originalEvent.touches[0].pageX,y:e.originalEvent.touches[0].pageY}),e.target!==this&&e.target!==ke.get(0)||ke.data("tmlongtap",setTimeout(function(){ke.data("longtap",!0),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:xe.data("touching").x,y:xe.data("touching").y})},500)))},touchend:function(e){"touchmove"===e.type&&(!xe.data("touching")||Math.abs(xe.data("touching").x-e.originalEvent.touches[0].pageX)+Math.abs(xe.data("touching").y-e.originalEvent.touches[0].pageY)>4)&&xe.data("touching",null),clearTimeout(ke.data("tmlongtap"))},click:function(e){ke.data("longtap")&&(e.preventDefault(),e.stopPropagation())}},we=function(){var n;Oe.append(Te).removeClass("elfinder-cwd-wrapper-empty elfinder-search-result elfinder-incsearch-result elfinder-letsearch-result"),(t.searchStatus.state>1||t.searchStatus.ininc)&&Oe.addClass("elfinder-search-result"+(t.searchStatus.ininc?" elfinder-"+("/"===k.substr(0,1)?"let":"inc")+"search-result":"")),Y.attachThumbJob&&Y.attachThumbJob._abort(),ke.data("selectable")&&ke.selectable("disable").selectable("destroy").removeData("selectable"),t.trigger("cwdinit"),N=e();try{ke.empty()}catch(i){ke.html("")}se&&(xe.off("scroll.fixheader resize.fixheader"),se.remove(),se=null),ke.removeClass("elfinder-cwd-view-icons elfinder-cwd-view-list").addClass("elfinder-cwd-view-"+(r?"list":"icons")).attr("style","").css("height","auto"),Ce.hide(),xe[r?"addClass":"removeClass"]("elfinder-cwd-wrapper-list")._padding=parseInt(xe.css("padding-top"))+parseInt(xe.css("padding-bottom")),t.UA.iOS&&xe.removeClass("overflow-scrolling-touch").addClass("overflow-scrolling-touch"),r&&(ke.html("<table><thead/><tbody/></table>"),n=e('<tr class="ui-state-default"><td class="elfinder-cwd-view-th-name">'+ge.name+"</td>"+ve()+"</tr>"),ke.find("thead").hide().append(n.on("contextmenu."+t.namespace,ye.contextmenu).on("touchstart."+t.namespace,"td",ye.touchstart).on("touchmove."+t.namespace+" touchend."+t.namespace+" mou
e.each(t.buttons,function(t,n){var a=e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-btncnt-'+b++ +" "+c+'"><span class="ui-button-text">'+t+"</span></button>").on("click",e.proxy(n,i[0]));r?m.append(a):m.prepend(a)}),m.children().length&&(A.append(g),A.show(),g.find("button").each(function(t,n){v+=e(n).outerWidth(!0)}),A.hide(),v+=20,A.width()<v&&A.width(v)),A.trigger("posinit").data("margin-y",i.outerHeight(!0)-i.height()),t.resizable&&e.fn.resizable&&A.resizable({minWidth:t.minWidth,minHeight:t.minHeight,start:function(){A.data("resizing")!==!0&&A.data("resizing")&&clearTimeout(A.data("resizing")),A.data("resizing",!0)},stop:function(){A.data("resizing",setTimeout(function(){A.data("resizing",!1)},200))},resize:function(t,n){var a=0;A.children(".ui-widget-header,.ui-dialog-buttonpane").each(function(){a+=e(this).outerHeight(!0)}),i.height(n.size.height-a-A.data("margin-y")),A.trigger("resize")}}),"function"==typeof t.create&&e.proxy(t.create,this)(),w(),t.autoOpen&&i.elfinderdialog("open")}),this)},e.fn.elfinderdialog.defaults={cssClass:"",title:"",modal:!1,resizable:!0,autoOpen:!0,closeOnEscape:!0,destroyOnClose:!1,buttons:{},btnHoverFocus:!0,position:null,absolute:!1,width:320,height:"auto",minWidth:200,minHeight:110,allowMinimize:"auto",allowMaximize:!1,headerBtnPos:"auto",headerBtnOrder:"auto"},e.fn.elfinderfullscreenbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t),i=n.children(".elfinder-button-icon");t.change(function(){var e=t.value;i.toggleClass("elfinder-button-icon-unfullscreen",e),n.attr("title",e?t.fm.i18n("reinstate"):t.fm.i18n("cmdfullscreen")),t.className=e?"unfullscreen":"",t.title=t.fm.i18n(e?"reinstate":"cmdfullscreen")})})},e.fn.elfindermkdirbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t);t.change(function(){n.attr("title",t.value)})})},e.fn.elfindernavbar=function(t,n){return this.not(".elfinder-navbar").each(function(){var i,a,r,o,s=e(this).hide().addClass("ui-state-default elfinder-navbar"),l=s.parent(),d=l.children(".elfinder-workzone").append(s),c=s.outerHeight()-s.height(),u="ltr"==t.direction,h=function(){var e=t.getUI("cwd"),n=t.getUI("workzone"),i=n.data("rectangle"),a=e.offset();n.data("rectangle",Object.assign(i,{cwdEdge:"ltr"===t.direction?a.left:a.left+e.width()}))};t.one("cssloaded",function(){c=s.outerHeight()-s.height()}).bind("wzresize",function(){s.height(d.height()-c)}),t.UA.Touch&&(r=t.storage("autoHide")||{},"undefined"==typeof r.navbar&&(r.navbar=n.autoHideUA&&n.autoHideUA.length>0&&e.map(n.autoHideUA,function(e){return t.UA[e]?!0:null}).length,t.storage("autoHide",r)),r.navbar&&t.one("init",function(){t.uiAutoHide.push(function(){s.stop(!0,!0).trigger("navhide",{duration:"slow",init:!0})})}),t.bind("load",function(){a=e('<div class="elfinder-navbar-swipe-handle"/>').hide().appendTo(d),"none"!==a.css("pointer-events")&&(a.remove(),a=null)}),s.on("navshow navhide",function(e,n){var i="navshow"===e.type?"show":"hide",o=n&&n.duration?n.duration:"fast",l=n&&n.handleW?n.handleW:Math.max(50,t.getUI().width()/10);s.stop(!0,!0)[i](o,function(){"show"===i?a&&a.stop(!0,!0).hide():a&&(a.width(l?l:""),t.resources.blink(a,"slowonce")),t.trigger("navbar"+i).getUI("cwd").trigger("resize"),n.init&&t.trigger("uiautohide"),h()}),r.navbar="show"!==i,t.storage("autoHide",Object.assign(t.storage("autoHide"),{navbar:r.navbar}))})),e.fn.resizable&&!t.UA.Mobile&&(i=s.resizable({handles:u?"e":"w",minWidth:n.minWidth||150,maxWidth:n.maxWidth||500,stop:function(e,n){t.storage("navbarWidth",n.size.width),h()}}).on("resize scroll",function(n){u||"resize"!==n.type||s.css("left",0),clearTimeout(e(this).data("posinit")),e(this).data("posinit",setTimeout(function(){var e=t.UA.Opera&&s.scrollLeft()?20:2;i.css({top:parseInt(s.scrollTop())+"px",left:u?"auto":parseInt(s.scrollLeft()+e),right:u?-1*parseInt(s.scrollLeft()-e):"auto"}),"resize"===n.type&&t.getUI("cwd").trigger("resize")},50))}).find(".ui-resizable-handle").addClass("ui-front"),t.one("open",function(){setTimeout(function(){s.tri
},500)),o.is(".elfinder-ro,.elfinder-na")?(o.removeClass(k),void s.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus")):(a=t.navId2Hash(o.attr("id")),o.data("dropover",a),e.each(i.helper.data("files"),function(e,n){return n===a||t.file(n).phash===a&&!i.helper.hasClass("elfinder-drag-helper-plus")?(o.removeClass(l),!1):void 0}),s.data("locked")?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",(n.shiftKey||n.ctrlKey||n.metaKey)&&(r+=" elfinder-drag-helper-plus")),o.hasClass(k)&&s.addClass(r),void setTimeout(function(){o.hasClass(k)&&s.addClass(r)},20))):(o.removeClass(l),void s.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus"))},out:function(t,n){var i=e(this),a=n.helper;t.stopPropagation(),a.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(a.data("dropover")-1,0)),i.data("expandTimer")&&clearTimeout(i.data("expandTimer")),i.removeData("dropover").removeClass(x+" "+k)},deactivate:function(){e(this).removeData("dropover").removeClass(x+" "+k)},drop:function(e,t){S(e.clientX)&&R.call(this,e,t)}}),N=e(t.res("tpl","navspinner")),q=t.res("tpl","navdir"),_=t.res("tpl","perms"),L=(t.res("tpl","lock"),t.res("tpl","symlink")),W={},$={id:function(e){return t.navHash2Id(e.hash)},name:function(e){return t.escape(e.i18||e.name)},cssclass:function(e){var i=(e.phash&&!e.isroot?"":l)+" "+p+" "+t.perms2class(e);return e.dirs&&!e.link&&(i+=" "+m)&&-1==e.dirs&&(i+=" "+b),n.getClass&&(i+=" "+n.getClass(e)),e.csscls&&(i+=" "+t.escape(e.csscls)),i},root:function(t){var n="";return!t.phash||t.isroot?(n+=" "+z,!t.disabled||t.disabled.length<1?n+=" "+I+" "+O:(-1===e.inArray("paste",t.disabled)&&(n+=" "+I),-1===e.inArray("upload",t.disabled)&&(n+=" "+O)),n):""},permissions:function(e){return e.read&&e.write?"":_},symlink:function(e){return e.alias?L:""},style:function(e){return e.icon?t.getIconStyle(e):""}},B=function(e){return q.replace(/(?:\{([a-z]+)\})/gi,function(t,n){var i=$[n]?$[n](e):e[n]||"";return"id"===n&&-1==e.dirs&&(U[i]=i),i})},V=function(t){return e.map(t||[],function(e){return"directory"==e.mime?e:null})},K=function(n){return n?e("#"+t.navHash2Id(n)).next("."+h):ie},G=function(e,n){for(var i,a=e.children(":first");a.length;){if(i=t.file(t.navId2Hash(a.children("[id]").attr("id"))),(i=t.file(t.navId2Hash(a.children("[id]").attr("id"))))&&Y(n,i)<0)return a;a=a.next()}return e.children("button.elfinder-navbar-pager-next")},J=function(i){for(var a,r,o,l,d,c,u=i.length,h=[],p=u,f=e(),m={},g=t.cwd(),b=function(i,a,r,o){var l={},d=0,c=t.newAPI?Math.min(1e4,Math.max(10,n.subTreeMax)):1e4,u=function(){l={},e.each(a,function(e,t){l[t.hash]=e})},h=function(t){"prepare"===t?e.each(a,function(e,t){t.node&&i.append(t.node.hide())}):"done"===t&&e.each(a,function(e,t){t.node&&t.node.detach().show()})},p=function(t,n){var i;return t.stopPropagation(),n.select?void b(f(n.select)):n.change?void h(n.change):(n.removed&&n.removed.length&&(a=e.map(a,function(e){return-1===n.removed.indexOf(e.hash)?e:(i=!0,null)})),n.added&&n.added.length&&(a=a.concat(e.map(n.added,function(e){return void 0===l[e.hash]?(i=!0,e):null}))),void(i&&(a.sort(Y),u(),b(d))))},f=function(e){return void 0!==l[e]?Math.floor(l[e]/c)*c:void 0},m=t.navId2Hash(i.prev("[id]").attr("id")),b=function(n,r){var o,l,h,v,w,k,x,C,T=[],A={};delete W[m],d=n,i.off("update."+t.namespace,p),a.length>c&&(i.on("update."+t.namespace,p),void 0===n&&(h=0,u(),n=f(g.hash),void 0===n&&(n=0)),v=a.slice(n,n+c),W[m]=i,w=n?Math.max(-1,n-c):-1,k=n+c>=a.length?0:n+c,o=Math.ceil(a.length/c),l=Math.ceil(n/c)),e.each(v||a,function(e,t){T.push(B(t)),t.node&&(A[t.hash]=t.node)}),x=w>-1?e('<button class="elfinder-navbar-pager elfinder-navbar-pager-prev"/>').text(t.i18n("btnPrevious",l,o)).button({icons:{primary:"ui-icon-caret-1-n"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),b(w,"up")}):e(),C=k?e('<button class="elfinder-navbar-pager elfinder-navbar-pager-next"/>').text(t.i18n("btnNext",l+2,o)).button({icons:{primary:"ui-icon-caret-1-s"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),b(k,"down")})
t.nextAction={cmd:"edit",msg:"cmdedit"},t.data={target:o.phash},e.proxy(n.res("mixin","make"),t)().done(function(e){e.added&&e.added.length?(p.data("hash",e.added[0].hash),y(),m.show(),w()):r()}).fail(r).always(function(){delete t.mime,delete t.prefix,delete t.nextAction,delete t.data,d.fadeIn()}),n.trigger("unselectfiles",{files:[o.hash]})},l=null,d=n.getUI().children("."+i).fadeOut();p.removeClass(z),n.enable(),n.searchStatus.state<2&&o.phash!==n.cwd().hash&&(l=n.exec("open",[o.phash],{thash:o.phash})),e.when([l]).done(function(){l?n.one("cwdrender",s):s()}).fail(r)},C=function(){return p.editor&&p.editor.save(p[0],p.editor.instance),f!==A()},T={title:n.escape(o.name),width:t.options.dialogWidth||Math.min(650,.9*e(window).width()),buttons:{},allowMinimize:!0,allowMaximize:!0,btnHoverFocus:!1,closeOnEscape:!1,close:function(){var i=function(){b.resolve(),p.editor&&p.editor.close(p[0],p.editor.instance),p.elfinderdialog("destroy")};n.toggleMaximize(e(this).closest(".ui-dialog"),!1),C()?n.confirm({title:t.title,text:"confirmNotSave",accept:{label:"btnSaveClose",callback:function(){y(),i()}},cancel:{label:"btnClose",callback:i},buttons:[{label:"btnSaveAs",callback:function(){setTimeout(x,10)}}]}):i()},open:function(){var e;if(p.initEditArea.call(p,r,o,d,n),f=A(),n.disable(),p.editor)if(e=p.editor.load(p[0])||null,e&&e.done)e.done(function(e){p.editor.instance=e,p.editor.focus(p[0],p.editor.instance),f=A()}).fail(function(e){e&&n.error(e),p.elfinderdialog("destroy")});else{if(e&&("string"==typeof e||Array.isArray(e)))return n.error(e),void p.elfinderdialog("destroy");p.editor.instance=e,p.editor.focus(p[0],p.editor.instance),f=A()}},resize:function(e,t){p.editor&&p.editor.resize(p[0],p.editor.instance,e,t||{})}},A=function(){return p.getContent.call(p,p[0])},z=n.res("class","editing");if(h&&(h.html&&(p=e(h.html)),v={init:h.init||null,load:h.load,getContent:h.getContent||null,save:h.save,close:"function"==typeof h.close?h.close:function(){},focus:"function"==typeof h.focus?h.focus:function(){},resize:"function"==typeof h.resize?h.resize:function(){},instance:null,doSave:y,doCancel:w,doClose:k,file:o,fm:n,confObj:h}),!p){if(0!==o.mime.indexOf("text/")&&-1===e.inArray(o.mime,a))return b.reject("errEditorNotFound");!function(){var t=function(){g&&(C()?g.attr("title",n.i18n("saveAsEncoding")).addClass("elfinder-edit-changed"):g.attr("title",n.i18n("openAsEncoding")).removeClass("elfinder-edit-changed"))};p=e('<textarea class="elfinder-file-edit" rows="20" id="'+r+'-ta"></textarea>').on("input propertychange",t),p.editor&&p.editor.info&&!p.editor.info.useTextAreaEvent||p.on("keydown",function(t){var n,i,a=t.keyCode;t.stopPropagation(),a==e.ui.keyCode.TAB&&(t.preventDefault(),this.setSelectionRange&&(n=this.value,i=this.selectionStart,this.value=n.substr(0,i)+" "+n.substr(this.selectionEnd),i+=1,this.setSelectionRange(i,i))),(t.ctrlKey||t.metaKey)&&(a!="Q".charCodeAt(0)&&a!="W".charCodeAt(0)||(t.preventDefault(),w()),a=="S".charCodeAt(0)&&(t.preventDefault(),y()))}).on("mouseenter",function(){this.focus()}),p.initEditArea=function(n,i,a){var r=c&&"unknown"!==c?[{value:c}]:[];p.val(a),""!==a&&c&&"UTF-8"===c||r.push({value:"UTF-8"}),g=l(r).on("touchstart",function(e){e.stopPropagation()}).on("change",function(){C()||""===A()||(w(),u(i,e(this).val(),h))}).on("mouseover",t),p.parent().prev().find(".elfinder-titlebar-button:last").after(e('<span class="elfinder-titlebar-button-right"/>').append(g)),p.focus(),p[0].setSelectionRange&&p[0].setSelectionRange(0,0)}}()}return p.addClass(z).data("hash",o.hash),v&&(p.editor=v,"function"==typeof v.init&&(p.initEditArea=v.init),"function"==typeof v.getContent&&(p.getContent=v.getContent)),p.initEditArea||(p.initEditArea=function(){}),p.getContent||(p.getContent=function(){return s(p.val())}),T.buttons[n.i18n("btnSave")]=y,T.buttons[n.i18n("btnSaveClose")]=k,T.buttons[n.i18n("btnSaveAs")]=x,T.buttons[n.i18n("btnCancel")]=w,m=n.dialog(p,T).attr("id",r).on("keydown keyup keypress",function(e){e.stopPropagation()}).closest(".ui-dialog").addClass(i),b.promise()},u=function(i,a,r){var o,s,d=i.hash,h=
o[i]&&(d.protocol.append('<option value="'+i+'">'+a.i18n(o[i].name||i)+"</option>"),e.each(o[i].inputs,function(n,r){r.attr("name",n),"hidden"!=r.attr("type")?(r.addClass("ui-corner-all elfinder-netmount-inputs-"+i),t.append(e("<tr/>").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e("<td>"+a.i18n(n)+"</td>")).append(e("<td/>").append(r)))):(r.addClass("elfinder-netmount-inputs-"+i),h.append(r))}),o[i].protocol=d.protocol)}),t.append(h),t.find(".elfinder-netmount-tr").hide(),c.buttons[a.i18n("btnMount")]=function(){var i=d.protocol.val(),s={cmd:"netmount",protocol:i},l=o[i];return e.each(t.find("input.elfinder-netmount-inputs-"+i),function(t,n){var i;i="function"==typeof n.val?e.trim(n.val()):e.trim(n.value),i&&(s[n.name]=i)}),s.host?(a.request({data:s,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(e.added[0].phash&&(t=a.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,a.change({changed:[t]}))),a.one("netmountdone",function(){a.exec("open",e.added[0].hash)})),r.resolve()}).fail(function(e){l.fail&&"function"==typeof l.fail&&l.fail(a,e),r.reject(e)}),void n.dialog.elfinderdialog("close")):a.trigger("error",{error:"errNetMountHostReq"})},c.buttons[a.i18n("btnCancel")]=function(){n.dialog.elfinderdialog("close")},t.find("select,input").addClass("elfinder-tabstop"),s=a.dialog(u.append(t),c),i=s.closest(".ui-dialog"),s.ready(function(){d.protocol.change(),s.elfinderdialog("posInit")}),s};return n.dialog?n.dialog.elfinderdialog("open"):n.dialog=s(),r.promise()},n.fm.bind("netmount",function(e){var i=e.data||null,a=n.options;i&&i.protocol&&a[i.protocol]&&"function"==typeof a[i.protocol].done&&(a[i.protocol].done(n.fm,i),t.find("select,input").addClass("elfinder-tabstop"),n.dialog.elfinderdialog("tabstopsInit"))})},i.prototype.commands.netunmount=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(e){var t=this.fm;return e&&this.drivers.length&&!this._disabled&&t.file(e[0]).netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),r=i.file(t[0]);return this._disabled?a.reject():("pending"==a.state()&&i.confirm({title:n.title,text:i.i18n("confirmUnmount",r.name),accept:{label:"btnUnmount",callback:function(){var t=i.root()==r.hash,n=e("#"+i.navHash2Id(r.hash)).parent(),o=(n.next().length?n.next():n.prev()).find(".elfinder-navbar-root");i.request({data:{cmd:"netmount",protocol:"netunmount",host:r.netkey,user:r.hash,pass:"dum"},notify:{type:"netunmount",cnt:1,hideCnt:!0},preventFail:!0}).fail(function(e){a.reject(e)}).done(function(n){var r=i.root();t&&(o.length?r=i.navId2Hash(o[0].id):e.each(i.files(),function(e,t){return"directory"==t.mime?(r=e,null):void 0}),i.exec("open",r)),a.resolve()})}},cancel:{label:"btnCancel",callback:function(){a.reject()}}}),a)}},(i.prototype.commands.open=function(){this.alwaysEnabled=!0,this.noChangeDirOnRemovedCwd=!0,this._handlers={dblclick:function(e){e.preventDefault(),this.exec(e.data&&e.data.file?[e.data.file]:void 0)},"select enable disable reload":function(e){this.update("disable"==e.type?-1:void 0)}},this.shortcuts=[{pattern:"ctrl+down numpad_enter"+("mac"!=this.fm.OS&&" enter")}],this.getstate=function(t){var t=this.files(t),n=t.length;return 1==n?t[0].read?0:-1:n&&!this.fm.UA.Mobile&&e.map(t,function(e){return"directory"!=e.mime&&e.read?e:null}).length==n?0:-1},this.exec=function(t,n){var i,a,r,o,s,l,d,c,u,h,p,f,m=this.fm,g=e.Deferred().fail(function(e){e&&m.error(e)}),v=this.files(t),b=v.length,y="object"==typeof n?n.thash:!1,n=this.options,w=n.into||"window";if(!b&&!y)return g.reject();if(y||1==b&&(i=v[0])&&"directory"==i.mime)return y||!i||i.read?m.request({data:{cmd:"open",target:y||i.hash},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0,lazy:!1}):g.reject(["errOpen",i.name,"errPerm"]);if(v=e.map(v,function(e){return"directory"!=e.mime?e:null}),b!=v.length)return g.reject();var k=function(){var y,k;try{u=new RegExp(m.option("dispInlineRegex"))}catch(x){u=!1}for(h=e("<a>").
for(w=0;288>w;w++)switch(!0){case 143>=w:C.push([w+48,8]);break;case 255>=w:C.push([w-144+400,9]);break;case 279>=w:C.push([w-256+0,7]);break;case 287>=w:C.push([w-280+192,8]);break;default:e("invalid literal: "+w)}var T=function(){function t(t){switch(!0){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var n,i,a=[];for(n=3;258>=n;n++)i=t(n),a[n]=i[2]<<24|i[1]<<16|i[0];return a}();g&&new Uint32Array(T);var A=0,z=1;i.prototype.r=function(){for(;!this.u;){var t=a(this,3);switch(1&t&&(this.u=!0),t>>>=1){case 0:var n=this.input,i=this.c,r=this.b,s=this.a,l=n.length,d=f,c=f,u=r.length,h=f;switch(this.d=this.f=0,i+1>=l&&e(Error("invalid uncompressed block header: LEN")),d=n[i++]|n[i++]<<8,i+1>=l&&e(Error("invalid uncompressed block header: NLEN")),c=n[i++]|n[i++]<<8,d===~c&&e(Error("invalid uncompressed block header: length verify")),i+d>n.length&&e(Error("input buffer is broken")),this.n){case A:for(;s+d>r.length;){if(h=u-s,d-=h,g)r.set(n.subarray(i,i+h),s),s+=h,i+=h;else for(;h--;)r[s++]=n[i++];this.a=s,r=this.e(),s=this.a}break;case z:for(;s+d>r.length;)r=this.e({H:2});break;default:e(Error("invalid inflate mode"))}if(g)r.set(n.subarray(i,i+d),s),s+=d,i+=d;else for(;d--;)r[s++]=n[i++];this.c=i,this.a=s,this.b=r;break;case 1:this.q(L,$);break;case 2:o(this);break;default:e(Error("unknown BTYPE: "+t))}}return this.B()};var I,O,S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=g?new Uint16Array(S):S,M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],D=g?new Uint16Array(M):M,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],F=g?new Uint8Array(E):E,P=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],j=g?new Uint16Array(P):P,R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],H=g?new Uint8Array(R):R,N=new(g?Uint8Array:Array)(288);for(I=0,O=N.length;O>I;++I)N[I]=143>=I?8:255>=I?9:279>=I?7:8;var q,_,L=n(N),W=new(g?Uint8Array:Array)(30);for(q=0,_=W.length;_>q;++q)W[q]=5;var $=n(W);p=i.prototype,p.q=function(e,t){var n=this.b,i=this.a;this.C=e;for(var o,s,l,d,c=n.length-258;256!==(o=r(this,e));)if(256>o)i>=c&&(this.a=i,n=this.e(),i=this.a),n[i++]=o;else for(s=o-257,d=D[s],0<F[s]&&(d+=a(this,F[s])),o=r(this,t),l=j[o],0<H[o]&&(l+=a(this,H[o])),i>=c&&(this.a=i,n=this.e(),i=this.a);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},p.W=function(e,t){var n=this.b,i=this.a;this.C=e;for(var o,s,l,d,c=n.length;256!==(o=r(this,e));)if(256>o)i>=c&&(n=this.e(),c=n.length),n[i++]=o;else for(s=o-257,d=D[s],0<F[s]&&(d+=a(this,F[s])),o=r(this,t),l=j[o],0<H[o]&&(l+=a(this,H[o])),i+d>c&&(n=this.e(),c=n.length);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},p.e=function(){var e,t,n=new(g?Uint8Array:Array)(this.a-32768),i=this.a-32768,a=this.b;if(g)n.set(a.subarray(32768,n.length));else for(e=0,t=n.length;t>e;++e)n[e]=a[e+32768];if(this.l.push(n),this.t+=n.length,g)a.set(a.subarray(i,i+32768));else for(e=0;32768>e;++e)a[e]=a[i+e];return this.a=32768,a},p.X=function(e){var t,n,i,a,r=this.input.length/this.c+1|0,o=this.input,s=this.b;return e&&("number"==typeof e.H&&(r=e.H),"number"==typeof e.Q&&(r+=e.Q)),2>r?(n=(o.length-this.c)/
}).button({icons:{primary:re?"ui-icon-locked":"ui-icon-unlocked"},text:!1}),fe=e("<button>").html(r.i18n("aspectRatio")).on("click",function(){oe=!oe,fe.button("option",{icons:{primary:oe?"ui-icon-locked":"ui-icon-unlocked"}}),I.resizable("option","aspectRatio",oe).data("uiResizable")._aspectRatio=oe}).button({icons:{primary:oe?"ui-icon-locked":"ui-icon-unlocked"},text:!1}),me=e("<button>").html(r.i18n(he?"enabled":"disabled")).toggleClass("ui-state-active",he).on("click",function(){he=!he,me.html(r.i18n(he?"enabled":"disabled")).toggleClass("ui-state-active",he),he&&(R.val(ze(R.val())),H.val(ze(H.val())),_.val(ze(_.val())),L.val(ze(L.val())),N.val(ze(N.val())),q.val(ze(q.val())),O.is(":visible")?Oe.updateView(R.val(),H.val()):S.is(":visible")&&Se.updateView())}).button(),ge=function(){var e;e=Math.min(se,le)/Math.sqrt(Math.pow(ie,2)+Math.pow(ae,2)),de=Math.ceil(ie*e),ce=Math.ceil(ae*e),Ae.width(de).height(ce).css("margin-top",(le-ce)/2+"px").css("margin-left",(se-de)/2+"px"),Ae.is(":visible")&&Q.is(":visible")&&("image/png"!==t.mime?(T.css("backgroundColor",Q.val()),setTimeout(function(){i&&i.width!==de&&be()},0)):(Q.parent().hide(),ee.hide()))},ve=function(){Oe.updateView(ie,ae),ge(),xe.width(ke.width()).height(ke.height()),Ce.width(ke.width()).height(ke.height()),Se.updateView()},be=function(){if(o){var t,n,a,r,s,l,d,c,u,h,p,f,m,g,v,b,y,w,k,x={},C=[],T=function(e,t,n){var i,a,r,o=Math.max(Math.max(e,t),n),s=Math.min(Math.min(e,t),n);return o===s?i=0:e===o?i=((t-n)/(o-s)*60+360)%360:t===o?i=(n-e)/(o-s)*60+120:n===o&&(i=(e-t)/(o-s)*60+240),a=(o-s)/o,r=(.3*e+.59*t+.11*n)/255,[i,a,r,"hsl"]};e:try{n=i.width=Ae.width(),a=i.height=Ae.height(),m=n/ie,o.scale(m,m),o.drawImage(Ae.get(0),0,0),f=o.getImageData(0,0,n,a).data,g=.1*n,v=.9*n,b=.1*a,y=.9*a;for(var A=0;a-1>A;A++)for(var z=0;n-1>z;z++){if(t=4*z+A*n*4,r=f[t],s=f[t+1],l=f[t+2],d=f[t+3],255!==d){Q.parent().hide(),ee.hide();break e}h=T(r,s,l),p=Math.round(h[0]),c=Math.round(100*h[1]),u=Math.round(100*h[2]),V[z]||(V[z]={}),V[z][A]=[r,s,l,p,c,u],(g>z||z>v)&&(b>A||A>y)&&(w=r+","+s+","+l,x[w]?++x[w]:x[w]=1)}ee.children(":first").length||(k=1,e.each(x,function(e,t){C.push({c:e,v:t})}),e.each(C.sort(function(e,t){return e.v>t.v?-1:1}),function(){return this.v<2||k>10?!1:(ee.append(e('<span style="width:20px;height:20px;display:inline-block;background-color:rgb('+this.c+');">')),void++k)}))}catch(I){X.hide(),ee.hide()}}},ye=function(){try{i=document.createElement("canvas"),o=i.getContext("2d")}catch(e){X.hide(),ee.hide()}},we=function(){We.on("click","span.elfinder-resize-preset",function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1],a=ie/ae;ie>n||ae>i?n>=ie?n=ze(i*a):i>=ae?i=ze(n/a):ie-n>ae-i?i=ze(n/a):n=ze(i*a):(n=ie,i=ae),R.val(n),H.val(i),Oe.updateView(n,i)}),$e.on("click","span.elfinder-resize-preset",function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1],a=N.val(),r=q.val();ie>=n&&ae>=i&&(0>ie-n-a&&(a=ie-n),0>ae-i-r&&(r=ae-i),N.val(a),q.val(r),_.val(n),L.val(i),Se.updateView())}),$e.children("span.elfinder-resize-preset").each(function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1];t[ie>=n&&ae>=i?"show":"hide"]()})},ke=e("<img/>").on("load",function(){var t=ke.get(0),n=t.naturalWidth?null:{w:ke.width(),h:ke.height()};n&&ke.removeAttr("width").removeAttr("height"),ie=t.naturalWidth||t.width||ke.width(),ae=t.naturalHeight||t.height||ke.height(),n&&ke.width(n.w).height(n.h),g.show();var i,a=ae/ie;1>a&&T.height()>T.width()*a&&T.height(T.width()*a),T.height()>ke.height()+20&&T.height(ke.height()+20),le=T.height()-(z.outerHeight()-z.height()),A.remove(),te=ie/ae,z.append(ke.show()).show(),R.val(ie),H.val(ae),ye(),we(),ve(),P[u]("enable"),i=C.find("input,select").prop("disabled",!1).filter(":text").on("keydown",function(t){return t.keyCode==e.ui.keyCode.ENTER?(t.stopPropagation(),t.preventDefault(),void r.confirm({title:e("input:checked",P).val(),text:"confirmReq",accept:{label:"btnApply",callback:function(){Pe()}},cancel:{label:"btnCancel",callback:function(){e(this).focus()}},buttons:[{label:"btnSaveAs",callback:function(){setTimeout(je,10)}}]})):void 0}).on("keyup",f
}).on("click",function(){c.exec("open",f).done(function(){c.one("opendone",function(){c.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})})})})})):c.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})}),c.toast({msg:c.i18n(["complete",c.i18n("cmdupload")]),extNode:n}))}})},v=function(e){i.elfinderdialog("close"),p&&(e.target=p[0]),g(e)},b=function(){var t=m.hash,n=e.map(c.files(t),function(e){return"directory"===e.mime&&e.write?e:null});return n.length?e('<div class="elfinder-upload-dirselect elfinder-tabstop" title="'+c.i18n("folders")+'"/>').on("click",function(t){t.stopPropagation(),t.preventDefault(),n=c.sortFiles(n);var a=e(this),r=(c.cwd(),i.closest("div.ui-dialog")),o=function(e,t){return{label:c.escape(e.i18||e.name),icon:t,remain:!1,callback:function(){var t=r.children(".ui-dialog-titlebar:first").find("span.elfinder-upload-target");p=[e.hash],t.html(" - "+c.escape(e.i18||e.name)),a.focus()},options:{className:p&&p.length&&e.hash===p[0]?"ui-state-active":"",iconClass:e.csscls||"",iconImg:e.icon||""}}},s=[o(m,"opendir"),"|"];e.each(n,function(e,t){s.push(o(t,"dir"))}),a.blur(),c.trigger("contextmenu",{raw:s,x:t.pageX||e(this).offset().left,y:t.pageY||e(this).offset().top,prevNode:r,fitHeight:!0})}).append('<span class="elfinder-button-icon elfinder-button-icon-dir" />'):e()},y=function(n,i){var a=e('<input type="file" '+n+"/>").change(function(){v({input:a.get(0),type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"});return e('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-tabstop elfinder-focus"><span class="ui-button-text">'+c.i18n(i)+"</span></div>").append(e("<form/>").append(a)).on("click",function(e){e.target===this&&(e.stopPropagation(),e.preventDefault(),a.click())}).hover(function(){e(this).toggleClass(t)})},w=e.Deferred();return o=function(t){t.stopPropagation(),t.preventDefault();var n,i=!1,a="",r=null,o="",s=null,l=t._target||null,d=t.dataTransfer||null,u=d.items&&d.items.length&&d.items[0].kind?d.items[0].kind:"";if(d){try{if(r=d.getData("elfinderfrom"),r&&(o=window.location.href+c.cwd().hash,!l&&r===o||l===o))return void w.reject()}catch(t){}if("file"===u&&(d.items[0].getAsEntry||d.items[0].webkitGetAsEntry))i=d,a="data";else if("string"!==u&&d.files&&d.files.length&&-1===e.inArray("Text",d.types))i=d.files,a="files";else{try{(s=d.getData("text/html"))&&s.match(/<(?:img|a)/i)&&(i=[s],a="html")}catch(t){}!i&&(s=d.getData("text"))&&(i=[s],a="text")}}i?g({files:i,type:a,target:l,dropEvt:t}):(n=["errUploadNoFiles"],"file"===u&&n.push("errFolderUpload"),c.error(n),w.reject())},!p&&n?(n.input||n.files?(n.type="files",g(n)):n.dropEvt&&o(n.dropEvt),w):(s=function(t){var n,t=t.originalEvent||t,i=[],a=[];if(t.clipboardData){if(t.clipboardData.items&&t.clipboardData.items.length){a=t.clipboardData.items;for(var r=0;r<a.length;r++)"file"==t.clipboardData.items[r].kind&&(n=t.clipboardData.items[r].getAsFile(),i.push(n))}else t.clipboardData.files&&t.clipboardData.files.length&&(i=t.clipboardData.files);if(i.length)return void v({files:i,type:"files",clipdata:!0})}var o=t.target||t.srcElement;setTimeout(function(){var t,n="text";o.innerHTML&&(e(o).find("img").each(function(t,n){n.src.match(/^webkit-fake-url:\/\//)&&e(n).remove()}),e(o).find("a,img").length&&(n="html"),t=o.innerHTML,o.innerHTML="",v({files:[t],type:n}))},1)},i=e('<div class="elfinder-upload-dialog-wrapper"/>').append(y("multiple","selectForUpload")),!c.UA.Mobile&&function(e){return"undefined"!=typeof e.webkitdirectory||"undefined"!=typeof e.directory}(document.createElement("input"))&&i.append(y("multiple webkitdirectory directory","selectFolder")),m.dirs&&(m.hash===u||e("#"+c.navHash2Id(m.hash)).hasClass("elfinder-subtree-loaded")?b().appendTo(i):(l=e('<div class="elfinder-upload-dirselect" title="'+c.i18n("nowLoading")+'"/>').append('<span class="elfinder-button-icon elfinder-button-icon-spinner" />').appendTo(i),c.request({cmd:"tree",target:m.hash}).done(function(){c.one("treedone",function(){l.replaceWith(b()),d.elfinderdi