markstream-react 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ return e(t,{children:C(n,r,`${o}-inline`,i)})}const N={note:"ℹ️",info:"ℹ
4
4
  return n("div",{className:`admonition admonition-${d}${s?" is-dark":""}`,"data-index-key":c,children:[
5
5
  /* @__PURE__ */n("div",{id:p,className:"admonition-header",children:[N[d]&&/* @__PURE__ */e("span",{className:"admonition-icon",children:N[d]}),
6
6
  /* @__PURE__ */e("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */e("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${p}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */e("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */e("div",{id:`${p}-content`,className:"admonition-content","aria-labelledby":p,children:l&&a?C(r.children,l,String(null!=c?c:p),a):null})]})}const L=a(null);function S(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,r=/* @__PURE__ */new Map;return(o,i)=>{var l,a;const c={current:!1};let s,d=!1;const u=new Promise(e=>{s=()=>{d||(d=!0,e())}}),m=()=>{for(const e of r.values())if(e.targets.has(o)){e.targets.delete(o);try{e.observer.unobserve(o)}catch{}}};if(!n||!t())return c.current=!0,s(),{isVisible:()=>!0,whenVisible:u,destroy:m};const h=((t,o)=>{var i,l;if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const a=null!=(i=e())?i:null,c=`${t}::${o}`,s=r.get(c);if(s&&s.root===a)return s;if(s){try{s.observer.disconnect()}catch{}r.delete(c)}const d=null!=(l=null==s?void 0:s.targets)?l:/* @__PURE__ */new Map,u=new IntersectionObserver(e=>{for(const t of e){const e=d.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){e.state.current=!0;try{e.resolve()}catch{}try{u.unobserve(t.target)}catch{}d.delete(t.target)}}},{root:a,rootMargin:t,threshold:o}),m={observer:u,root:a,rootMargin:t,threshold:o,targets:d};r.set(c,m);for(const e of d.keys())u.observe(e);return m})(null!=(l=null==i?void 0:i.rootMargin)?l:"300px",null!=(a=null==i?void 0:i.threshold)?a:0);return h?(h.targets.set(o,{resolve:s,state:c}),h.observer.observe(o),{isVisible:()=>c.current,whenVisible:u,destroy:m}):(c.current=!0,s(),{isVisible:()=>!0,whenVisible:u,destroy:m})}}const T=S(()=>null,()=>!0);function E({getRoot:t,enabled:n=!0,children:r}){const i=c(n);i.current=n;const l=c(t);l.current=t;const a=o(()=>S(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
7
- return e(L.Provider,{value:a,children:r})}function $(){var e;return null!=(e=l(L))?e:T}const _="__global__",D="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",j=(()=>{const e=globalThis;if(e[D])return e[D];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[D]=t,t})();function W(){j.revision++;for(const e of Array.from(j.listeners))try{e()}catch{}}function P(e){return j.listeners.add(e),()=>{j.listeners.delete(e)}}function A(){return j.revision}function O(e,t){"string"==typeof e?j.scopedComponents[e]={...t||{}}:j.scopedComponents[_]={...e},W()}function I(e){const t=j.scopedComponents[_]||{};if(!e)return t;const n=j.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function R(e){if(e===_)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete j.scopedComponents[e],W()}function H(){delete j.scopedComponents[_],W()}function z(t){const{node:n}=t;/* @__PURE__ */
7
+ return e(L.Provider,{value:a,children:r})}function $(){var e;return null!=(e=l(L))?e:T}const D="__global__",_="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",j=(()=>{const e=globalThis;if(e[_])return e[_];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[_]=t,t})();function W(){j.revision++;for(const e of Array.from(j.listeners))try{e()}catch{}}function P(e){return j.listeners.add(e),()=>{j.listeners.delete(e)}}function A(){return j.revision}function O(e,t){"string"==typeof e?j.scopedComponents[e]={...t||{}}:j.scopedComponents[D]={...e},W()}function I(e){const t=j.scopedComponents[D]||{};if(!e)return t;const n=j.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function R(e){if(e===D)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete j.scopedComponents[e],W()}function H(){delete j.scopedComponents[D],W()}function z(t){const{node:n}=t;/* @__PURE__ */
8
8
  return e("span",{className:"checkbox-node",children:/* @__PURE__ */e("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const F={"common.copy":"Copy","common.copySuccess":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function V(e){Object.assign(F,e)}function K(){return{t:e=>{var t;return null!=(t=F[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let X=null,q=null,U=null,Z=null,Y=null,G=null;function J(){Z&&(clearTimeout(Z),Z=null),Y&&(clearTimeout(Y),Y=null)}async function Q(e){if(!X||!q)return;const{x:t,y:n}=await f(q,X,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});X.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function ee(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(X||"undefined"==typeof document||(X=document.createElement("div"),X.className="ms-tooltip",X.setAttribute("role","tooltip"),X.dataset.visible="false",X.style.position="fixed",X.style.left="0px",X.style.top="0px",X.style.transform="translate3d(0,0,0)",document.body.appendChild(X)),!X)return;J();const l=async()=>{if(X){q=e,X.textContent=t,X.dataset.placement=n,X.dataset.dark=function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(i)?"true":"false",X.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,X.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),X.dataset.visible="true",null==U||U(),U=g(e,X,()=>{Q(n)})}};r?l():Z=setTimeout(l,80)}function te(e=!1){if(!X)return;J();const t=()=>{if(X){if(X.dataset.visible="false",q&&G)try{q.removeAttribute("aria-describedby")}catch{}q=null,G=null,U&&(U(),U=null)}};e?t():Y=setTimeout(t,120)}let ne=null;function re(e){ne=null!=e?e:null}const oe={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"};function ie(e){var t;const n=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e);return null!=(t=oe[n])?t:n}function le(e){const t=ie(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}function ae(e){if(ne){const t=ne(e);if(null!=t&&""!==t)return t}switch(ie(e)){case"javascript":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n\n';case"typescript":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n\n';case"jsx":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n';case"tsx":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n';case"html":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n\n';case"css":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n\n';case"json":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n\n';case"python":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n\n';case"shell":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n\n';case"markdown":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n\n';case"mermaid":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n\n';case"svg":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />\n</svg>\n\n';case"vue":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n\n';case"cpp":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n\n';case"plain":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n\n';default:return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n\n'}}const ce={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid"};function se(t){const r=o(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`},[t.code,t.isDark]);return s(()=>{const e=e=>{var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[t]),"undefined"==typeof document?null:x(
9
9
  /* @__PURE__ */e("div",{className:"html-preview-frame__backdrop"+(t.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:/* @__PURE__ */n("div",{className:"html-preview-frame"+(t.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
10
10
  /* @__PURE__ */n("div",{className:"html-preview-frame__header",children:[
@@ -13,7 +13,7 @@ return e("span",{className:"checkbox-node",children:/* @__PURE__ */e("input",{ty
13
13
  /* @__PURE__ */e("span",{className:"html-preview-frame__label",children:t.title||"Preview"})]}),
14
14
  /* @__PURE__ */e("button",{type:"button",className:"html-preview-frame__close"+(t.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:"×"})]}),
15
15
  /* @__PURE__ */e("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:r,title:t.title||"Preview"})]})}),document.body)}let de=!1,ue=null,me=!1;async function he(){if(ue)return ue;if(me)return null;try{return ue=await import("stream-monaco"),await async function(e){if(de)return;de=!0;const t=null==globalThis?void 0:globalThis.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&(null==e?void 0:e.preloadMonacoWorkers)&&await e.preloadMonacoWorkers()}(ue),ue}catch{return me=!0,null}}let pe=null,ge=!1,fe=null,we=null,ve=null,ye=null,xe=null;const ke=/* @__PURE__ */new WeakMap;let be=0;function Ce(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=ke.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return ke.set(e,t),t}catch{}const n="__theme_"+ ++be;return ke.set(e,n),n}return String(e)}(e);return n?(pe!==t&&(pe=t),ge||xe!==n?!fe||ye!==n&&we!==n?(ve=e,ye=n,fe||(ge=!0,fe=(async()=>{for(;null!=ve&&null!=ye;){const e=ve,t=ye;if(ve=null,ye=null,xe===t)continue;const n=pe;if(!n)break;try{we=t,await Promise.resolve(n(e)),xe=t}catch{}}})().finally(()=>{ge=!1,fe=null,we=null}),fe)):fe:Promise.resolve()):Promise.resolve()}let Me=null,Ne=null,Be=null;const Le=/* @__PURE__ */new Set,Se=/* @__PURE__ */new WeakMap;let Te=0;function Ee(){for(const e of Array.from(Le))try{e()}catch{}}function $e({node:t}){var n;const r=o(()=>function(e){var t;return String(null!=(t=String(null!=e?e:"").split(/\s+/g)[0])?t:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}(null==t?void 0:t.language),[t]),i=r?`Code block: ${r}`:"Code block";/* @__PURE__ */
16
- return e("pre",{className:`language-${r}`,"aria-busy":!0===(null==t?void 0:t.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(null!=(n=null==t?void 0:t.code)?n:"")})})}const _e={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function De(r){var l;const a={..._e,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:g,enableFontSizeControl:f,darkTheme:w,lightTheme:v,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:M,showExpandButton:N,showPreviewButton:B,showFontSizeButtons:L}=a,S=c(null),T=c(null),E=c(null),_=c(null),D=c(null),j=c(null),W=c(null),P=c(0),A=c(null),O=c(null),I=$(),R=c(y),H=c(x),z=c(y),[F,V]=i(!1),[X,q]=i(()=>"undefined"==typeof window),[U,Z]=i(!1),[Y,G]=i(!1),[J,Q]=i(!1),[ne,re]=i(()=>u.language||"plaintext"),[oe,de]=i(()=>ie(u.language)),[ue,me]=i(!1),[pe,ge]=i(!1),[fe,we]=i(!1),[ve,ye]=i(!1),{t:xe}=K(),[ke,be]=i(()=>{const e=Number(null==y?void 0:y.fontSize);return Number.isFinite(e)&&e>0?e:14}),[Se,Te]=i(ke),De=d(()=>{var e,t;const n=null!=(t=null==(e=R.current)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n&&Number.isFinite(n))return Math.max(80,n);const r=String(n).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),je=d(e=>{var t,n,r,o;if(F)return;const i=S.current,l=E.current;if(!i||!l)return;const a="diff"===j.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=De();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}e?(i.style.maxHeight="none",i.style.overflow="visible"):(i.style.maxHeight=`${Math.ceil(c)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===j.current&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,c);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[De,F]);s(()=>{R.current=y},[y]),s(()=>{de(ie(u.language))},[u.language]);const We=c(u);We.current=u;const Pe=d(()=>{var e;P.current+=1;try{null==(e=_.current)||e.call(_)}catch{}D.current=null,j.current=null,W.current=null,Q(!1),G(!1)},[]),Ae=d(()=>{var e,t,n,r,o,i;const l=S.current,a=T.current;if(!l||!a)return;const c=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(c):null,l=String(null!=(t=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?t:"").trim()||String(null!=(n=null==e?void 0:e.color)?n:"").trim(),s=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();l&&a.style.setProperty("--vscode-editor-foreground",l),s&&a.style.setProperty("--vscode-editor-background",s),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[]);s(()=>()=>{var e,t,n;P.current+=1,null==(e=_.current)||e.call(_),_.current=null,D.current=null,j.current=null,W.current=null,A.current=null,null==(n=null==(t=O.current)?void 0:t.destroy)||n.call(t),O.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(X)return;const n=T.current;if(!n)return;null==(t=null==(e=O.current)?void 0:e.destroy)||t.call(e);const r=I(n,{rootMargin:"400px"});return O.current=r,r.isVisible()&&q(!0),r.whenVisible.then(()=>q(!0)),()=>{r.destroy(),O.current===r&&(O.current=null)}},[I,X]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await he();if(!e)return;if(!r)return void V(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(A.current=i),"function"!=typeof o)return void V(!0);const l=null!=(t=m?w:v)?t:Me,a={...z.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:H.current,theme:l,...a,onThemeChange(){Ae()}});E.current=c,"function"==typeof(n=c.setTheme)&&(Be=n,null!=Me&&null!=Ne&&Ce(Me,Be).then(()=>Ee()).catch(()=>{})),_.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,Z(!0)}catch{e&&V(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!oe&&A.current)try{const t=A.current(String(null!=(e=u.code)?e:""));t&&re(t)}catch{}},[oe,u.code,u.language]);const Oe=o(()=>String(u.language||oe||ne||"plaintext"),[oe,ne,u.language]),Ie=o(()=>ie(Oe),[Oe]),Re=o(()=>le(Ie),[Ie]),He=o(()=>ae(Ie),[Ie]),ze=o(()=>!!g&&("html"===Ie||"svg"===Ie),[Ie,g]),Fe=o(()=>{const e=Ie;return e?ce[e]||e.charAt(0).toUpperCase()+e.slice(1):ce[""]||"Plain Text"},[Ie]),Ve=o(()=>{var e,t,n;return u.diff?null!=(t=null!=(e=u.updatedCode)?e:u.code)?t:"":null!=(n=u.code)?n:""},[u.code,u.diff,u.updatedCode]),Ke=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(k),r=e(b);return n&&(t.minWidth=n),r&&(t.maxWidth=r),t},[k,b]),Xe=!1===p&&h,qe=o(()=>m?w:v,[w,m,v]);s(()=>{if(F)return;if(!Y||!X)return;const e=E.current;(null==e?void 0:e.setTheme)&&qe&&Ce(qe,e.setTheme).then(Ae).catch(()=>{})},[Y,qe,Ae,F,X]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{Ae()},Le.add(e),()=>{Le.delete(e)}},[Ae]);const Ue=d(async()=>{var e,t;if(F)return null;if(!X)return null;if(fe)return null;if(Xe)return null;const n=E.current,r=S.current;if(!n||!r||!n.createEditor)return null;const o=We.current,i=o.diff?"diff":"single",l=W.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(j.current===i&&l===r&&a)return null;if(D.current)return D.current;P.current+=1;const c=P.current;G(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=_.current)||e.call(_),j.current=null,W.current=null,Q(!1);const p=Re;if(o.diff?"function"==typeof n.createDiffEditor?(j.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(j.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(j.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),W.current=r,P.current!==c)return;const g=Number(null==(d=R.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){be(g),Te(g);try{const e="diff"===j.current?null==(u=n.getDiffEditorView)?void 0:u.call(n):null==(m=n.getEditorView)?void 0:m.call(n);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:g,automaticLayout:!1})}catch{}}Ae(),pe||fe||je(!1),Q(!0)}catch{P.current===c&&V(!0)}})().finally(()=>{D.current===s&&(D.current=null)});return D.current=s,s},[je,fe,pe,Re,Xe,Ae,F,X]);s(()=>{F||U&&X&&(fe||Xe?Pe():Ue())},[fe,Ue,U,Pe,Xe,F,X]),s(()=>{var e;if(F)return;if(!U)return;if(!X)return;if(fe)return;if(Xe)return;const t=E.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=oe;if(!o&&A.current)try{o=ie(A.current(n)),o&&de(o)}catch{}const i=le(o||Ie);if(t.createEditor&&S.current){try{await Promise.resolve(Ue())}catch{}const e=D.current;if(e)try{await e}catch{}}try{u.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=u.originalCode)?e:""),String(null!=(r=u.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}pe&&je(!0)})()},[je,Ie,oe,fe,Y,Ue,pe,U,u.code,u.diff,u.originalCode,u.updatedCode,Xe,F,X]),s(()=>{if(F)return;if(!U)return;if(!X)return;if(fe)return;if(Xe)return;if(!pe&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>je(pe)):null;return null==e&&je(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[je,fe,pe,h,U,Xe,F,X]),s(()=>{var e,t,n;if(!f)return;if(F)return;const r=E.current;if(r){try{const o="diff"===j.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Se})}catch{}je(pe)}},[je,f,pe,Se,u.diff,F]);const Ze=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),m)},[m]),Ye=d(()=>{te()},[]),Ge=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Ve)),me(!0),null==(e=a.onCopy)||e.call(a,String(Ve)),setTimeout(()=>me(!1),1e3)}catch{}},[a,Ve]),Je=d(()=>{if(!ze)return;const e="html"===Ie?"text/html":"image/svg+xml",t="html"===Ie?xe("artifacts.htmlPreviewTitle")||"HTML Preview":xe("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof a.onPreviewCode?"html"===Ie&&ye(e=>!e):a.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${Ie}-${Date.now()}`})},[Ie,ze,u,a,xe]);return F?/* @__PURE__ */e($e,{node:u}):/* @__PURE__ */n("div",{ref:T,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",m?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",m?"is-dark":""].join(" "),style:Ke,children:[C&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:`var(--vscode-editor-foreground, ${m?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${m?"#111827":"#ffffff"})`},children:[
16
+ return e("pre",{className:`language-${r}`,"aria-busy":!0===(null==t?void 0:t.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(null!=(n=null==t?void 0:t.code)?n:"")})})}const De={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function _e(r){var l;const a={...De,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:g,enableFontSizeControl:f,darkTheme:w,lightTheme:v,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:M,showExpandButton:N,showPreviewButton:B,showFontSizeButtons:L}=a,S=c(null),T=c(null),E=c(null),D=c(null),_=c(null),j=c(null),W=c(null),P=c(0),A=c(null),O=c(null),I=$(),R=c(y),H=c(x),z=c(y),[F,V]=i(!1),[X,q]=i(()=>"undefined"==typeof window),[U,Z]=i(!1),[Y,G]=i(!1),[J,Q]=i(!1),[ne,re]=i(()=>u.language||"plaintext"),[oe,de]=i(()=>ie(u.language)),[ue,me]=i(!1),[pe,ge]=i(!1),[fe,we]=i(!1),[ve,ye]=i(!1),{t:xe}=K(),[ke,be]=i(()=>{const e=Number(null==y?void 0:y.fontSize);return Number.isFinite(e)&&e>0?e:14}),[Se,Te]=i(ke),_e=d(()=>{var e,t;const n=null!=(t=null==(e=R.current)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n&&Number.isFinite(n))return Math.max(80,n);const r=String(n).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),je=d(e=>{var t,n,r,o;if(F)return;const i=S.current,l=E.current;if(!i||!l)return;const a="diff"===j.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=_e();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}e?(i.style.maxHeight="none",i.style.overflow="visible"):(i.style.maxHeight=`${Math.ceil(c)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===j.current&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,c);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[_e,F]);s(()=>{R.current=y},[y]),s(()=>{de(ie(u.language))},[u.language]);const We=c(u);We.current=u;const Pe=d(()=>{var e;P.current+=1;try{null==(e=D.current)||e.call(D)}catch{}_.current=null,j.current=null,W.current=null,Q(!1),G(!1)},[]),Ae=d(()=>{var e,t,n,r,o,i;const l=S.current,a=T.current;if(!l||!a)return;const c=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(c):null,l=String(null!=(t=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?t:"").trim()||String(null!=(n=null==e?void 0:e.color)?n:"").trim(),s=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();l&&a.style.setProperty("--vscode-editor-foreground",l),s&&a.style.setProperty("--vscode-editor-background",s),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[]);s(()=>()=>{var e,t,n;P.current+=1,null==(e=D.current)||e.call(D),D.current=null,_.current=null,j.current=null,W.current=null,A.current=null,null==(n=null==(t=O.current)?void 0:t.destroy)||n.call(t),O.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(X)return;const n=T.current;if(!n)return;null==(t=null==(e=O.current)?void 0:e.destroy)||t.call(e);const r=I(n,{rootMargin:"400px"});return O.current=r,r.isVisible()&&q(!0),r.whenVisible.then(()=>q(!0)),()=>{r.destroy(),O.current===r&&(O.current=null)}},[I,X]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await he();if(!e)return;if(!r)return void V(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(A.current=i),"function"!=typeof o)return void V(!0);const l=null!=(t=m?w:v)?t:Me,a={...z.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:H.current,theme:l,...a,onThemeChange(){Ae()}});E.current=c,"function"==typeof(n=c.setTheme)&&(Be=n,null!=Me&&null!=Ne&&Ce(Me,Be).then(()=>Ee()).catch(()=>{})),D.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,Z(!0)}catch{e&&V(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!oe&&A.current)try{const t=A.current(String(null!=(e=u.code)?e:""));t&&re(t)}catch{}},[oe,u.code,u.language]);const Oe=o(()=>String(u.language||oe||ne||"plaintext"),[oe,ne,u.language]),Ie=o(()=>ie(Oe),[Oe]),Re=o(()=>le(Ie),[Ie]),He=o(()=>ae(Ie),[Ie]),ze=o(()=>!!g&&("html"===Ie||"svg"===Ie),[Ie,g]),Fe=o(()=>{const e=Ie;return e?ce[e]||e.charAt(0).toUpperCase()+e.slice(1):ce[""]||"Plain Text"},[Ie]),Ve=o(()=>{var e,t,n;return u.diff?null!=(t=null!=(e=u.updatedCode)?e:u.code)?t:"":null!=(n=u.code)?n:""},[u.code,u.diff,u.updatedCode]),Ke=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(k),r=e(b);return n&&(t.minWidth=n),r&&(t.maxWidth=r),t},[k,b]),Xe=!1===p&&h,qe=o(()=>m?w:v,[w,m,v]);s(()=>{if(F)return;if(!Y||!X)return;const e=E.current;(null==e?void 0:e.setTheme)&&qe&&Ce(qe,e.setTheme).then(Ae).catch(()=>{})},[Y,qe,Ae,F,X]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{Ae()},Le.add(e),()=>{Le.delete(e)}},[Ae]);const Ue=d(async()=>{var e,t;if(F)return null;if(!X)return null;if(fe)return null;if(Xe)return null;const n=E.current,r=S.current;if(!n||!r||!n.createEditor)return null;const o=We.current,i=o.diff?"diff":"single",l=W.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(j.current===i&&l===r&&a)return null;if(_.current)return _.current;P.current+=1;const c=P.current;G(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=D.current)||e.call(D),j.current=null,W.current=null,Q(!1);const p=Re;if(o.diff?"function"==typeof n.createDiffEditor?(j.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(j.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(j.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),W.current=r,P.current!==c)return;const g=Number(null==(d=R.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){be(g),Te(g);try{const e="diff"===j.current?null==(u=n.getDiffEditorView)?void 0:u.call(n):null==(m=n.getEditorView)?void 0:m.call(n);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:g,automaticLayout:!1})}catch{}}Ae(),pe||fe||je(!1),Q(!0)}catch{P.current===c&&V(!0)}})().finally(()=>{_.current===s&&(_.current=null)});return _.current=s,s},[je,fe,pe,Re,Xe,Ae,F,X]);s(()=>{F||U&&X&&(fe||Xe?Pe():Ue())},[fe,Ue,U,Pe,Xe,F,X]),s(()=>{var e;if(F)return;if(!U)return;if(!X)return;if(fe)return;if(Xe)return;const t=E.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=oe;if(!o&&A.current)try{o=ie(A.current(n)),o&&de(o)}catch{}const i=le(o||Ie);if(t.createEditor&&S.current){try{await Promise.resolve(Ue())}catch{}const e=_.current;if(e)try{await e}catch{}}try{u.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=u.originalCode)?e:""),String(null!=(r=u.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}pe&&je(!0)})()},[je,Ie,oe,fe,Y,Ue,pe,U,u.code,u.diff,u.originalCode,u.updatedCode,Xe,F,X]),s(()=>{if(F)return;if(!U)return;if(!X)return;if(fe)return;if(Xe)return;if(!pe&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>je(pe)):null;return null==e&&je(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[je,fe,pe,h,U,Xe,F,X]),s(()=>{var e,t,n;if(!f)return;if(F)return;const r=E.current;if(r){try{const o="diff"===j.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Se})}catch{}je(pe)}},[je,f,pe,Se,u.diff,F]);const Ze=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),m)},[m]),Ye=d(()=>{te()},[]),Ge=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Ve)),me(!0),null==(e=a.onCopy)||e.call(a,String(Ve)),setTimeout(()=>me(!1),1e3)}catch{}},[a,Ve]),Je=d(()=>{if(!ze)return;const e="html"===Ie?"text/html":"image/svg+xml",t="html"===Ie?xe("artifacts.htmlPreviewTitle")||"HTML Preview":xe("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof a.onPreviewCode?"html"===Ie&&ye(e=>!e):a.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${Ie}-${Date.now()}`})},[Ie,ze,u,a,xe]);return F?/* @__PURE__ */e($e,{node:u}):/* @__PURE__ */n("div",{ref:T,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",m?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",m?"is-dark":""].join(" "),style:Ke,children:[C&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:`var(--vscode-editor-foreground, ${m?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${m?"#111827":"#ffffff"})`},children:[
17
17
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
18
18
  /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:He}}),
19
19
  /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:Fe})]}),
@@ -59,7 +59,7 @@ return n("figure",{ref:w,className:"image-node",children:[
59
59
  /* @__PURE__ */e("path",{d:"M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z",fill:"#FFCCCC"}),
60
60
  /* @__PURE__ */e("path",{d:"M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z",fill:"#FF939F"}),
61
61
  /* @__PURE__ */e("path",{d:"M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z",fill:"#FF356A"}),
62
- /* @__PURE__ */e("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),bt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Ct(r){const o={...bt,...r},{t:l}=K(),[a,u]=i(!1),[m,h]=i(!1),[p,g]=i(!1),[f,w]=i("360px"),[v,y]=i(!1),[k,b]=i(1),[C,M]=i({x:0,y:0}),[N,B]=i(!1),L=c(null),S=c(null),T=c(null),E=c({x:0,y:0}),$=c(null),_=o.node.code,D=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(_)),u(!0),null==(t=o.onCopy)||t.call(o,_),setTimeout(()=>u(!1),1e3)}catch{}},[_,o]),j=d(async()=>{var e,t;if(!L.current)return;const n=L.current;try{const r=await async function(){return xt||yt||(yt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),xt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),yt)}();if(!r)return void console.warn("Infographic library failed to load.");$.current&&(null==(t=(e=$.current).destroy)||t.call(e),$.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});$.current=o,o.render(_),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&w(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[_]);s(()=>{p||m||j()},[_,p,m,j]),s(()=>()=>{var e,t;$.current&&(null==(t=(e=$.current).destroy)||t.call(e),$.current=null)},[]);const W=d(()=>{y(!1),S.current&&(S.current.innerHTML=""),T.current=null,document.body.style.overflow=""},[]),P=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&W()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,W]),s(()=>{v&&setTimeout(()=>{if(L.current&&S.current){S.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=L.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),S.current.appendChild(e),T.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&T.current&&(T.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const A=d(()=>{var e;const t=null==(e=L.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),O=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;E.current={x:t-C.x,y:n-C.y}},I=e=>{if(!N)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;M({x:t-E.current.x,y:n-E.current.y})},R=()=>B(!1),H=o.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",z=p||m;/* @__PURE__ */
62
+ /* @__PURE__ */e("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),bt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Ct(r){const o={...bt,...r},{t:l}=K(),[a,u]=i(!1),[m,h]=i(!1),[p,g]=i(!1),[f,w]=i("360px"),[v,y]=i(!1),[k,b]=i(1),[C,M]=i({x:0,y:0}),[N,B]=i(!1),L=c(null),S=c(null),T=c(null),E=c({x:0,y:0}),$=c(null),D=o.node.code,_=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(D)),u(!0),null==(t=o.onCopy)||t.call(o,D),setTimeout(()=>u(!1),1e3)}catch{}},[D,o]),j=d(async()=>{var e,t;if(!L.current)return;const n=L.current;try{const r=await async function(){return xt||yt||(yt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),xt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),yt)}();if(!r)return void console.warn("Infographic library failed to load.");$.current&&(null==(t=(e=$.current).destroy)||t.call(e),$.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});$.current=o,o.render(D),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&w(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[D]);s(()=>{p||m||j()},[D,p,m,j]),s(()=>()=>{var e,t;$.current&&(null==(t=(e=$.current).destroy)||t.call(e),$.current=null)},[]);const W=d(()=>{y(!1),S.current&&(S.current.innerHTML=""),T.current=null,document.body.style.overflow=""},[]),P=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&W()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,W]),s(()=>{v&&setTimeout(()=>{if(L.current&&S.current){S.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=L.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),S.current.appendChild(e),T.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&T.current&&(T.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const A=d(()=>{var e;const t=null==(e=L.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),O=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;E.current={x:t-C.x,y:n-C.y}},I=e=>{if(!N)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;M({x:t-E.current.x,y:n-E.current.y})},R=()=>B(!1),H=o.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",z=p||m;/* @__PURE__ */
63
63
  return n(t,{children:[
64
64
  /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":o.loading}),children:[o.showHeader&&/* @__PURE__ */n("div",{className:ze("flex justify-between items-center px-4 py-2.5 border-b",o.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
65
65
  /* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[kt,
@@ -72,11 +72,11 @@ return n(t,{children:[
72
72
  /* @__PURE__ */e("button",{className:ze("px-2.5 py-1 text-xs rounded transition-colors",p?o.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":o.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>g(!0),onMouseEnter:e=>ee(e.currentTarget,l("common.source")||"Source","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[
73
73
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
74
74
  /* @__PURE__ */e("span",{children:l("common.source")||"Source"})]})})]}),
75
- /* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:H,onClick:()=>h(!m),onMouseEnter:e=>ee(e.currentTarget,m?l("common.expand")||"Expand":l("common.collapse")||"Collapse","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:m?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),o.showCopyButton&&/* @__PURE__ */e("button",{className:H,onClick:D,onMouseEnter:e=>ee(e.currentTarget,a?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",a?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
75
+ /* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:H,onClick:()=>h(!m),onMouseEnter:e=>ee(e.currentTarget,m?l("common.expand")||"Expand":l("common.collapse")||"Collapse","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:m?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),o.showCopyButton&&/* @__PURE__ */e("button",{className:H,onClick:_,onMouseEnter:e=>ee(e.currentTarget,a?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",a?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
76
76
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
77
77
  /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),o.showExportButton&&/* @__PURE__ */e("button",{className:ze(H,z&&"opacity-50 cursor-not-allowed"),disabled:z,onClick:A,onMouseEnter:e=>ee(e.currentTarget,l("common.export")||"Export","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
78
78
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
79
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:ze(H,z&&"opacity-50 cursor-not-allowed"),disabled:z,onClick:P,onMouseEnter:e=>ee(e.currentTarget,v?l("common.minimize")||"Minimize":l("common.open")||"Open","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",v?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!m&&/* @__PURE__ */e("div",{children:p?/* @__PURE__ */e("div",{className:ze("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:ze("text-sm font-mono whitespace-pre-wrap",o.isDark?"text-gray-300":"text-gray-700"),children:_})}):/* @__PURE__ */n("div",{className:"relative",children:[o.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
79
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:ze(H,z&&"opacity-50 cursor-not-allowed"),disabled:z,onClick:P,onMouseEnter:e=>ee(e.currentTarget,v?l("common.minimize")||"Minimize":l("common.open")||"Open","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",v?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!m&&/* @__PURE__ */e("div",{children:p?/* @__PURE__ */e("div",{className:ze("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:ze("text-sm font-mono whitespace-pre-wrap",o.isDark?"text-gray-300":"text-gray-700"),children:D})}):/* @__PURE__ */n("div",{className:"relative",children:[o.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
80
80
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.min(k+.1,3)),children:"+"}),
81
81
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.max(k-.1,.5)),children:"-"}),
82
82
  /* @__PURE__ */n("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{b(1),M({x:0,y:0})},children:[Math.round(100*k),"%"]})]})}),
@@ -94,10 +94,10 @@ return e("ins",{className:"insert-node",children:t.children})}function Bt(t){var
94
94
  /* @__PURE__ */e("span",{className:"underline-anim","aria-hidden":"true"})]})}):/* @__PURE__ */e("a",{className:"link-node",href:s.href,title:p?"":w,"aria-label":`Link: ${w}`,target:"_blank",rel:"noopener noreferrer",style:f,onMouseEnter:v,onMouseLeave:y,children:u&&m?C(s.children,u,String(null!=h?h:"link"),m):null!=(c=s.text)?c:null})}function Lt(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
95
95
  return e("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?C(n.children,r,String(null!=l?l:"list-item"),o):null})}function St(t){var n;const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=r.ordered?"ol":"ul",c=r.ordered&&r.start?r.start:void 0,s=o&&I(o.customId).list_item||Lt;/* @__PURE__ */
96
96
  return e(a,{className:ze("list-node my-5 pl-[calc(13/8*1em)]",r.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:c,children:null==(n=r.items)?void 0:n.map((t,n)=>{var a;/* @__PURE__ */
97
- return e(s,{node:t,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${n}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${n}`)})})}let Tt=null,Et=null,$t=!1;const _t=/* @__PURE__ */new Map,Dt=/* @__PURE__ */new Map;let jt=5;const Wt=/* @__PURE__ */new Set;function Pt(){if(_t.size<jt&&Wt.size){const e=Array.from(Wt);Wt.clear();for(const t of e)try{t()}catch{}}}function At(e){Tt=e,Et=null,Tt.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=_t.get(t);if(o)if(_t.delete(t),clearTimeout(o.timeoutId),Pt(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(Dt.set(e,n),Dt.size>200){const e=Dt.keys().next().value;Dt.delete(e)}}o.resolve(n)}},Tt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of _t.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));_t.clear(),Pt()}}function Ot(){var e;Tt&&(null==(e=Tt.terminate)||e.call(Tt)),Tt=null,Et=null}function It(e){$t=!!e,Tt&&Tt.postMessage({type:"init",debug:$t})}const Rt="WORKER_BUSY";async function Ht(e,t=!0,n=2e3,r){if(performance.now(),Et)return Promise.reject(Et);const o=`${t?"d":"i"}:${e}`,i=Dt.get(o);if(i)return Promise.resolve(i);const l=Tt||(Et=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Et.name="WORKER_INIT_ERROR",Et.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Et);if(_t.size>=jt){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Rt,e.busy=!0,e.inFlight=_t.size,e.max=jt,Promise.reject(e)}return new Promise((o,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const a=Math.random().toString(36).slice(2),c=setTimeout(()=>{_t.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Pt()},n),s=()=>{},d=()=>{_t.delete(a),clearTimeout(c),Wt.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),Pt()};r&&r.addEventListener("abort",d,{once:!0}),_t.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{l.postMessage({id:a,content:e,displayMode:t,debug:$t})}catch(u){_t.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),Pt()}})}function zt(e,t,n){const r=`${t?"d":"i"}:${e}`;if(Dt.set(r,n),Dt.size>200){const e=Dt.keys().next().value;Dt.delete(e)}}function Ft(){Dt.clear()}function Vt(e){jt=Math.max(1,Math.floor(e)),Pt()}function Kt(e=1500,t){return _t.size<jt?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){Wt.delete(l),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),Wt.add(l)})}const Xt={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function qt(e){null!=e.timeout&&(Xt.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Xt.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Xt.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Xt.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ut(){return{...Xt}}async function Zt(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:Xt.timeout,c=null!=(o=n.waitTimeout)?o:Xt.waitTimeout,s=null!=(i=n.backoffMs)?i:Xt.backoffMs,d=null!=(l=n.maxRetries)?l:Xt.maxRetries,u=n.signal;let m=0;for(;;){if(null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await Ht(e,t,a,u)}catch(h){if((null==h?void 0:h.code)!==Rt||m>=d)throw h;if(m++,await Kt(c,u).catch(()=>{}),null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*m))}}}let Yt=null,Gt=!1;async function Jt(){if(Yt)return Yt;if(Gt)return null;try{return Yt=await import("katex"),await import("katex/contrib/mhchem"),Yt}catch{return Gt=!0,null}}function Qt({node:t}){const n=c(null),[r,o]=i(!0),l=c(0);return s(()=>{var e;let r=!1;const i=new AbortController,a=++l.current,c=null!=(e=t.content)?e:"";return c?(Zt(c,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async e=>{if(r||a!==l.current)return;if(!n.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===Rt||"WORKER_TIMEOUT"===i){const e=await Jt();if(e)try{const i=e.renderToString(c,{throwOnError:t.loading,displayMode:!0});return void(!r&&a===l.current&&n.current&&(n.current.innerHTML=i,o(!1),zt(c,!0,i)))}catch{}}t.loading||(n.current.textContent=t.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[t.content,t.loading,t.raw]),/* @__PURE__ */e("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */e("div",{ref:n,className:r?"math-rendering":void 0})})}function en({node:t}){const r=c(null),o=c(null),[l,a]=i(!0),d=c(0);return s(()=>{var e;let n=!1;const r=new AbortController,i=++d.current,l=null!=(e=t.content)?e:"";if(!l)return a(!1),()=>r.abort();const c="$$"===t.markup;return Zt(l,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{n||i!==d.current||o.current&&(o.current.innerHTML=e,a(!1))}).catch(async e=>{if(n||i!==d.current)return;if(!o.current)return;const r=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===r||(null==e?void 0:e.fallbackToRenderer)||r===Rt||"WORKER_TIMEOUT"===r){const e=await Jt();if(e)try{const r=e.renderToString(l,{throwOnError:t.loading,displayMode:c});return void(!n&&i===d.current&&o.current&&(o.current.innerHTML=r,a(!1),zt(l,c,r)))}catch{}}t.loading||(o.current.textContent=t.raw,a(!1))}),()=>{n=!0,r.abort()}},[t.content,t.loading,t.raw,t.markup]),/* @__PURE__ */n("span",{ref:r,className:"math-inline-wrapper",children:[
97
+ return e(s,{node:t,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${n}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${n}`)})})}let Tt=null,Et=null,$t=!1;const Dt=/* @__PURE__ */new Map,_t=/* @__PURE__ */new Map;let jt=5;const Wt=/* @__PURE__ */new Set;function Pt(){if(Dt.size<jt&&Wt.size){const e=Array.from(Wt);Wt.clear();for(const t of e)try{t()}catch{}}}function At(e){Tt=e,Et=null,Tt.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Dt.get(t);if(o)if(Dt.delete(t),clearTimeout(o.timeoutId),Pt(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(_t.set(e,n),_t.size>200){const e=_t.keys().next().value;_t.delete(e)}}o.resolve(n)}},Tt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Dt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Dt.clear(),Pt()}}function Ot(){var e;Tt&&(null==(e=Tt.terminate)||e.call(Tt)),Tt=null,Et=null}function It(e){$t=!!e,Tt&&Tt.postMessage({type:"init",debug:$t})}const Rt="WORKER_BUSY";async function Ht(e,t=!0,n=2e3,r){if(performance.now(),Et)return Promise.reject(Et);const o=`${t?"d":"i"}:${e}`,i=_t.get(o);if(i)return Promise.resolve(i);const l=Tt||(Et=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Et.name="WORKER_INIT_ERROR",Et.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Et);if(Dt.size>=jt){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Rt,e.busy=!0,e.inFlight=Dt.size,e.max=jt,Promise.reject(e)}return new Promise((o,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const a=Math.random().toString(36).slice(2),c=setTimeout(()=>{Dt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Pt()},n),s=()=>{},d=()=>{Dt.delete(a),clearTimeout(c),Wt.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),Pt()};r&&r.addEventListener("abort",d,{once:!0}),Dt.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{l.postMessage({id:a,content:e,displayMode:t,debug:$t})}catch(u){Dt.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),Pt()}})}function zt(e,t,n){const r=`${t?"d":"i"}:${e}`;if(_t.set(r,n),_t.size>200){const e=_t.keys().next().value;_t.delete(e)}}function Ft(){_t.clear()}function Vt(e){jt=Math.max(1,Math.floor(e)),Pt()}function Kt(e=1500,t){return Dt.size<jt?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){Wt.delete(l),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),Wt.add(l)})}const Xt={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function qt(e){null!=e.timeout&&(Xt.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Xt.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Xt.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Xt.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ut(){return{...Xt}}async function Zt(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:Xt.timeout,c=null!=(o=n.waitTimeout)?o:Xt.waitTimeout,s=null!=(i=n.backoffMs)?i:Xt.backoffMs,d=null!=(l=n.maxRetries)?l:Xt.maxRetries,u=n.signal;let m=0;for(;;){if(null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await Ht(e,t,a,u)}catch(h){if((null==h?void 0:h.code)!==Rt||m>=d)throw h;if(m++,await Kt(c,u).catch(()=>{}),null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*m))}}}let Yt=null,Gt=!1;async function Jt(){if(Yt)return Yt;if(Gt)return null;try{return Yt=await import("katex"),await import("katex/contrib/mhchem"),Yt}catch{return Gt=!0,null}}function Qt({node:t}){const n=c(null),[r,o]=i(!0),l=c(0);return s(()=>{var e;let r=!1;const i=new AbortController,a=++l.current,c=null!=(e=t.content)?e:"";return c?(Zt(c,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async e=>{if(r||a!==l.current)return;if(!n.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===Rt||"WORKER_TIMEOUT"===i){const e=await Jt();if(e)try{const i=e.renderToString(c,{throwOnError:t.loading,displayMode:!0});return void(!r&&a===l.current&&n.current&&(n.current.innerHTML=i,o(!1),zt(c,!0,i)))}catch{}}t.loading||(n.current.textContent=t.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[t.content,t.loading,t.raw]),/* @__PURE__ */e("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */e("div",{ref:n,className:r?"math-rendering":void 0})})}function en({node:t}){const r=c(null),o=c(null),[l,a]=i(!0),d=c(0);return s(()=>{var e;let n=!1;const r=new AbortController,i=++d.current,l=null!=(e=t.content)?e:"";if(!l)return a(!1),()=>r.abort();const c="$$"===t.markup;return Zt(l,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{n||i!==d.current||o.current&&(o.current.innerHTML=e,a(!1))}).catch(async e=>{if(n||i!==d.current)return;if(!o.current)return;const r=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===r||(null==e?void 0:e.fallbackToRenderer)||r===Rt||"WORKER_TIMEOUT"===r){const e=await Jt();if(e)try{const r=e.renderToString(l,{throwOnError:t.loading,displayMode:c});return void(!n&&i===d.current&&o.current&&(o.current.innerHTML=r,a(!1),zt(l,c,r)))}catch{}}t.loading||(o.current.textContent=t.raw,a(!1))}),()=>{n=!0,r.abort()}},[t.content,t.loading,t.raw,t.markup]),/* @__PURE__ */n("span",{ref:r,className:"math-inline-wrapper",children:[
98
98
  /* @__PURE__ */e("span",{ref:o,className:"math-inline"+(l?" math-inline--hidden":"")}),l&&/* @__PURE__ */n("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
99
99
  /* @__PURE__ */e("span",{className:"math-inline__spinner","aria-hidden":"true"}),
100
- /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}let tn=null,nn=null;const rn=/* @__PURE__ */new Map;let on=5,ln=!1;function an(e){ln=!!e}function cn(e){Number.isFinite(e)&&e>0&&(on=Math.floor(e))}function sn(){return{inFlight:rn.size,max:on}}const dn="WORKER_BUSY";function un(e){tn=e,nn=null;const t=e;tn.onmessage=e=>{if(tn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=rn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},tn.onerror=e=>{var n,r;if(tn===t)if(0!==rn.size){try{ln?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of rn.entries())n.reject(new Error(`Worker error: ${e.message}`));rn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},tn.onmessageerror=e=>{var n,r;if(tn===t)if(0!==rn.size){try{ln?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of rn.entries())t.reject(new Error("Worker messageerror"));rn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function mn(){var e;if(tn)try{for(const[e,t]of rn.entries())t.reject(new Error("Worker cleared"));rn.clear(),null==(e=tn.terminate)||e.call(tn)}catch{}tn=null,nn=null}function hn(e,t,n=1400){if(nn)return Promise.reject(nn);const r=tn||(nn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),nn.name="WORKER_INIT_ERROR",nn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(nn);if(rn.size>=on){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=dn,e.inFlight=rn.size,e.max=on,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),rn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};rn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return rn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=rn.get(l);null==t||t.reject(e)},n)})}async function pn(e,t,n=1400){return hn("canParse",{code:e,theme:t},n)}async function gn(e,t,n=2400){return hn("findPrefix",{code:e,theme:t},n)}function fn(){var e;null==(e=null==tn?void 0:tn.terminate)||e.call(tn),tn=null,nn=null,rn.clear()}let wn=null,vn=!1,yn=null,xn=null;function kn(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(yn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),yn=r}catch{}}const bn="undefined"!=typeof window?m:s,Cn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Mn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Nn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Bn(e){if(!e)return"";const t=e.trim();return Nn.test(t)?t:""}function Ln(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Sn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Ln(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return null;const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Mn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Bn(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Ln(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Tn={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function En(r){var l,a,u,m,h,p,g,f,w;const v={...Tn,...r},{t:y}=K(),k=o(()=>ae("mermaid"),[]),b=null!=(a=null==(l=v.node)?void 0:l.code)?a:"",C=o(()=>b.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[b]),M=null!=(u=v.workerTimeoutMs)?u:Tn.workerTimeoutMs,N=null!=(m=v.parseTimeoutMs)?m:Tn.parseTimeoutMs,B=null!=(h=v.renderTimeoutMs)?h:Tn.renderTimeoutMs,L=null!=(p=v.fullRenderTimeoutMs)?p:Tn.fullRenderTimeoutMs,[S,T]=i(!1),[E,_]=i(!1),[D,j]=i(!1),[W,P]=i(!1),[A,O]=i(1),[I,R]=i({x:0,y:0}),[H,z]=i(!1),[F,V]=i(!1),[X,q]=i(!1),[U,Z]=i(null),[Y,G]=i(!1),[J,Q]=i(()=>null==v.maxHeight?"360px":v.maxHeight),[ne,re]=i("undefined"==typeof window),oe=c(null),ie=c(null),le=c(null),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c({x:0,y:0}),he=c(0),pe=c({}),ge=c(""),fe=c(!1),we=c(null),ve=c(!1),ye=c({zoom:1,translateX:0,translateY:0,containerHeight:J||"360px"}),xe=$(),ke=Boolean(null!=(f=null==(g=v.node)?void 0:g.loading)?f:v.loading),be=v.isDark?"dark":"light",Ce=Boolean(v.isStrict),Me=o(()=>Ce?{startOnLoad:!1,securityLevel:"strict",dompurifyConfig:Cn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose"},[Ce]);s(()=>{ve.current=X},[X]),s(()=>{pe.current={}},[be,C,Ce]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(wn)return kn(wn,e),wn;if(xn){const t=await xn;return t&&kn(t,e),t}if(vn)return null;try{vn=!0,xn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(wn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!wn)throw new Error("Mermaid module did not export expected API");return kn(wn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),wn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{xn=null}})();const t=await xn;return t&&kn(t,e),t}catch{return null}}(Me);e||(oe.current=t,T(Boolean(t)),fe.current||_(!t))})(),()=>{e=!0}},[Me]),s(()=>{const e=ie.current;if(!e)return;const t=xe(e,{rootMargin:"400px"});return we.current=t,t.isVisible()&&re(!0),t.whenVisible.then(()=>re(!0)),()=>{t.destroy(),we.current=null}},[xe]),s(()=>{if("undefined"==typeof document)return;if(!Y)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Y]);const Ne=d(e=>{const t=ie.current,n=ce.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i;Q(`${Math.min(c,i)}px`)},[]);s(()=>{if(!ie.current||"undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;!function(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}globalThis.setTimeout(e,0)}(()=>Ne(t))});return e.observe(ie.current),()=>e.disconnect()},[Ne]),s(()=>()=>{fn()},[]);const Be=d(async(e,t,n)=>{var r;if(!oe.current||!ce.current)return!1;V(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=_n(e,t),l=await jn(()=>oe.current.render(o,i),{timeoutMs:L,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Sn(ce.current,l.svg,Ce);return null==(r=l.bindFunctions)||r.call(l,ce.current),Ne(),pe.current[t]=a,q(!0),Z(null),!0}catch(o){return ke||Z(o instanceof Error?o.message:String(o)),!1}finally{V(!1)}},[L,ke,Ce,Ne]),Le=d(async(e,t,n)=>{var r;if(oe.current&&ce.current){V(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=_n(Dn(e)||e,t),l=await jn(()=>oe.current.render(o,i),{timeoutMs:B,signal:n});(null==l?void 0:l.svg)&&(Sn(ce.current,l.svg,Ce),null==(r=l.bindFunctions)||r.call(l,ce.current),Ne())}catch{}finally{V(!1)}}},[B,ke,Ce,Ne]),Se=d(async(e,t)=>{if(!e.trim())return Ln(ce.current),q(!1),void(ge.current="");const n=e.replace(/\s+/g,"");if(n===ge.current&&ve.current)return;const r=++he.current;try{if(await async function(e,t,n){try{if(await pn(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===(null==l?void 0:l.name))throw l}if(!n.mermaid)throw new Error("Mermaid not available");const r=_n(e,t),o=n.mermaid;if("function"==typeof o.parse)return await jn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await jn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,be,{workerTimeout:M,parseTimeout:N,mermaid:oe.current,signal:t}),(null==t?void 0:t.aborted)||he.current!==r)return;return void(await Be(e,be,t)&&(ge.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await gn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Dn(e)}(e,be,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||he.current!==r)return;await Le(n,be,t)}catch{}},[N,Be,Le,be,M]);s(()=>{if(!ne||E||D)return;const e=new AbortController;return Se(C,e.signal),()=>e.abort()},[C,D,Se,E,ne]);const Te=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,v.isDark)},[v.isDark]),Ee=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(C)),P(!0),null==(t=v.onCopy)||t.call(v,C),setTimeout(()=>P(!1),1e3)}catch{}},[C,v]),$e=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=Wn(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=v.onExport)||n.call(v,i),i.defaultPrevented||function(e,t){const n=null!=t?t:Wn(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[v]),_e=d(()=>{ue.current=null,Ln(de.current)},[]),De=d(()=>{G(!1),_e()},[_e]),je=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null,o=r?Wn(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=v.onOpenModal)||n.call(v,i),i.defaultPrevented||G(!0)},[v]);s(()=>{if(!Y)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&De()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[De,Y]),bn(()=>{if(!Y)return;const e=de.current,t=ie.current;if(!e||!t)return;const n=`translate(${I.x}px, ${I.y}px) scale(${A})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(ue.current=o,o.style.transform=n),Ln(e),e.appendChild(r)},[Y]),s(()=>{Y&&ue.current&&(ue.current.style.transform=`translate(${I.x}px, ${I.y}px) scale(${A})`)},[Y,I.x,I.y,A]);const We=E||F||D,Pe=o(()=>v.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[v.isDark]),Ae=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=v.onToggleMode)||t.call(v,e,n),!n.defaultPrevented)if(fe.current=!0,"preview"===e){_(!1);const e=ye.current;O(e.zoom),R({x:e.translateX,y:e.translateY}),Q(e.containerHeight),ve.current&&pe.current[be]&&ce.current?(ce.current.innerHTML=pe.current[be],Ne()):Se(C)}else ye.current={zoom:A,translateX:I.x,translateY:I.y,containerHeight:J},_(!0)},[C,J,Se,v,be,I.x,I.y,Ne,A]),Oe=d(e=>{if(!1===v.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=ie.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-I.x,o=e.clientY-n.top-I.y,i=.01*-e.deltaY,l=$n(A+i,.5,3);if(l===A)return;const a=l/A;R({x:I.x-r*(a-1),y:I.y-o*(a-1)}),O(l)},[I,A]),Ie=d((e,t)=>{z(!0),me.current={x:e-I.x,y:t-I.y}},[I.x,I.y]),Re=d((e,t)=>{H&&R({x:e-me.current.x,y:t-me.current.y})},[H]),He=d(()=>{z(!1)},[]),Fe=/* @__PURE__ */n("div",{className:"relative",children:[v.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
100
+ /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}let tn=null,nn=null;const rn=/* @__PURE__ */new Map;let on=5,ln=!1;function an(e){ln=!!e}function cn(e){Number.isFinite(e)&&e>0&&(on=Math.floor(e))}function sn(){return{inFlight:rn.size,max:on}}const dn="WORKER_BUSY";function un(e){tn=e,nn=null;const t=e;tn.onmessage=e=>{if(tn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=rn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},tn.onerror=e=>{var n,r;if(tn===t)if(0!==rn.size){try{ln?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of rn.entries())n.reject(new Error(`Worker error: ${e.message}`));rn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},tn.onmessageerror=e=>{var n,r;if(tn===t)if(0!==rn.size){try{ln?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of rn.entries())t.reject(new Error("Worker messageerror"));rn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function mn(){var e;if(tn)try{for(const[e,t]of rn.entries())t.reject(new Error("Worker cleared"));rn.clear(),null==(e=tn.terminate)||e.call(tn)}catch{}tn=null,nn=null}function hn(e,t,n=1400){if(nn)return Promise.reject(nn);const r=tn||(nn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),nn.name="WORKER_INIT_ERROR",nn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(nn);if(rn.size>=on){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=dn,e.inFlight=rn.size,e.max=on,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),rn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};rn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return rn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=rn.get(l);null==t||t.reject(e)},n)})}async function pn(e,t,n=1400){return hn("canParse",{code:e,theme:t},n)}async function gn(e,t,n=2400){return hn("findPrefix",{code:e,theme:t},n)}function fn(){var e;null==(e=null==tn?void 0:tn.terminate)||e.call(tn),tn=null,nn=null,rn.clear()}let wn=null,vn=!1,yn=null,xn=null;function kn(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(yn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),yn=r}catch{}}const bn="undefined"!=typeof window?m:s,Cn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Mn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Nn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Bn(e){if(!e)return"";const t=e.trim();return Nn.test(t)?t:""}function Ln(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Sn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Ln(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return null;const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Mn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Bn(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Ln(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Tn={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function En(r){var l,a,u,m,h,p,g,f,w;const v={...Tn,...r},{t:y}=K(),k=o(()=>ae("mermaid"),[]),b=null!=(a=null==(l=v.node)?void 0:l.code)?a:"",C=o(()=>b.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[b]),M=null!=(u=v.workerTimeoutMs)?u:Tn.workerTimeoutMs,N=null!=(m=v.parseTimeoutMs)?m:Tn.parseTimeoutMs,B=null!=(h=v.renderTimeoutMs)?h:Tn.renderTimeoutMs,L=null!=(p=v.fullRenderTimeoutMs)?p:Tn.fullRenderTimeoutMs,[S,T]=i(!1),[E,D]=i(!1),[_,j]=i(!1),[W,P]=i(!1),[A,O]=i(1),[I,R]=i({x:0,y:0}),[H,z]=i(!1),[F,V]=i(!1),[X,q]=i(!1),[U,Z]=i(null),[Y,G]=i(!1),[J,Q]=i(()=>null==v.maxHeight?"360px":v.maxHeight),[ne,re]=i("undefined"==typeof window),oe=c(null),ie=c(null),le=c(null),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c({x:0,y:0}),he=c(0),pe=c({}),ge=c(""),fe=c(!1),we=c(null),ve=c(!1),ye=c({zoom:1,translateX:0,translateY:0,containerHeight:J||"360px"}),xe=$(),ke=Boolean(null!=(f=null==(g=v.node)?void 0:g.loading)?f:v.loading),be=v.isDark?"dark":"light",Ce=Boolean(v.isStrict),Me=o(()=>Ce?{startOnLoad:!1,securityLevel:"strict",dompurifyConfig:Cn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose"},[Ce]);s(()=>{ve.current=X},[X]),s(()=>{pe.current={}},[be,C,Ce]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(wn)return kn(wn,e),wn;if(xn){const t=await xn;return t&&kn(t,e),t}if(vn)return null;try{vn=!0,xn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(wn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!wn)throw new Error("Mermaid module did not export expected API");return kn(wn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),wn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{xn=null}})();const t=await xn;return t&&kn(t,e),t}catch{return null}}(Me);e||(oe.current=t,T(Boolean(t)),fe.current||D(!t))})(),()=>{e=!0}},[Me]),s(()=>{const e=ie.current;if(!e)return;const t=xe(e,{rootMargin:"400px"});return we.current=t,t.isVisible()&&re(!0),t.whenVisible.then(()=>re(!0)),()=>{t.destroy(),we.current=null}},[xe]),s(()=>{if("undefined"==typeof document)return;if(!Y)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Y]);const Ne=d(e=>{const t=ie.current,n=ce.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i;Q(`${Math.min(c,i)}px`)},[]);s(()=>{if(!ie.current||"undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;!function(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}globalThis.setTimeout(e,0)}(()=>Ne(t))});return e.observe(ie.current),()=>e.disconnect()},[Ne]),s(()=>()=>{fn()},[]);const Be=d(async(e,t,n)=>{var r;if(!oe.current||!ce.current)return!1;V(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Dn(e,t),l=await jn(()=>oe.current.render(o,i),{timeoutMs:L,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Sn(ce.current,l.svg,Ce);return null==(r=l.bindFunctions)||r.call(l,ce.current),Ne(),pe.current[t]=a,q(!0),Z(null),!0}catch(o){return ke||Z(o instanceof Error?o.message:String(o)),!1}finally{V(!1)}},[L,ke,Ce,Ne]),Le=d(async(e,t,n)=>{var r;if(oe.current&&ce.current){V(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Dn(_n(e)||e,t),l=await jn(()=>oe.current.render(o,i),{timeoutMs:B,signal:n});(null==l?void 0:l.svg)&&(Sn(ce.current,l.svg,Ce),null==(r=l.bindFunctions)||r.call(l,ce.current),Ne())}catch{}finally{V(!1)}}},[B,ke,Ce,Ne]),Se=d(async(e,t)=>{if(!e.trim())return Ln(ce.current),q(!1),void(ge.current="");const n=e.replace(/\s+/g,"");if(n===ge.current&&ve.current)return;const r=++he.current;try{if(await async function(e,t,n){try{if(await pn(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===(null==l?void 0:l.name))throw l}if(!n.mermaid)throw new Error("Mermaid not available");const r=Dn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await jn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await jn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,be,{workerTimeout:M,parseTimeout:N,mermaid:oe.current,signal:t}),(null==t?void 0:t.aborted)||he.current!==r)return;return void(await Be(e,be,t)&&(ge.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await gn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return _n(e)}(e,be,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||he.current!==r)return;await Le(n,be,t)}catch{}},[N,Be,Le,be,M]);s(()=>{if(!ne||E||_)return;const e=new AbortController;return Se(C,e.signal),()=>e.abort()},[C,_,Se,E,ne]);const Te=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,v.isDark)},[v.isDark]),Ee=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(C)),P(!0),null==(t=v.onCopy)||t.call(v,C),setTimeout(()=>P(!1),1e3)}catch{}},[C,v]),$e=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=Wn(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=v.onExport)||n.call(v,i),i.defaultPrevented||function(e,t){const n=null!=t?t:Wn(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[v]),De=d(()=>{ue.current=null,Ln(de.current)},[]),_e=d(()=>{G(!1),De()},[De]),je=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null,o=r?Wn(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=v.onOpenModal)||n.call(v,i),i.defaultPrevented||G(!0)},[v]);s(()=>{if(!Y)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&_e()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[_e,Y]),bn(()=>{if(!Y)return;const e=de.current,t=ie.current;if(!e||!t)return;const n=`translate(${I.x}px, ${I.y}px) scale(${A})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(ue.current=o,o.style.transform=n),Ln(e),e.appendChild(r)},[Y]),s(()=>{Y&&ue.current&&(ue.current.style.transform=`translate(${I.x}px, ${I.y}px) scale(${A})`)},[Y,I.x,I.y,A]);const We=E||F||_,Pe=o(()=>v.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[v.isDark]),Ae=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=v.onToggleMode)||t.call(v,e,n),!n.defaultPrevented)if(fe.current=!0,"preview"===e){D(!1);const e=ye.current;O(e.zoom),R({x:e.translateX,y:e.translateY}),Q(e.containerHeight),ve.current&&pe.current[be]&&ce.current?(ce.current.innerHTML=pe.current[be],Ne()):Se(C)}else ye.current={zoom:A,translateX:I.x,translateY:I.y,containerHeight:J},D(!0)},[C,J,Se,v,be,I.x,I.y,Ne,A]),Oe=d(e=>{if(!1===v.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=ie.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-I.x,o=e.clientY-n.top-I.y,i=.01*-e.deltaY,l=$n(A+i,.5,3);if(l===A)return;const a=l/A;R({x:I.x-r*(a-1),y:I.y-o*(a-1)}),O(l)},[I,A]),Ie=d((e,t)=>{z(!0),me.current={x:e-I.x,y:t-I.y}},[I.x,I.y]),Re=d((e,t)=>{H&&R({x:e-me.current.x,y:t-me.current.y})},[H]),He=d(()=>{z(!1)},[]),Fe=/* @__PURE__ */n("div",{className:"relative",children:[v.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
101
101
  /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",v.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,y("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>O($n(A+.1,.5,3)),children:"+"}),
102
102
  /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",v.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,y("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>O($n(A-.1,.5,3)),children:"−"}),
103
103
  /* @__PURE__ */n("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",v.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,y("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{O(1),R({x:0,y:0})},children:[Math.round(100*A),"%"]})]})}),
@@ -116,18 +116,18 @@ return e(s,{node:t,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,render
116
116
  /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",E?v.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":v.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Ae("source"),onMouseEnter:e=>Te(e,y("common.source")),onFocus:e=>Te(e,y("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
117
117
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
118
118
  /* @__PURE__ */e("span",{children:y("common.source")})]})})]}),
119
- /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[v.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,"aria-pressed":D,onClick:()=>j(e=>!e),onMouseEnter:e=>Te(e,y(D?"common.expand":"common.collapse")),onFocus:e=>Te(e,y(D?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:D?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),v.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,onClick:Ee,onMouseEnter:e=>Te(e,y(W?"common.copySuccess":"common.copy")),onFocus:e=>Te(e,y(W?"common.copySuccess":"common.copy")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",W?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
119
+ /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[v.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,"aria-pressed":_,onClick:()=>j(e=>!e),onMouseEnter:e=>Te(e,y(_?"common.expand":"common.collapse")),onFocus:e=>Te(e,y(_?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:_?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),v.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,onClick:Ee,onMouseEnter:e=>Te(e,y(W?"common.copySuccess":"common.copy")),onFocus:e=>Te(e,y(W?"common.copySuccess":"common.copy")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",W?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
120
120
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
121
121
  /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),v.showExportButton&&S&&/* @__PURE__ */e("button",{type:"button",className:ze(Pe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:$e,onMouseEnter:e=>Te(e,y("common.export")),onFocus:e=>Te(e,y("common.export")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
122
122
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
123
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),v.showFullscreenButton&&S&&/* @__PURE__ */e("button",{type:"button",className:ze(Pe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:Y?De:je,onMouseEnter:e=>Te(e,y(Y?"common.minimize":"common.open")),onFocus:e=>Te(e,y(Y?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",Y?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),Ke=/* @__PURE__ */n("div",{children:[E?/* @__PURE__ */e("div",{className:ze("p-4",v.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */e("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:C})}):Fe,U&&/* @__PURE__ */e("div",{className:"mermaid-error",children:U})]});/* @__PURE__ */
123
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),v.showFullscreenButton&&S&&/* @__PURE__ */e("button",{type:"button",className:ze(Pe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:Y?_e:je,onMouseEnter:e=>Te(e,y(Y?"common.minimize":"common.open")),onFocus:e=>Te(e,y(Y?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",Y?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),Ke=/* @__PURE__ */n("div",{children:[E?/* @__PURE__ */e("div",{className:ze("p-4",v.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */e("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:C})}):Fe,U&&/* @__PURE__ */e("div",{className:"mermaid-error",children:U})]});/* @__PURE__ */
124
124
  return n(t,{children:[
125
- /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",v.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":ke}),children:[Ve,!D&&/* @__PURE__ */e("div",{ref:se,children:Ke})]}),Y&&"undefined"!=typeof document&&x(
126
- /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>De(),children:/* @__PURE__ */n("div",{className:ze("mermaid-modal-panel",{"is-dark":v.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
125
+ /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",v.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":ke}),children:[Ve,!_&&/* @__PURE__ */e("div",{ref:se,children:Ke})]}),Y&&"undefined"!=typeof document&&x(
126
+ /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>_e(),children:/* @__PURE__ */n("div",{className:ze("mermaid-modal-panel",{"is-dark":v.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
127
127
  /* @__PURE__ */n("div",{className:"mermaid-modal-header",children:[
128
128
  /* @__PURE__ */e("span",{className:"mermaid-modal-title",children:"Mermaid Preview"}),
129
- /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:De,children:"Close"})]}),
130
- /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:de,className:"mermaid-modal-content"})})]})}),document.body)]})}function $n(e,t,n){return Math.min(Math.max(e,t),n)}function _n(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function Dn(e){const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function jn(e,t={}){const{timeoutMs:n,signal:r}=t;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,o)=>{let i=!1,l=null;function a(){i||(i=!0,c(),o(new DOMException("Aborted","AbortError")))}function c(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,c(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,c(),t(e))}).catch(e=>{i||(i=!0,c(),o(e))})})}function Wn(e){return(new XMLSerializer).serializeToString(e)}function Pn(e){const{node:t}=e;/* @__PURE__ */
129
+ /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:_e,children:"Close"})]}),
130
+ /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:de,className:"mermaid-modal-content"})})]})}),document.body)]})}function $n(e,t,n){return Math.min(Math.max(e,t),n)}function Dn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function _n(e){const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function jn(e,t={}){const{timeoutMs:n,signal:r}=t;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,o)=>{let i=!1,l=null;function a(){i||(i=!0,c(),o(new DOMException("Aborted","AbortError")))}function c(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,c(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,c(),t(e))}).catch(e=>{i||(i=!0,c(),o(e))})})}function Wn(e){return(new XMLSerializer).serializeToString(e)}function Pn(e){const{node:t}=e;/* @__PURE__ */
131
131
  return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function An(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
132
132
  return e("p",{dir:"auto",className:"paragraph-node",children:s});const d=null!=(o=i.children)?o:[],u=[],m=[],h=()=>{if(!m.length)return;const t=u.length;u.push(
133
133
  /* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(m.slice(),l,`${String(null!=c?c:"paragraph")}-${t}`,a)},`${String(null!=c?c:"paragraph")}-inline-${t}`)),m.length=0};return d.forEach((t,n)=>{k.has(t.type)?(h(),u.push(
@@ -164,7 +164,7 @@ return e(Re,{node:t,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
164
164
  return e(Bt,{node:t,ctx:o,renderNode:Un,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
165
165
  return e(vt,{node:t},n);case"inline_code":/* @__PURE__ */
166
166
  return e(Mt,{node:t,typewriter:o.typewriter},n);case"code_block":return function(t,n,o){var i,l,a,c;const s=ie(String(t.language||""));if("mermaid"===s){const i=I(o.customId).mermaid;if(i)return r.createElement(i,{key:n,node:t,isDark:o.isDark});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
167
- return e(En,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("infographic"===s){const i=I(o.customId).infographic;return i?r.createElement(i,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Ct,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}return o.renderCodeBlocksAsPre||"mermaid"===s?/* @__PURE__ */e($e,{node:t},n):/* @__PURE__ */e(De,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(i=o.codeBlockThemes)?void 0:i.monacoOptions,themes:null==(l=o.codeBlockThemes)?void 0:l.themes,minWidth:null==(a=o.codeBlockThemes)?void 0:a.minWidth,maxWidth:null==(c=o.codeBlockThemes)?void 0:c.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o);case"strong":/* @__PURE__ */
167
+ return e(En,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("infographic"===s){const i=I(o.customId).infographic;return i?r.createElement(i,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Ct,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}return o.renderCodeBlocksAsPre||"mermaid"===s?/* @__PURE__ */e($e,{node:t},n):/* @__PURE__ */e(_e,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(i=o.codeBlockThemes)?void 0:i.monacoOptions,themes:null==(l=o.codeBlockThemes)?void 0:l.themes,minWidth:null==(a=o.codeBlockThemes)?void 0:a.minWidth,maxWidth:null==(c=o.codeBlockThemes)?void 0:c.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o);case"strong":/* @__PURE__ */
168
168
  return e(Rn,{node:t,children:C(t.children,o,`${String(n)}-strong`,Un)},n);case"emphasis":/* @__PURE__ */
169
169
  return e(Pe,{node:t,children:C(t.children,o,`${String(n)}-em`,Un)},n);case"strikethrough":/* @__PURE__ */
170
170
  return e(In,{node:t,children:C(t.children,o,`${String(n)}-strike`,Un)},n);case"highlight":/* @__PURE__ */
@@ -179,10 +179,10 @@ return e(en,{node:t},n);case"math_block":/* @__PURE__ */
179
179
  return e(Qt,{node:t},n);case"reference":/* @__PURE__ */
180
180
  return e(On,{node:t,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */e(tt,{node:t,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */e(ft,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
181
181
  return e(Xn,{node:t,ctx:o,renderNode:Un,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
182
- return e(Pn,{node:t},n)}}const Zn={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},Yn=h();function Gn(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function Jn(e){return/^[a-z][a-z0-9-]*$/.test(e)}const Qn=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u})=>{var m,h,p,g,f,w,v;const y=$(),x="undefined"!=typeof window,k="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,b=Math.max(0,Math.trunc(null!=(m=t.renderBatchSize)?m:80)),C=Math.max(0,Math.trunc(null!=(h=t.initialRenderBatchSize)?h:b||r.length)),M=!1!==t.batchRendering&&b>0&&x,N=Math.max(0,null!=(p=t.liveNodeBuffer)?p:60),B=Math.max(1,null!=(g=t.maxLiveNodes)?g:320),L=(null!=(f=t.maxLiveNodes)?f:0)>0&&r.length>B,S=!1!==t.viewportPriority,T=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,E=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&S},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,S,L]),[_,D]=i(()=>T?Math.min(r.length,C):r.length),j=c(_);s(()=>{j.current=_},[_]);const W=T?_:r.length,[P,A]=i(0),[O,I]=i({start:0,end:r.length}),R=c(/* @__PURE__ */new Map),[H,z]=i(0),F=c({}),V=c(/* @__PURE__ */new Map),K=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Set),q=c(_),U=c(null),Z=c(null),Y=c(null),G=c(!1),J=c(null),Q=c(Math.max(1,b||1)),ee=c(r.length),te=c({key:t.indexKey,total:r.length}),ne=c({batchSize:b,initial:C,delay:null!=(v=t.renderBatchDelay)?v:16,enabled:T}),re=E||L,oe=o(()=>{const e=R.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[H]),ie=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(O.start,e)),n=Math.max(t,Math.min(O.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,O,L]),le=o(()=>{if(!L)return r.length;const e=Math.max(O.end+N,C),t=Math.min(r.length,e);return Math.max(_,t)},[r.length,L,O.end,N,C,_]);ee.current=le;const ae=d((e,t)=>{var n;if(e>=t)return 0;const r=R.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:oe;return o},[oe]),ce=L?ae(0,Math.min(O.start,r.length)):0,se=L?ae(Math.min(O.end,r.length),r.length):0,de=d(()=>{null!=U.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(U.current),U.current=null),null!=Z.current&&(window.clearTimeout(Z.current),Z.current=null),null!=Y.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Y.current),Y.current=null),G.current=!1,J.current=null},[]),ue=d(e=>{var n;if(!T)return;const r=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6),o=Math.max(1,b||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?Q.current=Math.max(i,Math.floor(.7*Q.current)):e<.5*r&&Q.current<o&&(Q.current=Math.min(o,Math.ceil(1.2*Q.current)))},[T,t.renderBatchBudgetMs,b]),me=d((e,n={})=>{var r,o;if(!T)return;const i=ee.current;if(j.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();D(t=>{const n=Math.min(ee.current,t+Math.max(1,e));return j.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();ue(n-t)},c=()=>{const e=Math.max(1,Math.round(Q.current));me(e)},s=e=>{var n;U.current=null,Z.current=null,Y.current=null,G.current=!1;const r=J.current;if(J.current=null,a(null!=r?r:l),j.current>=ee.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;j.current<ee.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(Q.current)));j.current<ee.current&&c()};if(!x||n.immediate)return void s();const d=Math.max(0,null!=(r=t.renderBatchDelay)?r:16);if(J.current=null!=J.current?Math.max(J.current,l):l,!G.current){if(G.current=!0,k){const e=Math.max(0,null!=(o=t.renderBatchIdleTimeoutMs)?o:120);return void(Y.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?U.current=requestAnimationFrame(()=>{0!==d?Z.current=window.setTimeout(()=>s(),d):s()}):Z.current=window.setTimeout(()=>s(),d)}},[ue,k,T,x,t.renderBatchDelay,t.renderBatchBudgetMs,t.renderBatchIdleTimeoutMs]);s(()=>{var e;const n=t.indexKey,o=r.length,i=te.current,l=void 0!==n?n!==i.key:o!==i.total;te.current={key:n,total:o};const a=ne.current,c=null!=(e=t.renderBatchDelay)?e:16,s=a.batchSize!==b||a.initial!==C||a.delay!==c||a.enabled!==T;if(ne.current={batchSize:b,initial:C,delay:c,enabled:T},(l||s||!T)&&de(),(l||s)&&(Q.current=Math.max(1,b||1),X.current.clear()),!o)return j.current=0,void D(0);const d=ee.current;if(!T)return j.current=d,void D(d);if(l||s){const e=Math.min(d,C);return j.current=e,D(e),void(e<d&&me(Math.max(1,C),{immediate:!x}))}const u=Math.min(j.current,d);u!==j.current&&(j.current=u,D(u)),j.current<d&&me(Math.max(1,b||1))},[de,T,x,r.length,t.indexKey,t.renderBatchDelay,b,C,me]),s(()=>{if(!L)return void I({start:0,end:r.length});const e=r.length;if(!e)return void I({start:0,end:0});const t=Math.max(0,Math.min(P,e-1));let n=Math.max(0,t-N),o=Math.min(e,t+N+1);const i=o-n;if(i>B){const e=i-B;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<B){const t=B-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}I({start:n,end:o})},[P,N,B,r.length,L]),s(()=>()=>{de();for(const e of V.current.values())e.destroy();V.current.clear()},[de]);const he=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete F.current[t],K.current.delete(t))},[]);s(()=>{he(W)},[he,W]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(R.current.keys()))n>=e&&(R.current.delete(n),t=!0);t&&z(e=>e+1);for(const n of Object.keys(F.current))Number(n)>=e&&delete F.current[n];for(const n of Array.from(X.current))n>=e&&X.current.delete(n)},[r.length]);const pe=d((e,t)=>{E&&t&&(F.current[e]=!0),t&&L&&A(t=>e>t?e:t)},[E,L]),ge=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),fe=d((e,t)=>{const n=K.current;if(t?n.set(e,t):n.delete(e),!re||!t)return ge(e),E&&!t&&delete F.current[e],void(t&&pe(e,!0));if(e<C&&!L)return ge(e),void pe(e,!0);ge(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&pe(e,!0),r.whenVisible.then(()=>pe(e,!0)).catch(()=>{})},[E,ge,pe,y,C,re,L]),we=d((e,t)=>{if(!t)return void(R.current.has(e)&&(R.current.delete(e),z(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),ve=d(e=>!(T&&e>=j.current)&&(!E||e<C||!0===F.current[e]),[E,T,C]),ye=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of K.current.entries())t&&fe(e,t)},[fe]),s(()=>{L&&_>q.current&&A(_-1),q.current=_},[_,L]);const xe=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${ce}px`},"aria-hidden":"true"}):null,ke=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${se}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
183
- return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,onClick:t.onClick,onMouseOver:ye(t.onMouseOver),onMouseOut:ye(t.onMouseOut),children:[xe,ie.map(({node:n,index:r})=>{var o;const i=ve(r),c=null!=(o=R.current.get(r))?o:oe,s=!1!==t.typewriter&&"code_block"!==n.type&&!X.current.has(r)&&i;return s&&X.current.add(r),/* @__PURE__ */e("div",{ref:e=>fe(r,e),className:"node-slot","data-node-index":r,"data-node-type":n.type,children:/* @__PURE__ */e("div",i?{ref:e=>we(r,e),className:"node-content"+(s?" typewriter-node":""),children:Un(n,`${a}-${r}`,l)}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),ke]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),er=t=>{const n={...Zn,...t},r=c(null),i=c(null),l=u(P,A,A),a=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),d=o(()=>{const e=I(n.customId);return Object.keys(e).map(String).map(e=>e.trim().toLowerCase()).filter(Jn)},[n.customId,l]),m=o(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...d].map(Gn).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,d,l]),g=o(()=>{const e=m;return e&&0!==e.length?h(a,{customHtmlTags:e}):h(a)},[a,m]),f=o(()=>{const e=g;return n.customMarkdownIt?n.customMarkdownIt(e):e},[g,n.customMarkdownIt]),w=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=m.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:m}:{}}:r},[m,n.final,n.parseOptions]),v=o(()=>{var e,t;const r=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,o=r?performance.now():0;let i=[];return Array.isArray(n.nodes)&&n.nodes.length?i=n.nodes.map(e=>({...e})):n.content&&(i=p(n.content,null!=f?f:Yn,w)),r&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-o),nodes:i.length,contentLength:null!=(t=null==(e=n.content)?void 0:e.length)?t:0}),i},[n.content,n.debugPerformance,n.nodes,w,f,n.customId,l,m]);if(s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!v.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==ie(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const r=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},o=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),i=r(()=>{he()},{timeout:900});return()=>o(i)},[v,n.renderCodeBlocksAsPre]),"undefined"!=typeof window&&!n.renderCodeBlocksAsPre){const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&i.current!==t&&(i.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Se.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Se.set(e,t),t}catch{}const n="__theme_"+ ++Te;return Se.set(e,n),n}return String(e)}(e);t&&Ne!==t&&(Me=e,Ne=t,Be&&Ce(Me,Be).then(()=>Ee()).catch(()=>{}))}(e))}const y=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),x=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:y,typewriter:n.typewriter,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:n.codeBlockProps,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,y,n.typewriter,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockProps,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick]);/* @__PURE__ */
182
+ return e(Pn,{node:t},n)}}const Zn={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},Yn=h();function Gn(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function Jn(e){return/^[a-z][a-z0-9-]*$/.test(e)}const Qn=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u})=>{var m,h,p,g,f,w,v;const y=$(),x="undefined"!=typeof window,k="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,b=Math.max(0,Math.trunc(null!=(m=t.renderBatchSize)?m:80)),C=Math.max(0,Math.trunc(null!=(h=t.initialRenderBatchSize)?h:b||r.length)),M=!1!==t.batchRendering&&b>0&&x,N=Math.max(0,null!=(p=t.liveNodeBuffer)?p:60),B=Math.max(1,null!=(g=t.maxLiveNodes)?g:320),L=(null!=(f=t.maxLiveNodes)?f:0)>0&&r.length>B,S=!1!==t.viewportPriority,T=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,E=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&S},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,S,L]),[D,_]=i(()=>T?Math.min(r.length,C):r.length),j=c(D);s(()=>{j.current=D},[D]);const W=T?D:r.length,[P,A]=i(0),[O,I]=i({start:0,end:r.length}),R=c(/* @__PURE__ */new Map),[H,z]=i(0),F=c({}),V=c(/* @__PURE__ */new Map),K=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Set),Z=c(D),Y=c(null),G=c(null),J=c(null),Q=c(!1),ee=c(null),te=c(Math.max(1,b||1)),ne=c(r.length),re=c({key:t.indexKey,total:r.length}),oe=c({batchSize:b,initial:C,delay:null!=(v=t.renderBatchDelay)?v:16,enabled:T}),ie=E||L,le=o(()=>{const e=R.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[H]),ae=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(O.start,e)),n=Math.max(t,Math.min(O.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,O,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(O.end+N,C),t=Math.min(r.length,e);return Math.max(D,t)},[r.length,L,O.end,N,C,D]);ne.current=ce;const se=d((e,t)=>{var n;if(e>=t)return 0;const r=R.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:le;return o},[le]),de=L?se(0,Math.min(O.start,r.length)):0,ue=L?se(Math.min(O.end,r.length),r.length):0,me=d(()=>{null!=Y.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(Y.current),Y.current=null),null!=G.current&&(window.clearTimeout(G.current),G.current=null),null!=J.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(J.current),J.current=null),Q.current=!1,ee.current=null},[]),he=d(e=>{var n;if(!T)return;const r=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6),o=Math.max(1,b||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?te.current=Math.max(i,Math.floor(.7*te.current)):e<.5*r&&te.current<o&&(te.current=Math.min(o,Math.ceil(1.2*te.current)))},[T,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!T)return;const i=ne.current;if(j.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();_(t=>{const n=Math.min(ne.current,t+Math.max(1,e));return j.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();he(n-t)},c=()=>{const e=Math.max(1,Math.round(te.current));pe(e)},s=e=>{var n;Y.current=null,G.current=null,J.current=null,Q.current=!1;const r=ee.current;if(ee.current=null,a(null!=r?r:l),j.current>=ne.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;j.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));j.current<ne.current&&c()};if(!x||n.immediate)return void s();const d=Math.max(0,null!=(r=t.renderBatchDelay)?r:16);if(ee.current=null!=ee.current?Math.max(ee.current,l):l,!Q.current){if(Q.current=!0,k){const e=Math.max(0,null!=(o=t.renderBatchIdleTimeoutMs)?o:120);return void(J.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?Y.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>s(),d):s()}):G.current=window.setTimeout(()=>s(),d)}},[he,k,T,x,t.renderBatchDelay,t.renderBatchBudgetMs,t.renderBatchIdleTimeoutMs]);s(()=>{var e;const n=t.indexKey,o=r.length,i=re.current,l=void 0!==n?n!==i.key:o!==i.total;re.current={key:n,total:o};const a=oe.current,c=null!=(e=t.renderBatchDelay)?e:16,s=a.batchSize!==b||a.initial!==C||a.delay!==c||a.enabled!==T;if(oe.current={batchSize:b,initial:C,delay:c,enabled:T},(l||s||!T)&&me(),(l||s)&&(te.current=Math.max(1,b||1),U.current.clear()),!o)return j.current=0,void _(0);const d=ne.current;if(!T)return j.current=d,void _(d);if(l||s){const e=Math.min(d,C);return j.current=e,_(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(j.current,d);u!==j.current&&(j.current=u,_(u)),j.current<d&&pe(Math.max(1,b||1))},[me,T,x,r.length,t.indexKey,t.renderBatchDelay,b,C,pe]),s(()=>{if(!L)return void I({start:0,end:r.length});const e=r.length;if(!e)return void I({start:0,end:0});const t=Math.max(0,Math.min(P,e-1));let n=Math.max(0,t-N),o=Math.min(e,t+N+1);const i=o-n;if(i>B){const e=i-B;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<B){const t=B-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}I({start:n,end:o})},[P,N,B,r.length,L]),s(()=>()=>{me();for(const e of V.current.values())e.destroy();V.current.clear()},[me]);const ge=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete F.current[t],K.current.delete(t),X.current.delete(t),q.current.delete(t))},[]);s(()=>{ge(W)},[ge,W]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(R.current.keys()))n>=e&&(R.current.delete(n),t=!0);t&&z(e=>e+1);for(const n of Object.keys(F.current))Number(n)>=e&&delete F.current[n];for(const n of Array.from(U.current))n>=e&&U.current.delete(n)},[r.length]);const fe=d((e,t)=>{E&&t&&(F.current[e]=!0),t&&L&&A(t=>e>t?e:t)},[E,L]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),ve=d((e,t)=>{const n=K.current;if(t?n.set(e,t):n.delete(e),!ie||!t)return we(e),E&&!t&&delete F.current[e],void(t&&fe(e,!0));if(e<C&&!L)return we(e),void fe(e,!0);we(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&fe(e,!0),r.whenVisible.then(()=>fe(e,!0)).catch(()=>{})},[E,we,fe,y,C,ie,L]),ye=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>ve(e,t);return X.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(R.current.has(e)&&(R.current.delete(e),z(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),ke=d(e=>{const t=q.current.get(e);if(t)return t;const n=t=>xe(e,t);return q.current.set(e,n),n},[xe]),be=d(e=>!(T&&e>=j.current)&&(!E||e<C||!0===F.current[e]),[E,T,C]),Ce=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of K.current.entries())t&&ve(e,t)},[ve]),s(()=>{L&&D>Z.current&&A(D-1),Z.current=D},[D,L]);const Me=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${de}px`},"aria-hidden":"true"}):null,Ne=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
183
+ return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,onClick:t.onClick,onMouseOver:Ce(t.onMouseOver),onMouseOut:Ce(t.onMouseOut),children:[Me,ae.map(({node:n,index:r})=>{var o;const i=be(r),c=null!=(o=R.current.get(r))?o:le,s=!1!==t.typewriter&&"code_block"!==n.type&&!U.current.has(r)&&i;return s&&U.current.add(r),/* @__PURE__ */e("div",{ref:ye(r),className:"node-slot","data-node-index":r,"data-node-type":n.type,children:/* @__PURE__ */e("div",i?{ref:ke(r),className:"node-content"+(s?" typewriter-node":""),children:Un(n,`${a}-${r}`,l)}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Ne]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),er=t=>{const n={...Zn,...t},r=c(null),i=c(null),l=u(P,A,A),a=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),d=o(()=>{const e=I(n.customId);return Object.keys(e).map(String).map(e=>e.trim().toLowerCase()).filter(Jn)},[n.customId,l]),m=o(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...d].map(Gn).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,d,l]),g=o(()=>{const e=m;return e&&0!==e.length?h(a,{customHtmlTags:e}):h(a)},[a,m]),f=o(()=>{const e=g;return n.customMarkdownIt?n.customMarkdownIt(e):e},[g,n.customMarkdownIt]),w=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=m.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:m}:{}}:r},[m,n.final,n.parseOptions]),v=o(()=>{var e,t;const r=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,o=r?performance.now():0;let i=[];return Array.isArray(n.nodes)&&n.nodes.length?i=n.nodes.map(e=>({...e})):n.content&&(i=p(n.content,null!=f?f:Yn,w)),r&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-o),nodes:i.length,contentLength:null!=(t=null==(e=n.content)?void 0:e.length)?t:0}),i},[n.content,n.debugPerformance,n.nodes,w,f,n.customId,l,m]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!v.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==ie(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const r=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},o=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),i=r(()=>{he()},{timeout:900});return()=>o(i)},[v,n.renderCodeBlocksAsPre]),s(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&i.current!==t&&(i.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Se.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Se.set(e,t),t}catch{}const n="__theme_"+ ++Te;return Se.set(e,n),n}return String(e)}(e);t&&Ne!==t&&(Me=e,Ne=t,Be&&Ce(Me,Be).then(()=>Ee()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const y=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),x=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:y,typewriter:n.typewriter,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:n.codeBlockProps,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,y,n.typewriter,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockProps,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick]);/* @__PURE__ */
184
184
  return e(E,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(Qn,{props:n,parsedNodes:v,renderCtx:x,indexPrefix:y,containerRef:r})})};function tr(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
185
- return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(er,{nodes:c.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:s.customId,isDark:s.isDark,typewriter:s.typewriter,viewportPriority:!0,codeBlockStream:s.codeBlockStream,renderCodeBlocksAsPre:s.renderCodeBlocksAsPre,codeBlockProps:s.codeBlockProps,themes:null==(n=s.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=s.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=s.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=s.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=s.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=s.codeBlockThemes)?void 0:a.maxWidth,onCopy:s.events.onCopy,onHandleArtifactClick:s.events.onHandleArtifactClick}):null})}function nr(r){const l={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0,...r},a=o(()=>{var e;return String(null!=(e=l.node.language)?e:"")},[l.node.language]),u=o(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(a),[a]),m=o(()=>ie(a),[a]),h=o(()=>{const e=ce[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),p=o(()=>ae(m),[m]),{t:g}=K(),f=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),w=o(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),r=t(l.maxWidth);return n&&(e.minWidth=n),r&&(e.maxWidth=r),e},[l.maxWidth,l.minWidth]),[v,y]=i(!1),[x,k]=i(!1),[b,C]=i(!1),[M,N]=i(""),[B,L]=i(!1),[S,T]=i(14),[E,$]=i(S),_=c(null),D=c(null),j=c(null),W=c(null),P=c(!1),A=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),O=d(e=>{if(!e)return N(""),void L(!1);var t;N(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`),L(!1)},[]),I=d(()=>{N(""),L(!0)},[]),R=d(async()=>{if(!W.current&&!P.current){P.current=!0;try{const e=await import("stream-markdown");W.current=e.createShikiStreamRenderer}catch{}}},[]),H=d(async()=>{if(await R(),_.current&&D.current)if(!j.current&&W.current&&(j.current=W.current(D.current,{theme:A(),themes:l.themes}),L(!0)),j.current)if(!1===l.stream&&l.loading)O(l.node.code);else{O(l.node.code);try{await j.current.updateCode(l.node.code,u),I()}catch{}}else O(l.node.code);else O(l.node.code)},[I,R,A,u,l.loading,l.node.code,l.stream,l.themes,O]);s(()=>(H(),()=>{var e;null==(e=j.current)||e.dispose(),j.current=null}),[H]),s(()=>{j.current&&j.current.setTheme(A())},[A]),s(()=>{j.current&&(!1===l.stream&&l.loading||(O(l.node.code),Promise.resolve(j.current.updateCode(l.node.code,u)).then(()=>I()).catch(()=>{})))},[I,u,l.loading,l.node.code,l.stream,O]);const z=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),l.isDark)},[l.isDark]),F=d(()=>te(),[]),V=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),y(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>y(!1),1e3)}catch{}},[l]),X=d(()=>{var e;if(!f)return;const t="html"===u?"text/html":"image/svg+xml",n="html"===u?"HTML Preview":"SVG Preview";null==(e=l.onPreviewCode)||e.call(l,{type:t,content:l.node.code,title:n})},[f,u,l]),q=o(()=>({fontSize:`${E}px`}),[E]);return s(()=>{T(14),$(14)},[]),/* @__PURE__ */n("div",{className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",l.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:w,children:[l.showHeader&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
185
+ return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(er,{nodes:c.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:s.customId,isDark:s.isDark,typewriter:s.typewriter,viewportPriority:!0,codeBlockStream:s.codeBlockStream,renderCodeBlocksAsPre:s.renderCodeBlocksAsPre,codeBlockProps:s.codeBlockProps,themes:null==(n=s.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=s.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=s.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=s.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=s.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=s.codeBlockThemes)?void 0:a.maxWidth,onCopy:s.events.onCopy,onHandleArtifactClick:s.events.onHandleArtifactClick}):null})}function nr(r){const l={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0,...r},a=o(()=>{var e;return String(null!=(e=l.node.language)?e:"")},[l.node.language]),u=o(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(a),[a]),m=o(()=>ie(a),[a]),h=o(()=>{const e=ce[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),p=o(()=>ae(m),[m]),{t:g}=K(),f=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),w=o(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),r=t(l.maxWidth);return n&&(e.minWidth=n),r&&(e.maxWidth=r),e},[l.maxWidth,l.minWidth]),[v,y]=i(!1),[x,k]=i(!1),[b,C]=i(!1),[M,N]=i(""),[B,L]=i(!1),[S,T]=i(14),[E,$]=i(S),D=c(null),_=c(null),j=c(null),W=c(null),P=c(!1),A=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),O=d(e=>{if(!e)return N(""),void L(!1);var t;N(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`),L(!1)},[]),I=d(()=>{N(""),L(!0)},[]),R=d(async()=>{if(!W.current&&!P.current){P.current=!0;try{const e=await import("stream-markdown");W.current=e.createShikiStreamRenderer}catch{}}},[]),H=d(async()=>{if(await R(),D.current&&_.current)if(!j.current&&W.current&&(j.current=W.current(_.current,{theme:A(),themes:l.themes}),L(!0)),j.current)if(!1===l.stream&&l.loading)O(l.node.code);else{O(l.node.code);try{await j.current.updateCode(l.node.code,u),I()}catch{}}else O(l.node.code);else O(l.node.code)},[I,R,A,u,l.loading,l.node.code,l.stream,l.themes,O]);s(()=>(H(),()=>{var e;null==(e=j.current)||e.dispose(),j.current=null}),[H]),s(()=>{j.current&&j.current.setTheme(A())},[A]),s(()=>{j.current&&(!1===l.stream&&l.loading||(O(l.node.code),Promise.resolve(j.current.updateCode(l.node.code,u)).then(()=>I()).catch(()=>{})))},[I,u,l.loading,l.node.code,l.stream,O]);const z=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),l.isDark)},[l.isDark]),F=d(()=>te(),[]),V=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),y(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>y(!1),1e3)}catch{}},[l]),X=d(()=>{var e;if(!f)return;const t="html"===u?"text/html":"image/svg+xml",n="html"===u?"HTML Preview":"SVG Preview";null==(e=l.onPreviewCode)||e.call(l,{type:t,content:l.node.code,title:n})},[f,u,l]),q=o(()=>({fontSize:`${E}px`}),[E]);return s(()=>{T(14),$(14)},[]),/* @__PURE__ */n("div",{className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",l.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:w,children:[l.showHeader&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
186
186
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
187
187
  /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:p}}),
188
188
  /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:h})]}),
@@ -196,10 +196,10 @@ return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,childr
196
196
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
197
197
  /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),l.showExpandButton&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":x,onClick:()=>k(e=>!e),onMouseEnter:e=>z(e,x?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onFocus:e=>z(e,x?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onMouseLeave:F,onBlur:F,children:/* @__PURE__ */e("svg",x?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})})}),f&&l.showPreviewButton&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":g("common.preview")||"Preview",onClick:X,onMouseEnter:e=>z(e,g("common.preview")||"Preview"),onFocus:e=>z(e,g("common.preview")||"Preview"),onMouseLeave:F,onBlur:F,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
198
198
  /* @__PURE__ */e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
199
- /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!b&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:_,className:"code-block-content",style:{...q,maxHeight:x?"none":"500px",overflowY:x?"visible":"auto",overflowX:"auto"},children:[
200
- /* @__PURE__ */e("div",{ref:D,className:"code-block-render"}),!B&&M&&/* @__PURE__ */e("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:M}})]}),!l.stream&&l.loading&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
199
+ /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!b&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:D,className:"code-block-content",style:{...q,maxHeight:x?"none":"500px",overflowY:x?"visible":"auto",overflowX:"auto"},children:[
200
+ /* @__PURE__ */e("div",{ref:_,className:"code-block-render"}),!B&&M&&/* @__PURE__ */e("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:M}})]}),!l.stream&&l.loading&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
201
201
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
202
202
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
203
203
  /* @__PURE__ */e("div",{className:"skeleton-line short"})]})}),
204
204
  /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:v?g("common.copied")||"Copied":""})]})}function rr(t){var n;const r=c(null),[l,a]=i(!1),[d,u]=i({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),m=o(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(t.isDark),[t.isDark]);return s(()=>{if(!t.visible)return void a(!1);if(!t.anchorEl||!r.current)return void a(!0);let e=null,n=!1;const o=async()=>{var e,o;if(!t.anchorEl||!r.current)return;const{x:i,y:l}=await f(t.anchorEl,r.current,{placement:null!=(e=t.placement)?e:"top",middleware:[w(null!=(o=t.offset)?o:8),v(),y({padding:8})],strategy:"fixed"});n||u({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(l)}px, 0)`})};return o().then(()=>{n||a(!0)}),e=g(t.anchorEl,r.current,o),()=>{n=!0,null==e||e()}},[t.anchorEl,t.offset,t.placement,t.visible]),"undefined"==typeof document?null:t.visible&&l?x(
205
- /* @__PURE__ */e("div",{id:null!=(n=t.id)?n:void 0,ref:r,style:d,className:["ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:t.content}),document.body):null}export{B as AdmonitionNode,tr as BlockquoteNode,z as CheckboxNode,De as CodeBlockNode,je as DefinitionListNode,We as EmojiNode,Pe as EmphasisNode,Pn as FallbackComponent,Ae as FootnoteAnchorNode,Oe as FootnoteNode,Ie as FootnoteReferenceNode,Re as HardBreakNode,Fe as HeadingNode,Ve as HighlightNode,tt as HtmlBlockNode,ft as HtmlInlineNode,se as HtmlPreviewFrame,vt as ImageNode,Ct as InfographicBlockNode,Mt as InlineCodeNode,Nt as InsertNode,Bt as LinkNode,Lt as ListItemNode,St as ListNode,dn as MERMAID_WORKER_BUSY_CODE,nr as MarkdownCodeBlockNode,Qt as MathBlockNode,en as MathInlineNode,En as MermaidBlockNode,er as NodeRenderer,An as ParagraphNode,$e as PreCodeNode,De as ReactCodeBlockNode,On as ReferenceNode,In as StrikethroughNode,Rn as StrongNode,Hn as SubscriptNode,zn as SuperscriptNode,Fn as TableNode,Vn as TextNode,Kn as ThematicBreakNode,rr as Tooltip,Xn as VmrContainerNode,Rt as WORKER_BUSY_CODE,pn as canParseOffthread,H as clearGlobalCustomComponents,Ft as clearKaTeXCache,Ot as clearKaTeXWorker,mn as clearMermaidWorker,gn as findPrefixOffthread,I as getCustomNodeComponents,Ut as getKaTeXBackpressureDefaults,ae as getLanguageIcon,sn as getMermaidWorkerLoad,ce as languageMap,ie as normalizeLanguageIdentifier,R as removeCustomComponents,Ht as renderKaTeXInWorker,Zt as renderKaTeXWithBackpressure,Un as renderNode,le as resolveMonacoLanguageId,O as setCustomComponents,V as setDefaultI18nMap,qt as setKaTeXBackpressureDefaults,zt as setKaTeXCache,Vt as setKaTeXConcurrencyLimit,At as setKaTeXWorker,It as setKaTeXWorkerDebug,re as setLanguageIconResolver,un as setMermaidWorker,an as setMermaidWorkerClientDebug,cn as setMermaidWorkerMaxConcurrency,fn as terminateWorker,K as useSafeI18n,Kt as waitForKaTeXWorkerSlot};
205
+ /* @__PURE__ */e("div",{id:null!=(n=t.id)?n:void 0,ref:r,style:d,className:["ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:t.content}),document.body):null}export{B as AdmonitionNode,tr as BlockquoteNode,z as CheckboxNode,_e as CodeBlockNode,je as DefinitionListNode,We as EmojiNode,Pe as EmphasisNode,Pn as FallbackComponent,Ae as FootnoteAnchorNode,Oe as FootnoteNode,Ie as FootnoteReferenceNode,Re as HardBreakNode,Fe as HeadingNode,Ve as HighlightNode,tt as HtmlBlockNode,ft as HtmlInlineNode,se as HtmlPreviewFrame,vt as ImageNode,Ct as InfographicBlockNode,Mt as InlineCodeNode,Nt as InsertNode,Bt as LinkNode,Lt as ListItemNode,St as ListNode,dn as MERMAID_WORKER_BUSY_CODE,nr as MarkdownCodeBlockNode,Qt as MathBlockNode,en as MathInlineNode,En as MermaidBlockNode,er as NodeRenderer,An as ParagraphNode,$e as PreCodeNode,_e as ReactCodeBlockNode,On as ReferenceNode,In as StrikethroughNode,Rn as StrongNode,Hn as SubscriptNode,zn as SuperscriptNode,Fn as TableNode,Vn as TextNode,Kn as ThematicBreakNode,rr as Tooltip,Xn as VmrContainerNode,Rt as WORKER_BUSY_CODE,pn as canParseOffthread,H as clearGlobalCustomComponents,Ft as clearKaTeXCache,Ot as clearKaTeXWorker,mn as clearMermaidWorker,gn as findPrefixOffthread,I as getCustomNodeComponents,Ut as getKaTeXBackpressureDefaults,ae as getLanguageIcon,sn as getMermaidWorkerLoad,ce as languageMap,ie as normalizeLanguageIdentifier,R as removeCustomComponents,Ht as renderKaTeXInWorker,Zt as renderKaTeXWithBackpressure,Un as renderNode,le as resolveMonacoLanguageId,O as setCustomComponents,V as setDefaultI18nMap,qt as setKaTeXBackpressureDefaults,zt as setKaTeXCache,Vt as setKaTeXConcurrencyLimit,At as setKaTeXWorker,It as setKaTeXWorkerDebug,re as setLanguageIconResolver,un as setMermaidWorker,an as setMermaidWorkerClientDebug,cn as setMermaidWorkerMaxConcurrency,fn as terminateWorker,K as useSafeI18n,Kt as waitForKaTeXWorkerSlot};
package/dist/tailwind.ts CHANGED
@@ -1,3 +1,3 @@
1
- export const safeList = `string cannot delete global call clearGlobalCustomComponents checkbox-node checkbox checkbox-input react react-dom en utf-8 viewport content="width=device-width initial-scale=1 event.key keydown html-preview-frame__backdrop--dark html-preview-frame--dark html-preview-frame__header html-preview-frame__title html-preview-frame__dot html-preview-frame__label html-preview-frame__close--dark html-preview-frame__iframe allow-scripts allow-same-origin blockquote-node auto dl definition-list indexKey mb-4 dt definition-term font-semibold ctx renderNode ?? definition dd definition-desc ml-4 emoji-node note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby stream-markdown-parser typeof window.requestIdleCallback [data-node-index] node-spacer dark virtualized code_block node-slot data-node-index data-node-type typewriter-node node-placeholder performance [markstream-react][perf] mermaid theme object name markdown-renderer smooth footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer ↩︎ footnote-reference handleScroll href footnote footnote-link clsx heading-node emphasis-node footnote-node flex mt-2 mb-2 leading-relaxed border-t border-[#eaecef] pt-2 flex-1 plaintext number diff none visible view.getModifiedEditor on same helpers.cleanupEditor canonicalLanguage single window.requestAnimationFrame window.cancelAnimationFrame top navigator.clipboard navigator.clipboard.writeText code-block-container my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 bg-gray-900 border-gray-200 bg-white is-rendering code-block-header justify-between items-center px-4 py-2.5 border-b border-gray-400/5 space-x-2 icon-slot h-4 w-4 flex-shrink-0 font-medium font-mono truncate code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)] aria-pressed w-3 h-3 currentColor round m9 copied m14 evenodd code-block-body--collapsed code-block-body--expanded code-height-placeholder hidden aria-hidden absolute code-fallback-plain m-0 aria-busy aria-label no code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status hard-break onclick onerror onload onmouseover onmouseout onmousedown onmouseup onkeydown onkeyup onfocus onblur onsubmit onreset onchange onselect ondblclick src srcset xlink:href formaction abbr address area article aside bdi bdo caption cite col colgroup data datalist details dfn dialog embed fieldset footer header hgroup kbd legend main map mark menu meter nav optgroup output param picture progress rp rt ruby samp section small source summary template tfoot time track var wbr class text tag_close self_closing tag_open setHostEl html-block-node shouldRender useDynamic reactNodes renderContent html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 highlight-node setFigureEl image-node image-node__inner is-loaded contain lazy eager async image image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error failed to load image-node__caption insert-node inline-code inline text-[85%] px-1 py-0.5 rounded bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full list-item pl-1.5 my-2 valueAttr children linear infinite link-loading inline-flex items-baseline gap-1.5 link-text-wrapper relative leading-[normal] link-text node.text underline-anim link-node noopener noreferrer list-node my-5 pl-[calc(13/8*1em)] list-decimal list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)] list library render text-red-500 p-4">Failed instanceof error.message error transform ease center fullscreen touches text-gray-400 hover:bg-gray-700 hover:text-gray-200 text-gray-600 hover:bg-gray-200 hover:text-gray-700 bg-gray-800 bg-gray-50 gap-x-2 gap-x-1 p-0.5 bg-gray-700 bg-gray-100 px-2.5 py-1 !showSource bg-gray-600 text-gray-200 text-gray-700 text-gray-500 showSource m16 isCollapsed opacity-50 cursor-not-allowed m7 whitespace-pre-wrap text-gray-300 baseCode top-2 right-2 z-10 gap-2 backdrop-blur min-h-[360px] transition-all duration-100 block inset-0 cursor-grab isDragging containerRef w-full text-center justify-center min-h-full fixed z-50 bg-black/70 p-4 closeModal h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing vitesse-dark vitesse-light shiki shiki-fallback stream-markdown code-block-content rendererTargetRef code-block-render unknown-node italic node paragraph-node paragraph reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] superscript-node strong-node right text-right text-left table-node-wrapper my-8 table-node table-node--loading border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] table-node__loading table-node__spinner strikethrough-node subscript-node hr-node thematic-break boolean window.matchMedia ms-tooltip z-[9999] inline-block text-base py-2 px-3 shadow-md whitespace-nowrap pointer-events-none tooltip-element text-white border-gray-700 text-gray-900 tooltip in out zoom text-node text-node-center containerClass vmr-container infographic html_block node.type html_inline text_special node.content heading list_item definition_list footnote_reference footnote_anchor admonition hardbreak inline_code emphasis strikethrough highlight insert subscript superscript checkbox_input emoji thematic_break math_inline math_block reference vmr_container label_open label_close afterbegin light loose strict viewBox open-modal [data-mermaid-wrapper] mermaid-action-btn toggle-mode preview common.zoomIn common.zoomOut common.resetZoom data-mermaid-wrapper mermaid-loading mermaid-spinner diagram… mermaid-block-header space-x-1 common.preview common.source common.export mermaid-error mermaid-block mermaid-modal-overlay mermaid-modal-panel mermaid-modal-header mermaid-modal-title mermaid-modal-close mermaid-modal-body modalContentRef mermaid-modal-content not available default abort timed [mermaidWorkerClient] messageerror cleared worker instance inject via busy canParse findPrefix javascript typescript python shell plain cpp markdown stream-monaco thinking htmlFor className document data-language role aria-describedby math-block overflow-x-auto min-h-[40px] mathRef rendering math-rendering ontouchstart ontouchend ontouchmove ontouchcancel onwheel onscroll oncopy oncut onpaste oninput oninvalid onsearch checked disabled readonly required autofocus multiple value min max step width height size maxlength parse dynamic html-inline-node html-inline-node--loading $$ math-inline-wrapper math-inline--hidden math-inline__loading math-inline__spinner [katexWorkerClient] init cache-hit timeout waiting slot globalThis.requestAnimationFrame globalThis.cancelAnimationFrame module did expected [markstream-react] existingEnv.getWorkerUrl katex`
1
+ export const safeList = `string cannot delete global call clearGlobalCustomComponents blockquote-node auto react note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby stream-markdown-parser typeof window.requestIdleCallback [data-node-index] node-spacer dark virtualized code_block node-slot data-node-index data-node-type typewriter-node node-placeholder performance [markstream-react][perf] mermaid theme object name markdown-renderer checkbox-node checkbox checkbox-input emoji-node react-dom en utf-8 viewport content="width=device-width initial-scale=1 event.key keydown html-preview-frame__backdrop--dark html-preview-frame--dark html-preview-frame__header html-preview-frame__title html-preview-frame__dot html-preview-frame__label html-preview-frame__close--dark html-preview-frame__iframe allow-scripts allow-same-origin emphasis-node smooth footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer ↩︎ dl definition-list indexKey mb-4 dt definition-term font-semibold ctx renderNode ?? definition dd definition-desc ml-4 footnote-node flex mt-2 mb-2 leading-relaxed border-t border-[#eaecef] pt-2 flex-1 hard-break clsx heading-node plaintext number diff none visible view.getModifiedEditor on same helpers.cleanupEditor canonicalLanguage single window.requestAnimationFrame window.cancelAnimationFrame top navigator.clipboard navigator.clipboard.writeText code-block-container my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 bg-gray-900 border-gray-200 bg-white is-rendering code-block-header justify-between items-center px-4 py-2.5 border-b border-gray-400/5 space-x-2 icon-slot h-4 w-4 flex-shrink-0 font-medium font-mono truncate code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)] aria-pressed w-3 h-3 currentColor round m9 copied m14 evenodd code-block-body--collapsed code-block-body--expanded code-height-placeholder hidden aria-hidden absolute code-fallback-plain m-0 aria-busy aria-label no code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status footnote-reference handleScroll href footnote footnote-link mark highlight-node onclick onerror onload onmouseover onmouseout onmousedown onmouseup onkeydown onkeyup onfocus onblur onsubmit onreset onchange onselect ondblclick src srcset xlink:href formaction abbr address area article aside bdi bdo caption cite col colgroup data datalist details dfn dialog embed fieldset footer header hgroup kbd legend main map menu meter nav optgroup output param picture progress rp rt ruby samp section small source summary template tfoot time track var wbr class text tag_close self_closing tag_open setHostEl html-block-node shouldRender useDynamic reactNodes renderContent html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 setFigureEl image-node image-node__inner is-loaded contain lazy eager async image image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error failed to load image-node__caption inline-code inline text-[85%] px-1 py-0.5 rounded bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full insert-node list-node my-5 pl-[calc(13/8*1em)] list-decimal list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)] list linear infinite link-loading inline-flex items-baseline gap-1.5 link-text-wrapper relative leading-[normal] link-text node.text underline-anim link-node noopener noreferrer list-item pl-1.5 my-2 valueAttr children library render text-red-500 p-4">Failed instanceof error.message error transform ease center fullscreen touches text-gray-400 hover:bg-gray-700 hover:text-gray-200 text-gray-600 hover:bg-gray-200 hover:text-gray-700 bg-gray-800 bg-gray-50 gap-x-2 gap-x-1 p-0.5 bg-gray-700 bg-gray-100 px-2.5 py-1 !showSource bg-gray-600 text-gray-200 text-gray-700 text-gray-500 showSource m16 isCollapsed opacity-50 cursor-not-allowed m7 whitespace-pre-wrap text-gray-300 baseCode top-2 right-2 z-10 gap-2 backdrop-blur min-h-[360px] transition-all duration-100 block inset-0 cursor-grab isDragging containerRef w-full text-center justify-center min-h-full fixed z-50 bg-black/70 p-4 closeModal h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing right text-right text-left table-node-wrapper my-8 table-node table-node--loading border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] table-node__loading table-node__spinner paragraph-node paragraph strikethrough-node unknown-node italic node strong-node subscript-node vitesse-dark vitesse-light shiki shiki-fallback stream-markdown code-block-content rendererTargetRef code-block-render hr-node thematic-break in out zoom text-node text-node-center reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] superscript-node boolean window.matchMedia ms-tooltip z-[9999] inline-block text-base py-2 px-3 shadow-md whitespace-nowrap pointer-events-none tooltip-element text-white border-gray-700 text-gray-900 tooltip containerClass vmr-container infographic html_block node.type html_inline text_special node.content heading list_item definition_list footnote_reference footnote_anchor admonition hardbreak inline_code emphasis strikethrough highlight insert subscript superscript checkbox_input emoji thematic_break math_inline math_block reference vmr_container label_open label_close afterbegin light loose strict viewBox open-modal [data-mermaid-wrapper] mermaid-action-btn toggle-mode preview common.zoomIn common.zoomOut common.resetZoom data-mermaid-wrapper mermaid-loading mermaid-spinner diagram… mermaid-block-header space-x-1 common.preview common.source common.export mermaid-error mermaid-block mermaid-modal-overlay mermaid-modal-panel mermaid-modal-header mermaid-modal-title mermaid-modal-close mermaid-modal-body modalContentRef mermaid-modal-content not available default abort timed javascript typescript python shell plain cpp markdown [mermaidWorkerClient] messageerror cleared worker instance inject via busy canParse findPrefix stream-monaco thinking htmlFor className data-language document role aria-describedby ontouchstart ontouchend ontouchmove ontouchcancel onwheel onscroll oncopy oncut onpaste oninput oninvalid onsearch checked disabled readonly required autofocus multiple value min max step width height size maxlength parse dynamic html-inline-node html-inline-node--loading $$ math-inline-wrapper mathRef math-inline--hidden math-inline__loading math-inline__spinner math-block overflow-x-auto min-h-[40px] rendering math-rendering globalThis.requestAnimationFrame globalThis.cancelAnimationFrame module did expected [markstream-react] [katexWorkerClient] init cache-hit timeout waiting slot existingEnv.getWorkerUrl katex`
2
2
  module.exports = safeList;
3
3
  export default safeList;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-react",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "description": "React Markdown renderer optimized for large documents with progressive Mermaid rendering, streaming diff code blocks, and fast real-time preview. Built on stream-markdown AST for consistent rendering across frameworks. Perfect for documentation sites, AI chat interfaces, and content management systems.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",