You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
216 KiB

var zt=Object.create;var _=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty;var Qt=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),Gt=(i,n)=>{for(var e in n)_(i,e,{get:n[e],enumerable:!0})},ut=(i,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Vt(n))!Wt.call(i,s)&&s!==e&&_(i,s,{get:()=>n[s],enumerable:!(t=qt(n,s))||t.enumerable});return i};var Kt=(i,n,e)=>(e=i!=null?zt(Jt(i)):{},ut(n||!i||!i.__esModule?_(e,"default",{value:i,enumerable:!0}):e,i)),Zt=i=>ut(_({},"__esModule",{value:!0}),i);var a=(i,n,e)=>new Promise((t,s)=>{var o=c=>{try{u(e.next(c))}catch(g){s(g)}},r=c=>{try{u(e.throw(c))}catch(g){s(g)}},u=c=>c.done?t(c.value):Promise.resolve(c.value).then(o,r);u((e=e.apply(i,n)).next())});var _t=Qt(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});var f=require("obsidian"),it="YYYY-MM-DD",st="gggg-[W]ww",Et="YYYY-MM",It="YYYY-[Q]Q",Ft="YYYY";function L(i){var e,t;let n=window.app.plugins.getPlugin("periodic-notes");return n&&((t=(e=n.settings)==null?void 0:e[i])==null?void 0:t.enabled)}function B(){var i,n,e,t;try{let{internalPlugins:s,plugins:o}=window.app;if(L("daily")){let{format:g,folder:d,template:p}=((n=(i=o.getPlugin("periodic-notes"))==null?void 0:i.settings)==null?void 0:n.daily)||{};return{format:g||it,folder:(d==null?void 0:d.trim())||"",template:(p==null?void 0:p.trim())||""}}let{folder:r,format:u,template:c}=((t=(e=s.getPluginById("daily-notes"))==null?void 0:e.instance)==null?void 0:t.options)||{};return{format:u||it,folder:(r==null?void 0:r.trim())||"",template:(c==null?void 0:c.trim())||""}}catch(s){console.info("No custom daily note settings found!",s)}}function R(){var i,n,e,t,s,o,r;try{let u=window.app.plugins,c=(i=u.getPlugin("calendar"))==null?void 0:i.options,g=(e=(n=u.getPlugin("periodic-notes"))==null?void 0:n.settings)==null?void 0:e.weekly;if(L("weekly"))return{format:g.format||st,folder:((t=g.folder)==null?void 0:t.trim())||"",template:((s=g.template)==null?void 0:s.trim())||""};let d=c||{};return{format:d.weeklyNoteFormat||st,folder:((o=d.weeklyNoteFolder)==null?void 0:o.trim())||"",template:((r=d.weeklyNoteTemplate)==null?void 0:r.trim())||""}}catch(u){console.info("No custom weekly note settings found!",u)}}function k(){var n,e,t,s;let i=window.app.plugins;try{let o=L("monthly")&&((e=(n=i.getPlugin("periodic-notes"))==null?void 0:n.settings)==null?void 0:e.monthly)||{};return{format:o.format||Et,folder:((t=o.folder)==null?void 0:t.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom monthly note settings found!",o)}}function M(){var n,e,t,s;let i=window.app.plugins;try{let o=L("quarterly")&&((e=(n=i.getPlugin("periodic-notes"))==null?void 0:n.settings)==null?void 0:e.quarterly)||{};return{format:o.format||It,folder:((t=o.folder)==null?void 0:t.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom quarterly note settings found!",o)}}function O(){var n,e,t,s;let i=window.app.plugins;try{let o=L("yearly")&&((e=(n=i.getPlugin("periodic-notes"))==null?void 0:n.settings)==null?void 0:e.yearly)||{};return{format:o.format||Ft,folder:((t=o.folder)==null?void 0:t.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom yearly note settings found!",o)}}function Dt(...i){let n=[];for(let t=0,s=i.length;t<s;t++)n=n.concat(i[t].split("/"));let e=[];for(let t=0,s=n.length;t<s;t++){let o=n[t];!o||o==="."||e.push(o)}return n[0]===""&&e.unshift(""),e.join("/")}function ne(i){let n=i.substring(i.lastIndexOf("/")+1);return n.lastIndexOf(".")!=-1&&(n=n.substring(0,n.lastIndexOf("."))),n}function ie(i){return a(this,null,function*(){let n=i.replace(/\\/g,"/").split("/");if(n.pop(),n.length){let e=Dt(...n);window.app.vault.getAbstractFileByPath(e)||(yield window.app.vault.createFolder(e))}})}function x(i,n){return a(this,null,function*(){n.endsWith(".md")||(n+=".md");let e=f.normalizePath(Dt(i,n));return yield ie(e),e})}function E(i)
${n}
${s}`,e*1e3);t&&(o.noticeEl.oncontextmenu=()=>a(this,null,function*(){t()}))}function z(){return a(this,null,function*(){try{let i=yield fetch("https://obsidian.md/?"+Math.random());return i.status>=200&&i.status<300}catch(i){return!1}})}var Pt=i=>(0,q.normalizePath)(i.app.vault.configDir+"/themes")+"/",nt=(i,n,e="")=>a(void 0,null,function*(){let t=yield et(n);if(!t)return m(i,"There is no obsidian.css file in the root path of this repository, so there is no theme to install."),!1;yield vt(i,e,t);let s=`${e} theme installed from ${n}. `;return i.log(s+`[Theme Info](https://github.com/${n})`,!1),m(i,`${s}`,10,()=>a(void 0,null,function*(){window.open(`https://github.com/${n}`)})),setTimeout(()=>{i.app.customCss.setTheme(e)},500),!0}),vt=(i,n,e)=>a(void 0,null,function*(){let t=Pt(i),s=i.app.vault.adapter;(yield s.exists(t))===!1&&(yield s.mkdir(t)),yield s.write(t+n+".css",e)}),Nt=i=>a(void 0,null,function*(){let n=yield Y(),e=Object.values(n).map(s=>({display:`Theme: ${s.name} (${s.repo})`,info:s})),t=new v(i);t.setSuggesterData(e),yield t.display(s=>a(void 0,null,function*(){yield nt(i,s.info.repo,s.info.name)}))}),V=i=>("BRAT-"+i.replace("/","----")).substr(0,100),Ct=(i,n)=>a(void 0,null,function*(){i.settings.themesList=i.settings.themesList.filter(t=>t.repo!=n),i.saveSettings(),yield i.app.vault.adapter.remove(Pt(i)+V(n)+".css");let e=`Removed ${n} from BRAT themes list and deleted from vault`;i.log(e,!0),m(i,`${e}`)}),J=(i,n)=>a(void 0,null,function*(){if((yield z())===!1){console.log("BRAT: No internet detected.");return}let e,t="Checking for beta theme updates STARTED";i.log(t,!0),n&&i.settings.notificationsEnabled&&(e=new q.Notice(`BRAT
${t}`,3e4));for(let o of i.settings.themesList){let r=yield j(o.repo,"obsidian.css");r!==o.lastUpdate&&(yield ee(i,o.repo,o.lastUpdate,r))}let s="Checking for beta theme updates COMPLETED";i.log(s,!0),n&&(i.settings.notificationsEnabled&&e.hide(),m(i,s))}),ee=(i,n,e="",t="")=>a(void 0,null,function*(){let s=yield et(n);if(!s)return m(i,"There is no obsidian.css file in the root path of the ${cssGithubRepository} repository, so this theme cannot be updated."),!1;let o=V(n);yield vt(i,o,s),yt(i,n,t);let r=`${o} theme updated from ${n}. From date: ${e} to ${t} `;return i.log(r+`[Theme Info](https://github.com/${n})`,!1),m(i,`${r}`,20,()=>a(void 0,null,function*(){window.open(`https://github.com/${n}`)})),!0});var W=require("obsidian");var S=class extends W.Modal{constructor(e,t=!1){super(e.app);this.plugin=e,this.address="",this.openSettingsTabAfterwards=t}submitForm(){return a(this,null,function*(){if(this.address==="")return;let e=this.address.replace("https://github.com/","");if(yield wt(this.plugin,e)){m(this.plugin,"This plugin is already in the list for beta testing",10);return}(yield nt(this.plugin,e,V(e)))&&(yield bt(this.plugin,e),this.close())})}onOpen(){this.contentEl.createEl("h4",{text:"Github repository for beta theme:"}),this.contentEl.createEl("form",{},e=>{new W.Setting(e).addText(t=>{t.setPlaceholder("Repository (example: GitubUserName/repository-name"),t.onChange(s=>{this.address=s.trim()}),t.inputEl.addEventListener("keydown",s=>a(this,null,function*(){s.key==="Enter"&&this.address!==" "&&(s.preventDefault(),yield this.submitForm())})),t.inputEl.style.width="100%",window.setTimeout(()=>{let s=document.querySelector(".setting-item-info");s&&s.remove(),t.inputEl.focus()},10)}),e.createDiv("modal-button-container",t=>{t.createEl("button",{attr:{type:"button"},text:"Never mind"}).addEventListener("click",()=>this.close()),t.createEl("button",{attr:{type:"submit"},cls:"mod-cta",text:"Add Theme"})}),e.addEventListener("submit",t=>a(this,null,function*(){t.preventDefault(),this.address!==""&&(yield this.submitForm())}))})}onClose(){return a(this,null,function*(){this.openSettingsTabAfterwards&&(yield this.plugin.app.setting.open(),yield this.plugin.app.setting.openTabById("obsidian42-brat"))})}};var Q=class extends T.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:this.plugin.appName}),new T.Setting(e).setName("Auto-update plugins at startup").setDesc("If enabled all beta plugins will be checked for updates each time Obsidian starts.").addToggle(t=>{t.setValue(this.plugin.settings.updateAtStartup),t.onChange(s=>a(this,null,function*(){this.plugin.settings.updateAtStartup=s,yield this.plugin.saveSettings()}))}),new T.Setting(e).setName("Auto-update themes at startup").setDesc("If enabled all beta themes will be checked for updates each time Obsidian starts.").addToggle(t=>{t.setValue(this.plugin.settings.updateThemesAtStartup),t.onChange(s=>a(this,null,function*(){this.plugin.settings.updateThemesAtStartup=s,yield this.plugin.saveSettings()}))}),new T.Setting(e).setName("Ribbon Button").setDesc("Toggle ribbon button off and on.").addToggle(t=>{t.setValue(this.plugin.settings.ribbonIconEnabled),t.onChange(s=>a(this,null,function*(){this.plugin.settings.ribbonIconEnabled=s,this.plugin.settings.ribbonIconEnabled===!1?this.plugin.ribbonIcon.remove():this.plugin.showRibbonButton(),yield this.plugin.saveSettings()}))}),e.createEl("hr"),e.createEl("h2",{text:"Beta Plugin List"}),e.createEl("div",{text:'The following is a list of beta plugins added via the command palette "Add a beta plugin for testing". '}),e.createEl("p"),e.createEl("div",{text:"Click the x button next to a plugin to remove it from the list."}),e.createEl("p"),e.createEl("span").createEl("b",{text:"Note: "}),e.createSpan({text:"This does not delete the plugin, this should be done from the Community Plugins tab in Settings."}),new T.Setting(e).addButton(t=>{t.setButtonText("Add Beta plugin"),t.onClick(()=>a(this,null,function*(){this.plugin.app.setting.close(),yield this.plu
The version attribute for the release is missing from the manifest file`,15),null):(t&&m(this.plugin,`${n}
The plugin id attribute for the release is missing from the manifest file`,15),null):(t&&m(this.plugin,`${n}
This does not seem to be an obsidian plugin, as there is no manifest.json file.`,15),null)})}getAllReleaseFiles(n,e,t){return a(this,null,function*(){return{mainJs:yield H(n,e.version,"main.js"),manifest:t?yield H(n,e.version,"manifest.json"):null,styles:yield H(n,e.version,"styles.css")}})}writeReleaseFilesToPluginFolder(n,e){return a(this,null,function*(){let t=(0,K.normalizePath)(this.plugin.app.vault.configDir+"/plugins/"+n)+"/",s=this.plugin.app.vault.adapter;((yield s.exists(t))===!1||!(yield s.exists(t+"manifest.json")))&&(yield s.mkdir(t)),yield s.write(t+"main.js",e.mainJs),yield s.write(t+"manifest.json",e.manifest),e.styles&&(yield s.write(t+"styles.css",e.styles))})}addPlugin(n,e=!1,t=!1,s=!1){return a(this,null,function*(){var g;let r=yield this.validateRepository(n,!0,!1),u=!!r;if(u===!1&&(r=yield this.validateRepository(n,!1,!0)),r===null){let d=`${n}
A manifest.json or manifest-beta.json file does not exist in the root directory of the repository. This plugin cannot be installed.`;return this.plugin.log(d,!0),m(this.plugin,`${d}`,10),!1}if(!r.hasOwnProperty("version")){let d=`${n}
The manifest${u?"-beta":""}.json file in the root directory of the repository does not have a version number in the file. This plugin cannot be installed.`;return this.plugin.log(d,!0),m(this.plugin,`${d}`,10),!1}let c=()=>a(this,null,function*(){let d=yield this.getAllReleaseFiles(n,r,u);if((u||d.manifest===null)&&(d.manifest=JSON.stringify(r)),d.mainJs===null){let p=`${n}
The release is not complete and cannot be download. main.js is missing from the Release`;return this.plugin.log(p,!0),m(this.plugin,`${p}`,10),null}return d});if(e===!1){let d=yield c();if(d===null)return;yield this.writeReleaseFilesToPluginFolder(r.id,d),yield ft(this.plugin,n),yield this.plugin.app.plugins.loadManifests();let p=`${n}
The plugin has been registered with BRAT. You may still need to enable it the Community Plugin List.`;this.plugin.log(p,!0),m(this.plugin,p,10)}else{let d=this.plugin.app.vault.configDir+"/plugins/"+r.id+"/",p=null;try{p=yield this.plugin.app.vault.adapter.read(d+"manifest.json")}catch(w){if(w.errno===-4058)return yield this.addPlugin(n,!1,u),!0;console.log("BRAT - Local Manifest Load",r.id,JSON.stringify(w,null,2))}let P=yield JSON.parse(p);if(P.version!==r.version){let w=yield c();if(w===null)return;if(t){let y=`There is an update available for ${r.id} from version ${P.version} to ${r.version}. `;this.plugin.log(y+`[Release Info](https://github.com/${n}/releases/tag/${r.version})`,!1),m(this.plugin,y,30,()=>a(this,null,function*(){window.open(`https://github.com/${n}/releases/tag/${r.version}`)}))}else{yield this.writeReleaseFilesToPluginFolder(r.id,w),yield this.plugin.app.plugins.loadManifests(),(g=this.plugin.app.plugins.plugins[r.id])!=null&&g.manifest&&(yield this.reloadPlugin(r.id));let y=`${r.id}
Plugin has been updated from version ${P.version} to ${r.version}. `;this.plugin.log(y+`[Release Info](https://github.com/${n}/releases/tag/${r.version})`,!1),m(this.plugin,y,30,()=>a(this,null,function*(){window.open(`https://github.com/${n}/releases/tag/${r.version}`)}))}}else s&&m(this.plugin,`No update available for ${n}`,3)}return!0})}reloadPlugin(n){return a(this,null,function*(){let e=this.plugin.app.plugins;try{yield e.disablePlugin(n),yield e.enablePlugin(n)}catch(t){console.log("reload plugin",t)}})}updatePlugin(n,e=!1,t=!1){return a(this,null,function*(){let s=yield this.addPlugin(n,!0,e,t);return s===!1&&e===!1&&m(this.plugin,`${n}
Update of plugin failed.`),s})}checkForUpdatesAndInstallUpdates(n=!1,e=!1){return a(this,null,function*(){if((yield z())===!1){console.log("BRAT: No internet detected.");return}let t,s="Checking for plugin updates STARTED";this.plugin.log(s,!0),n&&this.plugin.settings.notificationsEnabled&&(t=new K.Notice(`BRAT
${s}`,3e4));for(let r of this.plugin.settings.pluginList)yield this.updatePlugin(r,e);let o="Checking for plugin updates COMPLETED";this.plugin.log(o,!0),n&&(t.hide(),m(this.plugin,o,10))})}deletePlugin(n){return a(this,null,function*(){let e=`Removed ${n} from BRAT plugin list`;this.plugin.log(e,!0),this.plugin.settings.pluginList=this.plugin.settings.pluginList.filter(t=>t!=n),this.plugin.saveSettings()})}getEnabledDisabledPlugins(n){let e=this.plugin.app.plugins,t=Object.values(e.manifests),s=Object.values(e.plugins).map(o=>o.manifest);return n?t.filter(o=>s.find(r=>o.id===r.id)):t.filter(o=>!s.find(r=>o.id===r.id))}};var At=require("obsidian");function St(){(0,At.addIcon)("BratIcon",'<path fill="currentColor" stroke="currentColor" d="M 41.667969 41.667969 C 41.667969 39.367188 39.800781 37.5 37.5 37.5 C 35.199219 37.5 33.332031 39.367188 33.332031 41.667969 C 33.332031 43.96875 35.199219 45.832031 37.5 45.832031 C 39.800781 45.832031 41.667969 43.96875 41.667969 41.667969 Z M 60.417969 58.582031 C 59.460938 58.023438 58.320312 57.867188 57.25 58.148438 C 56.179688 58.429688 55.265625 59.125 54.707031 60.082031 C 53.746094 61.777344 51.949219 62.820312 50 62.820312 C 48.050781 62.820312 46.253906 61.777344 45.292969 60.082031 C 44.734375 59.125 43.820312 58.429688 42.75 58.148438 C 41.679688 57.867188 40.539062 58.023438 39.582031 58.582031 C 37.597656 59.726562 36.910156 62.257812 38.042969 64.25 C 40.5 68.53125 45.0625 71.171875 50 71.171875 C 54.9375 71.171875 59.5 68.53125 61.957031 64.25 C 63.089844 62.257812 62.402344 59.726562 60.417969 58.582031 Z M 62.5 37.5 C 60.199219 37.5 58.332031 39.367188 58.332031 41.667969 C 58.332031 43.96875 60.199219 45.832031 62.5 45.832031 C 64.800781 45.832031 66.667969 43.96875 66.667969 41.667969 C 66.667969 39.367188 64.800781 37.5 62.5 37.5 Z M 50 8.332031 C 26.988281 8.332031 8.332031 26.988281 8.332031 50 C 8.332031 73.011719 26.988281 91.667969 50 91.667969 C 73.011719 91.667969 91.667969 73.011719 91.667969 50 C 91.667969 26.988281 73.011719 8.332031 50 8.332031 Z M 50 83.332031 C 33.988281 83.402344 20.191406 72.078125 17.136719 56.363281 C 14.078125 40.644531 22.628906 24.976562 37.5 19.042969 C 37.457031 19.636719 37.457031 20.238281 37.5 20.832031 C 37.5 27.738281 43.097656 33.332031 50 33.332031 C 52.300781 33.332031 54.167969 31.46875 54.167969 29.167969 C 54.167969 26.867188 52.300781 25 50 25 C 47.699219 25 45.832031 23.132812 45.832031 20.832031 C 45.832031 18.53125 47.699219 16.667969 50 16.667969 C 68.410156 16.667969 83.332031 31.589844 83.332031 50 C 83.332031 68.410156 68.410156 83.332031 50 83.332031 Z M 50 83.332031 " />')}var $=require("obsidian"),Ht=Kt(_t());function Yt(i,n,e=!1){if(i.settings.debuggingMode&&console.log("BRAT: "+n),i.settings.loggingEnabled){if(i.settings.loggingVerboseEnabled===!1&&e===!0)return;{let t=i.settings.loggingPath+".md",s="[["+(0,$.moment)().format((0,Ht.getDailyNoteSettings)().format).toString()+"]] "+(0,$.moment)().format("HH:mm"),o=$.Platform.isDesktop?window.require("os").hostname():"MOBILE",r=s+" "+o+" "+n.replace(`
`," ")+`
`;setTimeout(()=>a(this,null,function*(){if((yield i.app.vault.adapter.exists(t))===!0){let u=yield i.app.vault.adapter.read(t);r=r+u;let c=i.app.vault.getAbstractFileByPath(t);yield i.app.vault.modify(c,r)}else yield i.app.vault.create(t,r)}),10)}}}var U=class{constructor(n){this.bratCommands=[{id:"BRAT-AddBetaPlugin",icon:"BratIcon",name:"Plugins: Add a beta plugin for testing",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.displayAddNewPluginModal()})},{id:"BRAT-checkForUpdatesAndUpdate",icon:"BratIcon",name:"Plugins: Check for updates to all beta plugins and UPDATE",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.checkForUpdatesAndInstallUpdates(!0,!1)})},{id:"BRAT-checkForUpdatesAndDontUpdate",icon:"BratIcon",name:"Plugins: Only check for updates to beta plugins, but don't Update",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.checkForUpdatesAndInstallUpdates(!0,!0)})},{id:"BRAT-updateOnePlugin",icon:"BratIcon",name:"Plugins: Choose a single plugin to update",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=Object.values(this.plugin.settings.pluginList).map(t=>({display:t,info:t})),e=new v(this.plugin);e.setSuggesterData(n),yield e.display(t=>a(this,null,function*(){let s=`Checking for updates for ${t.info}`;this.plugin.log(s,!0),m(this.plugin,`
${s}`,3),yield this.plugin.betaPlugins.updatePlugin(t.info,!1,!0)}))})},{id:"BRAT-restartPlugin",icon:"BratIcon",name:"Plugins: Restart a plugin that is already installed",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=Object.values(this.plugin.app.plugins.manifests).map(t=>({display:t.id,info:t.id})),e=new v(this.plugin);e.setSuggesterData(n),yield e.display(t=>a(this,null,function*(){m(this.plugin,`${t.info}
Plugin reloading .....`,5),yield this.plugin.betaPlugins.reloadPlugin(t.info)}))})},{id:"BRAT-disablePlugin",icon:"BratIcon",name:"Plugins: Disable a plugin - toggle it off",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=this.plugin.betaPlugins.getEnabledDisabledPlugins(!0).map(t=>({display:`${t.name} (${t.id})`,info:t.id})),e=new v(this.plugin);e.setSuggesterData(n),yield e.display(t=>a(this,null,function*(){this.plugin.log(`${t.display} plugin disabled`,!1),yield this.plugin.app.plugins.disablePlugin(t.info)}))})},{id:"BRAT-enablePlugin",icon:"BratIcon",name:"Plugins: Enable a plugin - toggle it on",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=this.plugin.betaPlugins.getEnabledDisabledPlugins(!1).map(t=>({display:`${t.name} (${t.id})`,info:t.id})),e=new v(this.plugin);e.setSuggesterData(n),yield e.display(t=>a(this,null,function*(){this.plugin.log(`${t.display} plugin enabled`,!1),yield this.plugin.app.plugins.enablePlugin(t.info)}))})},{id:"BRAT-openGitHubZRepository",icon:"BratIcon",name:"Plugins: Open the GitHub repository for a plugin",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=yield mt(),e=Object.values(n).map(o=>({display:`Plugin: ${o.name} (${o.repo})`,info:o.repo})),t=Object.values(this.plugin.settings.pluginList).map(o=>({display:"BRAT: "+o,info:o}));e.forEach(o=>t.push(o));let s=new v(this.plugin);s.setSuggesterData(t),yield s.display(o=>a(this,null,function*(){o.info&&window.open(`https://github.com/${o.info}`)}))})},{id:"BRAT-openGitHubRepoTheme",icon:"BratIcon",name:"Themes: Open the GitHub repository for a theme (appearance)",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=yield Y(),e=Object.values(n).map(s=>({display:`Theme: ${s.name} (${s.repo})`,info:s.repo})),t=new v(this.plugin);t.setSuggesterData(e),yield t.display(s=>a(this,null,function*(){s.info&&window.open(`https://github.com/${s.info}`)}))})},{id:"BRAT-opentPluginSettings",icon:"BratIcon",name:"Plugins: Open Plugin Settings Tab",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=this.plugin.app.setting,e=Object.values(n.pluginTabs).map(o=>({display:"Plugin: "+o.name,info:o.id})),t=new v(this.plugin),s=Object.values(n.settingTabs).map(o=>({display:"Core: "+o.name,info:o.id}));e.forEach(o=>s.push(o)),t.setSuggesterData(s),yield t.display(o=>a(this,null,function*(){n.open(),n.openTabById(o.info)}))})},{id:"BRAT-GrabCommunityTheme",icon:"BratIcon",name:"Themes: Grab a community theme",showInRibbon:!0,callback:()=>a(this,null,function*(){return yield Nt(this.plugin)})},{id:"BRAT-GrabBetaTheme",icon:"BratIcon",name:"Themes: Grab a beta theme for testing from a Github repository",showInRibbon:!0,callback:()=>a(this,null,function*(){new S(this.plugin).open()})},{id:"BRAT-updateBetaThemes",icon:"BratIcon",name:"Themes: Update beta themes",showInRibbon:!0,callback:()=>a(this,null,function*(){return yield J(this.plugin,!0)})},{id:"BRAT-switchTheme",icon:"BratIcon",name:"Themes: Switch Active Theme ",showInRibbon:!0,callback:()=>a(this,null,function*(){let n=Object.values(this.plugin.app.customCss.themes).map(t=>({display:t,info:t}));n.unshift({display:"Obsidian Default Theme",info:""});let e=new v(this.plugin);e.setSuggesterData(n),yield e.display(t=>a(this,null,function*(){this.plugin.log(`Switched to theme ${t.display}`,!1),this.plugin.app.customCss.setTheme(t.info)}))})},{id:"BRAT-allCommands",icon:"BratIcon",name:"All Commands list",showInRibbon:!1,callback:()=>a(this,null,function*(){return this.ribbonDisplayCommands()})}];this.plugin=n,this.bratCommands.forEach(e=>a(this,null,function*(){this.plugin.addCommand({id:e.id,name:e.name,icon:e.icon,callback:()=>a(this,null,function*(){yield e.callback()})})}))}ribbonDisplayCommands(){return a(this,null,function*(){let n=[];this.bratCommands.forEach(r=>{r.showInRibbon&&n.push({display:r.name,info:r.callback})});let e=new v(this.plugin),t=this.plugin.app.setting,s=Object.values(t.settingTabs).map(r=>({display:"Core: "+r.name,info:()=>a(this,null,function*(){t.open(),t.openTabById(r.id)})})),o=Object.values(t.pluginTabs).map(r=>({display:"Plugi
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vbm9kZV9tb2R1bGVzL29ic2lkaWFuLWRhaWx5LW5vdGVzLWludGVyZmFjZS9kaXN0L21haW4uanMiLCAiLi4vc3JjL21haW4udHMiLCAiLi4vc3JjL3VpL1NldHRpbmdzVGFiLnRzIiwgIi4uL3NyYy9mZWF0dXJlcy90aGVtZXMudHMiLCAiLi4vc3JjL3VpL0dlbmVyaWNGdXp6eVN1Z2dlc3Rlci50cyIsICIuLi9zcmMvZmVhdHVyZXMvZ2l0aHViVXRpbHMudHMiLCAiLi4vc3JjL3VpL3NldHRpbmdzLnRzIiwgIi4uL3NyYy91dGlscy9ub3RpZmljYXRpb25zLnRzIiwgIi4uL3NyYy91dGlscy9pbnRlcm5ldGNvbm5lY3Rpb24udHMiLCAiLi4vc3JjL3VpL0FkZE5ld1RoZW1lLnRzIiwgIi4uL3NyYy91aS9BZGROZXdQbHVnaW5Nb2RhbC50cyIsICIuLi9zcmMvZmVhdHVyZXMvQmV0YVBsdWdpbnMudHMiLCAiLi4vc3JjL3VpL2ljb25zLnRzIiwgIi4uL3NyYy91dGlscy9sb2dnaW5nLnRzIiwgIi4uL3NyYy91aS9QbHVnaW5Db21tYW5kcy50cy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