text: /**
   * skylark-elfinder - A version of elfinder that ported to running on skylarkjs.
   * @author 
   * @version v0.9.0
   * @link 
   * @license MIT
   */
  define(["skylark-jquery"],function(e){e.fn.elfindercwd=function(t,a){"use strict";return this.not(".elfinder-cwd").each(function(){var n,i,r,s,l,d,o,c=t.UA.Mobile,h="list"==t.viewType,f="select."+t.namespace,p="unselect."+t.namespace,u="disable."+t.namespace,g="enable."+t.namespace,m="class",w=t.res(m,"cwdfile"),v="."+w,b="ui-selected",y=t.res(m,"disabled"),C=t.res(m,"draggable"),k=t.res(m,"droppable"),x=t.res(m,"hover"),T=t.res(m,"active"),H=t.res(m,"adroppable"),E=w+"-tmp",z="elfinder-cwd-selectchk",A=t.options.loadTmbs>0?t.options.loadTmbs:5,S="",D={},I=[],O=[],F=void 0,M=[],j="",P=function(){return'<tr id="{id}" class="'+w+' {permsclass} {dirclass}" title="{tooltip}"{css}><td class="elfinder-col-name"><div class="elfinder-cwd-file-wrapper"><span class="elfinder-cwd-icon {mime}"{style}/>{marker}<span class="elfinder-cwd-filename">{name}</span></div>'+U+"</td>"+function(){for(var e="",t=0;t<M.length;t++)e+='<td class="elfinder-col-'+M[t]+'">{'+M[t]+"}</td>";return e}()+"</tr>"},U=e.map(a.showSelectCheckboxUA,function(e){return!(!t.UA[e]&&!e.match(/^all$/i))||null}).length?'<div class="elfinder-cwd-select"><input type="checkbox" class="'+z+'"></div>':"",q=!1,W=null,L={icon:'<div id="{id}" class="'+w+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="elfinder-cwd-file-wrapper ui-corner-all"><div class="elfinder-cwd-icon {mime} ui-corner-all" unselectable="on"{style}/>{marker}</div><div class="elfinder-cwd-filename" title="{nametitle}">{name}</div>'+U+"</div>",row:""},K=t.res("tpl","perms"),R=t.res("tpl","lock"),N=t.res("tpl","symlink"),X={id:function(e){return t.cwdHash2Id(e.hash)},name:function(e){var a=t.escape(e.i18||e.name);return!h&&(a=a.replace(/([_.])/g,"&#8203;$1")),a},nametitle:function(e){return t.escape(e.i18||e.name)},permsclass:function(e){return t.perms2class(e)},perm:function(e){return t.formatPermissions(e)},dirclass:function(e){var n="directory"==e.mime?"directory":"";return e.isroot&&(n+=" isroot"),e.csscls&&(n+=" "+t.escape(e.csscls)),a.getClass&&(n+=" "+a.getClass(e)),n},style:function(e){return e.icon?t.getIconStyle(e):""},mime:function(e){var a=t.mime2class(e.mime);return e.icon&&(a+=" elfinder-cwd-bgurl"),a},size:function(e){return"directory"!==e.mime||e.size?t.formatSize(e.size):"-"},date:function(e){return t.formatDate(e)},kind:function(e){return t.mime2kind(e)},mode:function(e){return e.perm?t.formatFileMode(e.perm):""},modestr:function(e){return e.perm?t.formatFileMode(e.perm,"string"):""},modeoct:function(e){return e.perm?t.formatFileMode(e.perm,"octal"):""},modeboth:function(e){return e.perm?t.formatFileMode(e.perm,"both"):""},marker:function(e){return(e.alias||"symlink-broken"==e.mime?N:"")+(e.read&&e.write?"":K)+(e.locked?R:"")},tooltip:function(e){var a=t.formatDate(e)+(e.size>0?" ("+t.formatSize(e.size)+")":""),n="";return n=S&&e.path?t.escape(e.path.replace(/\/[^\/]*$/,"")):e.tooltip?t.escape(e.tooltip).replace(/\r/g,"&#13;"):"",h&&(n+=(n?"&#13;":"")+t.escape(e.i18||e.name)),n?n+"&#13;"+a:a}},Y={},$=function(a){return a.mime&&"directory"!==a.mime&&!Y[a.mime]&&function(a,n){var r,s,l;if(a&&!Y[a]&&(void 0===i&&(e("#elfinderAddBadgeStyle"+t.namespace).length&&e("#elfinderAddBadgeStyle"+t.namespace).remove(),i=e('<style id="addBadgeStyle'+t.namespace+'"/>').insertBefore(e("head").children(":first")).get(0).sheet||null),i)){if(l=(a=a.toLowerCase()).split("/"),s=t.escape(t.mimeTypes[a]||(n.replace(/.bac?k$/i,"").match(/\.([^.]+)$/)||["",""])[1])){r=".elfinder-cwd-icon-"+l[0].replace(/(\.|\+)/g,"-"),void 0!==l[1]&&(r+=".elfinder-cwd-icon-"+l[1].replace(/(\.|\+)/g,"-"));try{i.insertRule(r+':before{content:"'+s.toLowerCase()+'"}',0)}catch(e){}}Y[a]=!0}}(a.mime,a.name),L[h?"row":"icon"].replace(/\{([a-z0-9_]+)\}/g,function(e,n){return X[n]?X[n](a,t):a[n]?a[n]:""})},_=e(),V=!1,B={},J=function(e){t.cwdHash2Elm(e).trigger(f)},G=!1,Q=function(){t.cwd().hash;U&&Oe.find("input").prop("checked",!0),t.lazy(function(){var a;t.maxTargets&&(F||O).length>t.maxTargets?(Z({notrigger:!0}),a=(a=e.map(F||O,function(e){return t.file(e)||null})).slice(0,t.maxTargets),B={},e.each(a,function(e,a){B[a.hash]=!0,t.cwdHash2Elm(a.hash).trigger(f)}),t.toast({mode:"warning",msg:t.i18n(["errMaxTargets",t.maxTargets])})):(Se.find("[id]:not(.ui-selected):not(.elfinder-cwd-parent)").trigger(f),B=t.arrayFlip(F||O,!0)),te(),U&&Oe.data("pending",!1)},0,{repaint:!0})},Z=function(e){var t=e||{};U&&Oe.find("input").prop("checked",!1),Object.keys(B).length&&(V=!1,B={},Se.find("[id].ui-selected").trigger(p),U&&Se.find("input:checkbox."+z).prop("checked",!1)),!t.notrigger&&te(),U&&Oe.data("pending",!1),Se.removeClass("elfinder-cwd-allselected")},ee=void 0,te=function(){var e=Object.keys(B),a={selected:e,origin:"cwd"};ce&&(e.length>1||e[0]!==t.cwdId2Hash(ce.attr("id")))&&ce.hasClass(b)&&ce.trigger(p),G=e.length&&e.length===(F||O).length&&(!t.maxTargets||e.length<=t.maxTargets),U&&(Oe.find("input").prop("checked",G),Se[G?"addClass":"removeClass"]("elfinder-cwd-allselected")),G?a.selectall=!0:e.length||(a.unselectall=!0),t.trigger("select",a)},ae=function(e,a){if(e.length){var n=e.position().top,i=e.outerHeight(!0),r=De.scrollTop(),s=De.get(0).clientHeight,l=pe?pe.outerHeight(!0):0;n+l+i>r+s?De.scrollTop(parseInt(n+l+i-s)):n<r&&De.scrollTop(n),h&&De.scrollLeft(0),a&&t.resources.blink(e,"lookme")}},ne=[],ie={},re=function(e){for(var t=ne.length;t--;)if(ne[t].hash==e)return t;return-1},se=!1,le={disabled:!0,filter:"[id]:first",stop:te,delay:250,appendTo:"body",autoRefresh:!1,selected:function(t,a){e(a.selected).trigger(f)},unselected:function(t,a){e(a.unselected).trigger(p)}},de={},oe=function(i,r){if(ie.renderd){var s=(h?Se.find("tbody:first"):Se).children("[id]"+(a.oldSchool?":not(.elfinder-cwd-parent)":"")+":first");if(s.length){var l,d,o,c,f,p,u,g,m=Se.data("selectable"),b=(o=De.offset(),c=De.width(),f=e(window),p=s.width()/2,u=Math.min(o.left-f.scrollLeft()+("ltr"===t.direction?p:c-p),o.left+c-10),g=o.top-f.scrollTop()+10+(h?n:0),{left:Math.max(0,Math.round(u)),top:Math.max(0,Math.round(g))}),y=i?s:e(document.elementFromPoint(b.left,b.top)),C={},k={},x=Math.ceil((ie.hpi?Math.ceil(je.data("rectangle").height/ie.hpi*1.5):he)/5),T=function(){var e,a,n;for(n=0;n<5&&((e=y.attr("id"))&&(ie.getTmbs=[],a=t.cwdId2Hash(e),de[a]=e,ie.attachTmbs[a]&&(k[a]=ie.attachTmbs[a]),m&&(C[e]=!0)),(y=y.next()).length);n++);},H=function(){var e;Se.data("selectable")&&(Object.assign(C,B),(e=Object.keys(C)).length&&(le.filter="#"+e.join(", #"),Se.selectable("enable").selectable("option",{filter:le.filter}).selectable("refresh"))),Object.keys(k).length&&(ie.getTmbs=[],be(k))},E=function(){y.hasClass(w)||(y=y.closest(v))};if(de={},m&&Se.selectable("option","disabled"),y.length&&(y.hasClass(w)||y.closest(v).length||((d=t.getUI().find(".ui-dialog:visible,.ui-widget:visible")).length?(d.hide(),y=e(document.elementFromPoint(b.left,b.top)),d.show()):d=null),E(),y.length||(d&&d.hide(),y=e(document.elementFromPoint(b.left,b.top+5)),d&&d.show(),E())),y.length){if(y.attr("id"))if(i){for(var z=0;z<x&&(T(),y.length);z++);H()}else l=new Array(x),ie.repaintJob=t.asyncJob(function(){T(),y.length||H()},l).done(H)}else i&&ie.renderd&&(r=r||0)<10&&requestAnimationFrame(function(){oe(i,++r)})}}},ce=null,he=t.options.showFiles,fe=function(){if(!(ie.rendering||ie.renderd&&!ne.length)){var n,i,r=h?Se.children("table").children("tbody"):Se,s=!!e.htmlPrefilter,l=e(s?document.createDocumentFragment():"<div/>"),d=function(a){var n,i,d,o=a||null,p=[],u=!1,g={},m="self"===t.option("tmbUrl"),w=!ie.renderd;n=ne.splice(0,he+(o||0)/(ie.hpi||1)),ie.renderd+=n.length,ne.length||(Ie.hide(),De.off("elfscrstop",fe)),i=[],p=e.map(n,function(e){return e.hash&&e.name?("directory"==e.mime&&(u=!0),(e.tmb&&(1!=e.tmb||e.size>0)||m&&0===e.mime.indexOf("image/"))&&(g[e.hash]=e.tmb||"self"),D[e.hash]&&i.push(e.hash),$(e)):null}),l.empty().append(p.join("")),u&&!c&&ve(l),d=[],Object.keys(B).length&&l.find("[id]:not(.ui-selected):not(.elfinder-cwd-parent)").each(function(){B[t.cwdId2Hash(this.id)]&&d.push(e(this))}),r.append(s?l:l.children()),d.length&&(e.each(d,function(e,t){t.trigger(f)}),te()),i.length&&t.trigger("lockfiles",{files:i}),!ie.hpi&&xe(r,n.length),h&&(Se.find("thead").show(),ge({fitWidth:!W})),Object.keys(g).length&&Object.assign(ie.attachTmbs,g),w&&(c||Se.data("selectable")||Se.selectable(le).data("selectable",!0)),!se&&De.trigger("elfscrstop")};ie.renderd||(ie.rendering=!0,De.scrollTop(0),n=t.cwd().phash,d(),a.oldSchool&&(n&&!S?function(a){var n=t.cwd().phash,i=t.file(n)||null,r=function(a){a&&(ce=e($(e.extend(!0,{},a,{name:"..",i18:"..",mime:"directory"}))).addClass("elfinder-cwd-parent").on("dblclick",function(){t.trigger("select",{selected:[n]}).exec("open",n)}),(h?ce.children("td:first"):ce).children(".elfinder-cwd-select").remove(),t.cwdHash2Elm(n).length?t.cwdHash2Elm(n).replaceWith(ce):(h?Se.find("tbody"):Se).prepend(ce),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1))};i?r(i):(r({hash:n,read:!0,write:!0}),t.getUI("tree").length?t.one("parents",function(){r(t.file(n)||null),De.trigger("elfscrstop")}):t.request({data:{cmd:"parents",target:t.cwd().hash},preventFail:!0}).done(function(e){r(t.file(n)||null),De.trigger("elfscrstop")}))}():ce=e()),h&&(W&&me(),ge({fitWidth:!0})),ie.itemH=(h?r.find("tr:first"):r.find("[id]:first")).outerHeight(!0),t.trigger("cwdrender"),ie.rendering=!1,oe(!0)),!ie.rendering&&ne.length?(i=De.height()+De.scrollTop()+t.options.showThreshold+ie.row-ie.renderd*ie.hpi)>0?(ie.rendering=!0,t.lazy(function(){d(i),ie.rendering=!1})):!t.enabled()&&Me():Me()}},pe=null,ue=t.UA.CSS.positionSticky&&t.UA.CSS.widthMaxContent,ge=function(i){if(n=0,a.listView.fixedHeader){var r,s,l,d,o,c,h,f,p,u,g,m,w,v=function(){var e,a;a="ltr"===t.direction?"left":"right",e=-1*("ltr"===t.direction?De.scrollLeft():l.outerWidth(!0)-De.width()-De.scrollLeft()),s.css(a)!==e&&s.css(a,e)},b=i||{};if((f=(o=Se.find("tbody")).children("tr:first")).length&&f.is(":visible")){if(l=o.parent(),pe?h=(d=e("#"+t.namespace+"-cwd-thead")).children("tr:first"):(w=!0,o.addClass("elfinder-cwd-fixheader"),c=(h=(d=Se.find("thead").attr("id",t.namespace+"-cwd-thead")).children("tr:first")).outerHeight(!0),Se.css("margin-top",c-parseInt(l.css("padding-top"))),ue?(pe=e('<div class="elfinder-table-header-sticky"/>').addClass(Se.attr("class")).append(e("<table/>").append(d)),Se.after(pe),De.on("resize.fixheader",function(e){e.stopPropagation(),ge({fitWidth:!0})})):(s=e("<div/>").addClass(Se.attr("class")).append(e("<table/>").append(d)),pe=e("<div/>").addClass(De.attr("class")+" elfinder-cwd-fixheader").removeClass("ui-droppable native-droppable").css(De.position()).css({height:c,width:Se.outerWidth()}).append(s),"rtl"===t.direction&&pe.css("left",De.data("width")-De.width()+"px"),v(),De.after(pe).on("scroll.fixheader resize.fixheader",function(e){v(),"resize"===e.type&&(e.stopPropagation(),pe.css(De.position()),De.data("width",De.css("overflow","hidden").width()),De.css("overflow","auto"),ge())}))),w||b.fitWidth||Math.abs(f.outerWidth()-h.outerWidth())>2){r=M.length+1;for(var y=0;y<r&&(p=h.children("td:eq("+y+")"),u=f.children("td:eq("+y+")"),g=p.width(),m=u.width(),void 0===p.data("delta")&&p.data("delta",p.outerWidth()-g-(u.outerWidth()-m)),m-=p.data("delta"),w||b.fitWidth||g!==m);y++)p.css("width",m+"px")}ue||(pe.data("widthTimer")&&cancelAnimationFrame(pe.data("widthTimer")),pe.data("widthTimer",requestAnimationFrame(function(){pe&&(pe.css("width",Pe.width()+"px"),"rtl"===t.direction&&pe.css("left",De.data("width")-De.width()+"px"))}))),n=d.height()}}},me=function(){if(h&&W){var t="elfinder-cwd-colwidth",a=Se.find("tr[id]:first");a.hasClass(t)||(Se.find("tr."+t).removeClass(t).find("td").css("width",""),a.addClass(t),Se.find("table:first").css("table-layout","fixed"),e.each(e.merge(["name"],M),function(e,t){var n=W[t]||a.find("td.elfinder-col-"+t).width();a.find("td.elfinder-col-"+t).width(n)}))}},we=Object.assign({},t.droppable,{over:function(a,n){var i,r,s,l=e(this),d=n.helper,o=a.shiftKey||a.ctrlKey||a.metaKey;a.stopPropagation(),d.data("dropover",d.data("dropover")+1),l.data("dropover",!0),d.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus"),d.data("namespace")===t.namespace&&t.insideWorkzone(a.pageX,a.pageY)?(l.hasClass(t.res(m,"cwdfile"))?(i=t.cwdId2Hash(l.attr("id")),l.data("dropover",i)):(i=t.cwd().hash,t.cwd().write&&l.data("dropover",i)),s=t.file(d.data("files")[0]).phash===i,l.data("dropover")===i?e.each(d.data("files"),function(e,t){if(t===i||s&&!o&&!d.hasClass("elfinder-drag-helper-plus"))return l.removeClass(H),!1}):l.removeClass(H),d.data("locked")||s?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",o&&(r+=" elfinder-drag-helper-plus")),l.hasClass(H)&&d.addClass(r),requestAnimationFrame(function(){l.hasClass(H)&&d.addClass(r)})):l.removeClass(H)},out:function(t,a){var n=a.helper;t.stopPropagation(),n.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(n.data("dropover")-1,0)),e(this).removeData("dropover").removeClass(H)},deactivate:function(){e(this).removeData("dropover").removeClass(H)},drop:function(e,a){Z({notrigger:!0}),t.droppable.drop.call(this,e,a)}}),ve=function(a){var n=(a=a||(h?Se.find("tbody"):Se)).children(".directory:not(."+k+",.elfinder-na,.elfinder-ro)");t.isCommandEnabled("paste")&&n.droppable(we),t.isCommandEnabled("upload")&&n.addClass("native-droppable"),a.children(".isroot").each(function(a,n){var i=e(n),r=t.cwdId2Hash(n.id);t.isCommandEnabled("paste",r)?i.hasClass(k+",elfinder-na,elfinder-ro")||i.droppable(we):i.hasClass(k)&&i.droppable("destroy"),t.isCommandEnabled("upload",r)?i.hasClass("native-droppable,elfinder-na,elfinder-ro")||i.addClass("native-droppable"):i.hasClass("native-droppable")&&i.removeClass("native-droppable")})},be=function(a,n){e.isPlainObject(a)&&Object.keys(a).length&&(Object.assign(ie.attachTmbs,a),e.each(a,function(a,i){var r,s,l=t.cwdHash2Elm(a);l.length&&("1"!=i?((r=t.file(a)).tmb!==i&&(r.tmb=i),s=t.tmb(r),n?l.find(".elfinder-cwd-icon").addClass(s.className).css("background-image","url('"+s.url+"')"):function(t,a){e("<img/>").on("load",function(){t.find(".elfinder-cwd-icon").addClass(a.className).css("background-image","url('"+a.url+"')")}).attr("src",a.url)}(l,s),delete ie.attachTmbs[a]):n?ye([a]):ie.tmbLoading[a]||ie.getTmbs.push(a))}),n||!ie.getTmbs.length||Object.keys(ie.tmbLoading).length||ye())},ye=function(a){var n=[],i=!1;t.oldAPI?t.request({data:{cmd:"tmb",current:t.cwd().hash},preventFail:!0}).done(function(e){e.images&&Object.keys(e.images).length&&be(e.images),e.tmb&&ye()}):(a?(i=!0,n=a.splice(0,A)):n=ie.getTmbs.splice(0,A),n.length&&(i||de[n[0]]||de[n[n.length-1]])&&(e.each(n,function(e,t){ie.tmbLoading[t]=!0}),t.request({data:{cmd:"tmb",targets:n},preventFail:!0}).done(function(t){var r,s=[];t.images&&((r=Object.keys(t.images).length)?(r<n.length&&e.each(n,function(e,a){t.images[a]||s.push(a)}),be(t.images,i)):s=n,s.length&&e.each(s,function(e,t){delete ie.attachTmbs[t]})),i&&a.length&&ye(a)}).always(function(){ie.tmbLoading={},!i&&ie.getTmbs.length&&ye()})))},Ce=function(a,n){var i,r,s,l,d,o,f=h?Se.find("tbody"):Se,p=a.length,u={},g=function(e){for(var a,n=Se.find("[id]:first");n.length;){if(a=t.file(t.cwdId2Hash(n.attr("id"))),!n.hasClass("elfinder-cwd-parent")&&a&&t.compare(e,a)<0)return n;n=n.next("[id]")}},m=function(e){var a,n=ne.length;for(a=0;a<n;a++)if(t.compare(e,ne[a])<0)return a;return n||-1},w=!!e.htmlPrefilter,v=e(w?document.createDocumentFragment():"<div/>");if(p>he)Ae(),B=t.arrayFlip(e.map(a,function(e){return e.hash}),!0),te();else{for(p&&je.removeClass("elfinder-cwd-wrapper-empty"),o="self"===t.option("tmbUrl");p--;)r=(i=a[p]).hash,t.cwdHash2Elm(r).length||((s=g(i))&&!s.length&&(s=null),!s&&(d=m(i))>=0?ne.splice(d,0,i):(v.empty().append($(i)),"directory"===i.mime&&!c&&ve(v),l=w?v:v.children(),s?s.before(l):f.append(l),++ie.renderd),t.cwdHash2Elm(r).length&&(i.tmb&&(1!=i.tmb||i.size>0)||o&&0===i.mime.indexOf("image/"))&&(u[r]=i.tmb||"self"));h&&(me(),ge({fitWidth:!W})),xe(f),Object.keys(u).length&&(Object.assign(ie.attachTmbs,u),ne.length<1&&ye())}},ke=function(a){var n,i,r,s,l=a.length,d=t.searchStatus.state>1,o=t.getCommand(t.currentReqCmd)||{};if(!t.cwd().hash&&!o.noChangeDirOnRemovedCwd)return e.each(I.reverse(),function(e,a){if(t.file(a))return s=!0,t.one(t.currentReqCmd+"done",function(){!t.cwd().hash&&t.exec("open",a)}),!1}),void(!s&&!t.cwd().hash&&t.exec("open",t.roots[Object.keys(t.roots)[0]]));for(;l--;){if(n=a[l],(i=t.cwdHash2Elm(n)).length)try{i.remove(),--ie.renderd}catch(e){t.debug("error",e)}else-1!==(r=re(n))&&ne.splice(r,1);B[n]&&delete B[n],d&&-1!==(r=e.inArray(n,O))&&O.splice(r,1)}d&&t.trigger("cwdhasheschange",O),h&&(me(),ge({fitWidth:!W}))},xe=function(e,a){var n,i=e||(h?Se.find("tbody"):Se),r=We[t.viewType],s=1;ne.length>0&&(ie.hpi?h||(s=Math.floor(i.width()/r.width)):(!function(e){var t;e.height||(t=(h?Se.find("tbody"):Se).find(h?"tr:first":"[id]:first"),e.height=t.outerHeight(!0),h||(e.width=t.outerWidth(!0)))}(r),h?ie.row=ie.hpi=r.height:(s=Math.floor(i.width()/r.width),ie.row=r.height,ie.hpi=ie.row/s)),n=Math.ceil((ne.length+(a||0))/s),h&&pe&&++n,Ie.css({top:ie.row*n+"px"}).show())},Te=function(e){e.preventDefault(),void 0===Se.data("longtap")?t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:e.pageX,y:e.pageY}):e.stopPropagation()},He=function(e){e.originalEvent.touches.length>1||(!1!==Se.data("longtap")&&(De.data("touching",{x:e.originalEvent.touches[0].pageX,y:e.originalEvent.touches[0].pageY}),Se.data("tmlongtap",setTimeout(function(){Se.data("longtap",!0),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:De.data("touching").x,y:De.data("touching").y})},500))),Se.data("longtap",null))},Ee=function(e){"touchmove"===e.type?(!De.data("touching")||Math.abs(De.data("touching").x-e.originalEvent.touches[0].pageX)+Math.abs(De.data("touching").y-e.originalEvent.touches[0].pageY)>4)&&De.data("touching",null):setTimeout(function(){Se.removeData("longtap")},80),clearTimeout(Se.data("tmlongtap"))},ze=function(e){Se.data("longtap")&&(e.preventDefault(),e.stopPropagation())},Ae=function(){t.lazy(function(){var a;je.append(Oe).removeClass("elfinder-cwd-wrapper-empty elfinder-search-result elfinder-incsearch-result elfinder-letsearch-result"),(t.searchStatus.state>1||t.searchStatus.ininc)&&je.addClass("elfinder-search-result"+(t.searchStatus.ininc?" elfinder-"+("/"===S.substr(0,1)?"let":"inc")+"search-result":"")),ie.attachThumbJob&&ie.attachThumbJob._abort(),Se.data("selectable")&&Se.selectable("disable").selectable("destroy").removeData("selectable"),t.trigger("cwdinit"),_=e();try{Se.empty()}catch(e){Se.html("")}pe&&(De.off("scroll.fixheader resize.fixheader"),pe.remove(),pe=null),Se.removeClass("elfinder-cwd-view-icons elfinder-cwd-view-list").addClass("elfinder-cwd-view-"+(h?"list":"icons")).attr("style","").css("height","auto"),Ie.hide(),De[h?"addClass":"removeClass"]("elfinder-cwd-wrapper-list")._padding=parseInt(De.css("padding-top"))+parseInt(De.css("padding-bottom")),t.UA.iOS&&De.removeClass("overflow-scrolling-touch").addClass("overflow-scrolling-touch"),h&&(Se.html("<table><thead/><tbody/></table>"),a=e('<tr class="ui-state-default"><td class="elfinder-cwd-view-th-name">'+t.getColumnName("name")+"</td>"+function(){for(var e="",a="",n=0;n<M.length;n++)e=t.getColumnName(M[n]),a+='<td class="elfinder-cwd-view-th-'+M[n]+' sortable-item">'+e+"</td>";return a}()+"</tr>"),Se.find("thead").hide().append(a).find("td:first").append(Oe),e.fn.sortable&&a.addClass("touch-punch touch-punch-keep-default").sortable({axis:"x",distance:8,items:"> .sortable-item",start:function(t,a){e(a.item[0]).data("dragging",!0),a.placeholder.width(a.helper.removeClass("ui-state-hover").width()).removeClass("ui-state-active").addClass("ui-state-hover").css("visibility","visible")},update:function(a,n){var i,r,s=e(n.item[0]).attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","");M=e.map(e(this).children(),function(t){var a=e(t).attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","");return r||(s===a?r=!0:i=a),"name"===a?null:a}),L.row=P(),t.storage("cwdCols",M),i=".elfinder-col-"+i+":first",s=".elfinder-col-"+s+":first",t.lazy(function(){Se.find("tbody tr").each(function(){var t=e(this);t.children(i).after(t.children(s))})})},stop:function(t,a){setTimeout(function(){e(a.item[0]).removeData("dragging")},100)}}),a.find("td").addClass("touch-punch").resizable({handles:"ltr"===t.direction?"e":"w",start:function(t,a){var n=Se.find("td.elfinder-col-"+a.element.attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","")+":first");a.element.data("dragging",!0).data("resizeTarget",n).data("targetWidth",n.width()),q=!0,"fixed"!==Se.find("table").css("table-layout")&&(Se.find("tbody tr:first td").each(function(){e(this).width(e(this).width())}),Se.find("table").css("table-layout","fixed"))},resize:function(e,t){t.element.data("resizeTarget").width(t.element.data("targetWidth")-(t.originalSize.width-t.size.width))},stop:function(a,n){q=!1,ge({fitWidth:!0}),W={},Se.find("tbody tr:first td").each(function(){var t=e(this).attr("class").split(" ")[0].replace("elfinder-col-","");W[t]=e(this).width()}),t.storage("cwdColWidth",W),setTimeout(function(){n.element.removeData("dragging")},100)}}).find(".ui-resizable-handle").addClass("ui-icon ui-icon-grip-dotted-vertical")),ne=e.map(F||O,function(e){return t.file(e)||null}),ne=t.sortFiles(ne),F?F=e.map(ne,function(e){return e.hash}):O=e.map(ne,function(e){return e.hash}),ie={renderd:0,attachTmbs:{},getTmbs:[],tmbLoading:{},lazyOpts:{tm:0}},je[ne.length<1?"addClass":"removeClass"]("elfinder-cwd-wrapper-empty"),De.off("elfscrstop",fe).on("elfscrstop",fe).trigger("elfscrstop"),t.cwd().write?(De[t.isCommandEnabled("upload")?"addClass":"removeClass"]("native-droppable"),De.droppable(t.isCommandEnabled("paste")?"enable":"disable")):De.removeClass("native-droppable").droppable("disable").removeClass("ui-state-disabled")})},Se=e(this).addClass("ui-helper-clearfix elfinder-cwd").attr("unselectable","on").on("click."+t.namespace,v,function(a){var n,i,r,s,l,d=this.id?e(this):e(this).parents("[id]:first"),o=e(a.target);if(U&&(o.is("input:checkbox."+z)||o.hasClass("elfinder-cwd-select")))return a.stopPropagation(),a.preventDefault(),d.trigger(d.hasClass(b)?p:f),te(),void requestAnimationFrame(function(){o.prop("checked",d.hasClass(b))});if(Se.data("longtap")||o.hasClass("elfinder-cwd-nonselect"))a.stopPropagation();else{if(j||(j=d.attr("id"),setTimeout(function(){j=""},500)),a.shiftKey&&(n=d.prevAll(ee||".ui-selected:first"),i=d.nextAll(ee||".ui-selected:first"),r=n.length,s=i.length),a.shiftKey&&(r||s))l=(l=r?d.prevUntil("#"+n.attr("id")):d.nextUntil("#"+i.attr("id"))).add(d),r||(l=e(l.get().reverse())),l.trigger(f);else if(a.ctrlKey||a.metaKey)d.trigger(d.hasClass(b)?p:f);else{if(De.data("touching")&&d.hasClass(b))return De.data("touching",null),void t.dblclick({file:t.cwdId2Hash(this.id)});Z({notrigger:!0}),d.trigger(f)}te()}}).on("dblclick."+t.namespace,v,function(a){if(j){var n=t.cwdId2Hash(j);a.stopPropagation(),this.id!==j&&(e(this).trigger(p),e("#"+j).trigger(f),te()),t.dblclick({file:n})}}).on("touchstart."+t.namespace,v,function(a){if(!(a.originalEvent.touches.length>1)){var n=this.id?e(this):e(this).parents("[id]:first"),i=e(a.target),r=a.target.nodeName;if("INPUT"===r&&"text"===a.target.type||"TEXTAREA"===r||i.hasClass("elfinder-cwd-nonselect"))a.stopPropagation();else{if(n.find("input:text,textarea").length)return a.stopPropagation(),void a.preventDefault();De.data("touching",{x:a.originalEvent.touches[0].pageX,y:a.originalEvent.touches[0].pageY}),U&&(i.is("input:checkbox."+z)||i.hasClass("elfinder-cwd-select"))||(n.prevAll(".ui-selected:first").length+n.nextAll(".ui-selected:first").length,Se.data("longtap",null),(Object.keys(B).length||h&&"TD"!==a.target.nodeName||!h&&this!==a.target)&&(Se.data("longtap",!1),n.addClass(x),n.data("tmlongtap",setTimeout(function(){Se.data("longtap",!0),n.trigger(f),te(),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:a.originalEvent.touches[0].pageX,y:a.originalEvent.touches[0].pageY})},500))))}}}).on("touchmove."+t.namespace+" touchend."+t.namespace,v,function(a){var n,i=e(a.target);U&&(i.is("input:checkbox."+z)||i.hasClass("elfinder-cwd-select"))||("INPUT"!=a.target.nodeName&&"TEXTAREA"!=a.target.nodeName?(n=this.id?e(this):e(this).parents("[id]:first"),clearTimeout(n.data("tmlongtap")),"touchmove"===a.type?(De.data("touching",null),n.removeClass(x)):(De.data("touching")&&!Se.data("longtap")&&n.hasClass(b)&&(a.preventDefault(),De.data("touching",null),t.dblclick({file:t.cwdId2Hash(this.id)})),setTimeout(function(){Se.removeData("longtap")},80))):a.stopPropagation())}).on("mouseenter."+t.namespace,v,function(n){if(!se){var i=e(this),r=null;if(!(c||i.data("dragRegisted")||i.hasClass(E)||i.hasClass(C)||i.hasClass(y))){if(i.data("dragRegisted",!0),!t.isCommandEnabled("copy",t.searchStatus.state>1||i.hasClass("isroot")?t.cwdId2Hash(i.attr("id")):void 0))return;i.on("mousedown",function(n){var r=a.metakeyDragout&&!t.UA.IE&&(n.shiftKey||n.altKey),s=!1;r&&Se.data("selectable")&&(Se.selectable("disable").selectable("destroy").removeData("selectable"),requestAnimationFrame(function(){Se.selectable(le).selectable("option",{disabled:!1}).selectable("refresh").data("selectable",!0)})),i.removeClass("ui-state-disabled"),r?i.draggable("option","disabled",!0).attr("draggable","true"):(i.hasClass(b)||(s=h?e(n.target).closest("span,tr").is("tr"):e(n.target).hasClass("elfinder-cwd-file")),s?i.draggable("option","disabled",!0).removeClass("ui-state-disabled"):i.draggable("option","disabled",!1).removeAttr("draggable").draggable("option","cursorAt",{left:50-parseInt(e(n.currentTarget).css("margin-left")),top:47}))}).on("dragstart",function(a){var n=a.dataTransfer||a.originalEvent.dataTransfer||null;if(r=null,n&&!t.UA.IE){var i,s=this.id?e(this):e(this).parents("[id]:first"),l=e("<span>"),d="",o=null,c=null,h=[],p=function(a){var n,i=a.mime,r=t.tmb(a);return n='<div class="elfinder-cwd-icon elfinder-cwd-icon-drag '+t.mime2class(i)+' ui-corner-all"/>',r&&(n=e(n).addClass(r.className).css("background-image","url('"+r.url+"')").get(0).outerHTML),n},u=[];if(s.trigger(f),te(),e.each(B,function(a){var n=t.file(a),i=n.url;if(n&&"directory"!==n.mime){if(i){if("1"==i)return u.push(a),!0}else i=t.url(n.hash);i&&(i=t.convAbsUrl(i),h.push(a),e("<a>").attr("href",i).text(i).appendTo(l),d+=i+"\n",o||(o=n.mime+":"+n.name+":"+i),c||(c=i+"\n"+n.name))}}),u.length)return e.each(u,function(e,a){var n=t.file(a);n.url="",t.request({data:{cmd:"url",target:a},notify:{type:"url",cnt:1},preventDefault:!0}).always(function(e){n.url=e.url?e.url:"1"})}),!1;if(!d)return!1;n.setDragImage&&(r=e('<div class="elfinder-drag-helper html5-native"></div>').append(p(t.file(h[0]))).appendTo(e(document.body)),(i=h.length)>1&&r.append(p(t.file(h[i-1]))+'<span class="elfinder-drag-num">'+i+"</span>"),n.setDragImage(r.get(0),50,47)),n.effectAllowed="copyLink",n.setData("DownloadURL",o),n.setData("text/x-moz-url",c),n.setData("text/uri-list",d),n.setData("text/plain",d),n.setData("text/html",l.html()),n.setData("elfinderfrom",window.location.href+t.cwd().hash),n.setData("elfinderfrom:"+n.getData("elfinderfrom"),"")}}).on("dragend",function(e){Z({notrigger:!0}),r&&r.remove()}).draggable(t.draggable)}}}).on(f,v,function(a){var n=e(this),i=t.cwdId2Hash(n.attr("id"));V||n.hasClass(y)||(ee="#"+this.id,n.addClass(b).children().addClass(x).find("input:checkbox."+z).prop("checked",!0),B[i]||(B[i]=!0),_=Se.find("[id].ui-selected:last").next())}).on(p,v,function(a){var n=e(this),i=t.cwdId2Hash(n.attr("id"));V||(n.removeClass(b).children().removeClass(x).find("input:checkbox."+z).prop("checked",!1),Se.hasClass("elfinder-cwd-allselected")&&(U&&Oe.children("input").prop("checked",!1),Se.removeClass("elfinder-cwd-allselected")),B[i]&&delete B[i])}).on(u,v,function(){var t=e(this).removeClass(x+" "+b).addClass(y),a=t.children(),n=h?t:a.find("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");a.removeClass(x+" "+b),t.hasClass(k)&&t.droppable("disable"),n.hasClass(C)&&n.draggable("disable")}).on(g,v,function(){var t=e(this).removeClass(y),a=h?t:t.children("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");t.hasClass(k)&&t.droppable("enable"),a.hasClass(C)&&a.draggable("enable")}).on("scrolltoview",v,function(t,a){ae(e(this),!a||void 0===a.blink||a.blink)}).on("mouseenter."+t.namespace+" mouseleave."+t.namespace,v,function(a){"mouseenter"===a.type&&(se||t.UA.Mobile)||(t.trigger("hover",{hash:t.cwdId2Hash(e(this).attr("id")),type:a.type}),e(this).toggleClass(x,"mouseenter"==a.type))}).on("mouseenter."+t.namespace+" mouseleave."+t.namespace,".elfinder-cwd-file-wrapper,.elfinder-cwd-filename",function(t){"mouseenter"===t.type&&se||e(this).closest(v).children(".elfinder-cwd-file-wrapper,.elfinder-cwd-filename").toggleClass(T,"mouseenter"==t.type)}).on("contextmenu."+t.namespace,function(a){var n=e(a.target).closest(v);(n.get(0)!==a.target||B[t.cwdId2Hash(n.get(0).id)])&&(n.find("input:text,textarea").length?a.stopPropagation():n.length&&("TD"!=a.target.nodeName||B[t.cwdId2Hash(n.get(0).id)])&&(a.stopPropagation(),a.preventDefault(),n.hasClass(y)||De.data("touching")||(n.hasClass(b)||(Z({notrigger:!0}),n.trigger(f),te()),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:a.pageX,y:a.pageY}))))}).on("click."+t.namespace,function(e){e.target!==this||Se.data("longtap")||!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&Z()}).on("create."+t.namespace,function(a,n){var i=h?Se.find("tbody"):Se,r=i.find(".elfinder-cwd-parent"),s=n.move||!1,l=e($(n)).addClass(E),d=t.selected();d.length?s&&t.trigger("lockfiles",{files:d}):Z(),r.length?r.after(l):i.prepend(l),me(),De.scrollTop(0).scrollLeft(0)}).on("unselectall",Z).on("selectfile",function(e,a){t.cwdHash2Elm(a).trigger(f),te()}).on("colwidth",function(){h&&(Se.find("table").css("table-layout","").find("td").css("width",""),ge({fitWidth:!0}),t.storage("cwdColWidth",W=null))}).on("iconpref",function(e,t){Se.removeClass(function(e,t){return(t.match(/\belfinder-cwd-size\S+/g)||[]).join(" ")}),l=t&&parseInt(t.size)||0,h||(l>0&&Se.addClass("elfinder-cwd-size"+l),ie.renderd&&requestAnimationFrame(function(){We.icons={},ie.hpi=null,xe(Se,ie.renderd),oe()}))}).on("onwheel"in document?"wheel":"mousewheel",function(e){var n,i;!h&&(e.ctrlKey&&!e.metaKey||!e.ctrlKey&&e.metaKey)&&(e.stopPropagation(),e.preventDefault(),void 0!==(n=Se.data("wheelTm"))?(clearTimeout(n),Se.data("wheelTm",setTimeout(function(){Se.removeData("wheelTm")},200))):(Se.data("wheelTm",!1),i=l||0,(e.originalEvent.deltaY?e.originalEvent.deltaY:-e.originalEvent.wheelDelta)>0?l>0&&(i=l-1):l<a.iconsView.sizeMax&&(i=l+1),i!==l&&(t.storage("iconsize",i),Se.trigger("iconpref",{size:i}))))}),De=e('<div class="elfinder-cwd-wrapper"/>').droppable(Object.assign({},we,{autoDisable:!1})).on("contextmenu."+t.namespace,Te).on("touchstart."+t.namespace,He).on("touchmove."+t.namespace+" touchend."+t.namespace,Ee).on("click."+t.namespace,ze).on("scroll."+t.namespace,function(){se||(Se.data("selectable")&&Se.selectable("disable"),De.trigger("elfscrstart")),se=!0,ie.scrtm&&cancelAnimationFrame(ie.scrtm),ie.scrtm&&Math.abs((ie.scrolltop||0)-(ie.scrolltop=this.scrollTop||e(this).scrollTop()))<5&&(ie.scrtm=0,De.trigger("elfscrstop")),ie.scrtm=requestAnimationFrame(function(){ie.scrtm=0,De.trigger("elfscrstop")})}).on("elfscrstop",function(){se=!1,oe()}),Ie=e("<div>&nbsp;</div>").css({position:"absolute",width:"1px",height:"1px"}).hide(),Oe=U?e('<div class="elfinder-cwd-selectall"><input type="checkbox"/></div>').attr("title",t.i18n("selectall")).on("touchstart mousedown click",function(t){if(t.stopPropagation(),t.preventDefault(),e(this).data("pending")||"click"===t.type)return!1;Oe.data("pending",!0),Se.hasClass("elfinder-cwd-allselected")?(Oe.find("input").prop("checked",!1),requestAnimationFrame(function(){Z()})):Q()}):e(),Fe=null,Me=function(t){var a=function(){if(void 0!==ie.renderd){var t=0;De.siblings("div.elfinder-panel:visible").each(function(){t+=e(this).outerHeight(!0)}),De.height(je.height()-t-De._padding)}};t&&a(),Fe&&cancelAnimationFrame(Fe),Fe=requestAnimationFrame(function(){var e;!t&&a(),Se.css("height","auto"),e=De[0].clientHeight-parseInt(De.css("padding-top"))-parseInt(De.css("padding-bottom"))-parseInt(Se.css("margin-top")),Se.outerHeight(!0)<e&&Se.height(e)}),h&&!q&&(t?De.trigger("resize.fixheader"):ge()),oe()},je=e(this).parent().on("resize",Me).children(".elfinder-workzone").append(De.append(this).append(Ie)),Pe=e('<div class="elfinder-cwd-message-board"/>').insertAfter(Se),Ue=e('<div class="elfinder-cwd-expires" />'),qe=function(){var e,a,n;r&&clearTimeout(r),d&&t.volumeExpires[d]&&(n=(a=t.volumeExpires[d]-+new Date/1e3)%60+.1,e=Math.floor(a/60),Ue.html(t.i18n(["minsLeft",e])).show(),e&&(r=setTimeout(qe,1e3*n)))},We={icons:{},list:{}};t.UA.ltIE10||Pe.append(e('<div class="elfinder-cwd-trash" />').html(t.i18n("volume_Trash"))).append(Ue),X=Object.assign(X,a.replacement||{});try{W=t.storage("cwdColWidth")?t.storage("cwdColWidth"):null}catch(e){W=null}t.bind("columnpref",function(n){var i=n.data||{};(M=t.storage("cwdCols"))?(M=e.grep(M,function(e){return-1!==a.listView.columns.indexOf(e)}),a.listView.columns.length>M.length&&e.each(a.listView.columns,function(e,t){-1===M.indexOf(t)&&M.push(t)})):M=a.listView.columns;var r=t.storage("columnhides")||null;r&&Object.keys(r).length&&(M=e.grep(M,function(e){return!r[e]})),L.row=P(),h&&i.repaint&&Ae()}).trigger("columnpref"),c&&e("body").on("touchstart touchmove touchend",function(e){}),U&&Se.addClass("elfinder-has-checkbox"),e(window).on("scroll."+t.namespace,function(){o&&cancelAnimationFrame(o),o=requestAnimationFrame(function(){De.trigger("elfscrstop")})}),e(document).on("keydown."+t.namespace,function(a){a.keyCode==e.ui.keyCode.ESCAPE&&(t.getUI().find(".ui-widget:visible").length||Z())}),t.one("init",function(){var n,i,r,l,d=document.createElement("style"),o=0;document.head&&(document.head.appendChild(d),(n=d.sheet).insertRule('.elfinder-cwd-wrapper-empty .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptyFolder")+'" }',o++),n.insertRule('.elfinder-cwd-wrapper-empty .native-droppable .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptyFolder"+(c?"LTap":"Drop"))+'" }',o++),n.insertRule('.elfinder-cwd-wrapper-empty .ui-droppable-disabled .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptyFolder")+'" }',o++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptySearch")+'" }',o++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result.elfinder-incsearch-result .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptyIncSearch")+'" }',o++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result.elfinder-letsearch-result .elfinder-cwd:not(.elfinder-table-header-sticky):after{ content:"'+t.i18n("emptyLetSearch")+'" }',o++)),(l=t.storage("iconsize")||a.iconsView.size||0)&&(l=Math.min(l,a.iconsView.sizeMax),Se.trigger("iconpref",{size:l})),c||(t.one("open",function(){n&&t.zIndex&&n.insertRule(".ui-selectable-helper{z-index:"+t.zIndex+";}",o++)}),r=e('<div style="position:absolute"/>'),(i=t.getUI()).on("resize",function(e,t){var a;e.preventDefault(),e.stopPropagation(),t&&t.fullscreen&&(a=i.offset(),"on"===t.fullscreen?(r.css({top:-1*a.top,left:-1*a.left}).appendTo(i),le.appendTo=r):(r.detach(),le.appendTo="body"),Se.data("selectable")&&Se.selectable("option",{appendTo:le.appendTo}))})),s=t.getUI("tree").length}).bind("enable",function(){Me()}).bind("request.open",function(){ie.getTmbs=[]}).one("open",function(){t.maxTargets&&(A=Math.min(t.maxTargets,A))}).bind("open add remove searchend",function(){var a,n=t.cwd().hash,i=this.type;if(("open"===i||"searchend"===i||t.searchStatus.state<2)&&(O=e.map(t.files(n),function(e){return e.hash}),t.trigger("cwdhasheschange",O)),"open"===i){var r=n&&(!t.file(n)||s)?s?(a=e.Deferred(),t.one("treesync",function(e){e.data.always(function(){a.resolve()})}),a):t.request({data:{cmd:"parents",target:t.cwd().hash},preventFail:!0}):null,l=t.cwd();l.volumeid!==d&&(Ue.empty().hide(),d&&De.removeClass("elfinder-cwd-wrapper-"+d),d=l.volumeid,qe(),De.addClass("elfinder-cwd-wrapper-"+d)),e.when(r).done(function(){var a;I=t.parents(l.hash),De[(a=!1,e.each(I,function(e,n){if(t.trashes[n])return a=!0,!1}),a?"addClass":"removeClass")]("elfinder-cwd-wrapper-trash")}),F=void 0,Z({notrigger:!0}),Ae()}}).bind("search",function(a){O=e.map(a.data.files,function(e){return e.hash}),t.trigger("cwdhasheschange",O),F=void 0,t.searchStatus.ininc=!1,Ae(),t.autoSync("stop")}).bind("searchend",function(e){(S||F)&&(S="",F?t.trigger("incsearchend",e.data):e.data&&e.data.noupdate||Ae()),t.autoSync()}).bind("searchstart",function(e){Z(),S=e.data.query}).bind("incsearchstart",function(a){var n=a.data.query||"",i=a.data.type||"SearchName",r=t.options.commandsOptions.search.searchTypes||{};(r[i]&&r[i].incsearch||"SearchName"===i)&&(B={},t.lazy(function(){var a,s,l="";if(S=n,n){if("/"===n.substr(0,1)&&(n=n.substr(1),l="^"),a=new RegExp(l+n.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g,"\\$1"),"i"),"SearchName"===i)F=e.grep(O,function(e){var n=t.file(e);return!(!n||!(n.name.match(a)||n.i18&&n.i18.match(a)))});else if("string"==typeof(s=r[i].incsearch))F=e.grep(O,function(e){var n=t.file(e);return!!(n&&n[s]&&(n[s]+"").match(a))});else if("function"==typeof s)try{F=e.grep(s({val:n,regex:a},O,t),function(e){return!!t.file(e)})}catch(e){F=[]}t.trigger("incsearch",{hashes:F,query:n}).searchStatus.ininc=!0,Ae(),t.autoSync("stop")}else t.trigger("incsearchend")}))}).bind("incsearchend",function(e){S="",t.searchStatus.ininc=!1,F=void 0,e.data&&e.data.noupdate||Ae(),t.autoSync()}).bind("sortchange",function(){var e=De.scrollLeft(),a=Se.hasClass("elfinder-cwd-allselected");Ae(),t.one("cwdrender",function(){De.scrollLeft(e),a&&(B=t.arrayFlip(F||O,!0)),(a||Object.keys(B).length)&&te()})}).bind("viewchange",function(){var e="list"!=t.viewType,a=Se.hasClass("elfinder-cwd-allselected");e!=h&&(h=e,t.viewType=h?"list":"icons",l&&t.one("cwdinit",function(){Se.trigger("iconpref",{size:l})}),Ae(),Me(),a&&(Se.addClass("elfinder-cwd-allselected"),Oe.find("input").prop("checked",!0)),Object.keys(B).length&&te())}).bind("wzresize",function(){var e,a=h?Se.find("tbody"):Se;Me(!0),ie.hpi&&xe(a,a.find("[id]").length),e=Se.offset(),je.data("rectangle",Object.assign({width:je.width(),height:je.height(),cwdEdge:"ltr"===t.direction?e.left:e.left+Se.width()},je.offset())),ie.itemH=(h?a.find("tr:first"):a.find("[id]:first")).outerHeight(!0)}).bind("changeclipboard",function(t){D={},t.data&&t.data.clipboard&&t.data.clipboard.length&&e.each(t.data.clipboard,function(e,t){t.cut&&(D[t.hash]=!0)})}).bind("resMixinMake",function(){me()}).bind("tmbreload",function(t){var a={},n=t.data&&t.data.files?t.data.files:null;e.each(n,function(e,t){t.tmb&&"1"!=t.tmb&&(a[t.hash]=t.tmb)}),Object.keys(a).length&&be(a,!0)}).add(function(a){var n=S?new RegExp(S.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g,"\\$1"),"i"):null,i=t.searchStatus.mime,r=t.searchStatus.state>1,s=r&&t.searchStatus.target?t.searchStatus.target:t.cwd().hash,l=t.path(s),d=e.grep(a.data.added||[],function(a){return!!function(a){var d,o;return!(d=a.phash===s)&&r&&(o=a.path||t.path(a.hash),!(d=l&&0===o.indexOf(l))&&t.searchStatus.mixed&&(d=!!e.grep(t.searchStatus.mixed,function(e){return 0===a.hash.indexOf(e)}).length)),d&&r&&(d=i?0===a.mime.indexOf(i):!!(a.name.match(n)||a.i18&&a.i18.match(n))),d}(a)});Ce(d),2===t.searchStatus.state&&(e.each(d,function(t,a){-1===e.inArray(a.hash,O)&&O.push(a.hash)}),t.trigger("cwdhasheschange",O)),h&&Me(),De.trigger("elfscrstop")}).change(function(a){var n,i=t.cwd().hash,r=t.selected();S?e.each(a.data.changed||[],function(a,i){t.cwdHash2Elm(i.hash).length&&(ke([i.hash]),Ce([i]),-1!==e.inArray(i.hash,r)&&J(i.hash),n=!0)}):e.each(e.grep(a.data.changed||[],function(e){return e.phash==i}),function(a,i){t.cwdHash2Elm(i.hash).length&&(ke([i.hash]),Ce([i]),-1!==e.inArray(i.hash,r)&&J(i.hash),n=!0)}),n&&(t.trigger("cwdhasheschange",O),h&&Me(),De.trigger("elfscrstop")),te()}).remove(function(e){var t=h?Se.find("tbody"):Se;ke(e.data.removed||[]),te(),ne.length<1&&t.children(v+(a.oldSchool?":not(.elfinder-cwd-parent)":"")).length<1?(je.addClass("elfinder-cwd-wrapper-empty"),U&&Oe.find("input").prop("checked",!1),Ie.hide(),De.off("elfscrstop",fe),Me()):(xe(t),De.trigger("elfscrstop"))}).dragstart(function(t){var a=e(t.data.target),n=t.data.originalEvent;a.hasClass(w)&&(a.hasClass(b)||(!(n.ctrlKey||n.metaKey||n.shiftKey)&&Z({notrigger:!0}),a.trigger(f),te())),Se.removeClass(y).data("selectable")&&Se.selectable("disable"),V=!0}).dragstop(function(){Se.data("selectable")&&Se.selectable("enable"),V=!1}).bind("lockfiles unlockfiles selectfiles unselectfiles",function(a){var n,i,r,s={lockfiles:u,unlockfiles:g,selectfiles:f,unselectfiles:p}[a.type],l=a.data.files||[],d=l.length,o=a.data.helper||e();if(d>0&&(n=t.parents(l[0])),s!==f&&s!==p||(r=s===f,e.each(l,function(e,t){var a=Se.hasClass("elfinder-cwd-allselected");B[t]?(a&&(U&&Oe.children("input").prop("checked",!1),Se.removeClass("elfinder-cwd-allselected"),a=!1),!r&&delete B[t]):r&&(B[t]=!0)})),!o.data("locked")){for(;d--;)try{t.cwdHash2Elm(l[d]).trigger(s)}catch(a){}!a.data.inselect&&te()}De.data("dropover")&&-1!==n.indexOf(De.data("dropover"))&&(i="lockfiles"!==a.type,o.toggleClass("elfinder-drag-helper-plus",i),De.toggleClass(H,i))}).bind("mkdir mkfile duplicate upload rename archive extract paste multiupload",function(a){if("upload"!=a.type||!a.data._multiupload){var n=t.cwd().hash;Z({notrigger:!0}),e.each((a.data.added||[]).concat(a.data.changed||[]),function(e,t){t&&t.phash==n&&J(t.hash)}),te()}}).shortcut({pattern:"ctrl+a",description:"selectall",callback:Q}).shortcut({pattern:"ctrl+shift+i",description:"selectinvert",callback:function(){var a={};G?Z():Object.keys(B).length?(e.each(F||O,function(e,n){var i=t.cwdHash2Elm(n);B[n]?i.length&&i.trigger(p):(a[n]=!0,i.length&&i.trigger(f))}),B=a,te()):Q()}}).shortcut({pattern:"left right up down shift+left shift+right shift+up shift+down",description:"selectfiles",type:"keydown",callback:function(t){!function(t,a){var n,i,r,s,l,d=e.ui.keyCode,o=t==d.LEFT||t==d.UP,c=Se.find("[id].ui-selected");function u(e,t){return e[t+"All"]("[id]:not(."+y+"):not(.elfinder-cwd-parent):first")}if(c.length)if((r=u(n=c.filter(o?":first":":last"),o?"prev":"next")).length)if(h||t==d.LEFT||t==d.RIGHT)i=r;else if(s=n.position().top,l=n.position().left,i=n,o){do{i=i.prev("[id]")}while(i.length&&!(i.position().top<s&&i.position().left<=l));i.hasClass(y)&&(i=u(i,"next"))}else{do{i=i.next("[id]")}while(i.length&&!(i.position().top>s&&i.position().left>=l));i.hasClass(y)&&(i=u(i,"prev")),i.length||(r=Se.find("[id]:not(."+y+"):last")).position().top>s&&(i=r)}else i=n;else i=_.length?o?_.prev():_:Se.find("[id]:not(."+y+"):not(.elfinder-cwd-parent):"+(o?"last":"first"));i&&i.length&&!i.hasClass("elfinder-cwd-parent")&&(n&&a?i=n.add(n[o?"prevUntil":"nextUntil"]("#"+i.attr("id"))).add(i):c.trigger(p),i.trigger(f),ae(i.filter(o?":first":":last")),te())}(t.keyCode,t.shiftKey)}}).shortcut({pattern:"home",description:"selectffile",callback:function(e){Z({notrigger:!0}),ae(Se.find("[id]:first").trigger(f)),te()}}).shortcut({pattern:"end",description:"selectlfile",callback:function(e){Z({notrigger:!0}),ae(Se.find("[id]:last").trigger(f)),te()}}).shortcut({pattern:"page_up",description:"pageTurning",callback:function(e){ie.itemH&&De.scrollTop(Math.round(De.scrollTop()-Math.floor((De.height()+(h?-1*ie.itemH:16))/ie.itemH)*ie.itemH))}}).shortcut({pattern:"page_down",description:"pageTurning",callback:function(e){ie.itemH&&De.scrollTop(Math.round(De.scrollTop()+Math.floor((De.height()+(h?-1*ie.itemH:16))/ie.itemH)*ie.itemH))}})}),this}});
  //# sourceMappingURL=../sourcemaps/ui/cwd.js.map
  