varOS;!function(t){lete;!function(t){classeextendst.BaseApplication{constructor(t){super("Blogger",t),this.previewOn=!1}asyncinit_db(){try{conste=awaitthis.openDialog("FileDialog",{title:__("Open/create new database"),file:"Untitled.db"});vart=e.file.path.asFileHandle();"file"===e.file.type&&(t=t.parent());consti=`${t.path}/${e.name}`.asFileHandle();this.dbhandle=("sqlite://"+i.genealogy.join("/")).asFileHandle();consta=awaitthis.dbhandle.read();if(!a.user){this.dbhandle.cache={address:"TEXT",Phone:"TEXT",shortbiblio:"TEXT",fullname:"TEXT",email:"TEXT",url:"TEXT",photo:"TEXT"};constt=awaitthis.dbhandle.write("user");if(t.error)thrownewError(t.error)}if(!a.cv_cat){this.dbhandle.cache={publish:"NUMERIC",name:"TEXT",pid:"NUMERIC"};constt=awaitthis.dbhandle.write("cv_cat");if(t.error)thrownewError(t.error)}if(!a.cv_sections){this.dbhandle.cache={title:"TEXT",start:"NUMERIC",location:"TEXT",end:"NUMERIC",content:"TEXT",subtitle:"TEXT",publish:"NUMERIC",cid:"NUMERIC"};constt=awaitthis.dbhandle.write("cv_sections");if(t.error)thrownewError(t.error)}if(!a.blogs){this.dbhandle.cache={tags:"TEXT",content:"TEXT",utime:"NUMERIC",rendered:"TEXT",title:"TEXT",utimestr:"TEXT",ctime:"NUMERIC",ctimestr:"TEXT",publish:"INTEGER DEFAULT 0"};constt=awaitthis.dbhandle.write("blogs");if(t.error)thrownewError(t.error)}if(!a.st_similarity){this.dbhandle.cache={pid:"NUMERIC",sid:"NUMERIC",score:"NUMERIC"};constt=awaitthis.dbhandle.write("st_similarity");if(t.error)thrownewError(t.error)}if(!a.subscribers){this.dbhandle.cache={name:"TEXT",email:"TEXT"};constt=awaitthis.dbhandle.write("subscribers");if(t.error)thrownewError(t.error)}this.userdb=(this.dbhandle.path+"@user").asFileHandle(),this.cvcatdb=(this.dbhandle.path+"@cv_cat").asFileHandle(),this.cvsecdb=(this.dbhandle.path+"@cv_sections").asFileHandle(),this.blogdb=(this.dbhandle.path+"@blogs").asFileHandle(),this.subdb=(this.dbhandle.path+"@subscribers").asFileHandle(),this.last_ctime=0,this.bloglist.data=[],this.loadBlogs()}catch(t){this.error(__("Unable to init database file: {0}",t.toString()),t),this.dbhandle=void0}}menu(){return[{text:"__(Open/Create database)",onmenuselect:t=>{this.init_db()}}]}main(){this.user={},this.cvlist=this.find("cv-list"),this.cvlist.ontreeselect=t=>{if(!t)return;const{data:e}=t.data.item;returnthis.CVSectionByCID(Number(e.id))},this.inputtags=this.find("input-tags"),this.bloglist=this.find("blog-list"),this.seclist=this.find("cv-sec-list");lete=this.find("photo");return$(e).on("click",asynct=>{try{constt=awaitthis.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]});returne.value=t.file.path}catch(t){returnthis.error(__("Unable to get file"),t)}}),this.tabcontainer=this.find("tabcontainer"),this.tabcontainer.ontabselect=t=>this.fetchData(t.data.container.aid),this.find("bt-user-save").onbtclick=t=>this.saveUser(),this.find("blog-load-more").onbtclick=t=>{this.loadBlogs()},this.find("cv-cat-add").onbtclick=asynce=>{try{conste=awaitthis.fetchCVCat(),i=awaitthis.openDialog(newt.blogger.BloggerCategoryDialog,{title:__("Add category"),tree:e});this.cvcatdb.cache={name:i.value,pid:i.p.id,publish:1};consta=awaitthis.cvcatdb.write(void0);if(a.error)thrownewError(a.error);awaitthis.refreshCVCat()}catch(e){this.error(__("cv-cat-add: {0}",e.toString()),e)}},this.find("cv-cat-edit").onbtclick=asynce=>{try{conste=this.cvlist.selectedItem;if(!e)return;consti=e.data;if(!i)return;consta=awaitthis.fetchCVCat(),s=awaitthis.openDialog(newt.blogger.BloggerCategoryDialog,{title:__("Edit category"),tree:a,cat:i}),n=i.$vfs;n.cache={id:i.id,publish:i.publish,pid:s.p.id,name:s.value};constr=awaitn.write(void0);if(r.error)thrownewError(r.error);awaitthis.refreshCVCat()}catch(e){this.error(__("cv-cat-edit: {0}",e.toString()),e)}},this.find("cv-cat-del").onbtclick=asynct=>{try{constt=this.cvlist.selectedItem;if(!t)return;conste=t.data;if(!e)return;if(!awaitthis.openDialog("YesNoDialog",{title:__("Delete category"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",e