(()=>{"use strict";var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{activate:()=>h});const t=require("vscode"),n="mermaid",o="mermaidContainer",a=3,i=":",s=i.charCodeAt(0),c=i.length;function u(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n+$/,"").trimStart()}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const l="markdown-mermaid",f="default",p=["base","forest","dark","default","neutral"];function g(e){return"string"==typeof e&&p.includes(e)?e:f}function m(e){const r=e.renderer.render;return e.renderer.render=function(...n){const o=g(t.workspace.getConfiguration(l).get("darkModeTheme")),a=g(t.workspace.getConfiguration(l).get("lightModeTheme")),i=t.workspace.getConfiguration(l).get("maxTextSize");return`<span id="${l}" aria-hidden="true"\n                    data-dark-mode-theme="${o}"\n                    data-light-mode-theme="${a}"\n                    data-max-text-size="${i}"></span>\n                ${r.apply(e.renderer,n)}`},e}function h(e){return e.subscriptions.push(t.workspace.onDidChangeConfiguration((e=>{(e.affectsConfiguration(l)||e.affectsConfiguration("workbench.colorTheme"))&&t.commands.executeCommand("markdown.preview.refresh")}))),{extendMarkdownIt:e=>(function(e,r){e.use((e=>{e.block.ruler.before("fence",o,(function(e,r,t,u){let d,l=!1,f=e.bMarks[r]+e.tShift[r],p=e.eMarks[r];if(s!==e.src.charCodeAt(f))return!1;for(d=f+1;d<=p&&i[(d-f)%c]===e.src[d];d++);const g=Math.floor((d-f)/c);if(g<a)return!1;d-=(d-f)%c;const m=e.src.slice(f,d),h=e.src.slice(d,p);if(h.trim().split(" ")[0].toLowerCase()!==n)return!1;if(u)return!0;let k=r;for(;k++,!(k>=t||(f=e.bMarks[k]+e.tShift[k],p=e.eMarks[k],f<p&&e.sCount[k]<e.blkIndent));)if(s===e.src.charCodeAt(f)&&!(e.sCount[k]-e.blkIndent>=4)){for(d=f+1;d<=p&&i[(d-f)%c]===e.src[d];d++);if(!(Math.floor((d-f)/c)<g||(d-=(d-f)%c,d=e.skipSpaces(d),d<p))){l=!0;break}}const b=e.parentType,C=e.lineMax;e.parentType="container",e.lineMax=k;const y=e.push(o,"div",1);return y.markup=m,y.block=!0,y.info=h,y.map=[r,k],y.content=e.getLines(r+1,k,e.blkIndent,!0),e.parentType=b,e.lineMax=C,e.line=k+(l?1:0),!0}),{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules[o]=(e,r)=>{const t=e[r].content;return`<div class="${n}">${u(t)}</div>`}}));const t=e.options.highlight;e.options.highlight=(e,o,a)=>{const i=new RegExp("\\b("+r.languageIds().map(d).join("|")+")\\b","i");return o&&i.test(o)?`<pre style="all:unset;"><div class="${n}">${u(e)}</div></pre>`:t?.(e,o,a)??e}}(e,{languageIds:()=>t.workspace.getConfiguration(l).get("languages",["mermaid"])}),e.use(m),e)}}module.exports=r})();
//# sourceMappingURL=index.js.map