`)}function y(n,e){if(!(n==null?void 0:n.headings))return"";let{headings:t}=n,s=t.filter(i=>!!i&&i.level>=e.min_depth&&i.level<=e.max_depth);return s.length?G(s.map(i=>new O(i)),e):""}var _=class extends T.MarkdownRenderChild{constructor(e,t,s,i){super(i);this.app=e;this.config=t;this.filePath=s;this.container=i;this.onSettingsChangeHandler=e=>{this.render(x(this.config,e))};this.onFileChangeHandler=e=>{e.deleted||e.path!==this.filePath||this.render()}}onload(){return a(this,null,function*(){yield this.render(),this.registerEvent(this.app.metadataCache.on("dynamic-toc:settings",this.onSettingsChangeHandler)),this.registerEvent(this.app.metadataCache.on("changed",this.onFileChangeHandler))})}render(e){return a(this,null,function*(){this.container.empty(),this.container.classList.add(g);let t=y(this.app.metadataCache.getCache(this.filePath),e||this.config);yield T.MarkdownRenderer.renderMarkdown(t,this.container,this.filePath,this)})}};var o=c(require("obsidian"));var w=class extends o.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"Dynamic Table of Contents Settings"}),new o.Setting(e).setName("List Style").setDesc("The table indication").addDropdown(s=>s.addOptions({bullet:"Bullet",number:"Number"}).setValue(this.plugin.settings.style).onChange(i=>a(this,null,function*(){this.plugin.settings.style=i,yield this.plugin.saveSettings()}))),new o.Setting(e).setName("Minimum Header Depth").setDesc("The default minimum header depth to render").addSlider(s=>s.setLimits(1,6,1).setValue(this.plugin.settings.min_depth).setDynamicTooltip().onChange(i=>a(this,null,function*(){i>this.plugin.settings.max_depth?new o.Notice("Min Depth is higher than Max Depth"):(this.plugin.settings.min_depth=i,yield this.plugin.saveSettings())}))),new o.Setting(e).setName("Maximum Header Depth").setDesc("The default maximum header depth to render").addSlider(s=>s.setLimits(1,6,1).setValue(this.plugin.settings.max_depth).setDynamicTooltip().onChange(i=>a(this,null,function*(){i<this.plugin.settings.min_depth?new o.Notice("Max Depth is higher than Min Depth"):(this.plugin.settings.max_depth=i,yield this.plugin.saveSettings())})));let t=new o.Setting(e).setName("External rendering support").setDesc("Different markdown viewers provided Table of Contents support such as [TOC] or [[_TOC_]]. You may need to restart Obsidian for this to take effect.").addDropdown(s=>s.addOptions(Object.keys(d).reduce((i,r)=>{let p=d[r];return u(m({},i),{[r]:p})},{})).setDisabled(this.plugin.settings.supportAllMatchers).setValue(this.plugin.settings.externalStyle).onChange(i=>a(this,null,function*(){this.plugin.settings.externalStyle=i,yield this.plugin.saveSettings()})));new o.Setting(e).setName("Support all external renderers").setDesc("Cannot be used in conjunction with individual renderers").addToggle(s=>s.setValue(this.plugin.settings.supportAllMatchers).onChange(i=>a(this,null,function*(){this.plugin.settings.supportAllMatchers=i,t.setDisabled(i),yield this.plugin.saveSettings()})))}};var C=c(require("obsidian"));var f=class extends C.MarkdownRenderChild{constructor(e,t,s,i,r){super(i);this.app=e;this.settings=t;this.filePath=s;this.match=r;this.onSettingsChangeHandler=()=>{this.render()};this.onFileChangeHandler=e=>{e.deleted||e.path!==this.filePath||this.render()}}static findMatch(e,t){return Array.from(e.querySelectorAll("p, span, a")).find(i=>i.textContent.toLowerCase().includes(t.toLowerCase()))||null}onload(){return a(this,null,function*(){this.render(),this.registerEvent(this.app.metadataCache.on("dynamic-toc:settings",this.onSettingsChangeHandler)),this.registerEvent(this.app.metadataCache.on("changed",this.onFileChangeHandler))})}render(){return a(this,null,function*(){let e=y(this.app.metadataCache.getCache(this.filePath),this.settings),t=document.createElement("div");t.classList.add(g),yield C.MarkdownRenderer.renderMarkdown(e,t,this.filePath,this),this.match.style.display="none";let s=this.containerEl.querySelector(R);s&&this.containerEl.removeChild(s),this.match.parentNode.appendCh