vare;(function(){vare,t,r,n,a,i;(t=classextendsthis.OS.GUI.BaseApplication{constructor(e){super("Blogger",e)}main(){returnthis.user={},this.cvlist=this.find("cv-list"),this.cvlist.set("ontreeselect",e=>{vart;if(e)returnt=e.data.item.get("data"),this.CVSectionByCID(Number(t.id))}),this.inputtags=this.find("input-tags"),this.bloglist=this.find("blog-list"),this.seclist=this.find("cv-sec-list"),this.userdb=newthis._api.DB("user"),this.cvcatdb=newthis._api.DB("cv_cat"),this.cvsecdb=newthis._api.DB("cv_sections"),this.blogdb=newthis._api.DB("blogs"),this.tabcontainer=this.find("tabcontainer"),this.tabcontainer.set("ontabselect",e=>this.fetchData(e.data.container.aid())),this.find("bt-user-save").set("onbtclick",e=>this.saveUser()),this.find("cv-cat-add").set("onbtclick",e=>this.fetchCVCat().then(e=>this.openDialog(newn,{title:__("Add category"),tree:e}).then(e=>{vart;returnt={name:e.value,pid:e.p.id,publish:1},this.cvcatdb.save(t).then(e=>this.refreshCVCat()).catch(e=>this.error(__("Cannot add new category"),e))}).catch(e=>this.error(e.toString(),e))).catch(e=>this.error(__("Unable to fetch categories"),e))),this.find("cv-cat-edit").set("onbtclick",e=>{vart,r;if((r=this.cvlist.get("selectedItem"))&&(t=r.get("data")))returnthis.fetchCVCat().then(e=>this.openDialog(newn,{title:__("Edit category"),tree:e,cat:t}).then(e=>{varr;returnr={id:t.id,publish:t.publish,pid:e.p.id,name:e.value},this.cvcatdb.save(r).then(e=>this.refreshCVCat()).catch(e=>this.error(__("Cannot Edit category"),e))})).catch(e=>this.error(__("Unable to fetch categories"),e))}),this.find("cv-cat-del").set("onbtclick",e=>{vart,r;if((r=this.cvlist.get("selectedItem"))&&(t=r.get("data")))returnthis.openDialog("YesNoDialog",{title:__("Delete category"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",t.name)}).then(e=>{if(e)returnthis.deleteCVCat(t)}).catch(e=>this.error(e.toString(),e))}),this.find("cv-sec-add").set("onbtclick",e=>{vart,n;if(n=this.cvlist.get("selectedItem"))return(t=n.get("data"))&&"0"!==t.id?this.openDialog(newr(this),{title:__("New section entry for {0}",t.name)}).then(e=>(e.cid=Number(t.id),e.start=Number(e.start),e.end=Number(e.end),this.cvsecdb.save(e).then(e=>this.CVSectionByCID(Number(t.id))).catch(e=>this.error(__("Cannot save section: {0}",e.toString()),e)))):this.notify(__("Please select a category"))}),this.find("cv-sec-move").set("onbtclick",e=>{vart,r;return(r=this.find("cv-sec-list").get("selectedItem"))?(t=r.get("data"),this.fetchCVCat().then(e=>this.openDialog(newn,{title:__("Move to"),tree:e,selonly:!0}).then(e=>{varr;returnr={id:t.id,cid:e.p.id},this.cvsecdb.save(r).then(e=>(this.CVSectionByCID(t.cid),this.find("cv-sec-list").unselect())).catch(e=>this.error(__("Cannot move section"),e))}))):this.notify(__("Please select a section to move"))}),this.find("cv-sec-edit").set("onbtclick",e=>{vart,n;return(n=this.find("cv-sec-list").get("selectedItem"))?(t=n.get("data"),this.openDialog(newr(this),{title:__("Modify section entry"),section:t}).then(e=>(e.cid=Number(t.cid),e.start=Number(e.start),e.end=Number(e.end),this.cvsecdb.save(e).then(e=>this.CVSectionByCID(Number(t.cid))).catch(e=>this.error(__("Cannot save section: {0}",e.toString()),e))))):this.notify(__("Please select a section to edit"))}),this.seclist.set("onitemclose",e=>{vart;if(e)returnt=e.data.item.get("data"),console.log(t),this.openDialog("YesNoDialog",{iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",t.title)}).then(r=>{if(r)returnthis.cvsecdb.delete(t.id).then(t=>this.seclist.remove(e.data.item)).catch(e=>this.error(__("Cannot delete the section: {0}",e.toString()),e))}),!1}),this.editor=newSimpleMDE({element:this.find("markarea"),autoDownloadFontAwesome:!1,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:[{name:__("New"),className:"fa fa-file",action:e=>(this.bloglist.unselect(),this.clearEditor())},{name:__("Save"),className:"fa fa-save",action:e=>this.saveBlog()},"|","bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","