drill.init(async(e,a)=>{let l=await e("common/source"),[t,c,i]=await e("util/u-menu -pack","util/u-prompt -pack","util/u-confirm -pack"),s=a.que(".dirs");s.on("click",".dirblock",e=>{let{delegateTarget:l}=e;s.que(".selected").class.remove("selected"),l.class.add("selected");let t=l.tagid;switch(t){case"all":a.queAll(".pic_block").forEach(e=>e.class.remove("hide"));break;case"notag":a.queAll(".pic_block").forEach(e=>{0 in e.tagid?e.class.add("hide"):e.class.remove("hide")});break;default:/^\..+/.test(t)?a.queAll(".pic_block").forEach(e=>{/.+(\..+?$)/.exec(e.path)[1]==t?e.class.remove("hide"):e.class.add("hide")}):a.queAll(".pic_block").forEach(e=>{e.tagid.includes(t)?e.class.remove("hide"):e.class.add("hide")})}}),a.que(".add_btn").on("click",e=>{d.parent.class.remove("hide"),d.ele.focus()});const d=a.que(".add_fenlei");d.on("keypress",function(e){if(13==e.originalEvent.keyCode){let e=this.ele.value;if(l.tags.find(a=>a.name==e))return;l.tags.push({tag:"source-tag",xvele:1,name:e,tagid:String(Math.floor(1e10*Math.random()))}),this.ele.value=""}}),d.on("blur",e=>{d.parent.class.add("hide")}),a.que(".fenlei").on("contextmenu","source-tag",e=>{if(e.preventDefault(),a.class.contains("selected_img_mode"))return;let l=e.delegateTarget;t({title:"分类 "+l.name,options:[{name:"重命名"},{name:"删除"}],event:e,callback:async e=>{switch(e.index){case 0:(t=await c({value:l.name,title:`将分类 ${l.name} 修改为？`}))&&(l.name=t);break;case 1:var t;if(t=await i(`是否删除 ${l.name} 分类？`)){let e=l.tagid;a.queAll(".pic_block").forEach(a=>{a.tagid.includes(e)&&a.tagid.remove(e)}),l.remove()}}}})})});