import{a as D}from"./chunks/mermaid.esm/chunk-5M6CVFFU.mjs";import{r as c}from"./chunks/mermaid.esm/chunk-KTLIUP47.mjs";import{J as E,L as l,j as P,k as O,l as x}from"./chunks/mermaid.esm/chunk-IDWK7SLW.mjs";import"./chunks/mermaid.esm/chunk-MCPQR2OL.mjs";import"./chunks/mermaid.esm/chunk-PSBUIW4L.mjs";import{a as i,g as o}from"./chunks/mermaid.esm/chunk-BPWKEL6C.mjs";var H=i((e,r,a)=>{o.warn(e),E(e)?(a&&a(e.str,e.hash),r.push({...e,message:e.str,error:e})):(a&&a(e),e instanceof Error&&r.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),b=i(async function(e={querySelector:".mermaid"}){try{await k(e)}catch(r){if(E(r)&&o.error(r.str),m.parseError&&m.parseError(r),!e.suppressErrors)throw o.error("Use the suppressErrors option to suppress these errors"),r}},"run"),k=i(async function({postRenderCallback:e,querySelector:r,nodes:a}={querySelector:".mermaid"}){let t=c.getConfig();o.debug(`${e?"":"No "}Callback function found`);let d;if(a)d=a;else if(r)d=document.querySelectorAll(r);else throw new Error("Nodes and querySelector are both undefined");o.debug(`Found ${d.length} diagrams`),t?.startOnLoad!==void 0&&(o.debug("Start On Load: "+t?.startOnLoad),c.updateSiteConfig({startOnLoad:t?.startOnLoad}));let u=new l.initIdGenerator(t.deterministicIds,t.deterministicIDSeed),f,s=[];for(let n of Array.from(d)){o.info("Rendering diagram: "+n.id);if(n.getAttribute("data-processed"))continue;n.setAttribute("data-processed","true");let h=`mermaid-${u.next()}`;f=n.innerHTML,f=D(l.entityDecode(f)).trim().replace(//gi,"
");let w=l.detectInit(f);w&&o.debug("Detected early reinit: ",w);try{let{svg:g,bindFunctions:L}=await C(h,f,n);n.innerHTML=g,e&&await e(h),L&&L(n)}catch(g){H(g,s,m.parseError)}}if(s.length>0)throw s[0]},"runThrowsErrors"),M=i(function(e){c.initialize(e)},"initialize"),A=i(async function(e,r,a){o.warn("mermaid.init is deprecated. Please use run instead."),e&&M(e);let t={postRenderCallback:a,querySelector:".mermaid"};typeof r=="string"?t.querySelector=r:r&&(r instanceof HTMLElement?t.nodes=[r]:t.nodes=r),await b(t)},"init"),S=i(async(e,{lazyLoad:r=!0}={})=>{O(...e),r===!1&&await x()},"registerExternalDiagrams"),R=i(function(){if(m.startOnLoad){let{startOnLoad:e}=c.getConfig();e&&m.run().catch(r=>o.error("Mermaid failed to initialize",r))}},"contentLoaded");if(typeof document<"u"){window.addEventListener("load",R,!1)}var q=i(function(e){m.parseError=e},"setParseErrorHandler"),p=[],y=!1,T=i(async()=>{if(!y){for(y=!0;p.length>0;){let e=p.shift();if(e)try{await e()}catch(r){o.error("Error executing queue",r)}}y=!1}},"executeQueue"),z=i(async(e,r)=>new Promise((a,t)=>{let d=i(()=>new Promise((u,f)=>{c.parse(e,r).then(s=>{u(s),a(s)},s=>{o.error("Error parsing",s),m.parseError?.(s),f(s),t(s)})}),"performCall");p.push(d),T().catch(t)}),"parse"),C=i((e,r,a)=>new Promise((t,d)=>{let u=i(()=>new Promise((f,s)=>{c.render(e,r,a).then(n=>{f(n),t(n)},n=>{o.error("Error parsing",n),m.parseError?.(n),s(n),d(n)})}),"performCall");p.push(u),T().catch(d)}),"render"),m={startOnLoad:!0,mermaidAPI:c,parse:z,render:C,init:A,run:b,registerExternalDiagrams:S,initialize:M,parseError:void 0,contentLoaded:R,setParseErrorHandler:q,detectType:P},j=m;export{j as default}; /*! Check if previously processed */ /*! * Wait for document loaded before starting the execution */