"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7176,4792],{72412:(e,n,r)=>{r.r(n),r.d(n,{createMarkdownParser:()=>d,default:()=>l});var a=r(11296),t=r(39128),i=r(87716),o=r(89220);new a.Token("@jupyterlab/mermaid:IMermaidManager","a manager for rendering mermaid text-based diagrams");const s=new a.Token("@jupyterlab/mermaid:IMermaidMarkdown","a manager for rendering mermaid text-based diagrams in markdown fenced code blocks"),c="```~~~";function d(e,n){return{render:r=>u.render(r,e,n)}}const l={id:"@jupyterlab/markedparser-extension:plugin",description:"Provides the Markdown parser.",autoStart:!0,provides:o.IMarkdownParser,requires:[i.IEditorLanguageRegistry],optional:[s],activate:(e,n,r)=>d(n,{blocks:r?[r]:[]})};var u;!function(e){let n=null,i=null,o=[],s=null,d={},l=new t.LruCache;async function u(e){if(i)return i;if(n)return await n.promise;o=(null==e?void 0:e.blocks)||[],o=o.sort(((e,n)=>{var r,a;return(null!==(r=e.rank)&&void 0!==r?r:1/0)-(null!==(a=n.rank)&&void 0!==a?a:1/0)})),n=new a.PromiseDelegate;const[{marked:t,Renderer:s},c]=await Promise.all([r.e(7333).then(r.bind(r,17333)),f()]);for(const e of c)t.use(e);return d={async:!0,gfm:!0,walkTokens:m,renderer:g(s)},i=t,n.resolve(i),i}async function f(){return Promise.all([(async()=>(await r.e(8916).then(r.bind(r,63680))).gfmHeadingId())(),(async()=>(await r.e(4632).then(r.bind(r,4632))).mangle())()])}function g(e){const n=new e,r=n.code;return n.code=(e,a)=>{for(const n of o)if(n.languages.includes(a)){const r=n.render(e);if(null!=r)return r}const t=`${a}${c}${e}${c}`,i=l.get(t);return null!=i?i:r.call(n,e,a)},n}async function m(e){if("code"===e.type){if(e.lang)for(const n of o)if(n.languages.includes(e.lang))return void await n.walk(e.text);await async function(e){const{lang:n,text:r}=e;if(!n||!s)return;const a=`${n}${c}${r}${c}`;if(l.get(a))return;const t=document.createElement("div");try{await s.highlight(r,s.findBest(n),t);const e=`<pre><code class="language-${n}">${t.innerHTML}</code></pre>`;l.set(a,e)}catch(e){console.error(`Failed to highlight ${n} code`,e)}finally{t.remove()}}(e)}}e.render=async function(e,n,r){return s=n,i||(i=await u(r)),i(e,d)},e.initializeMarked=u}(u||(u={}))}}]);