vare;(function(){vare,t,r,n,a,i;(t=classextendsthis.OS.application.BaseApplication{constructor(e){super("Blogger",e)}main(){returnthis.user={},this.cvlist=this.find("cv-list"),this.cvlist.ontreeselect=e=>{vart;if(e)returnt=e.data.item.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.ontabselect=e=>this.fetchData(e.data.container.aid),this.find("bt-user-save").onbtclick=e=>this.saveUser(),this.find("cv-cat-add").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").onbtclick=e=>{vart,r;if((r=this.cvlist.selectedItem)&&(t=r.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").onbtclick=e=>{vart,r;if((r=this.cvlist.selectedItem)&&(t=r.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").onbtclick=e=>{vart,n;if(n=this.cvlist.selectedItem)return(t=n.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").onbtclick=e=>{vart,r;return(r=this.find("cv-sec-list").selectedItem)?(t=r.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").onbtclick=e=>{vart,n;return(n=this.find("cv-sec-list").selectedItem)?(t=n.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.onitemclose=e=>{vart;if(e)returnt=e.data.item.data,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.delete(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","horizontal-rule",{name:"image",className:"fa fa-file-image-o",action:e=>this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(e=>e.