window.Finder=function(a,b){this.time("load");var c=this;a=$(a);var d=$("<div/>").append(a.contents()),e=a.attr("style"),f=a.attr("id")||"",g="finder-"+(f||Math.random().toString().substr(2,7)),k="mousedown."+g,h="keydown."+g,m="keypress."+g,l=!0,q=!0,p="",t={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,tmb:!1},n={},u=[],w={},y={},E=[],O=[],N=[],T=new c.command(c),B="auto",D=400,P,J=function(a){if(a.init)n={};else for(var b in n)n.hasOwnProperty(b)&&"directory"!=
n[b].mime&&n[b].phash==p&&-1===$.inArray(b,O)&&delete n[b];p=a.cwd.hash;F(a.files);n[p]||F([a.cwd]);c.lastDir(p)},F=function(a){for(var c=a.length,b;c--;)b=a[c],b.name&&b.hash&&b.mime&&(n[b.hash]=b)},H=new Date;this.OS=-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other";this.UA=function(){var a=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"undefined"==typeof window.orientation;return{ltIE6:"undefined"==typeof window.addEventListener&&
"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:!!document.uniqueID,Firefox:!!window.sidebar,Opera:!!window.opera,Webkit:a,Chrome:a&&window.chrome,Safari:a&&!window.chrome,Mobile:"undefined"!=typeof window.orientation}}();this.options=$.extend(!0,{},this._options,b||{});b.ui&&(this.options.ui=
b.ui);b.commands&&(this.options.commands=b.commands);b.uiOptions&&b.uiOptions.toolbar&&(this.options.uiOptions.toolbar=b.uiOptions.toolbar);$.extend(this.options.contextmenu,b.contextmenu);this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"post";this.customData=$.isPlainObject(this.options.customData)?this.options.customData:{};this.id=f;this.uploadURL=b.urlUpload||b.url;this.namespace=g;this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?
this.options.lang:"en";f="en"==this.lang?this.i18.en:$.extend(!0,{},this.i18.en,this.i18[this.lang]);this.direction=f.direction;this.messages=f.messages;this.dateFormat=this.options.dateFormat||f.dateFormat;this.fancyFormat=this.options.fancyDateFormat||f.fancyDateFormat;this.today=(new Date(H.getFullYear(),H.getMonth(),H.getDate())).getTime()/1E3;this.yesterday=this.today-86400;H=this.options.UTCDate?"UTC":"";this.getHours="get"+H+"Hours";this.getMinutes="get"+H+"Minutes";this.getSeconds="get"+H+
"Seconds";this.getDate="get"+H+"Date";this.getDay="get"+H+"Day";this.getMonth="get"+H+"Month";this.getFullYear="get"+H+"FullYear";this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all finder finder-"+("rtl"==this.direction?"rtl":"ltr")+" "+this.options.cssClass;var v;try{v="localStorage"in window&&null!==window.localStorage?c.localStorage:c.cookie}catch(L){v=c.cookie}this.storage=v;this.viewType=this.storage("view")||this.options.defaultView||"icons";this.sortType=
this.storage("sortType")||this.options.sortType||"name";this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc";this.sortStickFolders=this.storage("sortStickFolders");this.sortStickFolders=null===this.sortStickFolders?!!this.options.sortStickFolders:!!this.sortStickFolders;this.sortRules=$.extend(!0,{},this._sortRules,this.options.sortsRules);$.each(this.sortRules,function(a,b){"function"!=typeof b&&delete c.sortRules[a]});this.compare=$.proxy(this.compare,this);this.notifyDelay=0<
this.options.notifyDelay?parseInt(this.options.notifyDelay):500;this.draggable={appendTo:"body",addClasses:!0,delay:30,revert:!0,refreshPositions:!0,cursor:"move",cursorAt:{left:50,top:47},drag:function(a,c){c.helper.data("locked")||c.helper.toggleClass("finder-drag-helper-plus",a.shiftKey||a.ctrlKey||a.metaKey)},start:function(a,c){var b=$.map(c.helper.data("files")||[],function(a){return a||null}),d,e;for(d=b.length;d--;)if(e=b[d],n[e].locked){c.helper.addClass("finder-drag-helper-plus").data("locked",
!0);break}},stop:function(){c.trigger("focus").trigger("dragstop")},helper:function(a,b){var d=this.id?$(this):$(this).parents("[id]:first"),e=$('<div class="finder-drag-helper"><span class="finder-drag-helper-icon-plus"/></div>'),f=function(a){return'<div class="finder-cwd-icon '+c.mime2class(a)+' ui-corner-all"/>'},g;c.trigger("dragstart",{target:d[0],originalEvent:a});d=d.is("."+c.res("class","cwdfile"))?c.selected():[c.navId2Hash(d.attr("id"))];e.append(f(n[d[0]].mime)).data("files",d).data("locked",
!1);1<(g=d.length)&&e.append(f(n[d[g-1]].mime)+'<span class="finder-drag-num">'+g+"</span>");return e}};this.droppable={tolerance:"pointer",accept:".finder-cwd-file-wrapper,.finder-navbar-dir,.finder-cwd-file",hoverClass:this.res("class","adroppable"),drop:function(a,b){var d=$(this),e=$.map(b.helper.data("files")||[],function(a){return a||null}),f=[],g,h;d.is("."+c.res("class","cwd"))?g=p:d.is("."+c.res("class","cwdfile"))?g=d.attr("id"):d.is("."+c.res("class","navdir"))&&(g=c.navId2Hash(d.attr("id")));
for(d=e.length;d--;)h=e[d],h!=g&&n[h].phash!=g&&f.push(h);f.length&&(b.helper.hide(),c.clipboard(f,!(a.ctrlKey||a.shiftKey||a.metaKey||b.helper.data("locked"))),c.exec("paste",g),c.trigger("drop",{files:e}))}};this.enabled=function(){return a.is(":visible")&&l};this.visible=function(){return a.is(":visible")};this.root=function(a){for(a=n[a||p];a&&a.phash;)a=n[a.phash];if(a)return a.hash;for(;void 0 in n&&n.hasOwnProperty(void 0);)if(a=n[void 0],!a.phash&&"directory"==!a.mime&&a.read)return a.hash;
return""};this.cwd=function(){return n[p]||{}};this.option=function(a){return t[a]||""};this.file=function(a){return n[a]};this.files=function(){return $.extend(!0,{},n)};this.parents=function(a){for(var c=[];a=this.file(a);)c.unshift(a.hash),a=a.phash;return c};this.path2array=function(a){for(var c,b=[];a&&(c=n[a])&&c.hash;)b.unshift(c.name),a=c.phash;return b};this.path=function(a){return n[a]&&n[a].path?n[a].path:this.path2array(a).join(t.separator)};this.url=function(a){var c=n[a];if(!c||!c.read)return"";
if(c.url)return c.url;if(t.url)return t.url+$.map(this.path2array(a),function(a){return encodeURIComponent(a)}).slice(1).join("/");a=$.extend({},this.customData,{cmd:"file",target:c.hash});return this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+$.param(a,!0)};this.tmb=function(a){(a=(a=n[a])&&a.tmb&&1!=a.tmb?t.tmbUrl+a.tmb:"")&&(this.UA.Opera||this.UA.IE)&&(a+="?_="+(new Date).getTime());return a};this.selected=function(){return u.slice(0)};this.selectedFiles=function(){return $.map(u,
function(a){return n[a]?$.extend({},n[a]):null})};this.fileByName=function(a,c){for(var b in n)if(n.hasOwnProperty(b)&&n[b].phash==c&&n[b].name==a)return n[b]};this.validResponse=function(a,c){return c.error||this.rules[this.rules[a]?a:"defaults"](c)};this.request=function(a){var c=this,b=this.options,d=$.Deferred(),e=$.extend({},b.customData,{mimes:b.onlyMimes},a.data||a),f=e.cmd,g=!(a.preventDefault||a.preventFail),h=!(a.preventDefault||a.preventDone),k=$.extend({},a.notify),m=a.syncOnFail,l;a=
$.extend({url:b.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:e},a.options||{});var b=function(a){a.warning&&c.error(a.warning);"netmount"==f&&(f="open");"open"==f&&J($.extend(!0,{},a));a.removed&&a.removed.length&&c.remove(a);a.added&&a.added.length&&c.add(a);a.changed&&a.changed.length&&c.change(a);c.trigger(f,a);a.sync&&c.sync()},p;h&&d.done(b);d.fail(function(a){a&&(g?c.error(a):c.debug("error",c.i18n(a)))});if(!f)return d.reject("errCmdReq");m&&d.fail(function(a){a&&c.sync()});
k.type&&k.cnt&&(l=setTimeout(function(){c.notify(k);d.always(function(){k.cnt=-(parseInt(k.cnt)||0);c.notify(k)})},c.notifyDelay),d.always(function(){clearTimeout(l)}));if("open"==f)for(;h=N.pop();)"pending"==h.state()&&(h.quiet=!0,h.abort());delete a.preventFail;p=this.transport.send(a).fail(function(a,c){var b;switch(c){case "abort":b=a.quiet?"":["errConnect","errAbort"];break;case "timeout":b=["errConnect","errTimeout"];break;case "parsererror":b="";"string"==typeof a.responseText&&(b="Response: "+
a.responseText.substr(0,300));b=["errResponse","errDataNotJSON","",b];break;default:b=403==a.status?["errConnect","errAccess"]:404==a.status?["errConnect","errNotFound"]:"errConnect"}d.reject(b,a,c)}).done(function(a){if(a)if($.isPlainObject(a)){if(a.error)return d.reject(a.error,p);if(!c.validResponse(f,a))return d.reject("errResponse",p)}else return d.reject(["errResponse","errDataNotJSON"],p);else return d.reject(["errResponse","errDataEmpty"],p);a.options&&(t=$.extend({},t,a.options));a.netDrivers&&
(c.netDrivers=a.netDrivers);d.resolve(a);a.debug&&c.debug("backend-debug",a.debug)});"open"==f&&(N.unshift(p),d.always(function(){var a=$.inArray(p,N);-1!==a&&N.splice(a,1)}));return d};this.diff=function(a){var c={},b=[],d=[],e=[];$.each(a,function(a,b){c[b.hash]=b});$.each(n,function(a,b){!c[a]&&d.push(a)});$.each(c,function(a,c){var d=n[a];d?$.each(c,function(a){if(c[a]!=d[a])return e.push(c),!1}):b.push(c)});$.each(d,function(a,b){var f=n[b],g=f.phash;if(f=g&&"directory"==f.mime&&-1===$.inArray(g,
d)&&c[g]){a:{for(f=e.length;f--;)if(e[f].hash==g){f=!0;break a}f=void 0}f=!f}f&&e.push(c[g])});return{added:b,removed:d,changed:e}};this.sync=function(){var a=this,c=$.Deferred().done(function(){a.trigger("sync")}),b={data:{cmd:"open",init:1,target:p,tree:this.ui.tree?1:0},preventDefault:!0},d={data:{cmd:"tree",target:p==this.root()?p:this.file(p).phash},preventDefault:!0};$.when(this.request(b),this.request(d)).fail(function(b){c.reject(b);b&&a.request({data:{cmd:"open",target:a.lastDir(""),tree:1,
init:1},notify:{type:"open",cnt:1,hideCnt:!0}})}).done(function(b,d){var e=a.diff(b.files.concat(d&&d.tree?d.tree:[]));e.added.push(b.cwd);e.removed.length&&a.remove(e);e.added.length&&a.add(e);e.changed.length&&a.change(e);return c.resolve(e)});return c};this.upload=function(a){return this.transport.upload(a,this)};this.bind=function(a,c){var b;if("function"==typeof c)for(a=(""+a).toLowerCase().split(/\s+/),b=0;b<a.length;b++)void 0===w[a[b]]&&(w[a[b]]=[]),w[a[b]].push(c);return this};this.unbind=
function(a,c){var b=w[(""+a).toLowerCase()]||[],d=b.indexOf(c);-1<d&&b.splice(d,1);return this};this.trigger=function(a,c){a=a.toLowerCase();var b=w[a]||[],d;if(b.length)for(a=$.Event(a),d=0;d<b.length;d++){a.data=$.extend(!0,{},c);try{if(!1===b[d](a,this)||a.isDefaultPrevented()){this.debug("event-stoped",a.type);break}}catch(e){window.console&&window.console.log&&window.console.log(e)}}return this};this.shortcut=function(a){var c,b,d,e,f;if(this.options.allowShortcuts&&a.pattern&&$.isFunction(a.callback))for(c=
a.pattern.toUpperCase().split(/\s+/),e=0;e<c.length;e++)b=c[e],f=b.split("+"),(d=1==(d=f.pop()).length?0<d?d:d.charCodeAt(0):$.ui.keyCode[d])&&!y[b]&&(y[b]={keyCode:d,altKey:-1!=$.inArray("ALT",f),ctrlKey:-1!=$.inArray("CTRL",f),shiftKey:-1!=$.inArray("SHIFT",f),type:a.type||"keydown",callback:a.callback,description:a.description,pattern:b});return this};this.shortcuts=function(){var a=[];$.each(y,function(b,d){a.push([d.pattern,c.i18n(d.description)])});return a};this.clipboard=function(a,c){var b=
function(){return $.map(E,function(a){return a.hash})};void 0!==a&&(E.length&&this.trigger("unlockfiles",{files:b()}),O=[],E=$.map(a||[],function(a){var b=n[a];return b?(O.push(a),{hash:a,phash:b.phash,name:b.name,mime:b.mime,read:b.read,locked:b.locked,cut:!!c}):null}),this.trigger("changeclipboard",{clipboard:E.slice(0,E.length)}),c&&this.trigger("lockfiles",{files:b()}));return E.slice(0,E.length)};this.isCommandEnabled=function(a){return this._commands[a]?-1===$.inArray(a,t.disabled):!1};this.exec=
function(a,c,b){return this._commands[a]&&this.isCommandEnabled(a)?this._commands[a].exec(c,b):$.Deferred().reject("No such command")};this.dialog=function(c,b){return $("<div/>").append(c).appendTo(a).finderdialog(b)};this.getUI=function(c){return this.ui[c]||a};this.command=function(a){return void 0===a?this._commands:this._commands[a]};this.resize=function(c,b){a.css("width",c).height(b).trigger("resize");this.trigger("resize",{width:a.width(),height:a.height()})};this.restoreSize=function(){this.resize(B,
D)};this.show=function(){a.show();this.enable().trigger("show")};this.hide=function(){this.disable().trigger("hide");a.hide()};this.destroy=function(){a&&a[0].finder&&(this.trigger("destroy").disable(),w={},y={},$(document).add(a).unbind("."+this.namespace),c.trigger=function(){},a.children().remove(),a.append(d.contents()).removeClass(this.cssClass).attr("style",e),a[0].finder=null,P&&clearInterval(P))};if(!($.fn.selectable&&$.fn.draggable&&$.fn.droppable))return alert(this.i18n("errJqui"));if(!a.length)return alert(this.i18n("errNode"));
if(!this.options.url)return alert(this.i18n("errURL"));$.extend($.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120});this.dragUpload=!1;this.xhrUpload="undefined"!=typeof XMLHttpRequestUpload&&"undefined"!=typeof File&&"undefined"!=typeof FormData;this.transport={};"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this));"function"!=typeof this.transport.send&&(this.transport.send=function(a){return $.ajax(a)});
"iframe"==this.transport.upload?this.transport.upload=$.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload?(this.transport.upload=$.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=$.proxy(this.uploads.iframe,this);this.error=function(){var a=arguments[0];return 1==arguments.length&&"function"==typeof a?c.bind("error",a):c.trigger("error",{error:a})};$.each("enable disable load open reload select add remove change dblclick getfile lockfiles unlockfiles dragstart dragstop search searchend viewchange".split(" "),
function(a,b){c[b]=function(){var a=arguments[0];return 1==arguments.length&&"function"==typeof a?c.bind(b,a):c.trigger(b,$.isPlainObject(a)?a:{})}});this.enable(function(){!l&&c.visible()&&c.ui.overlay.is(":hidden")&&(l=!0,$("texarea:focus,input:focus,button").blur(),a.removeClass("finder-disabled"))}).disable(function(){q=l;l=!1;a.addClass("finder-disabled")}).open(function(){u=[]}).select(function(a){u=$.map(a.data.selected||a.data.value||[],function(a){return n[a]?a:null})}).error(function(a){var b=
{cssClass:"finder-dialog-error",title:c.i18n(c.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};b.buttons[c.i18n(c.i18n("btnClose"))]=function(){$(this).finderdialog("close")};c.dialog('<span class="finder-dialog-icon finder-dialog-icon-error"/>'+c.i18n(a.data.error),b)}).bind("tree parents",function(a){F(a.data.tree||[])}).bind("tmb",function(a){$.each(a.data.images||[],function(a,b){n[a]&&(n[a].tmb=b)})}).add(function(a){F(a.data.added||[])}).change(function(a){$.each(a.data.changed||[],
function(a,b){var c=b.hash;n[c]=n[c]?$.extend(n[c],b):b})}).remove(function(a){a=a.data.removed||[];for(var b=a.length,c=function(a){var b=n[a];b&&("directory"==b.mime&&b.dirs&&$.each(n,function(b,d){d.phash==a&&c(b)}),delete n[a])};b--;)c(a[b])}).bind("search",function(a){F(a.data.files)});$.each(this.options.handlers,function(a,b){c.bind(a,b)});this.history=new this.history(this);"function"==typeof this.options.getFileCallback&&this.commands.getfile&&(this.bind("dblclick",function(a){a.preventDefault();
c.exec("getfile").fail(function(){c.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){c.exec("getfile").fail(function(){c.exec("mac"==c.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){c.exec("mac"==c.OS?"rename":"open")}}));this._commands={};$.isArray(this.options.commands)||(this.options.commands=[]);$.each("open reload back forward up home info quicklook getfile help".split(" "),
function(a,b){-1===$.inArray(b,c.options.commands)&&c.options.commands.push(b)});$.each(this.options.commands,function(a,b){var d=c.commands[b];$.isFunction(d)&&!c._commands[b]&&(d.prototype=T,c._commands[b]=new d,c._commands[b].setup(b,c.options.commandsOptions[b]||{}))});a.addClass(this.cssClass).bind(k,function(){!l&&c.enable()});this.ui={workzone:$("<div/>").appendTo(a).finderworkzone(this),navbar:$("<div/>").appendTo(a).findernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:$("<div/>").appendTo(a).findercontextmenu(this),
overlay:$("<div/>").appendTo(a).finderoverlay({show:function(){c.disable()},hide:function(){q&&c.enable()}}),cwd:$("<div/>").appendTo(a).findercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"finder-dialog-notify",position:{top:"12px",right:"12px"},resizable:!1,autoOpen:!1,title:"&nbsp;",width:280}),statusbar:$('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom finder-statusbar"/>').hide().appendTo(a)};$.each(this.options.ui||[],function(b,d){var e="finder"+
d,f=c.options.uiOptions[d]||{};!c.ui[d]&&$.fn[e]&&(c.ui[d]=$("<"+(f.tag||"div")+"/>").appendTo(a)[e](c,f))});a[0].finder=this;this.options.resizable&&$.fn.resizable&&a.resizable({handles:"se",minWidth:300,minHeight:200});this.options.width&&(B=this.options.width);this.options.height&&(D=this.options.height);c.resize(B,D);$(document).bind("click."+this.namespace,function(b){l&&!$(b.target).closest(a).length&&c.disable()}).bind(h+" "+m,function(a){var b=a.keyCode,d=!(!a.ctrlKey&&!a.metaKey);l&&($.each(y,
function(e,f){f.type==a.type&&f.keyCode==b&&f.shiftKey==a.shiftKey&&f.ctrlKey==d&&f.altKey==a.altKey&&(a.preventDefault(),a.stopPropagation(),f.callback(a,c),c.debug("shortcut-exec",e+" : "+f.description))}),9!=b||$(a.target).is(":input")||a.preventDefault())});this.trigger("init").request({data:{cmd:"open",target:c.lastDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){c.trigger("fail").disable().lastDir("");w={};y={};$(document).add(a).unbind("."+
this.namespace);c.trigger=function(){}}).done(function(a){c.load();a=$.extend(!0,{},a);J(a);c.trigger("open",a)});this.one("load",function(){a.trigger("resize");1E3<c.options.sync&&(P=setInterval(function(){c.sync()},c.options.sync))})};
Finder.prototype={res:function(a,b){return this.resources[a]&&this.resources[a][b]},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:"January February March April May June July August September October November December".split(" "),monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),daysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" ")},
rules:{defaults:function(a){return!a||a.added&&!$.isArray(a.added)||a.removed&&!$.isArray(a.removed)||a.changed&&!$.isArray(a.changed)?!1:!0},open:function(a){return a&&a.cwd&&a.files&&$.isPlainObject(a.cwd)&&$.isArray(a.files)},tree:function(a){return a&&a.tree&&$.isArray(a.tree)},parents:function(a){return a&&a.tree&&$.isArray(a.tree)},tmb:function(a){return a&&a.images&&($.isPlainObject(a.images)||$.isArray(a.images))},upload:function(a){return a&&($.isPlainObject(a.added)||$.isArray(a.added))},
search:function(a){return a&&a.files&&$.isArray(a.files)}},commands:{},parseUploadData:function(a){var b;if(!$.trim(a))return{error:["errResponse","errDataEmpty"]};try{b=$.parseJSON(a)}catch(c){return{error:["errResponse","errDataNotJSON"]}}if(!this.validResponse("upload",b))return{error:["errResponse"]};b.removed=$.map(b.added||[],function(a){return a.hash});return b},iframeCnt:0,uploads:{iframe:function(a,b){var c=b?b:this,d=a.input,e=$.Deferred().fail(function(a){a&&c.error(a)}).done(function(a){a.warning&&
c.error(a.warning);a.removed&&c.remove(a);a.added&&c.add(a);a.changed&&c.change(a);c.trigger("upload",a);a.sync&&c.sync()}),f="iframe-"+c.namespace+ ++c.iframeCnt,g=$('<form action="'+c.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+f+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),k=this.UA.IE,h=function(){t&&clearTimeout(t);p&&clearTimeout(p);q&&c.notify({type:"upload",cnt:-l});setTimeout(function(){k&&$('<iframe src="javascript:false;"/>').appendTo(g);
g.remove();m.remove()},100)},m=$('<iframe src="'+(k?"javascript:false;":"about:blank")+'" name="'+f+'" style="position:absolute;left:-1000px;top:-1000px" />').bind("load",function(){m.unbind("load").bind("load",function(){var a=c.parseUploadData(m.contents().text());h();a.error?e.reject(a.error):e.resolve(a)});p=setTimeout(function(){q=!0;c.notify({type:"upload",cnt:l})},c.options.notifyDelay);0<c.options.iframeTimeout&&(t=setTimeout(function(){h();e.reject([errors.connect,errors.timeout])},c.options.iframeTimeout));
g.submit()}),l,q,p,t;if(d&&$(d).is(":file")&&$(d).val())g.append(d);else return e.reject();l=d.files?d.files.length:1;g.append('<input type="hidden" name="target" value="'+c.cwd().hash+'"/>').append('<input type="hidden" name="html" value="1"/>').append($(d).attr("name","upload[]"));$.each(c.options.onlyMimes||[],function(a,b){g.append('<input type="hidden" name="mimes[]" value="'+b+'"/>')});$.each(c.options.customData,function(a,b){g.append('<input type="hidden" name="'+a+'" value="'+b+'"/>')});
g.appendTo("body");m.appendTo("body");return e},xhr:function(a,b){var c=b?b:this,d=$.Deferred().fail(function(a){a&&c.error(a)}).done(function(a){a.warning&&c.error(a.warning);a.removed&&c.remove(a);a.added&&c.add(a);a.changed&&c.change(a);c.trigger("upload",a);a.sync&&c.sync()}).always(function(){q&&clearTimeout(q);m&&c.notify({type:"upload",cnt:-k,progress:100*k})}),e=new XMLHttpRequest,f=new FormData,g=a.input?a.input.files:a.files,k=g.length,h=5,m=!1,l=function(){return setTimeout(function(){m=
!0;c.notify({type:"upload",cnt:k,progress:h*k})},c.options.notifyDelay)},q;if(!k)return d.reject();e.addEventListener("error",function(){d.reject("errConnect")},!1);e.addEventListener("abort",function(){d.reject(["errConnect","errAbort"])},!1);e.addEventListener("load",function(){var a=e.status;if(500<a)return d.reject("errResponse");if(200!=a)return d.reject("errConnect");if(4!=e.readyState)return d.reject(["errConnect","errTimeout"]);if(!e.responseText)return d.reject(["errResponse","errDataEmpty"]);
a=c.parseUploadData(e.responseText);a.error?d.reject(a.error):d.resolve(a)},!1);e.upload.addEventListener("progress",function(a){var b=h;a.lengthComputable&&(a=parseInt(100*a.loaded/a.total),0<a&&!q&&(q=l()),4<a-b&&(h=a,m&&c.notify({type:"upload",cnt:0,progress:(h-b)*k})))},!1);e.open("POST",c.uploadURL,!0);f.append("cmd","upload");f.append("target",c.cwd().hash);$.each(c.options.customData,function(a,b){f.append(a,b)});$.each(c.options.onlyMimes,function(a,b){f.append("mimes["+a+"]",b)});$.each(g,
function(a,b){f.append("upload[]",b)});e.onreadystatechange=function(){4==e.readyState&&0==e.status&&d.reject(["errConnect","errAbort"])};e.send(f);this.UA.Safari&&a.files||(q=l());return d}},one:function(a,b){var c=this,d=$.proxy(b,function(a){setTimeout(function(){c.unbind(a.type,d)},3);return b.apply(this,arguments)});return this.bind(a,d)},localStorage:function(a,b){var c=window.localStorage;a="finder-"+a+this.id;if(null===b)return c.removeItem(a);if(void 0!==b)try{c.setItem(a,b)}catch(d){c.clear(),
c.setItem(a,b)}return c.getItem(a)},cookie:function(a,b){var c,d;a="finder-"+a+this.id;if(void 0===b){if(document.cookie&&""!=document.cookie)for(c=document.cookie.split(";"),a+="=",d=0;d<c.length;d++)if(c[d]=$.trim(c[d]),c[d].substring(0,a.length)==a)return decodeURIComponent(c[d].substring(a.length));return""}d=$.extend({},this.options.cookie);null===b&&(b="",d.expires=-1);"number"==typeof d.expires&&(c=new Date,c.setTime(c.getTime()+864E5*d.expires),d.expires=c);document.cookie=a+"="+encodeURIComponent(b)+
"; expires="+d.expires.toUTCString()+(d.path?"; path="+d.path:"")+(d.domain?"; domain="+d.domain:"")+(d.secure?"; secure":"");return b},lastDir:function(a){return this.options.rememberLastDir?this.storage("lastdir",a):""},_node:$("<span/>"),escape:function(a){return this._node.text(a).html()},setSort:function(a,b,c){this.storage("sortType",this.sortType=this.sortRules[a]?a:"name");this.storage("sortOrder",this.sortOrder=/asc|desc/.test(b)?b:"asc");this.storage("sortStickFolders",(this.sortStickFolders=
!!c)?1:"");this.trigger("sortchange")},_sortRules:{name:function(a,b){return a.name.toLowerCase().localeCompare(b.name.toLowerCase())},size:function(a,b){var c=parseInt(a.size)||0,d=parseInt(b.size)||0;return c==d?0:c>d?1:-1},kind:function(a,b){return a.mime.localeCompare(b.mime)},date:function(a,b){var c=a.ts||a.date,d=b.ts||b.date;return c==d?0:c>d?1:-1}},compare:function(a,b){var c=this.sortType,d="asc"==this.sortOrder,e=this.sortRules,f=e[c],g="directory"==a.mime,k="directory"==b.mime;if(this.sortStickFolders){if(g&&
!k)return-1;if(!g&&k)return 1}f=d?f(a,b):f(b,a);return"name"!=c&&0==f?d?e.name(a,b):e.name(b,a):f},sortFiles:function(a){return a.sort(this.compare)},notify:function(a){var b=a.type,c=this.messages["ntf"+b]?this.i18n("ntf"+b):this.i18n("ntfsmth"),d=this.ui.notify,e=d.children(".finder-notify-"+b),f=a.cnt,g=0<=a.progress&&100>=a.progress?a.progress:0,k;if(!b)return this;e.length||(e=$('<div class="finder-notify finder-notify-{type}"><span class="finder-dialog-icon finder-dialog-icon-{type}"/><span class="finder-notify-msg">{msg}</span> <span class="finder-notify-cnt"/><div class="finder-notify-progressbar"><div class="finder-notify-progress"/></div></div>'.replace(/\{type\}/g,
b).replace(/\{msg\}/g,c)).appendTo(d).data("cnt",0),g&&e.data({progress:0,total:0}));b=f+parseInt(e.data("cnt"));0<b?(!a.hideCnt&&e.children(".finder-notify-cnt").text("("+b+")"),d.is(":hidden")&&d.finderdialog("open"),e.data("cnt",b),100>g&&0<=e.data("total")&&0<=(k=e.data("progress"))&&(a=f+parseInt(e.data("total")),k=g+k,g=parseInt(k/a),e.data({progress:k,total:a}),d.find(".finder-notify-progress").animate({width:(100>g?g:100)+"%"},20))):(e.remove(),!d.children().length&&d.finderdialog("close"));
return this},confirm:function(a){var b=!1,c={cssClass:"finder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(a.title||"confirmReq"),buttons:{},close:function(){!b&&a.cancel.callback();$(this).finderdialog("destroy")}},d=this.i18n("apllyAll"),e;a.reject&&(c.buttons[this.i18n(a.reject.label)]=function(){a.reject.callback(!(!e||!e.prop("checked")));b=!0;$(this).finderdialog("close")});c.buttons[this.i18n(a.accept.label)]=function(){a.accept.callback(!(!e||!e.prop("checked")));b=!0;$(this).finderdialog("close")};
c.buttons[this.i18n(a.cancel.label)]=function(){$(this).finderdialog("close")};a.all&&(a.reject&&(c.width=370),c.create=function(){e=$('<input type="checkbox" />');$(this).next().children().before($("<label>"+d+"</label>").prepend(e))},c.open=function(){var a=$(this).next(),b=parseInt(a.children(":first").outerWidth()+a.children(":last").outerWidth());b>parseInt(a.width())&&$(this).closest(".finder-dialog").width(b+30)});return this.dialog('<span class="finder-dialog-icon finder-dialog-icon-confirm"/>'+
this.i18n(a.text),c)},uniqueName:function(a,b){var c=0,d="",e;a=this.i18n(a);b=b||this.cwd().hash;-1!=(e=a.indexOf(".txt"))&&(d=".txt",a=a.substr(0,e));e=a+d;if(!this.fileByName(e,b))return e;for(;1E4>c;)if(e=a+" "+ ++c+d,!this.fileByName(e,b))return e;return a+Math.random()+d},i18n:function(){var a=this,b=this.messages,c=[],d=[],e=function(b){var c;return 0===b.indexOf("#")&&(c=a.file(b.substr(1)))?c.name:b},f,g,k;for(f=0;f<arguments.length;f++)if(k=arguments[f],"string"==typeof k)c.push(e(k));else if($.isArray(k))for(g=
0;g<k.length;g++)"string"==typeof k[g]&&c.push(e(k[g]));for(f=0;f<c.length;f++)-1===$.inArray(f,d)&&(k=c[f],k=b[k]||k,k=k.replace(/\$(\d+)/g,function(a,b){b=f+parseInt(b);0<b&&c[b]&&d.push(b);return c[b]||""}),c[f]=k);return $.map(c,function(a,b){return-1===$.inArray(b,d)?a:null}).join("<br>")},formatDate:function(a,b){var c=this;b=b||a.ts;var d=c.i18,e,f,g,k,h,m,l,q,p;return c.options.clientFormatDate&&0<b?(e=new Date(1E3*b),m=e[c.getHours](),l=12<m?m-12:m,q=e[c.getMinutes](),p=e[c.getSeconds](),
f=e[c.getDate](),g=e[c.getDay](),k=e[c.getMonth]()+1,h=e[c.getFullYear](),e=b>=this.yesterday?this.fancyFormat:this.dateFormat,e=e.replace(/[a-z]/gi,function(a){switch(a){case "d":return 9<f?f:"0"+f;case "j":return f;case "D":return c.i18n(d.daysShort[g]);case "l":return c.i18n(d.days[g]);case "m":return 9<k?k:"0"+k;case "n":return k;case "M":return c.i18n(d.monthsShort[k-1]);case "F":return c.i18n(d.months[k-1]);case "Y":return h;case "y":return(""+h).substr(2);case "H":return 9<m?m:"0"+m;case "G":return m;
case "g":return l;case "h":return 9<l?l:"0"+l;case "a":return 12<m?"pm":"am";case "A":return 12<m?"PM":"AM";case "i":return 9<q?q:"0"+q;case "s":return 9<p?p:"0"+p}return a}),b>=this.yesterday?e.replace("$1",this.i18n(b>=this.today?"Today":"Yesterday")):e):a.date?a.date.replace(/([a-z]+)\s/i,function(a,b){return c.i18n(b)+" "}):c.i18n("dateUnknown")},perms2class:function(a){var b="";a.read||a.write?a.read?a.write||(b="finder-ro"):b="finder-wo":b="finder-na";return b},formatPermissions:function(a){var b=
[];a.read&&b.push(this.i18n("read"));a.write&&b.push(this.i18n("write"));return b.length?b.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(a){var b=1,c="b";if("unknown"==a)return this.i18n("unknown");1073741824<a?(b=1073741824,c="GB"):1048576<a?(b=1048576,c="MB"):1024<a&&(b=1024,c="KB");a/=b;return(0<a?1048576<=b?a.toFixed(2):Math.round(a):0)+" "+c},navHash2Id:function(a){return"nav-"+a},navId2Hash:function(a){return"string"==typeof a?a.substr(4):!1},log:function(a){window.console&&
window.console.log&&window.console.log(a);return this},debug:function(a,b){var c=this.options.debug;("all"==c||!0===c||$.isArray(c)&&-1!=$.inArray(a,c))&&window.console&&window.console.log&&window.console.log("finder debug: ["+a+"] ["+this.id+"]",b);return this},time:function(a){window.console&&window.console.time&&window.console.time(a)},timeEnd:function(a){window.console&&window.console.timeEnd&&window.console.timeEnd(a)}};Finder.prototype.version="2.2.1";
$.fn.finder=function(a){return"instance"==a?this.getFinder():this.each(function(){var b="string"==typeof a?a:"";this.finder||new Finder(this,"object"==typeof a?a:{});switch(b){case "close":case "hide":this.finder.hide();break;case "open":case "show":this.finder.show();break;case "destroy":this.finder.destroy()}})};$.fn.getFinder=function(){var a;this.each(function(){if(this.finder)return a=this.finder,!1});return a};
Finder.prototype._options={url:"",requestType:"post",transport:{},urlUpload:"",dragUploadAllow:"auto",iframeTimeout:0,customData:{},handlers:{},lang:"en",cssClass:"",commands:"open reload home up back forward getfile quicklook download rm duplicate rename mkdir mkfile upload copy cut paste edit extract archive search info view help resize sort netmount unmount".split(" "),commandsOptions:{getfile:{multiple:!1,folders:!1,oncomplete:""},upload:{ui:"uploadbutton"},quicklook:{autoplay:!0,jplayer:"extensions/jplayer"},
edit:{mimes:[],editors:[]},help:{view:["about","shortcuts","help"]}},getFileCallback:null,defaultView:"icons",ui:["toolbar","places","tree","path","stat"],uiOptions:{toolbar:[["back","forward","up","reload"],["home","netmount"],["mkdir","mkfile","upload"],["open","download","getfile"],["info","quicklook"],["copy","cut","paste"],["rm"],["duplicate","rename","edit","resize"],["extract","archive"],["view","sort"],["help"],["search"]],tree:{openRootOnLoad:!0,syncTree:!0},navbar:{minWidth:150,maxWidth:500},
cwd:{oldSchool:!1}},onlyMimes:[],sortRules:{},sortType:"name",sortOrder:"asc",sortStickFolders:!0,clientFormatDate:!0,UTCDate:!1,dateFormat:"",fancyDateFormat:"",width:"auto",height:400,resizable:!0,notifyDelay:500,allowShortcuts:!0,rememberLastDir:!0,showFiles:30,showThreshold:50,validName:!1,sync:0,loadTmbs:5,cookie:{expires:30,domain:"",path:"/",secure:!1},contextmenu:{navbar:"open | copy cut paste duplicate | rm | info | unmount".split(" "),cwd:"reload back | upload mkdir mkfile paste | sort | info".split(" "),
files:"getfile | open quicklook | download | copy cut paste duplicate | rm | edit rename resize | archive extract | info".split(" ")},debug:["error","warning","event-destroy"]};
Finder.prototype.history=function(a){var b=this,c=!0,d=[],e,f=function(){d=[a.cwd().hash];e=0;c=!0},g=function(g){return g&&b.canForward()||!g&&b.canBack()?(c=!1,a.exec("open",d[g?++e:--e]).fail(f)):$.Deferred().reject()};this.canBack=function(){return 0<e};this.canForward=function(){return e<d.length-1};this.back=g;this.forward=function(){return g(!0)};a.open(function(b){b=d.length;var f=a.cwd().hash;c&&(0<=e&&b>e+1&&d.splice(e+1),d[d.length-1]!=f&&d.push(f),e=d.length-1);c=!0}).reload(f)};
Finder.prototype.command=function(a){this.fm=a;this.title=this.name="";this.state=-1;this.disableOnSearch=this._disabled=this.alwaysEnabled=!1;this.updateOnSelect=!0;this._handlers={enable:function(){this.update(void 0,this.value)},disable:function(){this.update(-1,this.value)},"open reload load":function(a){this._disabled=!(this.alwaysEnabled||this.fm.isCommandEnabled(this.name));this.update(void 0,this.value);this.change()}};this.handlers={};this.shortcuts=[];this.options={ui:"button"};this.setup=
function(a,c){var d=this,e=this.fm,f,g;this.name=a;this.title=e.messages["cmd"+a]?e.i18n("cmd"+a):a;this.options=$.extend({},this.options,c);this.listeners=[];this.updateOnSelect&&(this._handlers.select=function(){this.update(void 0,this.value)});$.each($.extend({},d._handlers,d.handlers),function(a,b){e.bind(a,$.proxy(b,d))});for(f=0;f<this.shortcuts.length;f++)g=this.shortcuts[f],g.callback=$.proxy(g.callback||function(){this.exec()},this),!g.description&&(g.description=this.title),e.shortcut(g);
this.disableOnSearch&&e.bind("search searchend",function(a){d._disabled="search"==a.type;d.update(void 0,d.value)});this.init()};this.init=function(){};this.exec=function(a,c){return $.Deferred().reject()};this.disabled=function(){return 0>this.state};this.enabled=function(){return-1<this.state};this.active=function(){return 0<this.state};this.getstate=function(){return-1};this.update=function(a,c){var d=this.state,e=this.value;this.state=this._disabled?-1:void 0!==a?a:this.getstate();this.value=
c;d==this.state&&e==this.value||this.change()};this.change=function(a){var c;if("function"===typeof a)this.listeners.push(a);else for(c=0;c<this.listeners.length;c++){a=this.listeners[c];try{a(this.state,this.value)}catch(d){this.fm.debug("error",d)}}return this};this.hashes=function(b){return b?$.map($.isArray(b)?b:[b],function(b){return a.file(b)?b:null}):a.selected()};this.files=function(a){var c=this.fm;return a?$.map($.isArray(a)?a:[a],function(a){return c.file(a)||null}):c.selectedFiles()}};
Finder.prototype.resources={"class":{hover:"ui-state-hover",active:"ui-state-active",disabled:"ui-state-disabled",draggable:"ui-draggable",droppable:"ui-droppable",adroppable:"finder-droppable-active",cwdfile:"finder-cwd-file",cwd:"finder-cwd",tree:"finder-tree",treeroot:"finder-navbar-root",navdir:"finder-navbar-dir",navdirwrap:"finder-navbar-dir-wrapper",navarrow:"finder-navbar-arrow",navsubtree:"finder-navbar-subtree",navcollapse:"finder-navbar-collapsed",navexpand:"finder-navbar-expanded",treedir:"finder-tree-dir",
placedir:"finder-place-dir",searchbtn:"finder-button-search"},tpl:{perms:'<span class="finder-perms"/>',symlink:'<span class="finder-symlink"/>',navicon:'<span class="finder-nav-icon"/>',navspinner:'<span class="finder-navbar-spinner"/>',navdir:'<div class="finder-navbar-wrapper"><span id="{id}" class="ui-corner-all finder-navbar-dir {cssclass}"><span class="finder-navbar-arrow"/><span class="finder-navbar-icon"/>{symlink}{permissions}{name}</span><div class="finder-navbar-subtree"/></div>'},mimes:{text:"application/x-empty application/javascript application/xhtml+xml audio/x-mp3-playlist application/x-web-config application/docbook+xml application/x-php application/x-perl application/x-awk application/x-config application/x-csh application/xml".split(" ")},
mixin:{make:function(){var a=this.fm,b=this.name,c=a.getUI("cwd"),d=$.Deferred().fail(function(b){c.trigger("unselectall");b&&a.error(b)}).always(function(){h.remove();k.remove();a.enable()}),e="tmp_"+parseInt(1E5*Math.random()),f=a.cwd().hash,g=new Date,g={hash:e,name:a.uniqueName(this.prefix),mime:this.mime,read:!0,write:!0,date:"Today "+g.getHours()+":"+g.getMinutes()},k=c.trigger("create."+a.namespace,g).find("#"+e),h=$('<input type="text"/>').keydown(function(a){a.stopImmediatePropagation();
a.keyCode==$.ui.keyCode.ESCAPE?d.reject():a.keyCode==$.ui.keyCode.ENTER&&h.blur()}).mousedown(function(a){a.stopPropagation()}).blur(function(){var c=$.trim(h.val()),g=h.parent();if(g.length){if(!c)return d.reject("errInvName");if(a.fileByName(c,f))return d.reject(["errExists",c]);g.html(a.escape(c));a.lockfiles({files:[e]});a.request({data:{cmd:b,name:c,target:f},notify:{type:b,cnt:1},preventFail:!0,syncOnFail:!0}).fail(function(a){d.reject(a)}).done(function(a){d.resolve(a)})}});if(this.disabled()||
!k.length)return d.reject();a.disable();k.find(".finder-cwd-filename").empty("").append(h.val(g.name));h.select().focus();return d}}};
Finder.prototype.kinds={unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP",
"application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO",
"application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF",
"application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML",
"text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF",
"image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash",
"video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"};Finder.prototype.mime2kind=function(a){var b="object"==typeof a?a.mime:a;a=a.alias?"Alias":this.kinds[b]?this.kinds[b]:0===b.indexOf("text")?"Text":0===b.indexOf("image")?"Image":0===b.indexOf("audio")?"Audio":0===b.indexOf("video")?"Video":0===b.indexOf("application")?"App":b;return this.messages["kind"+a]?this.i18n("kind"+a):b};
Finder.prototype.mime2class=function(a){a=a.split("/");return"finder-cwd-icon-"+a[0]+("image"!=a[0]&&a[1]?" finder-cwd-icon-"+a[1].replace(/(\.|\+)/g,"-"):"")};
$.fn.dialogfinder=function(a){this.not(".finder").each(function(){$(document);var b=$('<div class="ui-widget-header dialogfinder-drag ui-corner-top">'+(a.title||"Files")+"</div>");$('<a href="#" class="dialogfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').appendTo(b).click(function(a){a.preventDefault();c.dialogfinder("close")});var c=$(this).addClass("dialogfinder").css("position","absolute").hide().appendTo("body").draggable({handle:".dialogfinder-drag"}).finder(a).prepend(b);
c.finder("instance");c.width(parseInt(c.width())||840).data("finderDestroyOnClose",!!a.destroyOnClose).find(".finder-toolbar").removeClass("ui-corner-top");a.position&&c.data("finderPosition",a.position);!1!==a.autoOpen&&$(this).dialogfinder("open")});if("open"==a){var b=$(this),c=b.data("finderPosition")||{top:parseInt($(document).scrollTop()+($(window).height()<b.height()?2:($(window).height()-b.height())/2)),left:parseInt($(document).scrollLeft()+($(window).width()<b.width()?2:($(window).width()-
b.width())/2))},d=100;b.is(":hidden")&&($("body").find(":visible").each(function(){var a=$(this),c;this!==b[0]&&"absolute"==a.css("position")&&(c=parseInt(a.zIndex()))>d&&(d=c+1)}),b.zIndex(d).css(c).show().trigger("resize"),setTimeout(function(){b.trigger("resize").mousedown()},200))}else if("close"==a)b=$(this),b.is(":visible")&&(b.data("finderDestroyOnClose")?b.finder("destroy").remove():b.finder("close"));else if("instance"==a)return $(this).getFinder();return this};
Finder&&Finder.prototype&&"object"==typeof Finder.prototype.i18&&(Finder.prototype.i18.en={translator:"Troex Nevelin &lt;troex@fury.scancode.ru&gt;",language:"English",direction:"ltr",dateFormat:"M d, Y h:i A",fancyDateFormat:"$1 h:i A",messages:{error:"Error",errUnknown:"Unknown error.",errUnknownCmd:"Unknown command.",errJqui:"Invalid jQuery UI configuration. Selectable, draggable and droppable components must be included.",errNode:"gpFinder requires DOM Element to be created.",errURL:"Invalid gpFinder configuration! URL option is not set.",
errAccess:"Access denied.",errConnect:"Unable to connect to backend.",errAbort:"Connection aborted.",errTimeout:"Connection timeout.",errNotFound:"Backend not found.",errResponse:"Invalid backend response.",errConf:"Invalid backend configuration.",errJSON:"PHP JSON module not installed.",errNoVolumes:"Readable volumes not available.",errCmdParams:'Invalid parameters for command "$1".',errDataNotJSON:"Data is not JSON.",errDataEmpty:"Data is empty.",errCmdReq:"Backend request requires command name.",
errOpen:'Unable to open "$1".',errNotFolder:"Object is not a folder.",errNotFile:"Object is not a file.",errRead:'Unable to read "$1".',errWrite:'Unable to write into "$1".',errPerm:"Permission denied.",errLocked:'"$1" is locked and can not be renamed, moved or removed.',errExists:'File named "$1" already exists.',errInvName:"Invalid file name.",errFolderNotFound:"Folder not found.",errFileNotFound:"File not found.",errTrgFolderNotFound:'Target folder "$1" not found.',errPopup:"Browser prevented opening popup window. To open file enable it in browser options.",
errMkdir:'Unable to create folder "$1".',errMkfile:'Unable to create file "$1".',errRename:'Unable to rename "$1".',errCopyFrom:'Copying files from volume "$1" not allowed.',errCopyTo:'Copying files to volume "$1" not allowed.',errUpload:"Upload error.",errUploadFile:'Unable to upload "$1".',errUploadNoFiles:"No files found for upload.",errUploadTotalSize:"Data exceeds the maximum allowed size.",errUploadFileSize:"File exceeds maximum allowed size.",errUploadMime:"File type not allowed.",errUploadTransfer:'"$1" transfer error.',
errNotReplace:'Object "$1" already exists at this location and can not be replaced by object with another type.',errReplace:'Unable to replace "$1".',errSave:'Unable to save "$1".',errCopy:'Unable to copy "$1".',errMove:'Unable to move "$1".',errCopyInItself:'Unable to copy "$1" into itself.',errRm:'Unable to remove "$1".',errRmSrc:"Unable remove source file(s).",errExtract:'Unable to extract files from "$1".',errArchive:"Unable to create archive.",errArcType:"Unsupported archive type.",errNoArchive:"File is not archive or has unsupported archive type.",
errCmdNoSupport:"Backend does not support this command.",errReplByChild:"The folder \u201c$1\u201d can\u2019t be replaced by an item it contains.",errArcSymlinks:"For security reason denied to unpack archives contains symlinks or files with not allowed names.",errArcMaxSize:"Archive files exceeds maximum allowed size.",errResize:'Unable to resize "$1".',errUsupportType:"Unsupported file type.",errNotUTF8Content:'File "$1" is not in UTF-8 and cannot be edited.',errNetMount:'Unable to mount "$1".',
errNetMountNoDriver:"Unsupported protocol.",errNetMountFailed:"Mount failed.",errNetMountHostReq:"Host required.",cmdarchive:"Create archive",cmdback:"Back",cmdcopy:"Copy",cmdcut:"Cut",cmddownload:"Download",cmdduplicate:"Duplicate",cmdedit:"Edit file",cmdextract:"Extract files from archive",cmdforward:"Forward",cmdgetfile:"Select files",cmdhelp:"About this software",cmdhome:"Home",cmdinfo:"Get info",cmdmkdir:"New folder",cmdmkfile:"New text file",cmdopen:"Open",cmdpaste:"Paste",cmdquicklook:"Preview",
cmdreload:"Reload",cmdrename:"Rename",cmdrm:"Delete",cmdsearch:"Find files",cmdup:"Go to parent directory",cmdupload:"Upload files",cmdview:"View",cmdresize:"Resize & Rotate",cmdsort:"Sort",cmdnetmount:"Mount network volume",btnClose:"Close",btnSave:"Save",btnRm:"Remove",btnApply:"Apply",btnCancel:"Cancel",btnNo:"No",btnYes:"Yes",btnMount:"Mount",ntfopen:"Open folder",ntffile:"Open file",ntfreload:"Reload folder content",ntfmkdir:"Creating directory",ntfmkfile:"Creating files",ntfrm:"Delete files",
ntfcopy:"Copy files",ntfmove:"Move files",ntfprepare:"Prepare to copy files",ntfrename:"Rename files",ntfupload:"Uploading files",ntfdownload:"Downloading files",ntfsave:"Save files",ntfarchive:"Creating archive",ntfextract:"Extracting files from archive",ntfsearch:"Searching files",ntfresize:"Resizing images",ntfsmth:"Loading",ntfloadimg:"Loading image",ntfnetmount:"Mounting network volume",dateUnknown:"unknown",Today:"Today",Yesterday:"Yesterday",Jan:"Jan",Feb:"Feb",Mar:"Mar",Apr:"Apr",May:"May",
Jun:"Jun",Jul:"Jul",Aug:"Aug",Sep:"Sep",Oct:"Oct",Nov:"Nov",Dec:"Dec",sortname:"by name",sortkind:"by kind",sortsize:"by size",sortdate:"by date",sortFoldersFirst:"Folders first",confirmReq:"Confirmation required",confirmRm:"Are you sure you want to remove files?<br/>This cannot be undone!",confirmRepl:"Replace old file with new one?",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",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 to upload",moveFiles:"Move files",copyFiles:"Copy files",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:"\u00b0",netMountDialogTitle:"Mount network volume",protocol:"Protocol",host:"Host",port:"Port",user:"User",pass:"Password",kindUnknown:"Unknown",kindFolder:"Folder",kindAlias:"Alias",kindAliasBroken:"Broken alias",kindApp:"Application",kindPostscript:"Postscript document",kindMsOffice:"Microsoft Office document",kindMsWord:"Microsoft Word document",
kindMsExcel:"Microsoft Excel document",kindMsPP:"Microsoft Powerpoint presentation",kindOO:"Open Office document",kindAppFlash:"Flash application",kindPDF:"Portable Document Format (PDF)",kindTorrent:"Bittorrent file",kind7z:"7z archive",kindTAR:"TAR archive",kindGZIP:"GZIP archive",kindBZIP:"BZIP archive",kindZIP:"ZIP archive",kindRAR:"RAR archive",kindJAR:"Java JAR file",kindTTF:"True Type font",kindOTF:"Open Type font",kindRPM:"RPM package",kindText:"Text document",kindTextPlain:"Plain text",kindPHP:"PHP source",
kindCSS:"Cascading style sheet",kindHTML:"HTML document",kindJS:"Javascript source",kindRTF:"Rich Text Format",kindC:"C source",kindCHeader:"C header source",kindCPP:"C++ source",kindCPPHeader:"C++ header source",kindShell:"Unix shell script",kindPython:"Python source",kindJava:"Java source",kindRuby:"Ruby source",kindPerl:"Perl script",kindSQL:"SQL source",kindXML:"XML document",kindAWK:"AWK source",kindCSV:"Comma separated values",kindDOCBOOK:"Docbook XML document",kindImage:"Image",kindBMP:"BMP image",
kindJPEG:"JPEG image",kindGIF:"GIF Image",kindPNG:"PNG Image",kindTIFF:"TIFF image",kindTGA:"TGA image",kindPSD:"Adobe Photoshop image",kindXBITMAP:"X bitmap image",kindPXM:"Pixelmator image",kindAudio:"Audio media",kindAudioMPEG:"MPEG audio",kindAudioMPEG4:"MPEG-4 audio",kindAudioMIDI:"MIDI audio",kindAudioOGG:"Ogg Vorbis audio",kindAudioWAV:"WAV audio",AudioPlaylist:"MP3 playlist",kindVideo:"Video media",kindVideoDV:"DV movie",kindVideoMPEG:"MPEG movie",kindVideoMPEG4:"MPEG-4 movie",kindVideoAVI:"AVI movie",
kindVideoMOV:"Quick Time movie",kindVideoWM:"Windows Media movie",kindVideoFlash:"Flash movie",kindVideoMKV:"Matroska movie",kindVideoOGG:"Ogg movie"}});"use strict";
$.fn.finderbutton=function(a){return this.each(function(){var b=a.fm,c=b.res("class","disabled"),d=b.res("class","active"),e=b.res("class","hover"),f,g=$(this).addClass("ui-state-default finder-button").attr("title",a.title).append('<span class="finder-button-icon finder-button-icon-'+a.name+'"/>').hover(function(a){!g.is("."+c)&&g["mouseleave"==a.type?"removeClass":"addClass"](e)}).click(function(b){g.is("."+c)||(f&&1<a.variants.length?(f.is(":hidden")&&a.fm.getUI().click(),b.stopPropagation(),f.slideToggle(100)):
a.exec())}),b=function(){f.hide()};$.isArray(a.variants)&&(g.addClass("finder-menubutton"),f=$('<div class="ui-widget ui-widget-content finder-button-menu ui-corner-all"/>').hide().appendTo(g).zIndex(12+g.zIndex()).delegate(".finder-button-menu-item",{"mouseenter mouseleave":function(){$(this).toggleClass(e)},click:function(b){b.preventDefault();b.stopPropagation();g.removeClass(e);a.exec(a.fm.selected(),$(this).data("value"))}}),a.fm.bind("disable select",b).getUI().click(b),a.change(function(){f.html("");
$.each(a.variants,function(b,c){$('<div class="finder-button-menu-item">'+c[1]+"</div>").data("value",c[0]).addClass(c[0]==a.value?"finder-button-menu-item-selected":"").appendTo(f)})}));a.change(function(){a.disabled()?g.removeClass(d+" "+e).addClass(c):(g.removeClass(c),g[a.active()?"addClass":"removeClass"](d))}).change()})};"use strict";
$.fn.findercontextmenu=function(a){return this.each(function(){var b=$(this).addClass("ui-helper-reset ui-widget ui-state-default ui-corner-all finder-contextmenu finder-contextmenu-"+a.direction).hide().appendTo("body").delegate(".finder-contextmenu-item","mouseenter mouseleave",function(){$(this).toggleClass("ui-state-hover")}),c="ltr"==a.direction?"left":"right",d=$.extend({},a.options.contextmenu),e=function(a,b,c){return $('<div class="finder-contextmenu-item"><span class="finder-button-icon {icon} finder-contextmenu-icon"/><span>{label}</span></div>'.replace("{icon}",
b?"finder-button-icon-"+b:"").replace("{label}",a)).click(function(a){a.stopPropagation();a.stopPropagation();c()})},f=function(){b.hide().empty()},g=function(c,g){var k=!1;$.each(d[c]||[],function(c,d){var h,n,u;if("|"==d&&k)b.append('<div class="finder-contextmenu-separator"/>'),k=!1;else if((h=a.command(d))&&-1!=h.getstate(g)){if(h.variants){if(!h.variants.length)return;n=e(h.title,h.name,function(){});u=$('<div class="ui-corner-all finder-contextmenu-sub"/>').appendTo(n.append('<span class="finder-contextmenu-arrow"/>'));
n.addClass("finder-contextmenu-group").hover(function(){u.toggle()});$.each(h.variants,function(a,b){u.append($('<div class="finder-contextmenu-item"><span>'+b[1]+"</span></div>").click(function(a){a.stopPropagation();f();h.exec(g,b[0])}))})}else n=e(h.title,h.name,function(){f();h.exec(g)});b.append(n);k=!0}})},k=function(a){$.each(a,function(a,c){var d;c.label&&"function"==typeof c.callback&&(d=e(c.label,c.icon,function(){f();c.callback()}),b.append(d))})};a.one("load",function(){a.bind("contextmenu",
function(d){var e=d.data;f();e.type&&e.targets?g(e.type,e.targets):e.raw&&k(e.raw);if(b.children().length){d=e.x;var e=e.y,l=$(window),q=b.outerWidth(),p=b.outerHeight(),t=l.width(),n=l.height(),u=l.scrollTop(),l=l.scrollLeft();d={top:(e+p<n?e:0<e-p?e-p:e)+u,left:(d+q<t?d:d-q)+l,"z-index":100+a.getUI("workzone").zIndex()};b.css(d).show();d={"z-index":d["z-index"]+10};d[c]=parseInt(b.width());b.find(".finder-contextmenu-sub").css(d)}}).one("destroy",function(){b.remove()}).bind("disable select",f).getUI().click(f)})})};
"use strict";
$.fn.findercwd=function(a,b){this.not(".finder-cwd").each(function(){var c="list"==a.viewType,d="select."+a.namespace,e="unselect."+a.namespace,f="disable."+a.namespace,g="enable."+a.namespace,k=a.res("class","cwdfile"),h="."+k,m=a.res("class","disabled"),l=a.res("class","draggable"),q=a.res("class","droppable"),p=a.res("class","hover"),t=a.res("class","adroppable"),n=k+"-tmp",u=0<a.options.loadTmbs?a.options.loadTmbs:5,w="",y=[],E={icon:'<div id="{hash}" class="'+k+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="finder-cwd-file-wrapper ui-corner-all"><div class="finder-cwd-icon {mime} ui-corner-all" unselectable="on" {style}/>{marker}</div><div class="finder-cwd-filename" title="{name}">{name}</div></div>',row:'<tr id="{hash}" class="'+
k+' {permsclass} {dirclass}" title="{tooltip}"><td><div class="finder-cwd-file-wrapper"><span class="finder-cwd-icon {mime}"/>{marker}<span class="finder-cwd-filename">{name}</span></div></td><td>{perms}</td><td>{date}</td><td>{size}</td><td>{kind}</td></tr>'},O=a.res("tpl","perms"),N=a.res("tpl","symlink"),T={permsclass:function(b){return a.perms2class(b)},perms:function(b){return a.formatPermissions(b)},dirclass:function(a){return"directory"==a.mime?"directory":""},mime:function(b){return a.mime2class(b.mime)},
size:function(b){return a.formatSize(b.size)},date:function(b){return a.formatDate(b)},kind:function(b){return a.mime2kind(b)},marker:function(a){return(a.alias||"symlink-broken"==a.mime?N:"")+(a.read&&a.write?"":O)},tooltip:function(b){var c=a.formatDate(b)+(0<b.size?" ("+a.formatSize(b.size)+")":"");return b.tooltip?a.escape(b.tooltip).replace(/"/g,"&quot;").replace(/\r/g,"&#13;")+"&#13;"+c:c}},B=function(b){b.name=a.escape(b.name);return E[c?"row":"icon"].replace(/\{([a-z]+)\}/g,function(a,c){return T[c]?
T[c](b):b[c]?b[c]:""})},D=!1,P=function(a,b){function f(a,b){return a[b+"All"]("[id]:not(."+m+"):not(.finder-cwd-parent):first")}var g=$.ui.keyCode,h=a==g.LEFT||a==g.UP,k=r.find("[id].ui-selected"),l,n,p;if(k.length)if(l=k.filter(h?":first":":last"),n=f(l,h?"prev":"next"),n.length)if(c||a==g.LEFT||a==g.RIGHT)g=n;else if(p=l.position().top,n=l.position().left,g=l,h){do g=g.prev("[id]");while(g.length&&!(g.position().top<p&&g.position().left<=n));g.is("."+m)&&(g=f(g,"next"))}else{do g=g.next("[id]");
while(g.length&&!(g.position().top>p&&g.position().left>=n));g.is("."+m)&&(g=f(g,"prev"));g.length||(n=r.find("[id]:not(."+m+"):last"),n.position().top>p&&(g=n))}else g=l.siblings("[id]:not(."+m+"):not(.finder-cwd-parent):"+(h?"last":"first"));else g=r.find("[id]:not(."+m+"):not(.finder-cwd-parent):"+(h?"last":"first"));g&&g.length&&!g.is(".finder-cwd-parent")&&(b?g=l.add(l[h?"prevUntil":"nextUntil"]("#"+g.attr("id"))).add(g):k.trigger(e),g.trigger(d),L(g.filter(h?":first":":last")),v())},J=function(a){r.find("#"+
a).trigger(d)},F=function(){r.find("[id].ui-selected").trigger(e);v()},H=function(){return $.map(r.find("[id].ui-selected"),function(a){a=$(a);return a.is("."+m)?null:$(a).attr("id")})},v=function(){a.trigger("select",{selected:H()})},L=function(a){var b=a.position().top;a=a.outerHeight(!0);var c=A.scrollTop(),d=A.innerHeight();b+a>c+d?A.scrollTop(parseInt(b+a-d)):b<c&&A.scrollTop(b)},C=[],K=function(a){for(var b=C.length;b--;)if(C[b].hash==a)return b;return-1},x="scroll."+a.namespace,M=function(){var b=
[],d=!1,e=[],f={},b=r.find("[id]:last"),g=!b.length,h=c?r.children("table").children("tbody"):r,k;if(!C.length)return A.unbind(x);for(;(!b.length||b.position().top<=A.height()+A.scrollTop()+a.options.showThreshold)&&(k=C.splice(0,a.options.showFiles)).length;)b=$.map(k,function(a){return a.hash&&a.name?("directory"==a.mime&&(d=!0),a.tmb&&(1===a.tmb?e.push(a.hash):f[a.hash]=a.tmb),B(a)):null}),h.append(b.join("")),b=r.find("[id]:last"),g&&r.scrollTop(0);S(f);e.length&&X(e);d&&U()},V=$.extend({},a.droppable,
{over:function(b,c){var d=a.cwd().hash;$.each(c.helper.data("files"),function(b,c){if(a.file(c).phash==d)return r.removeClass(t),!1})}}),U=function(){setTimeout(function(){r.find(".directory:not(."+q+",.finder-na,.finder-ro)").droppable(a.droppable)},20)},S=function(b){var c=a.option("tmbUrl"),d=!0,e;$.each(b,function(a,b){var f=r.find("#"+a);f.length?function(a,b){$("<img/>").load(function(){a.find(".finder-cwd-icon").css("background","url('"+b+"') center center no-repeat")}).attr("src",b)}(f,c+
b):(d=!1,-1!=(e=K(a))&&(C[e].tmb=b))});return d},X=function(b){var c=[],c=c=b.splice(0,u);c.length&&a.request({data:{cmd:"tmb",targets:c},preventFail:!0}).done(function(a){S(a.images||[])&&X(b)})},Y=function(b){for(var d=c?r.find("tbody"):r,e=b.length,f=[],g={},h=!1,k=function(b){for(var c=r.find("[id]:first"),d;c.length;){d=a.file(c.attr("id"));if(!c.is(".finder-cwd-parent")&&d&&0>a.compare(b,d))return c;c=c.next("[id]")}},l=function(b){var c=C.length,d;for(d=0;d<c;d++)if(0>a.compare(b,C[d]))return d;
return c||-1},m,n,p,q;e--;)m=b[e],n=m.hash,r.find("#"+n).length||((p=k(m))&&p.length?p.before(B(m)):0<=(q=l(m))?C.splice(q,0,m):d.append(B(m)),r.find("#"+n).length&&("directory"==m.mime?h=!0:m.tmb&&(1===m.tmb?f.push(n):g[n]=m.tmb)));S(g);f.length&&X(f);h&&U()},Q=function(b){for(var c=b.length,d,e,f;c--;)if(d=b[c],(e=r.find("#"+d)).length)try{e.detach()}catch(g){a.debug("error",g)}else-1!=(f=K(d))&&C.splice(f,1)},z=a.i18n("name"),ba=a.i18n("perms"),R=a.i18n("modify"),Z=a.i18n("size"),I=a.i18n("kind"),
W=function(d,e){var f=a.cwd().hash;F();try{r.children("table,"+h).remove()}catch(g){r.html("")}r.removeClass("finder-cwd-view-icons finder-cwd-view-list").addClass("finder-cwd-view-"+(c?"list":"icons"));A[c?"addClass":"removeClass"]("finder-cwd-wrapper-list");c&&r.html('<table><thead><tr class="ui-state-default"><td >'+z+"</td><td>"+ba+"</td><td>"+R+"</td><td>"+Z+"</td><td>"+I+"</td></tr></thead><tbody/></table>");C=$.map(d,function(a){return e||a.phash==f?a:null});C=a.sortFiles(C);A.bind(x,M).trigger(x);
f=a.cwd().phash;if(b.oldSchool&&f&&!w){var k=$.extend(!0,{},a.file(f),{name:"..",mime:"directory"}),k=$(B(k)).addClass("finder-cwd-parent").bind("mousedown click mouseup dblclick mouseenter",function(a){a.preventDefault();a.stopPropagation()}).dblclick(function(){a.exec("open",this.id)});(c?r.find("tbody"):r).prepend(k)}},r=$(this).addClass("ui-helper-clearfix finder-cwd").attr("unselectable","on").delegate(h,"click."+a.namespace,function(a){var b=this.id?$(this):$(this).parents("[id]:first"),c=b.prevAll(".ui-selected:first"),
f=b.nextAll(".ui-selected:first"),g=c.length,h=f.length;a.stopImmediatePropagation();a.shiftKey&&(g||h)?(a=g?b.prevUntil("#"+c.attr("id")):b.nextUntil("#"+f.attr("id")),a.add(b).trigger(d)):a.ctrlKey||a.metaKey?b.trigger(b.is(".ui-selected")?e:d):(F(),b.trigger(d));v()}).delegate(h,"dblclick."+a.namespace,function(b){a.dblclick({file:this.id})}).delegate(h,"mouseenter."+a.namespace,function(b){b=$(this);var d=c?b:b.children();b.is("."+n)||d.is("."+l+",."+m)||d.draggable(a.draggable)}).delegate(h,
d,function(a){a=$(this);D||a.is("."+m)||a.addClass("ui-selected").children().addClass(p)}).delegate(h,e,function(a){D||$(this).removeClass("ui-selected").children().removeClass(p)}).delegate(h,f,function(){var a=$(this).removeClass("ui-selected").addClass(m),b=(c?a:a.children()).removeClass(p);a.is("."+q)&&a.droppable("disable");b.is("."+l)&&b.draggable("disable");!c&&b.removeClass(m)}).delegate(h,g,function(){var a=$(this).removeClass(m),b=c?a:a.children();a.is("."+q)&&a.droppable("enable");b.is("."+
l)&&b.draggable("enable")}).delegate(h,"scrolltoview",function(){L($(this))}).delegate(h,"mouseenter mouseleave",function(b){a.trigger("hover",{hash:$(this).attr("id"),type:b.type})}).bind("contextmenu."+a.namespace,function(b){var c=$(b.target).closest("."+k);c.length&&(b.stopPropagation(),b.preventDefault(),c.is("."+m)||(c.is(".ui-selected")||(F(),c.trigger(d),v()),a.trigger("contextmenu",{type:"files",targets:a.selected(),x:b.clientX,y:b.clientY})))}).selectable({filter:h,stop:v,selected:function(a,
b){$(b.selected).trigger(d)},unselected:function(a,b){$(b.unselected).trigger(e)}}).droppable(V).bind("create."+a.namespace,function(a,b){var d=c?r.find("tbody"):r,e=d.find(".finder-cwd-parent");b=$(B(b)).addClass(n);F();e.length?e.after(b):d.prepend(b);r.scrollTop(0)}).bind("unselectall",F).bind("selectfile",function(a,b){r.find("#"+b).trigger(d);v()}),A=$('<div class="finder-cwd-wrapper"/>').bind("contextmenu",function(b){b.preventDefault();a.trigger("contextmenu",{type:"cwd",targets:[a.cwd().hash],
x:b.clientX,y:b.clientY})}),G=function(){var a=0;A.siblings(".finder-panel:visible").each(function(){a+=$(this).outerHeight(!0)});A.height(aa.height()-a)},aa=$(this).parent().resize(G).children(".finder-workzone").append(A.append(this));a.dragUpload&&(A[0].addEventListener("dragenter",function(a){a.preventDefault();a.stopPropagation();A.addClass(t)},!1),A[0].addEventListener("dragleave",function(a){a.preventDefault();a.stopPropagation();a.target==r[0]&&A.removeClass(t)},!1),A[0].addEventListener("dragover",
function(a){a.preventDefault();a.stopPropagation()},!1),A[0].addEventListener("drop",function(b){b.preventDefault();A.removeClass(t);var c=!1,d="";b.dataTransfer&&b.dataTransfer.files&&b.dataTransfer.files.length?(c=b.dataTransfer.files,d="files"):b.dataTransfer.getData("text/html")?(c=[b.dataTransfer.getData("text/html")],d="html"):b.dataTransfer.getData("text")&&(c=[b.dataTransfer.getData("text")],d="text");c&&a.exec("upload",{files:c,type:d})},!1));a.bind("open",function(a){W(a.data.files)}).bind("search",
function(a){y=a.data.files;W(y,!0)}).bind("searchend",function(){y=[];w&&(w="",W(a.files()))}).bind("searchstart",function(a){w=a.data.query}).bind("sortchange",function(){W(w?y:a.files(),!!w)}).bind("viewchange",function(){var b=a.selected(),d="list"==a.storage("view");d!=c&&(c=d,W(a.files()),$.each(b,function(a,b){J(b)}),v());G()}).add(function(b){var c=a.cwd().hash;b=w?$.map(b.data.added||[],function(a){return-1===a.name.indexOf(w)?null:a}):$.map(b.data.added||[],function(a){return a.phash==c?
a:null});Y(b)}).change(function(b){var c=a.cwd().hash,d=a.selected();w?$.each(b.data.changed||[],function(a,b){Q([b.hash]);-1!==b.name.indexOf(w)&&(Y([b]),-1!==$.inArray(b.hash,d)&&J(b.hash))}):$.each($.map(b.data.changed||[],function(a){return a.phash==c?a:null}),function(a,b){Q([b.hash]);Y([b]);-1!==$.inArray(b.hash,d)&&J(b.hash)});v()}).remove(function(a){Q(a.data.removed||[]);v()}).bind("open add search searchend",function(){r.css("height","auto");r.outerHeight(!0)<A.height()&&r.height(A.height()-
(r.outerHeight(!0)-r.height())-2)}).dragstart(function(a){var b=$(a.data.target);a=a.data.originalEvent;b.is(h)&&(b.is(".ui-selected")||(a.ctrlKey||a.metaKey||a.shiftKey||F(),b.trigger(d),v()),r.droppable("disable"));r.selectable("disable").removeClass(m);D=!0}).dragstop(function(){r.selectable("enable").droppable("enable");D=!1}).bind("lockfiles unlockfiles",function(a){var b="lockfiles"==a.type?f:g;a=a.data.files||[];for(var c=a.length;c--;)r.find("#"+a[c]).trigger(b);v()}).bind("mkdir mkfile duplicate upload rename archive extract",
function(b){var c=a.cwd().hash;F();$.each(b.data.added||[],function(a,b){b&&b.phash==c&&J(b.hash)});v()}).shortcut({pattern:"ctrl+a",description:"selectall",callback:function(){var b;r.find("[id]:not(.ui-selected):not(.finder-cwd-parent)").trigger(d);C.length?(b=a.cwd().hash,a.select({selected:$.map(a.files(),function(a){return a.phash==b?a.hash:null})})):v()}}).shortcut({pattern:"left right up down shift+left shift+right shift+up shift+down",description:"selectfiles",type:"keydown",callback:function(a){P(a.keyCode,
a.shiftKey)}}).shortcut({pattern:"home",description:"selectffile",callback:function(a){F();L(r.find("[id]:first").trigger(d));v()}}).shortcut({pattern:"end",description:"selectlfile",callback:function(a){F();L(r.find("[id]:last").trigger(d));v()}})});return this};"use strict";
$.fn.finderdialog=function(a){var b;"string"==typeof a&&(b=this.closest(".ui-dialog")).length&&("open"==a?"none"==b.css("display")&&b.fadeIn(120,function(){b.trigger("open")}):"close"==a?"none"!=b.css("display")&&b.hide().trigger("close"):"destroy"==a?b.hide().remove():"toTop"==a&&b.trigger("totop"));a=$.extend({},$.fn.finderdialog.defaults,a);this.filter(":not(.ui-dialog-content)").each(function(){var b=$(this).addClass("ui-dialog-content ui-widget-content"),d=b.parent(),e=parseInt(1E6*Math.random()),
f=d.children(".finder-overlay"),g=$('<div class="ui-dialog-buttonset"/>'),k=$('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>').append(g),h=$('<div class="test ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog  finder-dialog '+a.cssClass+'"/>').hide().append(b).appendTo(d).draggable({handle:".ui-dialog-titlebar"}).css({width:a.width,height:a.height,position:"absolute"}).mousedown(function(a){a.stopPropagation();$(document).mousedown();h.is(".finder-dialog-active")||
(d.find(".finder-dialog:visible").removeClass("finder-dialog-active"),h.addClass("finder-dialog-active").zIndex(m()+1))}).bind("open",function(){a.modal&&f.finderoverlay("show");h.trigger("totop");"function"==typeof a.open&&$.proxy(a.open,b[0])();h.is(".finder-dialog-notify")||d.find(".finder-dialog:visible").not(".finder-dialog-notify").each(function(){var a=$(this),b=parseInt(a.css("top")),c=parseInt(a.css("left")),d=parseInt(h.css("top")),e=parseInt(h.css("left"));a[0]==h[0]||b!=d&&c!=e||h.css({top:b+
10,left:c+10})})}).bind("close",function(){var e=d.find(".finder-dialog:visible"),g=m();a.modal&&f.finderoverlay("hide");e.length?e.each(function(){var a=$(this);if(a.zIndex()>=g)return a.trigger("totop"),!1}):setTimeout(function(){d.mousedown().click()},10);"function"==typeof a.close?$.proxy(a.close,b[0])():a.destroyOnClose&&h.hide().remove()}).bind("totop",function(){$(this).mousedown().find(".ui-button:first").focus().end().find(":text:first").focus()}),m=function(){var a=d.zIndex()+10;d.find(".finder-dialog:visible").each(function(){var b;
this!=h[0]&&(b=$(this).zIndex(),b>a&&(a=b))});return a},l;a.position||(l=parseInt((d.height()-h.outerHeight())/2-42),a.position={top:0<l?l:0,left:parseInt((d.width()-h.outerWidth())/2)});h.css(a.position);a.closeOnEscape&&$(document).bind("keyup."+e,function(a){a.keyCode==$.ui.keyCode.ESCAPE&&h.is(".finder-dialog-active")&&(b.finderdialog("close"),$(document).unbind("keyup."+e))});h.prepend($('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+a.title+"</div>").prepend($('<a href="#" class="ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').mousedown(function(a){a.preventDefault();
b.finderdialog("close")})));$.each(a.buttons,function(a,d){var e=$('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+a+"</span></button>").click($.proxy(d,b[0])).hover(function(a){$(this)["mouseenter"==a.type?"focus":"blur"]()}).focus(function(){$(this).addClass("ui-state-hover")}).blur(function(){$(this).removeClass("ui-state-hover")}).keydown(function(a){a.keyCode==$.ui.keyCode.ENTER?$(this).click():a.keyCode==$.ui.keyCode.TAB&&
(a=$(this).next(".ui-button"),a.length?a.focus():$(this).siblings(".ui-button:first").focus())});g.append(e)});g.children().length&&h.append(k);a.resizable&&$.fn.resizable&&h.resizable({minWidth:a.minWidth,minHeight:a.minHeight,alsoResize:this});"function"==typeof a.create&&$.proxy(a.create,this)();a.autoOpen&&b.finderdialog("open")});return this};
$.fn.finderdialog.defaults={cssClass:"",title:"",modal:!1,resizable:!0,autoOpen:!0,closeOnEscape:!0,destroyOnClose:!1,buttons:{},position:null,width:320,height:"auto",minWidth:200,minHeight:110};
$.fn.findernavbar=function(a,b){this.not(".finder-navbar").each(function(){var c=$(this).addClass("ui-state-default finder-navbar"),d;c.siblings(".finder-workzone").append(c);$.fn.resizable&&(d=c.resizable({handles:"ltr"==a.direction?"e":"w",minWidth:b.minWidth||150,maxWidth:b.maxWidth||500}).bind("resize scroll",function(){d.css({top:parseInt(c.scrollTop())})}).find(".ui-resizable-handle").zIndex(c.zIndex()+10),a.one("open",function(){setTimeout(function(){c.trigger("resize")},150)}))});return this};
$.fn.finderoverlay=function(a){this.filter(":not(.finder-overlay)").each(function(){a=$.extend({},a);$(this).addClass("ui-widget-overlay finder-overlay").hide().mousedown(function(a){a.preventDefault();a.stopPropagation()}).data({cnt:0,show:"function"==typeof a.show?a.show:function(){},hide:"function"==typeof a.hide?a.hide:function(){}})});if("show"==a){var b=this.eq(0),c=b.data("cnt")+1,d=b.data("show");b.data("cnt",c);b.is(":hidden")&&(b.zIndex(b.parent().zIndex()+1),b.show(),d())}"hide"==a&&(b=
this.eq(0),c=b.data("cnt")-1,d=b.data("hide"),b.data("cnt",c),0==c&&b.is(":visible")&&(b.hide(),d()));return this};$.fn.finderpanel=function(a){return this.each(function(){var b=$(this).addClass("finder-panel ui-state-default ui-corner-all"),c="margin-"+("ltr"==a.direction?"left":"right");a.one("load",function(d){var e=a.getUI("navbar");b.css(c,parseInt(e.outerWidth(!0)));e.bind("resize",function(){b.is(":visible")&&b.css(c,parseInt(e.outerWidth(!0)))})})})};"use strict";
$.fn.finderpath=function(a){return this.each(function(){var b=$(this).addClass("finder-path").html("&nbsp;").delegate("a","click",function(b){var d=$(this).attr("href").substr(1);b.preventDefault();d!=a.cwd().hash&&a.exec("open",d)}).prependTo(a.getUI("statusbar").show());a.bind("open searchend",function(){var c=[];$.each(a.parents(a.cwd().hash),function(b,e){c.push('<a href="#'+e+'">'+a.escape(a.file(e).name)+"</a>")});b.html(c.join(a.option("separator")))}).bind("search",function(){b.html(a.i18n("searcresult"))})})};
"use strict";
$.fn.finderplaces=function(a,b){return this.each(function(){var c=[],d=a.res("class","navdir"),e=a.res("class","navcollapse"),f=a.res("class","navexpand");a.res("class","hover");var g=a.res("class","treeroot"),k=a.res("tpl","navdir"),h=a.res("tpl","perms"),m=$(a.res("tpl","navspinner")),l=function(a){return a.substr(6)},q=function(){a.storage("places",c.join(","))},p=function(b){return $(k.replace(/\{id\}/,"place-"+b.hash).replace(/\{name\}/,a.escape(b.name)).replace(/\{cssclass\}/,a.perms2class(b)).replace(/\{permissions\}/,b.read&&
b.write?"":h).replace(/\{symlink\}/,""))},t=function(b){var f=p(b);y.children().length&&$.each(y.children(),function(){var a=$(this);if(0>b.name.localeCompare(a.children("."+d).text()))return!f.insertBefore(a)});c.push(b.hash);!f.parent().length&&y.append(f);w.addClass(e);f.draggable({appendTo:"body",revert:!1,helper:function(){var b=$(this);b.children().removeClass("ui-state-hover");return $('<div class="finder-place-drag finder-'+a.direction+'"/>').append(b.clone()).data("hash",l(b.children(":first").attr("id")))},
start:function(){$(this).hide()},stop:function(a,b){var c=E.offset().top,d=E.offset().left,e=E.width(),f=E.height(),g=a.clientX,h=a.clientY;g>d&&g<d+e&&h>c&&h<h+f?$(this).show():(n(b.helper.data("hash")),q())}})},n=function(a){var b=$.inArray(a,c);-1!==b&&(c.splice(b,1),y.find("#place-"+a).parent().remove(),!y.children().length&&w.removeClass(e+" "+f))},u=p({hash:"root-"+a.namespace,name:a.i18n(b.name,"places"),read:!0,write:!0}),w=u.children("."+d).addClass(g).click(function(){w.is("."+e)&&(E.toggleClass(f),
y.slideToggle(),a.storage("placesState",E.is("."+f)?1:0))}),y=u.children("."+a.res("class","navsubtree")),E=$(this).addClass(a.res("class","tree")+" finder-places ui-corner-all").hide().append(u).appendTo(a.getUI("navbar")).delegate("."+d,{click:function(){a.exec("open",$(this).attr("id").substr(6))},mouseenter:function(){$(this).addClass("ui-state-hover")},mouseleave:function(){$(this).removeClass("ui-state-hover")}}).delegate("."+d+":not(."+g+")","contextmenu",function(b){var c=$(this).attr("id").substr(6);
b.preventDefault();a.trigger("contextmenu",{raw:[{label:a.i18n("rmFromPlaces"),icon:"rm",callback:function(){n(c);q()}}],x:b.clientX,y:b.clientY})}).droppable({tolerance:"pointer",accept:".finder-cwd-file-wrapper,.finder-tree-dir,.finder-cwd-file",hoverClass:a.res("class","adroppable"),drop:function(b,d){var e=!0;$.each(d.helper.data("files"),function(b,d){var f=a.file(d);f&&"directory"==f.mime&&-1===$.inArray(f.hash,c)?t(f):e=!1});q();e&&d.helper.hide()}});a.one("load",function(){E.show().parent().show();
c=$.map(a.storage("places").split(","),function(a){return a||null});c.length&&(w.prepend(m),a.request({data:{cmd:"info",targets:c},preventDefault:!0}).done(function(b){c=[];$.each(b.files,function(a,b){"directory"==b.mime&&t(b)});q();0<a.storage("placesState")&&w.click()}).always(function(){m.remove()}));a.remove(function(a){$.each(a.data.removed,function(a,b){n(b)});q()}).change(function(a){$.each(a.data.changed,function(a,b){-1!==$.inArray(b.hash,c)&&(n(b.hash),"directory"==b.mime&&t(b))});q()}).bind("sync",
function(){c.length&&(w.prepend(m),a.request({data:{cmd:"info",targets:c},preventDefault:!0}).done(function(a){$.each(a.files||[],function(a,b){-1===$.inArray(b.hash,c)&&n(b.hash)});q()}).always(function(){m.remove()}))})})})};"use strict";
$.fn.findersearchbutton=function(a){return this.each(function(){var b=!1,c=$(this).hide().addClass("ui-widget-content finder-button "+a.fm.res("class","searchbtn")+""),d=function(){var c=$.trim(f.val());c?a.exec(c).done(function(){b=!0;f.focus()}):a.fm.trigger("searchend")},e=function(){f.val("");b&&(b=!1,a.fm.trigger("searchend"))},f=$('<input type="text" size="42"/>').appendTo(c).keypress(function(a){a.stopPropagation()}).keydown(function(a){a.stopPropagation();13==a.keyCode&&d();27==a.keyCode&&
(a.preventDefault(),e())});$('<span class="ui-icon ui-icon-search" title="'+a.title+'"/>').appendTo(c).click(d);$('<span class="ui-icon ui-icon-close"/>').appendTo(c).click(e);setTimeout(function(){c.parent().detach();a.fm.getUI("toolbar").prepend(c.show());if(a.fm.UA.ltIE7){var b=c.children("ltr"==a.fm.direction?".ui-icon-close":".ui-icon-search");b.css({right:"",left:parseInt(c.width())-b.outerWidth(!0)})}},200);a.fm.error(function(){f.unbind("keydown")}).select(function(){f.blur()}).bind("searchend",
function(){f.val("")}).viewchange(e).shortcut({pattern:"ctrl+f f3",description:a.title,callback:function(){f.select().focus()}})})};"use strict";
$.fn.findersortbutton=function(a){return this.each(function(){var b=a.fm,c=a.name,d=b.res("class","disabled"),e=b.res("class","hover"),f=$(this).addClass("ui-state-default finder-button finder-menubutton elfiner-button-"+c).attr("title",a.title).append('<span class="finder-button-icon finder-button-icon-'+c+'"/>').hover(function(){!f.is("."+d)&&f.toggleClass(e)}).click(function(b){f.is("."+d)||(b.stopPropagation(),g.is(":hidden")&&a.fm.getUI().click(),g.slideToggle(100))}),g=$('<div class="ui-widget ui-widget-content finder-button-menu ui-corner-all"/>').hide().appendTo(f).zIndex(12+
f.zIndex()).delegate(".finder-button-menu-item",{"mouseenter mouseleave":function(){$(this).toggleClass(e)},click:function(a){a.preventDefault();a.stopPropagation();h()}}),k=function(){g.children(":not(:last)").removeClass("finder-button-menu-item-selected finder-button-menu-item-selected-asc finder-button-menu-item-selected-desc").filter('[rel="'+b.sortType+'"]').addClass("finder-button-menu-item-selected "+("asc"==b.sortOrder?"finder-button-menu-item-selected-asc":"finder-button-menu-item-selected-desc"));
g.children(":last").toggleClass("finder-button-menu-item-selected",b.sortStickFolders)},h=function(){g.hide()};$.each(b.sortRules,function(a,c){g.append($('<div class="finder-button-menu-item" rel="'+a+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+b.i18n("sort"+a)+"</div>").data("type",a))});g.children().click(function(c){c=$(this).attr("rel");a.exec([],{type:c,order:c==b.sortType?"asc"==b.sortOrder?"desc":"asc":b.sortOrder,stick:b.sortStickFolders})});
$('<div class="finder-button-menu-item finder-button-menu-item-separated"><span class="ui-icon ui-icon-check"/>'+b.i18n("sortFoldersFirst")+"</div>").appendTo(g).click(function(){a.exec([],{type:b.sortType,order:b.sortOrder,stick:!b.sortStickFolders})});b.bind("disable select",h).getUI().click(h);b.bind("sortchange",k);1<g.children().length?a.change(function(){f.toggleClass(d,a.disabled());k()}).change():f.addClass(d)})};"use strict";
$.fn.finderstat=function(a){return this.each(function(){var b=$(this).addClass("finder-stat-size"),c=$('<div class="finder-stat-selected"/>'),d=a.i18n("size").toLowerCase(),e=a.i18n("items").toLowerCase(),f=a.i18n("selected"),g=function(c,f){var g=0,l=0;$.each(c,function(a,b){f&&b.phash!=f||(g++,l+=parseInt(b.size)||0)});b.html(e+": "+g+", "+d+": "+a.formatSize(l))};a.getUI("statusbar").prepend(b).append(c).show();a.bind("open reload add remove change searchend",function(){g(a.files(),a.cwd().hash)}).search(function(a){g(a.data.files)}).select(function(){var b=
0,e=0,g=a.selectedFiles();1==g.length?(b=g[0].size,c.html(a.escape(g[0].name)+(0<b?", "+a.formatSize(b):""))):($.each(g,function(a,c){e++;b+=parseInt(c.size)||0}),c.html(e?f+": "+e+", "+d+": "+a.formatSize(b):"&nbsp;"))})})};"use strict";
$.fn.findertoolbar=function(a,b){this.not(".finder-toolbar").each(function(){var c=a._commands,d=$(this).addClass("ui-helper-clearfix ui-widget-header ui-corner-top finder-toolbar"),e=b||[],f=e.length,g,k,h,m;for(d.prev().length&&d.parent().prepend(this);f--;)if(e[f]){h=$('<div class="ui-widget-content ui-corner-all finder-buttonset"/>');for(g=e[f].length;g--;)if(k=c[e[f][g]])m="finder"+k.options.ui,$.fn[m]&&h.prepend($("<div/>")[m](k));h.children().length&&d.prepend(h);h.children(":gt(0)").before('<span class="ui-widget-content finder-toolbar-button-separator"/>')}d.children().length&&
d.show()});return this};"use strict";
$.fn.findertree=function(a,b){var c=a.res("class","tree");this.not("."+c).each(function(){var d=a.res("class","treeroot"),e=b.openRootOnLoad,f=a.res("class","navsubtree"),g=a.res("class","treedir"),k=a.res("class","navcollapse"),h=a.res("class","navexpand"),m=a.res("class","navarrow"),l=a.res("class","active"),q=a.res("class","adroppable"),p=a.res("class","hover"),t=a.res("class","disabled"),n=a.res("class","draggable"),u=a.res("class","droppable"),w=function(a){var b=M.offset().left;return b<=a&&
a<=b+M.width()},y=a.droppable.drop,E=$.extend(!0,{},a.droppable,{over:function(a){var b=$(this),c=p+" "+q;w(a.clientX)?(b.addClass(c),b.is("."+k+":not(."+h+")")&&setTimeout(function(){b.is("."+q)&&b.children("."+m).click()},500)):b.removeClass(c)},out:function(){$(this).removeClass(p+" "+q)},drop:function(a,b){w(a.clientX)&&y.call(this,a,b)}}),O=$(a.res("tpl","navspinner")),N=a.res("tpl","navdir"),T=a.res("tpl","perms"),B=a.res("tpl","symlink"),D={id:function(b){return a.navHash2Id(b.hash)},cssclass:function(b){return(b.phash?
"":d)+" "+(b.net?"finder-navbar-net":"")+" "+g+" "+a.perms2class(b)+" "+(b.dirs&&!b.link?k:"")},permissions:function(a){return a.read&&a.write?"":T},symlink:function(a){return a.alias?B:""}},P=function(b){b.name=a.escape(b.name);return N.replace(/(?:\{([a-z]+)\})/ig,function(a,c){return b[c]||(D[c]?D[c](b):"")})},J=function(a){return $.map(a||[],function(a){return"directory"==a.mime?a:null})},F=function(b){return b?x.find("#"+a.navHash2Id(b)).next("."+f):x},H=function(b,c){for(var d=b.children(":first"),
e;d.length;){e=a.file(a.navId2Hash(d.children("[id]").attr("id")));if((e=a.file(a.navId2Hash(d.children("[id]").attr("id"))))&&0>c.name.toLowerCase().localeCompare(e.name.toLowerCase()))return d;d=d.next()}return $("")},v=function(b){for(var c=b.length,d=[],e=b.length,f,g,h,k;e--;)if(f=b[e],!x.find("#"+a.navHash2Id(f.hash)).length)if(h=F(f.phash),h.length)if(g=P(f),f.phash&&(k=H(h,f)).length)k.before(g);else h[f.phash?"append":"prepend"](g);else d.push(f);if(d.length&&d.length<c)return v(d);setTimeout(function(){C()},
10)},L=function(c){var k=a.cwd().hash,m=x.find("#"+a.navHash2Id(k)),n,p;e&&(n=x.find("#"+a.navHash2Id(a.root())),n.is(".finder-subtree-loaded")&&n.addClass(h).next("."+f).show(),e=!1);m.is("."+l)||(x.find("."+g+"."+l).removeClass(l),m.addClass(l));b.syncTree&&(m.length?m.parentsUntil("."+d).filter("."+f).show().prev("."+g).addClass(h):!c&&(p=a.file(k)).phash&&x.find("#"+a.navHash2Id(p.phash)).length&&(v([p]),a.request({data:{cmd:"parents",target:k},preventFail:!0}).done(function(b){b=J(b.tree);v(b);
K(b,"finder-subtree-loaded");k==a.cwd().hash&&L(!0)})))},C=function(){x.find("."+g+":not(."+u+",.finder-ro,.finder-na)").droppable(E)},K=function(b,c){var d="finder-subtree-loaded"==c?"."+k+":not(.finder-subtree-loaded)":":not(."+k+")";$.each(b,function(b,e){x.find("#"+a.navHash2Id(e.phash)+d).filter(function(){return 0<$(this).next("."+f).children().length}).addClass(c)})},x=$(this).addClass(c).delegate("."+g,{"mouseenter mouseleave":function(b){var c=$(this);b="mouseenter"==b.type;c.is("."+q+" ,."+
t)||(b&&!c.is("."+d+",."+n+",.finder-na,.finder-wo")&&c.draggable(a.draggable),c.toggleClass(p,b))},"dropover dropout drop":function(a){$(this)["dropover"==a.type?"addClass":"removeClass"](q+" "+p)},click:function(b){b=$(this);var c=a.navId2Hash(b.attr("id")),d=a.file(c);a.trigger("searchend");c==a.cwd().hash||b.is("."+t)?b.is("."+k)&&b.children("."+m).click():a.exec("open",d.thash||c)},contextmenu:function(b){b.preventDefault();a.trigger("contextmenu",{type:"navbar",targets:[a.navId2Hash($(this).attr("id"))],
x:b.clientX,y:b.clientY})}}).delegate("."+g+"."+k+" ."+m,"click",function(b){var c=$(this),d=c.parent("."+g),e=d.next("."+f);b.stopPropagation();d.is(".finder-subtree-loaded")?(d.toggleClass(h),e.slideToggle()):(O.insertBefore(c),d.removeClass(k),a.request({cmd:"tree",target:a.navId2Hash(d.attr("id"))}).done(function(a){v(J(a.tree));e.children().length&&(d.addClass(k+" "+h),e.slideDown());L()}).always(function(a){O.remove();d.addClass("finder-subtree-loaded")}))}),M=a.getUI("navbar").append(x).show();
a.open(function(a){a=a.data;var b=J(a.files);a.init&&x.empty();b.length&&(v(b),K(b,"finder-subtree-loaded"));L()}).add(function(a){a=J(a.data.added);a.length&&(v(a),K(a,k))}).change(function(b){b=J(b.data.changed);for(var c=b.length,d,e,k,l,m,n;c--;)if(d=b[c],(e=x.find("#"+a.navHash2Id(d.hash))).length){if(d.phash){k=e.closest("."+f);l=F(d.phash);m=e.parent().next();n=H(l,d);if(!l.length)continue;if(l[0]!==k[0]||m.get(0)!==n.get(0))n.length?n.before(e):l.append(e)}l=e.is("."+h);m=e.is(".finder-subtree-loaded");
k=$(P(d));e.replaceWith(k.children("."+g));d.dirs&&(l||m)&&(e=x.find("#"+a.navHash2Id(d.hash)))&&e.next("."+f).children().length&&(l&&e.addClass(h),m&&e.addClass("finder-subtree-loaded"))}L();C()}).remove(function(b){b=b.data.removed;for(var c=b.length,d,e;c--;)(d=x.find("#"+a.navHash2Id(b[c]))).length&&(e=d.closest("."+f),d.parent().detach(),e.children().length||e.hide().prev("."+g).removeClass(k+" "+h+" finder-subtree-loaded"))}).bind("search searchend",function(b){x.find("#"+a.navHash2Id(a.cwd().hash))["search"==
b.type?"removeClass":"addClass"](l)}).bind("lockfiles unlockfiles",function(b){var c="lockfiles"==b.type,d=c?"disable":"enable";b=$.map(b.data.files||[],function(b){var c=a.file(b);return c&&"directory"==c.mime?b:null});$.each(b,function(b,e){var f=x.find("#"+a.navHash2Id(e));f.length&&(f.is("."+n)&&f.draggable(d),f.is("."+u)&&f.droppable(l),f[c?"addClass":"removeClass"](t))})})});return this};"use strict";
$.fn.finderuploadbutton=function(a){return this.each(function(){var b=$(this).finderbutton(a).unbind("click"),c=$("<form/>").appendTo(b),d=$('<input type="file" multiple="true"/>').change(function(){var b=$(this);b.val()&&(a.exec({input:b.remove()[0]}),d.clone(!0).appendTo(c))});c.append(d.clone(!0));a.change(function(){c[a.disabled()?"hide":"show"]()}).change()})};"use strict";
$.fn.finderviewbutton=function(a){return this.each(function(){var b=$(this).finderbutton(a),c=b.children(".finder-button-icon");a.change(function(){var d="icons"==a.value;c.toggleClass("finder-button-icon-view-list",d);b.attr("title",a.fm.i18n(d?"viewlist":"viewicons"))})})};"use strict";
$.fn.finderworkzone=function(a){this.not(".finder-workzone").each(function(){var a=$(this).addClass("finder-workzone"),c=a.outerHeight(!0)-a.height(),d=a.parent();d.add(window).bind("resize",function(){var e=d.height();d.children(":visible:not(.finder-workzone)").each(function(){var a=$(this);"absolute"!=a.css("position")&&(e-=a.outerHeight(!0))});a.height(e-c)})});return this};"use strict";
Finder.prototype.commands.archive=function(){var a=this,b=a.fm,c=[];this.variants=[];this.disableOnSearch=!0;b.bind("open reload",function(){a.variants=[];$.each(c=b.option("archivers").create||[],function(c,e){a.variants.push([e,b.mime2kind(e)])});a.change()});this.getstate=function(){return!this._disabled&&c.length&&b.selected().length&&b.cwd().write?0:-1};this.exec=function(a,e){var f=this.files(a),g=f.length,k=e||c[0],h=b.cwd(),m=["errArchive","errPerm"],l=$.Deferred().fail(function(a){a&&b.error(a)});
if(!(this.enabled()&&g&&c.length&&-1!==$.inArray(k,c)))return l.reject();if(!h.write)return l.reject(m);for(h=0;h<g;h++)if(!f[h].read)return l.reject(m);return b.request({data:{cmd:"archive",targets:this.hashes(a),type:k},notify:{type:"archive",cnt:1},syncOnFail:!0})}};"use strict";Finder.prototype.commands.back=function(){this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+left backspace"}];this.getstate=function(){return this.fm.history.canBack()?0:-1};this.exec=function(){return this.fm.history.back()}};
"use strict";Finder.prototype.commands.copy=function(){this.shortcuts=[{pattern:"ctrl+c ctrl+insert"}];this.getstate=function(a){a=this.files(a);var b=a.length;return b&&$.map(a,function(a){return a.phash&&a.read?a:null}).length==b?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){b.error(a)});$.each(this.files(a),function(a,b){if(!b.read||!b.phash)return!c.reject(["errCopy",b.name,"errPerm"])});return"rejected"==c.state()?c:c.resolve(b.clipboard(this.hashes(a)))}};"use strict";
Finder.prototype.commands.cut=function(){this.shortcuts=[{pattern:"ctrl+x shift+insert"}];this.getstate=function(a){a=this.files(a);var b=a.length;return b&&$.map(a,function(a){return a.phash&&a.read&&!a.locked?a:null}).length==b?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){b.error(a)});$.each(this.files(a),function(a,b){if(!b.read||!b.phash)return!c.reject(["errCopy",b.name,"errPerm"]);if(b.locked)return!c.reject(["errLocked",b.name])});return"rejected"==c.state()?c:
c.resolve(b.clipboard(this.hashes(a),!0))}};"use strict";
Finder.prototype.commands.download=function(){var a=this,b=this.fm,c=function(b){return $.map(a.files(b),function(a){return"directory"==a.mime?null:a})};this.shortcuts=[{pattern:"shift+enter"}];this.getstate=function(){var a=this.fm.selected(),e=a.length;return this._disabled||!e||b.UA.IE&&1!=e||e!=c(a).length?-1:0};this.exec=function(a){var b=this.fm,f=b.options.url,g=c(a),k=$.Deferred(),h="",m="",l;if(this.disabled())return k.reject();$.each(b.options.customData||{},function(a,b){m+="&"+a+"="+b});
f+=-1===f.indexOf("?")?"?":"&";for(l=0;l<g.length;l++)h+='<iframe class="downloader" id="downloader-'+g[l].hash+'" style="display:none" src="'+f+"cmd=file&target="+g[l].hash+"&download=1"+m+'"/>';$(h).appendTo("body").ready(function(){setTimeout(function(){$(h).each(function(){$("#"+$(this).attr("id")).remove()})},2E4+1E4*l)});b.trigger("download",{files:g});return k.resolve(a)}};"use strict";
Finder.prototype.commands.duplicate=function(){var a=this.fm;this.getstate=function(b){b=this.files(b);var c=b.length;return!this._disabled&&c&&a.cwd().write&&$.map(b,function(a){return a.phash&&a.read?a:null}).length==c?0:-1};this.exec=function(a){var c=this.fm,d=this.files(a),e=d.length,f=$.Deferred().fail(function(a){a&&c.error(a)});if(!e||this._disabled)return f.reject();$.each(d,function(a,b){if(!b.read||!c.file(b.phash).write)return!f.reject(["errCopy",b.name,"errPerm"])});return"rejected"==
f.state()?f:c.request({data:{cmd:"duplicate",targets:this.hashes(a)},notify:{type:"copy",cnt:e}})}};"use strict";
Finder.prototype.commands.edit=function(){var a=this,b=this.fm,c=b.res("mimes","text")||[],d=function(b){return $.map(b,function(b){return 0!==b.mime.indexOf("text/")&&-1===$.inArray(b.mime,c)||!b.mime.indexOf("text/rtf")||a.onlyMimes.length&&-1===$.inArray(b.mime,a.onlyMimes)||!b.read||!b.write?null:b})},e=function(c,d,e){var f=$.Deferred(),l=$('<textarea class="finder-file-edit" rows="20" id="'+c+'-ta">'+b.escape(e)+"</textarea>"),q=function(){l.editor&&l.editor.save(l[0],l.editor.instance);f.resolve(l.getContent());
l.finderdialog("close")},p=function(){f.reject();l.finderdialog("close")};e={title:d.name,width:a.options.dialogWidth||450,buttons:{},close:function(){l.editor&&l.editor.close(l[0],l.editor.instance);$(this).finderdialog("destroy")},open:function(){b.disable();l.focus();l[0].setSelectionRange&&l[0].setSelectionRange(0,0);l.editor&&l.editor.load(l[0])}};l.getContent=function(){return l.val()};$.each(a.options.editors||[],function(a,b){if(-1!==$.inArray(d.mime,b.mimes||[])&&"function"==typeof b.load&&
"function"==typeof b.save)return l.editor={load:b.load,save:b.save,close:"function"==typeof b.close?b.close:function(){},instance:null},!1});l.editor||l.keydown(function(a){var b=a.keyCode,c,d;a.stopPropagation();9==b&&(a.preventDefault(),this.setSelectionRange&&(c=this.value,d=this.selectionStart,this.value=c.substr(0,d)+"\t"+c.substr(this.selectionEnd),d+=1,this.setSelectionRange(d,d)));if(a.ctrlKey||a.metaKey){if(81==b||87==b)a.preventDefault(),p();83==b&&(a.preventDefault(),q())}});e.buttons[b.i18n("Save")]=
q;e.buttons[b.i18n("Cancel")]=p;b.dialog(l,e).attr("id",c);return f.promise()},f=function(a){var c=a.hash,d=$.Deferred();b.url(c);var f="edit-"+b.namespace+"-"+a.hash,l=b.getUI().find("#"+f);if(l.length)return l.finderdialog("toTop"),d.resolve();if(!a.read||!a.write)return l=["errOpen",a.name,"errPerm"],b.error(l),d.reject(l);b.request({data:{cmd:"get",target:c},notify:{type:"openfile",cnt:1},syncOnFail:!0}).done(function(l){e(f,a,l.content).done(function(a){b.request({options:{type:"post"},data:{cmd:"put",
target:c,content:a},notify:{type:"save",cnt:1},syncOnFail:!0}).fail(function(a){d.reject(a)}).done(function(a){a.changed&&a.changed.length&&b.change(a);d.resolve(a)})})}).fail(function(a){d.reject(a)});return d.promise()};this.shortcuts=[{pattern:"ctrl+e"}];this.init=function(){this.onlyMimes=this.options.mimes||[]};this.getstate=function(a){a=this.files(a);var b=a.length;return!this._disabled&&b&&d(a).length==b?0:-1};this.exec=function(a){a=d(this.files(a));var b=[],c;if(this.disabled())return $.Deferred().reject();
for(;c=a.shift();)b.push(f(c));return b.length?$.when.apply(null,b):$.Deferred().reject()}};"use strict";
Finder.prototype.commands.extract=function(){var a=this,b=a.fm,c=[],d=function(a){return $.map(a,function(a){return a.read&&-1!==$.inArray(a.mime,c)?a:null})};this.disableOnSearch=!0;b.bind("open reload",function(){c=b.option("archivers").extract||[];a.change()});this.getstate=function(a){a=this.files(a);var b=a.length;return!this._disabled&&b&&this.fm.cwd().write&&d(a).length==b?0:-1};this.exec=function(a){a=this.files(a);var d=$.Deferred(),g=a.length,k=g,h,m;if(!(this.enabled()&&g&&c.length))return d.reject();
for(h=0;h<g;h++){m=a[h];if(!m.read||!b.file(m.phash).write)return a=["errExtract",m.name,"errPerm"],b.error(a),d.reject(a);if(-1===$.inArray(m.mime,c))return a=["errExtract",m.name,"errNoArchive"],b.error(a),d.reject(a);b.request({data:{cmd:"extract",target:m.hash},notify:{type:"extract",cnt:1},syncOnFail:!0}).fail(function(a){"rejected"!=d.state()&&d.reject(a)}).done(function(){k--;0==k&&d.resolve()})}return d}};
Finder.prototype.commands.forward=function(){this.updateOnSelect=this.alwaysEnabled=!0;this.shortcuts=[{pattern:"ctrl+right"}];this.getstate=function(){return this.fm.history.canForward()?0:-1};this.exec=function(){return this.fm.history.forward()}};"use strict";
Finder.prototype.commands.getfile=function(){var a=this,b=this.fm,c=function(b){var c=a.options;b=$.map(b,function(a){return"directory"!=a.mime||c.folders?a:null});return c.multiple||1==b.length?b:[]};this.alwaysEnabled=!0;this.callback=b.options.getFileCallback;this._disabled="function"==typeof this.callback;this.getstate=function(a){a=this.files(a);var b=a.length;return this.callback&&b&&c(a).length==b?0:-1};this.exec=function(b){var c=this.fm,f=this.options,g=this.files(b);b=g.length;var k=c.option("url"),
h=c.option("tmbUrl"),m=$.Deferred().done(function(b){c.trigger("getfile",{files:b});a.callback(b,c);"close"==f.oncomplete?c.hide():"destroy"==f.oncomplete&&c.destroy()}),l=[],q,p,t;if(-1==this.getstate())return m.reject();for(q=0;q<b;q++){p=g[q];if("directory"==p.mime&&!f.folders)return m.reject();p.baseUrl=k;p.url=c.url(p.hash);p.path=c.path(p.hash);p.tmb&&1!=p.tmb&&(p.tmb=h+p.tmb);p.width||p.height||(p.dim?(t=p.dim.split("x"),p.width=t[0],p.height=t[1]):-1!==p.mime.indexOf("image")&&l.push(c.request({data:{cmd:"dim",
target:p.hash},preventDefault:!0}).done($.proxy(function(a){a.dim&&(t=a.dim.split("x"),this.width=t[0],this.height=t[1]);this.dim=a.dim},g[q]))))}return l.length?($.when.apply(null,l).always(function(){m.resolve(f.multiple?g:g[0])}),m):m.resolve(f.multiple?g:g[0])}};"use strict";
Finder.prototype.commands.help=function(){var a=this.fm,b=this,c=/\{url\}/,d=/\{link\}/,e=['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all finder-help">','<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],f=function(){var b=a.shortcuts();e.push('<div id="shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');b.length?(e.push('<div class="ui-widget-content finder-help-shortcuts">'),$.each(b,function(a,b){e.push('<div class="finder-help-shortcut"><div class="finder-help-shortcut-pattern">{pattern}</div> {descrip}</div>'.replace(/\{pattern\}/,
b[0]).replace(/\{descrip\}/,b[1]))}),e.push("</div>")):e.push('<div class="finder-help-disabled">'+a.i18n("shortcutsof")+"</div>");e.push("</div>")},g;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.state=0;this.shortcuts=[{pattern:"f1",description:this.title}];setTimeout(function(){var k=b.options.view||["about","shortcuts","help"];$.each(k,function(b,c){e.push('<li class="ui-state-default ui-corner-top"><a href="#{id}">{title}</a></li>'.replace(/\{id\}/,c).replace(/\{title\}/,a.i18n(c)))});e.push("</ul>");
-1!==$.inArray("about",k)&&(e.push('<div id="about" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),e.push("<h3>gpFinder</h3>"),e.push('<div class="ui-priority-primary">'+a.i18n("webfm")+"</div>"),e.push('<div class="ui-priority-secondary">'+a.i18n("ver")+": "+a.version+' <span id="apiver"></span></div>'),e.push('<div class="ui-priority-secondary">jQuery/jQuery UI: '+$().jquery+"/"+$.ui.version+"</div>"),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,
"https://github.com/oyejorge/gpFinder/wiki").replace(d,a.i18n("docs"))),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://github.com/oyejorge/gpFinder/issues").replace(d,"Issues")),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://github.com/oyejorge/gpFinder").replace(d,a.i18n("github"))),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://elfinder.org").replace(d,"gpFinder is an adaptation of elFinder")),
e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-license">'+a.i18n("icons")+': <a href="http://pixelmixer.ru/" target="_blank">Pixelmixer</a>, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>'),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-license">Licence: BSD Licence</div>'),e.push('<div class="finder-help-license">Copyright \u00a9 2009-2011, Studio 42</div>'),e.push('<div class="finder-help-license">\u201e \u2026'+
a.i18n("dontforget")+" \u201d</div>"),e.push("</div>"));-1!==$.inArray("shortcuts",k)&&f();-1!==$.inArray("help",k)&&(e.push('<div id="help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),e.push('<a href="http://gpfinder.org/index.php/Forum" target="_blank" class="finder-dont-panic"><span>DON\'T PANIC</span></a>'),e.push("</div>"));e.push("</div>");g=$(e.join(""));a.one("load",function(){g.find("#apiver").text(a.api)});g.find(".ui-tabs-nav li").hover(function(){$(this).toggleClass("ui-state-hover")}).children().click(function(a){var b=
$(this);a.preventDefault();a.stopPropagation();b.is(".ui-tabs-selected")||(b.parent().addClass("ui-tabs-selected ui-state-active").siblings().removeClass("ui-tabs-selected").removeClass("ui-state-active"),g.find(".ui-tabs-panel").hide().filter(b.attr("href")).show())}).filter(":first").click()},200);this.getstate=function(){return 0};this.exec=function(){this.dialog||(this.dialog=this.fm.dialog(g,{title:this.title,width:530,autoOpen:!1,destroyOnClose:!1}));this.dialog.finderdialog("open").find(".ui-tabs-nav li a:first").click()}};
Finder.prototype.commands.home=function(){this.title="Home";this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}];this.getstate=function(){var a=this.fm.root(),b=this.fm.cwd().hash;return a&&b&&a!=b?0:-1};this.exec=function(){return this.fm.exec("open",this.fm.root())}};"use strict";
Finder.prototype.commands.info=function(){var a=this.fm,b={calc:a.i18n("calc"),size:a.i18n("size"),unknown:a.i18n("unknown"),path:a.i18n("path"),aliasfor:a.i18n("aliasfor"),modify:a.i18n("modify"),perms:a.i18n("perms"),locked:a.i18n("locked"),dim:a.i18n("dim"),kind:a.i18n("kind"),files:a.i18n("files"),folders:a.i18n("folders"),items:a.i18n("items"),yes:a.i18n("yes"),no:a.i18n("no"),link:a.i18n("link")};this.tpl={main:'<div class="ui-helper-clearfix finder-info-title"><span class="finder-cwd-icon {class} ui-corner-all"/>{title}</div><table class="finder-info-tb">{content}</table>',
itemTitle:'<strong>{name}</strong><span class="finder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",row:"<tr><td>{label} : </td><td>{value}</td></tr>",spinner:'<span>{text}</span> <span class="finder-info-spinner"/>'};this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+i"}];this.init=function(){$.each(b,function(c,d){b[c]=a.i18n(d)})};this.getstate=function(a){a=this.files(a);return a.length?0:-1};this.exec=function(a){var d=this.fm,e=this.tpl,f=e.row,
g=this.files(a),k=g.length;a=[];var h=e.main,m={title:this.title,width:"auto",close:function(){$(this).finderdialog("destroy")}},l=[],q=function(a){t.find(".finder-info-spinner").parent().text(a)},p=d.namespace+"-info-"+$.map(g,function(a){return a.hash}).join("-"),t=d.getUI().find("#"+p),n,u,w,y;if(!k)return $.Deferred().reject();if(t.length)return t.finderdialog("toTop"),$.Deferred().resolve();1==k?(g=g[0],h=h.replace("{class}",d.mime2class(g.mime)),w=e.itemTitle.replace("{name}",g.name).replace("{kind}",
d.mime2kind(g)),g.tmb&&(u=d.option("tmbUrl")+g.tmb),g.read?"directory"!=g.mime||g.alias?n=d.formatSize(g.size):(n=e.spinner.replace("{text}",b.calc),l.push(g.hash)):n=b.unknown,a.push(f.replace("{label}",b.size).replace("{value}",n)),g.alias&&a.push(f.replace("{label}",b.aliasfor).replace("{value}",g.alias)),a.push(f.replace("{label}",b.path).replace("{value}",d.escape(d.path(g.hash)))),g.read&&a.push(f.replace("{label}",b.link).replace("{value}",'<a href="'+d.url(g.hash)+'" target="_blank">'+g.name+
"</a>")),g.dim?a.push(f.replace("{label}",b.dim).replace("{value}",g.dim)):-1!==g.mime.indexOf("image")&&(g.width&&g.height?a.push(f.replace("{label}",b.dim).replace("{value}",g.width+"x"+g.height)):(a.push(f.replace("{label}",b.dim).replace("{value}",e.spinner.replace("{text}",b.calc))),d.request({data:{cmd:"dim",target:g.hash},preventDefault:!0}).fail(function(){q(b.unknown)}).done(function(a){q(a.dim||b.unknown)}))),a.push(f.replace("{label}",b.modify).replace("{value}",d.formatDate(g))),a.push(f.replace("{label}",
b.perms).replace("{value}",d.formatPermissions(g))),a.push(f.replace("{label}",b.locked).replace("{value}",g.locked?b.yes:b.no))):(h=h.replace("{class}","finder-cwd-icon-group"),w=e.groupTitle.replace("{items}",b.items).replace("{num}",k),(y=$.map(g,function(a){return"directory"==a.mime?1:null}).length)?(a.push(f.replace("{label}",b.kind).replace("{value}",y==k?b.folders:b.folders+" "+y+", "+b.files+" "+(k-y))),a.push(f.replace("{label}",b.size).replace("{value}",e.spinner.replace("{text}",b.calc))),
l=$.map(g,function(a){return a.hash})):(n=0,$.each(g,function(a,b){var c=parseInt(b.size);n=0<=c&&0<=n?n+c:"unknown"}),a.push(f.replace("{label}",b.kind).replace("{value}",b.files)),a.push(f.replace("{label}",b.size).replace("{value}",d.formatSize(n)))));h=h.replace("{title}",w).replace("{content}",a.join(""));t=d.dialog(h,m);t.attr("id",p);u&&$("<img/>").load(function(){t.find(".finder-cwd-icon").css("background",'url("'+u+'") center center no-repeat')}).attr("src",u);l.length&&d.request({data:{cmd:"size",
targets:l},preventDefault:!0}).fail(function(){q(b.unknown)}).done(function(a){a=parseInt(a.size);q(0<=a?d.formatSize(a):b.unknown)})}};"use strict";Finder.prototype.commands.mkdir=function(){this.disableOnSearch=!0;this.updateOnSelect=!1;this.mime="directory";this.prefix="untitled folder";this.exec=$.proxy(this.fm.res("mixin","make"),this);this.shortcuts=[{pattern:"ctrl+shift+n"}];this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}};"use strict";
Finder.prototype.commands.mkfile=function(){this.disableOnSearch=!0;this.updateOnSelect=!1;this.mime="text/plain";this.prefix="untitled file.txt";this.exec=$.proxy(this.fm.res("mixin","make"),this);this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}};"use strict";
Finder.prototype.commands.netmount=function(){var a=this;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.drivers=[];this.handlers={load:function(){this.drivers=this.fm.netDrivers}};this.getstate=function(){return this.drivers.length?0:-1};this.exec=function(){var b=a.fm,c=$.Deferred(),d=function(){var d={protocol:$("<select/>"),host:$('<input type="text"/>'),port:$('<input type="text"/>'),path:$('<input type="text" value="/"/>'),user:$('<input type="text"/>'),pass:$('<input type="password"/>')},
f={title:b.i18n("netMountDialogTitle"),resizable:!1,modal:!0,destroyOnClose:!0,close:function(){delete a.dialog;"resolved"!=c.state()&&"rejected"!=c.state()&&c.reject()},buttons:{}},g=$('<table class="finder-info-tb finder-netmount-tb"/>');$.each(a.drivers,function(a,c){d.protocol.append('<option value="'+c+'">'+b.i18n(c)+"</option>")});$.each(d,function(a,c){"protocol"!=a&&c.addClass("ui-corner-all");g.append($("<tr/>").append($("<td>"+b.i18n(a)+"</td>")).append($("<td/>").append(c)))});f.buttons[b.i18n("btnMount")]=
function(){var b={cmd:"netmount"};$.each(d,function(a,c){var d=$.trim(c.val());d&&(b[a]=d)});if(!b.host)return a.fm.trigger("error",{error:"errNetMountHostReq"});a.fm.request({data:b,notify:{type:"netmount",cnt:1}}).done(function(){c.resolve()}).fail(function(a){c.reject(a)});a.dialog.finderdialog("close")};f.buttons[b.i18n("btnCancel")]=function(){a.dialog.finderdialog("close")};return b.dialog(g,f)};a.dialog||(a.dialog=d());return c.promise()}};"use strict";
Finder.prototype.commands.open=function(){this.alwaysEnabled=!0;this._handlers={dblclick:function(a){a.preventDefault();this.exec()},"select enable disable reload":function(a){this.update("disable"==a.type?-1:void 0)}};this.shortcuts=[{pattern:"ctrl+down numpad_enter"+("mac"!=this.fm.OS&&" enter")}];this.getstate=function(a){a=this.files(a);var b=a.length;return 1==b?0:b?$.map(a,function(a){return"directory"==a.mime?null:a}).length==b?0:-1:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){a&&
b.error(a)}),d=this.files(a),e=d.length,f,g,k;if(!e)return c.reject();if(1==e&&(f=d[0])&&"directory"==f.mime)return f&&!f.read?c.reject(["errOpen",f.name,"errPerm"]):b.request({data:{cmd:"open",target:f.thash||f.hash},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0});d=$.map(d,function(a){return"directory"!=a.mime?a:null});if(e!=d.length)return c.reject();for(e=d.length;e--;){f=d[e];if(!f.read)return c.reject(["errOpen",f.name,"errPerm"]);(g=b.url(f.hash))||(g=b.options.url,g=g+(-1===g.indexOf("?")?
"?":"&")+"cmd=file&target="+f.hash);k="";f.dim?(f=f.dim.split("x"),k="width="+(parseInt(f[0])+20)+",height="+(parseInt(f[1])+20)):k="width="+parseInt(2*$(window).width()/3)+",height="+parseInt(2*$(window).height()/3);if(!window.open(g,"_blank",k+",top=50,left=50,scrollbars=yes,resizable=yes"))return c.reject("errPopup")}return c.resolve(a)}};"use strict";
Finder.prototype.commands.paste=function(){this.updateOnSelect=!1;this.handlers={changeclipboard:function(){this.update()}};this.shortcuts=[{pattern:"ctrl+v shift+insert"}];this.getstate=function(a){if(this._disabled)return-1;if(a){if($.isArray(a)){if(1!=a.length)return-1;a=this.fm.file(a[0])}}else a=this.fm.cwd();return"directory"==a.mime&&a.write?0:-1};this.exec=function(a){var b=this,c=b.fm;a=a?this.files(a)[0]:c.cwd();var d=c.clipboard(),e=d.length,f=e?d[0].cut:!1,g=f?"errMove":"errCopy",k=[],
h=[],m=$.Deferred().fail(function(a){a&&c.error(a)}),l,q;if(!e||!a||"directory"!=a.mime)return m.reject();if(!a.write)return m.reject([g,d[0].name,"errPerm"]);l=c.parents(a.hash);$.each(d,function(b,e){if(!e.read)return!m.reject([g,d[0].name,"errPerm"]);if(f&&e.locked)return!m.reject(["errLocked",e.name]);if(-1!==$.inArray(e.hash,l))return!m.reject(["errCopyInItself",e.name]);q=c.parents(e.hash);if(-1!==$.inArray(a.hash,q)&&$.map(q,function(b){b=c.file(b);return b.phash==a.hash&&b.name==e.name?b:
null}).length)return!m.reject(["errReplByChild",e.name]);e.phash==a.hash?h.push(e.hash):k.push({hash:e.hash,phash:e.phash,name:e.name})});return"rejected"==m.state()?m:$.when(h.length&&c._commands.duplicate?c.exec("duplicate",h):$.Deferred().resolve(),function(d){var e=$.Deferred(),g=[],h=function(a){var b=d[g[a]],k=a==g.length-1;b&&c.confirm({title:c.i18n(f?"moveFiles":"copyFiles"),text:c.i18n(["errExists",b.name,"confirmRepl"]),all:!k,accept:{label:"btnYes",callback:function(b){k||b?l(d):h(++a)}},
reject:{label:"btnNo",callback:function(b){var c;if(b)for(c=g.length;a<c--;)d[g[c]].remove=!0;else d[g[a]].remove=!0;k||b?l(d):h(++a)}},cancel:{label:"btnCancel",callback:function(){e.resolve()}}})},k=function(a){for(var b=[],c=d.length;c--;)-1!==$.inArray(d[c].name,a)&&b.unshift(c);g=b;g.length?h(0):l(d)},l=function(b){b=$.map(b,function(a){return a.remove?null:a});var d=b.length,g;if(!d)return e.resolve();g=b[0].phash;b=$.map(b,function(a){return a.hash});c.request({data:{cmd:"paste",dst:a.hash,
targets:b,cut:f?1:0,src:g},notify:{type:f?"move":"copy",cnt:d}}).always(function(){e.resolve();c.unlockfiles({files:b})})};if(b._disabled||!d.length)return e.resolve();c.option("copyOverwrite")?a.hash==c.cwd().hash?k($.map(c.files(),function(b){return b.phash==a.hash?b.name:null})):c.request({data:{cmd:"ls",target:a.hash},notify:{type:"prepare",cnt:1,hideCnt:!0},preventFail:!0}).always(function(a){k(a.list||[])}):l(d);return e}(k)).always(function(){f&&c.clipboard([])})}};"use strict";
Finder.prototype.commands.quicklook=function(){var a=this,b=a.fm,c=0,d=function(a){$(document).trigger($.Event("keydown",{keyCode:a,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},e=function(a){return{opacity:0,width:20,height:"list"==b.view?1:20,top:a.offset().top,left:a.offset().left}},f=function(){var a=$(window);return{opacity:1,width:k,height:h,top:parseInt((a.height()-h)/2+a.scrollTop()),left:parseInt((a.width()-k)/2+a.scrollLeft())}},g=function(a){var b=document.createElement(a.substr(0,a.indexOf("/"))),
c=!1;try{c=b.canPlayType&&b.canPlayType(a)}catch(d){}return c&&""!==c&&"no"!=c},k,h,m,l,q=$('<div class="finder-quicklook-title"/>'),p=$("<div/>"),t=$('<div class="finder-quicklook-info"/>'),n=$('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-fullscreen"/>').mousedown(function(c){var d=a.window,e=d.is(".finder-quicklook-fullscreen"),f="scroll."+b.namespace,g=$(window);c.stopPropagation();e?(d.css(d.data("position")).unbind("mousemove"),g.unbind(f).trigger(a.resize).unbind(a.resize),
u.unbind("mouseenter").unbind("mousemove")):(d.data("position",{left:d.css("left"),top:d.css("top"),width:d.width(),height:d.height()}).css({width:"100%",height:"100%"}),$(window).bind(f,function(){d.css({left:parseInt($(window).scrollLeft()),top:parseInt($(window).scrollTop())})}).bind(a.resize,function(b){a.preview.trigger("changesize")}).trigger(f).trigger(a.resize),d.bind("mousemove",function(a){u.stop(!0,!0).show().delay(3E3).fadeOut("slow")}).mousemove(),u.mouseenter(function(){u.stop(!0,!0).show()}).mousemove(function(a){a.stopPropagation()}));
u.attr("style","");e?u.filter(":ui-draggable").draggable("destroy"):u.draggable({});d.toggleClass("finder-quicklook-fullscreen");$(this).toggleClass("finder-quicklook-navbar-icon-fullscreen-off");$.fn.resizable&&m.add(d).resizable(e?"enable":"disable").removeClass("ui-state-disabled")}),u=$('<div class="finder-quicklook-navbar"/>').append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-prev"/>').mousedown(function(){d(37)})).append(n).append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-next"/>').mousedown(function(){d(39)})).append('<div class="finder-quicklook-navbar-separator"/>').append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-close"/>').mousedown(function(){a.window.trigger("close")}));
this.resize="resize."+b.namespace;this.info=$('<div class="finder-quicklook-info-wrapper"/>').append(p).append(t);this.preview=$('<div class="finder-quicklook-preview ui-helper-clearfix"/>').bind("change",function(b){a.info.attr("style","").hide();p.removeAttr("class").attr("style","");t.html("")}).bind("update",function(b){var c=a.fm,d=b.file,e;d?(!d.read&&b.stopImmediatePropagation(),a.window.data("hash",d.hash),a.preview.unbind("changesize").trigger("change").children().remove(),q.html(c.escape(d.name)),
t.html('<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,d.name)+'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.mime2kind(d))+("directory"==d.mime?"":'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.formatSize(d.size)))+'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.i18n("modify")+": "+c.formatDate(d))),p.addClass("finder-cwd-icon ui-corner-all "+c.mime2class(d.mime)),d.tmb&&$("<img/>").hide().appendTo(a.preview).load(function(){p.css("background",
'url("'+e+'") center center no-repeat');$(this).remove()}).attr("src",e=c.tmb(d.hash)),a.info.delay(100).fadeIn(10)):b.stopImmediatePropagation()});this.window=$('<div class="ui-helper-reset ui-widget finder-quicklook" style="position:absolute"/>').click(function(a){a.stopPropagation()}).append($('<div class="finder-quicklook-titlebar"/>').append(q).append($('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(b){b.stopPropagation();a.window.trigger("close")}))).append(this.preview.add(u)).append(a.info.hide()).draggable({handle:"div.finder-quicklook-titlebar"}).bind("open",
function(b){b=a.window;var d=a.value,g;a.closed()&&d&&(g=l.find("#"+d.hash)).length&&(c=1,g.trigger("scrolltoview"),b.css(e(g)).show().animate(f(),550,function(){c=2;a.update(1,a.value)}))}).bind("close",function(b){var d=a.window,f=a.preview.trigger("change");b=l.find("#"+d.data("hash"));var g=function(){c=0;d.hide();f.children().remove();a.update(0,a.value)};a.opened()&&(c=1,d.is(".finder-quicklook-fullscreen")&&n.mousedown(),b.length?d.animate(e(b),500,g):g())});this.alwaysEnabled=!0;this.value=
null;this.handlers={select:function(){this.update(void 0,this.fm.selectedFiles()[0])},error:function(){a.window.is(":visible")&&a.window.data("hash","").trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")}};this.shortcuts=[{pattern:"space"}];this.support={audio:{ogg:g('audio/ogg; codecs="vorbis"'),mp3:g("audio/mpeg;"),wav:g('audio/wav; codecs="1"'),m4a:g("audio/x-m4a;")||g("audio/aac;")},video:{ogg:g('video/ogg; codecs="theora"'),webm:g('video/webm; codecs="vp8, vorbis"'),
mp4:g('video/mp4; codecs="avc1.42E01E"')||g('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}};this.closed=function(){return 0==c};this.opened=function(){return 2==c};this.init=function(){var c=this.options,d=this.window,e=this.preview;k=0<c.width?parseInt(c.width):450;h=0<c.height?parseInt(c.height):300;b.one("load",function(){m=b.getUI();l=b.getUI("cwd");d.appendTo("body").zIndex(100+m.zIndex());$(document).keydown(function(b){27==b.keyCode&&a.opened()&&d.trigger("close")});$.fn.resizable&&d.resizable({handles:"se",
minWidth:350,minHeight:120,resize:function(){e.trigger("changesize")}});a.change(function(){a.opened()&&(a.value?e.trigger($.Event("update",{file:a.value})):d.trigger("close"))});$.each(b.commands.quicklook.plugins||[],function(b,c){"function"==typeof c&&new c(a)});e.bind("update",function(){a.info.show()})})};this.getstate=function(){return 1==this.fm.selected().length?2==c?1:0:-1};this.exec=function(){this.enabled()&&this.window.trigger(this.opened()?"close":"open")};this.hideinfo=function(){this.info.stop(!0).hide()}};
Finder.prototype.commands.quicklook.plugins=[function(a){var b=["image/jpeg","image/png","image/gif","image/svg+xml"],c=a.preview;$.each(navigator.mimeTypes,function(a,c){var f=c.type;0===f.indexOf("image/")&&$.inArray(f,b)&&b.push(f)});c.bind("update",function(d){var e=d.file,f;-1!==$.inArray(e.mime,b)&&(d.stopImmediatePropagation(),f=$("<img/>").hide().appendTo(c).load(function(){setTimeout(function(){var b=(f.width()/f.height()).toFixed(2);c.bind("changesize",function(){var a=parseInt(c.width()),d=parseInt(c.height()),
e;b<(a/d).toFixed(2)?(e=d,a=Math.floor(e*b)):e=Math.floor(a/b);f.width(a).height(e).css("margin-top",e<d?Math.floor((d-e)/2):0)}).trigger("changesize");a.hideinfo();f.fadeIn(100)},1)}).attr("src",a.fm.url(e.hash)))})},function(a){var b=["text/html","application/xhtml+xml"],c=a.preview,d=a.fm;c.bind("update",function(e){var f=e.file,g;-1!==$.inArray(f.mime,b)&&(e.stopImmediatePropagation(),c.one("change",function(){"resolved"!=g.state()&&"rejected"!=g.state()&&g.reject()}),g=d.request({data:{cmd:"get",
target:f.hash,current:f.phash},preventDefault:!0}).done(function(b){a.hideinfo();doc=$('<iframe class="finder-quicklook-preview-html"/>').appendTo(c)[0].contentWindow.document;doc.open();doc.write(b.content);doc.close()}))})},function(a){var b=a.fm,c=b.res("mimes","text"),d=a.preview;d.bind("update",function(e){var f=e.file,g=f.mime,k;if(0===g.indexOf("text/")||-1!==$.inArray(g,c))e.stopImmediatePropagation(),d.one("change",function(){"resolved"!=k.state()&&"rejected"!=k.state()&&k.reject()}),k=b.request({data:{cmd:"get",
target:f.hash},preventDefault:!0}).done(function(c){a.hideinfo();$('<div class="finder-quicklook-preview-text-wrapper"><pre class="finder-quicklook-preview-text">'+b.escape(c.content)+"</pre></div>").appendTo(d)})})},function(a){var b=a.fm,c=a.preview,d=!1;b.UA.Safari&&"mac"==b.OS||b.UA.IE?d=!0:$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){if("application/pdf"==b.type)return!(d=!0)})});d&&c.bind("update",function(d){var f=d.file,g;"application/pdf"==f.mime&&(d.stopImmediatePropagation(),
c.one("change",function(){g.unbind("load").remove()}),g=$('<iframe class="finder-quicklook-preview-pdf"/>').hide().appendTo(c).load(function(){a.hideinfo();g.show()}).attr("src",b.url(f.hash)))})},function(a){var b=a.fm,c=a.preview,d=!1;$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){if("application/x-shockwave-flash"==b.type)return!(d=!0)})});d&&c.bind("update",function(d){var f=d.file;"application/x-shockwave-flash"==f.mime&&(d.stopImmediatePropagation(),a.hideinfo(),c.append($('<embed class="finder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
b.url(f.hash)+'" quality="high" type="application/x-shockwave-flash" />')))})},function(a){var b=a.preview,c=!!a.options.autoplay,d={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg"},e;b.bind("update",function(f){var g=f.file;a.support.audio[d[g.mime]]&&(f.stopImmediatePropagation(),e=$('<audio class="finder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+
a.fm.url(g.hash)+'" /></audio>').appendTo(b),c&&e[0].play())}).bind("change",function(){e&&e.parent().length&&(e[0].pause(),e.remove(),e=null)})},function(a){var b=a.preview,c=!!a.options.autoplay,d={"video/mp4":"mp4","video/x-m4v":"mp4","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm"},e;b.bind("update",function(f){var g=f.file;a.support.video[d[g.mime]]&&(f.stopImmediatePropagation(),a.hideinfo(),e=$('<video class="finder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+
a.fm.url(g.hash)+'" /></video>').appendTo(b),c&&e[0].play())}).bind("change",function(){e&&e.parent().length&&(e[0].pause(),e.remove(),e=null)})},function(a){var b=a.preview,c=[],d;$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){0!==b.type.indexOf("audio/")&&0!==b.type.indexOf("video/")||c.push(b.type)})});b.bind("update",function(e){var f=e.file,g=f.mime;-1!==$.inArray(f.mime,c)&&(e.stopImmediatePropagation(),(e=0===g.indexOf("video/"))&&a.hideinfo(),d=$('<embed src="'+a.fm.url(f.hash)+
'" type="'+g+'" class="finder-quicklook-preview-'+(e?"video":"audio")+'"/>').appendTo(b))}).bind("change",function(){d&&d.parent().length&&(d.remove(),d=null)})}];
Finder.prototype.commands.reload=function(){this.updateOnSelect=this.alwaysEnabled=!0;this.shortcuts=[{pattern:"ctrl+shift+r f5"}];this.getstate=function(){return 0};this.exec=function(){var a=this.fm,b=a.sync(),c=setTimeout(function(){a.notify({type:"reload",cnt:1,hideCnt:!0});b.always(function(){a.notify({type:"reload",cnt:-1})})},a.notifyDelay);return b.always(function(){clearTimeout(c);a.trigger("reload")})}};"use strict";
Finder.prototype.commands.rename=function(){this.shortcuts=[{pattern:"f2"+("mac"==this.fm.OS?" enter":"")}];this.getstate=function(){var a=this.fm.selectedFiles();return this._disabled||1!=a.length||!a[0].phash||a[0].locked?-1:0};this.exec=function(){var a=this.fm,b=a.getUI("cwd"),c=a.selected(),d=c.length,e=a.file(c.shift()),f=$.Deferred().fail(function(c){var d=g.parent(),f=a.escape(e.name);d.length?(g.remove(),d.html(f)):(b.find("#"+e.hash).find(".finder-cwd-filename").html(f),setTimeout(function(){b.find("#"+
e.hash).click()},50));c&&a.error(c)}).always(function(){a.enable()}),g=$('<input type="text"/>').keydown(function(a){a.stopPropagation();a.stopImmediatePropagation();a.keyCode==$.ui.keyCode.ESCAPE?f.reject():a.keyCode==$.ui.keyCode.ENTER&&g.blur()}).mousedown(function(a){a.stopPropagation()}).dblclick(function(a){a.stopPropagation();a.preventDefault()}).blur(function(){var b=$.trim(g.val()),c=g.parent();if(c.length){g[0].setSelectionRange&&g[0].setSelectionRange(0,0);if(b==e.name)return f.reject();
if(!b)return f.reject("errInvName");if(a.fileByName(b,e.phash))return f.reject(["errExists",b]);c.html(a.escape(b));a.lockfiles({files:[e.hash]});a.request({data:{cmd:"rename",target:e.hash,name:b},notify:{type:"rename",cnt:1}}).fail(function(b){f.reject();a.sync()}).done(function(a){f.resolve(a)}).always(function(){a.unlockfiles({files:[e.hash]})})}}),c=b.find("#"+e.hash).find(".finder-cwd-filename").empty().append(g.val(e.name)),k=g.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/ig,
"");if(this.disabled())return f.reject();if(!e||1<d||!c.length)return f.reject("errCmdParams",this.title);if(e.locked)return f.reject(["errLocked",e.name]);a.one("select",function(){g.parent().length&&e&&-1===$.inArray(e.hash,a.selected())&&g.blur()});g.select().focus();g[0].setSelectionRange&&g[0].setSelectionRange(0,k.length);return f}};"use strict";
Finder.prototype.commands.resize=function(){this.updateOnSelect=!1;this.getstate=function(){var a=this.fm.selectedFiles();return!this._disabled&&1==a.length&&a[0].read&&a[0].write&&-1!==a[0].mime.indexOf("image/")?0:-1};this.exec=function(a){var b=this.fm;a=this.files(a);var c=$.Deferred(),d,e;if(!a.length||-1===a[0].mime.indexOf("image/"))return c.reject();d="resize-"+b.namespace+"-"+a[0].hash;e=b.getUI().find("#"+d);if(e.length)return e.finderdialog("toTop"),c.resolve();(function(a,d){var e=$('<div class="finder-dialog-resize"/>'),
h=$('<div class="finder-resize-control"/>'),m=$('<div class="finder-resize-preview"/>'),l=$('<div class="finder-resize-spinner">'+b.i18n("ntfloadimg")+"</div>"),q=$('<div class="finder-resize-handle"/>'),p=$('<div class="finder-resize-handle"/>'),t=$('<div class="finder-resize-uiresize"/>'),n=$('<div class="finder-resize-uicrop"/>'),u=$('<div class="finder-resize-rotate"/>'),w=$('<div class="ui-state-default finder-button"/>').attr("title",b.i18n("rotate-cw")).append($('<span class="finder-button-icon finder-button-icon-rotate-l"/>').click(function(){Q-=
90;G.update(Q)})),y=$('<div class="ui-state-default finder-button"/>').attr("title",b.i18n("rotate-ccw")).append($('<span class="finder-button-icon finder-button-icon-rotate-r"/>').click(function(){Q+=90;G.update(Q)})),E=$("<span />"),O=$('<div class="ui-state-default ui-corner-all finder-resize-reset"><span class="ui-icon ui-icon-arrowreturnthick-1-w"/></div>'),N=$('<div class="finder-resize-type"/>').append('<input type="radio" name="type" id="type-resize" value="resize" checked="checked" /><label for="type-resize">'+
b.i18n("resize")+"</label>").append('<input type="radio" name="type" id="type-crop"   value="crop"/><label for="type-crop">'+b.i18n("crop")+"</label>").append('<input type="radio" name="type" id="type-rotate" value="rotate"/><label for="type-rotate">'+b.i18n("rotate")+"</label>");$("input",N).change(function(){var a=$("input:checked",N).val();W();aa(!0);da(!0);ea(!0);"resize"==a?(t.show(),u.hide(),n.hide(),aa()):"crop"==a?(u.hide(),t.hide(),n.show(),da()):"rotate"==a&&(t.hide(),n.hide(),u.show(),
ea())});var T=$('<input type="checkbox" checked="checked"/>').change(function(){V=!!T.prop("checked");r.fixHeight();aa(!0);aa()}),B=$('<input type="text" size="5"/>').change(function(){var a=parseInt(B.val()),b=parseInt(V?a/C:D.val());0<a&&0<b&&(r.updateView(a,b),D.val(b))}),D=$('<input type="text" size="5"/>').change(function(){var a=parseInt(D.val()),b=parseInt(V?a*C:B.val());0<b&&0<a&&(r.updateView(b,a),B.val(b))}),P=$('<input type="text" size="5"/>'),J=$('<input type="text" size="5"/>'),F=$('<input type="text" size="5"/>'),
H=$('<input type="text" size="5"/>'),v=$('<input type="text" size="3" maxlength="3" value="0" />').change(function(){G.update()}),L=$('<div class="finder-resize-rotate-slider"/>').slider({min:0,max:359,value:v.val(),animate:!0,change:function(a,b){b.value!=L.slider("value")&&G.update(b.value)},slide:function(a,b){G.update(b.value,!1)}}),C=1,K=1,x=0,M=0,V=!0,U=0,S=0,X=0,Y=0,Q=0,z=$("<img/>").load(function(){l.remove();x=z.width();M=z.height();C=x/M;r.updateView(x,M);q.append(z.show()).show();B.val(x);
D.val(M);var a=Math.min(U,S)/Math.sqrt(Math.pow(x,2)+Math.pow(M,2));X=x*a;Y=M*a;h.find("input,select").removeAttr("disabled").filter(":text").keydown(function(a){var b=a.keyCode,c;a.stopPropagation();37<=b&&40>=b||b==$.ui.keyCode.BACKSPACE||b==$.ui.keyCode.DELETE||65==b&&(a.ctrlKey||a.metaKey)||27==b||(9==b&&(c=$(this).parent()[a.shiftKey?"prev":"next"](".finder-resize-row").children(":text"),c.length&&c.focus()),13==b?fa():48<=b&&57>=b||96<=b&&105>=b||a.preventDefault())}).filter(":first").focus();
aa();O.hover(function(){O.toggleClass("ui-state-hover")}).click(W)}).error(function(){l.text("Unable to load image").css("background","transparent")}),ba=$("<div/>"),R=$("<img/>"),Z=$("<div/>"),I=$("<img/>"),W=function(){B.val(x);D.val(M);r.updateView(x,M)},r={update:function(){B.val(parseInt(z.width()/K));D.val(parseInt(z.height()/K))},updateView:function(a,b){a>U||b>S?a/U>b/S?z.width(U).height(Math.ceil(z.width()/C)):z.height(S).width(Math.ceil(z.height()*C)):z.width(a).height(b);K=z.width()/a;
E.text("1 : "+(1/K).toFixed(2));r.updateHandle()},updateHandle:function(){q.width(z.width()).height(z.height())},fixWidth:function(){var a;V&&(a=D.val(),a=parseInt(a*C),r.updateView(void 0,a),B.val(void 0))},fixHeight:function(){var a,b;V&&(a=B.val(),b=parseInt(a/C),r.updateView(a,b),D.val(b))}},A={update:function(){F.val(parseInt(p.width()/K));H.val(parseInt(p.height()/K));P.val(parseInt((p.offset().left-R.offset().left)/K));J.val(parseInt((p.offset().top-R.offset().top)/K))},resize_update:function(){A.update();
Z.width(p.width());Z.height(p.height())}},G={mouseStartAngle:0,imageStartAngle:0,imageBeingRotated:!1,update:function(a,c){"undefined"==typeof a&&(Q=a=parseInt(v.val()));"undefined"==typeof c&&(c=!0);!c||b.UA.Opera||b.UA.ltIE8?I.rotate(a):I.animate({rotate:a+"deg"});a%=360;0>a&&(a+=360);v.val(parseInt(a));L.slider("value",v.val())},execute:function(a){if(G.imageBeingRotated){var b=G.getCenter(I),b=Math.atan2(a.pageY-b[1],a.pageX-b[0])-G.mouseStartAngle+G.imageStartAngle,b=Math.round(180*parseFloat(b)/
Math.PI);a.shiftKey&&(b=15*Math.round((b+6)/15));I.rotate(b);b%=360;0>b&&(b+=360);v.val(b);L.slider("value",v.val());return!1}},start:function(a){G.imageBeingRotated=!0;var b=G.getCenter(I);G.mouseStartAngle=Math.atan2(a.pageY-b[1],a.pageX-b[0]);G.imageStartAngle=parseFloat(I.rotate())*Math.PI/180;$(document).mousemove(G.execute);return!1},stop:function(a){if(G.imageBeingRotated)return $(document).unbind("mousemove",G.execute),setTimeout(function(){G.imageBeingRotated=!1},10),!1},getCenter:function(a){a=
I.rotate();I.rotate(0);var b=I.offset(),c=b.left+I.width()/2,b=b.top+I.height()/2;I.rotate(a);return[c,b]}},aa=function(a){$.fn.resizable&&(a?(q.filter(":ui-resizable").resizable("destroy"),q.hide()):(q.show(),q.resizable({alsoResize:z,aspectRatio:V,resize:r.update,stop:r.fixHeight})))},da=function(a){$.fn.draggable&&$.fn.resizable&&(a?(p.filter(":ui-resizable").resizable("destroy"),p.filter(":ui-draggable").draggable("destroy"),ba.hide()):(R.width(z.width()).height(z.height()),Z.width(z.width()).height(z.height()),
p.width(R.width()).height(R.height()).offset(R.offset()).resizable({containment:ba,resize:A.resize_update,handles:"all"}).draggable({handle:p,containment:R,drag:A.update}),ba.show().width(z.width()).height(z.height()),A.update()))},ea=function(a){$.fn.draggable&&$.fn.resizable&&(a?I.hide():I.show().width(X).height(Y).css("margin-top",(S-Y)/2).css("margin-left",(U-X)/2))},fa=function(){var d,g,h,l,m,n=$("input:checked",N).val();B.add(D).change();if("resize"==n)d=parseInt(B.val())||0,g=parseInt(D.val())||
0;else if("crop"==n)d=parseInt(F.val())||0,g=parseInt(H.val())||0,h=parseInt(P.val())||0,l=parseInt(J.val())||0;else{n="rotate";d=x;g=M;m=parseInt(v.val())||0;if(0>m||360<m)return b.error("Invalid rotate degree");if(0==m||360==m)return b.error("Image dose not rotated")}if("rotate"!=n){if(0>=d||0>=g)return b.error("Invalid image size");if(d==x&&g==M)return b.error("Image size not changed")}e.finderdialog("close");b.request({data:{cmd:"resize",target:a.hash,width:d,height:g,x:h,y:l,degree:m,mode:n},
notify:{type:"resize",cnt:1}}).fail(function(a){c.reject(a)}).done(function(){c.resolve()})},ca={},ga=b.url(a.hash);I.mousedown(G.start);$(document).mouseup(G.stop);t.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("width"))).append(B).append(O)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("height"))).append(D)).append($('<div class="finder-resize-row"/>').append($("<label/>").text(b.i18n("aspectRatio")).prepend(T))).append($('<div class="finder-resize-row"/>').append(b.i18n("scale")+
" ").append(E));n.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text("X")).append(P)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text("Y")).append(J)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("width"))).append(F)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("height"))).append(H));u.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("rotate"))).append($('<div style="float:left; width: 130px;">').append($('<div style="float:left;">').append(v).append($("<span/>").text(b.i18n("degree")))).append($('<div class="ui-widget-content ui-corner-all finder-buttonset"/>').append(w).append($('<span class="ui-widget-content finder-toolbar-button-separator"/>')).append(y))).append(L));
e.append(N);h.append($('<div class="finder-resize-row"/>')).append(t).append(n.hide()).append(u.hide()).find("input,select").attr("disabled","disabled");q.append('<div class="finder-resize-handle-hline finder-resize-handle-hline-top"/>').append('<div class="finder-resize-handle-hline finder-resize-handle-hline-bottom"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-left"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-right"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-e"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-se"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-s"/>');
m.append(l).append(q.hide()).append(z.hide());p.css("position","absolute").append('<div class="finder-resize-handle-hline finder-resize-handle-hline-top"/>').append('<div class="finder-resize-handle-hline finder-resize-handle-hline-bottom"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-left"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-right"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-n"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-e"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-s"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-w"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-ne"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-se"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-sw"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-nw"/>');
m.append(ba.css("position","absolute").hide().append(R).append(p.append(Z)));m.append(I.hide());m.css("overflow","hidden");e.append(m).append(h);ca[b.i18n("btnCancel")]=function(){e.finderdialog("close")};ca[b.i18n("btnApply")]=fa;b.dialog(e,{title:a.name,width:650,resizable:!1,destroyOnClose:!0,buttons:ca,open:function(){m.zIndex(1+$(this).parent().zIndex())}}).attr("id",d);b.UA.ltIE8&&$(".finder-dialog").css("filter","");O.css("left",B.position().left+B.width()+12);Z.css({opacity:.2,"background-color":"#fff",
position:"absolute"});p.css("cursor","move");p.find(".finder-resize-handle-point").css({"background-color":"#fff",opacity:.5,"border-color":"#000"});I.css("cursor","pointer");N.buttonset();U=m.width()-(q.outerWidth()-q.width());S=m.height()-(q.outerHeight()-q.height());z.attr("src",ga+(-1===ga.indexOf("?")?"?":"&")+"_="+Math.random());R.attr("src",z.attr("src"));I.attr("src",z.attr("src"))})(a[0],d);return c}};
(function(a){var b=function(a,b){var c=0;for(c in b)if("undefined"!=typeof a[b[c]])return b[c];a[b[c]]="";return b[c]};a.cssHooks.rotate={get:function(b,c,f){return a(b).rotate()},set:function(b,c){a(b).rotate(c);return c}};a.cssHooks.transform={get:function(a,c,f){c=b(a.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return a.style[c]},set:function(a,c){var f=b(a.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return a.style[f]=c}};
a.fn.rotate=function(a){if("undefined"==typeof a)return window.opera?(a=this.css("transform").match(/rotate\((.*?)\)/))&&a[1]?Math.round(180*parseFloat(a[1])/Math.PI):0:(a=this.css("transform").match(/rotate\((.*?)\)/))&&a[1]?parseInt(a[1]):0;this.css("transform",this.css("transform").replace(/none|rotate\(.*?\)/,"")+"rotate("+parseInt(a)+"deg)");return this};a.fx.step.rotate=function(b){0==b.state&&(b.start=a(b.elem).rotate(),b.now=b.start);a(b.elem).rotate(b.now)};if("undefined"==typeof window.addEventListener&&
"undefined"==typeof document.getElementsByClassName){var c=a.cssHooks.transform.set;a.cssHooks.transform.set=function(a,b){c.apply(this,[a,b]);var f,g=1,k=1,h=1,m=1;if("undefined"==typeof a.style.msTransform){if("static"==a.currentStyle.position){f=a;for(var l=f.offsetLeft,q=f.offsetTop;f.offsetParent;){f=f.offsetParent;if(f!=document.body&&"static"!=f.currentStyle.position)break;f!=document.body&&f!=document.documentElement&&(l-=f.scrollLeft,q-=f.scrollTop);l+=f.offsetLeft;q+=f.offsetTop}a.style.position=
"absolute";a.style.left=l+"px";a.style.top=q+"px"}f=(f=b.match(/rotate\((.*?)\)/))&&f[1]?parseInt(f[1]):0;f%=360;0>f&&(f=360+f);l=f*Math.PI/180;q=Math.cos(l);l=Math.sin(l);g*=q;k*=-l;h*=l;m*=q;a.style.filter=(a.style.filter||"").replace(/progid:DXImageTransform\.Microsoft\.Matrix\([^)]*\)/,"")+("progid:DXImageTransform.Microsoft.Matrix(M11="+g+",M12="+k+",M21="+h+",M22="+m+",FilterType='bilinear',sizingMethod='auto expand')");g=parseInt(a.style.width||a.width||0);k=parseInt(a.style.height||a.height||
0);l=f*Math.PI/180;h=Math.abs(Math.cos(l));m=Math.abs(Math.sin(l));a.style.marginLeft=Math.floor((g-(g*h+k*m))/2)+"px";a.style.marginTop=Math.floor((k-(g*m+k*h))/2)+"px"}return b}}})(jQuery);"use strict";
Finder.prototype.commands.rm=function(){this.shortcuts=[{pattern:"delete ctrl+backspace"}];this.getstate=function(a){var b=this.fm;a=a||b.selected();return!this._disabled&&a.length&&$.map(a,function(a){var d=b.file(a);return d&&d.phash&&!d.locked?a:null}).length==a.length?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){a&&b.error(a)}),d=this.files(a),e=d.length,f=b.cwd().hash,g=!1;if(!e||this._disabled)return c.reject();$.each(d,function(a,d){if(!d.phash)return!c.reject(["errRm",
d.name,"errPerm"]);if(d.locked)return!c.reject(["errLocked",d.name]);d.hash==f&&(g=b.root(d.hash))});"rejected"!=c.state()&&(d=this.hashes(a),b.confirm({title:this.title,text:"confirmRm",accept:{label:"btnRm",callback:function(){b.lockfiles({files:d});b.request({data:{cmd:"rm",targets:d},notify:{type:"rm",cnt:e},preventFail:!0}).fail(function(a){c.reject(a)}).done(function(a){c.done(a);g&&b.exec("open",g)}).always(function(){b.unlockfiles({files:d})})}},cancel:{label:"btnCancel",callback:function(){c.reject()}}}));
return c}};"use strict";Finder.prototype.commands.search=function(){this.title="Find files";this.options={ui:"searchbutton"};this.alwaysEnabled=!0;this.updateOnSelect=!1;this.getstate=function(){return 0};this.exec=function(a){var b=this.fm;if("string"==typeof a&&a)return b.trigger("searchstart",{query:a}),b.request({data:{cmd:"search",q:a},notify:{type:"search",cnt:1,hideCnt:!0}});b.getUI("toolbar").find("."+b.res("class","searchbtn")+" :text").focus();return $.Deferred().reject()}};"use strict";
Finder.prototype.commands.sort=function(){this.options={ui:"sortbutton"};this.getstate=function(){return 0};this.exec=function(a,b){var c=this.fm;b=$.extend({type:c.sortType,order:c.sortOrder,stick:c.sortStickFolders},b);this.fm.setSort(b.type,b.order,b.stick);return $.Deferred().resolve()}};
Finder.prototype.commands.unmount=function(){var a=this.fm;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.getstate=function(b){return!b||1<b.length?-1:a.file(b[0]).net?0:-1};this.exec=function(b){var c=b[0],d=$.Deferred();return a.request({data:{cmd:"unmount",target:c},notify:{type:"unmount",cnt:1}}).fail(function(a){d.reject(a)}).done(function(a){d.resolve();$("#nav-"+c).closest(".finder-navbar-wrapper").detach();$(".finder-navbar-wrapper:first span:first").click()})}};"use strict";
Finder.prototype.commands.up=function(){this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+up"}];this.getstate=function(){return this.fm.cwd().phash?0:-1};this.exec=function(){return this.fm.cwd().phash?this.fm.exec("open",this.fm.cwd().phash):$.Deferred().reject()}};"use strict";
Finder.prototype.commands.upload=function(){var a=this.fm.res("class","hover");this.disableOnSearch=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+u"}];this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1};this.exec=function(b){var c=this.fm,d=function(a){f.finderdialog("close");c.upload(a).fail(function(a){e.reject(a)}).done(function(a){e.resolve(a)})},e,f,g,k,h,m;if(this.disabled())return $.Deferred().reject();if(b&&(b.input||b.files))return c.upload(b);e=$.Deferred();
g=$('<input type="file" multiple="true"/>').change(function(){d({input:g[0]})});k=$('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+c.i18n("selectForUpload")+"</span></div>").append($("<form/>").append(g)).hover(function(){k.toggleClass(a)});f=$('<div class="finder-upload-dialog-wrapper"/>').append(k);m=$('<div class="ui-corner-all finder-upload-dropbox" contenteditable=true></div>').focus(function(){if(this.innerHTML){var a=this.innerHTML.match(/<[^>]+>/)?
"html":"text",b=this.innerHTML;this.innerHTML="";d({files:[b],type:a})}}).bind("dragenter mouseover",function(){this.focus();$(m).addClass(a)}).bind("dragleave mouseout",function(){this.blur();$(m).removeClass(a)}).bind("mouseup keyup",function(){setTimeout(function(){$(m).focus()},100)});c.dragUpload?(h=$('<div class="ui-corner-all finder-upload-dropbox">'+c.i18n("dropFiles")+"</div>").prependTo(f).after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>").after(m).after("<div>"+c.i18n("dropFilesBrowser")+
"</div>").after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>")[0],h.addEventListener("dragenter",function(b){b.stopPropagation();b.preventDefault();$(h).addClass(a)},!1),h.addEventListener("dragleave",function(b){b.stopPropagation();b.preventDefault();$(h).removeClass(a)},!1),h.addEventListener("dragover",function(b){b.stopPropagation();b.preventDefault();$(h).addClass(a)},!1),h.addEventListener("drop",function(a){a.stopPropagation();a.preventDefault();var b=!1,c="";a.dataTransfer&&
a.dataTransfer.files&&a.dataTransfer.files.length?(b=a.dataTransfer.files,c="files"):a.dataTransfer.getData("text/html")?(b=[a.dataTransfer.getData("text/html")],c="html"):a.dataTransfer.getData("text")&&(b=[a.dataTransfer.getData("text")],c="text");b&&d({files:b,type:c})},!1)):$("<div>"+c.i18n("dropFilesBrowser")+"</div>").append(m).prependTo(f).after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>")[0];c.dialog(f,{title:this.title,modal:!0,resizable:!1,destroyOnClose:!0});return e}};
"use strict";Finder.prototype.commands.view=function(){this.value=this.fm.viewType;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.options={ui:"viewbutton"};this.getstate=function(){return 0};this.exec=function(){var a=this.fm.storage("view","list"==this.value?"icons":"list");this.fm.viewchange();this.update(void 0,a)}};