markstream-react 0.0.20-beta.9 → 0.0.21

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
@@ -3,213 +3,213 @@ import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{useMem
3
3
  return e(t,{children:C(n,r,`${o}-inline`,i)})}const N={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function B(t){const{node:r,ctx:l,renderNode:a,indexKey:c,isDark:s}=t,d=String(r.kind||"note"),u=o(()=>r.title&&String(r.title).trim().length?String(r.title):d.charAt(0).toUpperCase()+d.slice(1),[d,r.title]),[m,h]=i(()=>{var e;return!!r.collapsible&&!(null==(e=r.open)||e)}),p=o(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);/* @__PURE__ */
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
- /* @__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 E(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 S=E(()=>null,()=>!0);function T({getRoot:t,enabled:n=!0,children:r}){const i=c(n);i.current=n;const l=c(t);l.current=t;const a=o(()=>E(()=>{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 D(){var e;return null!=(e=l(L))?e:S}const $="__global__",j="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",_=(()=>{const e=globalThis;if(e[j])return e[j];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[j]=t,t})();function A(){_.revision++;for(const e of Array.from(_.listeners))try{e()}catch{}}function W(e){return _.listeners.add(e),()=>{_.listeners.delete(e)}}function O(){return _.revision}function P(e,t){"string"==typeof e?_.scopedComponents[e]={...t||{}}:_.scopedComponents[$]={...e},A()}function I(e){const t=_.scopedComponents[$]||{};if(!e)return t;const n=_.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 _.scopedComponents[e],A()}function H(){delete _.scopedComponents[$],A()}function F(t){const{node:n}=t;/* @__PURE__ */
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 z={"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.close":"Close","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(z,e)}function K(){return{t:e=>{var t;return null!=(t=z[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,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=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():Y=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():Z=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",d2lang:"d2",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",d2:"D2"};function se(t){const{t:r}=K(),i=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(
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 T(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 E=T(()=>null,()=>!0);function S({getRoot:t,enabled:n=!0,children:r}){const i=c(n);i.current=n;const l=c(t);l.current=t;const a=o(()=>T(()=>{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 D(){var e;return null!=(e=l(L))?e:E}const $="__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 A(){j.revision++;for(const e of Array.from(j.listeners))try{e()}catch{}}function W(e){return j.listeners.add(e),()=>{j.listeners.delete(e)}}function O(){return j.revision}function P(e,t){"string"==typeof e?j.scopedComponents[e]={...t||{}}:j.scopedComponents[$]={...e},A()}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],A()}function F(){delete j.scopedComponents[$],A()}function H(t){const{node:n}=t;/* @__PURE__ */
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 z={"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.close":"Close","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(z,e)}function X(){return{t:e=>{var t;return null!=(t=z[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 K=null,q=null,U=null,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=null)}async function Q(e){if(!K||!q)return;const{x:t,y:n}=await f(q,K,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});K.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(K||"undefined"==typeof document||(K=document.createElement("div"),K.className="ms-tooltip",K.setAttribute("role","tooltip"),K.dataset.visible="false",K.style.position="fixed",K.style.left="0px",K.style.top="0px",K.style.transform="translate3d(0,0,0)",document.body.appendChild(K)),!K)return;J();const l=async()=>{if(K){q=e,K.textContent=t,K.dataset.placement=n,K.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",K.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,K.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),K.dataset.visible="true",null==U||U(),U=g(e,K,()=>{Q(n)})}};r?l():Y=setTimeout(l,80)}function te(e=!1){if(!K)return;J();const t=()=>{if(K){if(K.dataset.visible="false",q&&G)try{q.removeAttribute("aria-describedby")}catch{}q=null,G=null,U&&(U(),U=null)}};e?t():Z=setTimeout(t,120)}const ne='<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';let re=null,oe=null,ie=null;const le=/* @__PURE__ */new Set;function ae(e){re=null!=e?e:null}const ce={"":"",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",d2lang:"d2",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"},se={"":ne,plain:ne,text:ne,javascript:'<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',typescript:'<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',jsx:'<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',tsx:'<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',html:'<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',css:'<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',json:'<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',python:'<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',shell:'<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',markdown:'<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',mermaid:'<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'};function de(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=ce[n])?t:n}function ue(e){const t=de(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}async function me(){return oe||(ie||(ie=import("./languageIconExtended-B1nZmPQn.js").then(e=>(oe=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of le)try{e()}catch{}}(),oe)).catch(()=>null)),ie)}async function he(){await me()}function pe(e){return le.add(e),()=>{le.delete(e)}}function ge(e){if(re){const t=re(e);if(null!=t&&""!==t)return t}const t=de(e),n=se[t];if(n)return n;return(null==oe?void 0:oe[t])||(me(),'<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 fe={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",d2:"D2"};function we(t){const{t:r}=X(),i=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:[
11
11
  /* @__PURE__ */n("div",{className:"html-preview-frame__title",children:[
12
12
  /* @__PURE__ */e("span",{className:"html-preview-frame__dot"}),
13
13
  /* @__PURE__ */e("span",{className:"html-preview-frame__label",children:t.title||`HTML ${r("common.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
- /* @__PURE__ */e("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:i,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,Ee=/* @__PURE__ */new WeakMap;let Se=0;function Te(){for(const e of Array.from(Le))try{e()}catch{}}function De({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 je(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,E=c(null),S=c(null),T=c(null),$=c(null),j=c(null),_=c(null),A=c(null),W=c(0),O=c(null),P=c(null),I=D(),R=c(y),H=c(x),F=c(y),[z,V]=i(!1),[X,q]=i(()=>"undefined"==typeof window),[U,Y]=i(!1),[Z,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}),[Ee,Se]=i(ke),je=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},[]),_e=d(e=>{var t,n,r,o;if(z)return;const i=E.current,l=T.current;if(!i||!l)return;const a="diff"===_.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=je();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"===_.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{}},[je,z]);s(()=>{R.current=y},[y]),s(()=>{de(ie(u.language))},[u.language]);const Ae=c(u);Ae.current=u;const We=d(()=>{var e;W.current+=1;try{null==(e=$.current)||e.call($)}catch{}j.current=null,_.current=null,A.current=null,Q(!1),G(!1)},[]),Oe=d(()=>{var e,t,n,r,o,i;const l=E.current,a=S.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;W.current+=1,null==(e=$.current)||e.call($),$.current=null,j.current=null,_.current=null,A.current=null,O.current=null,null==(n=null==(t=P.current)?void 0:t.destroy)||n.call(t),P.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(X)return;const n=S.current;if(!n)return;null==(t=null==(e=P.current)?void 0:e.destroy)||t.call(e);const r=I(n,{rootMargin:"400px"});return P.current=r,r.isVisible()&&q(!0),r.whenVisible.then(()=>q(!0)),()=>{r.destroy(),P.current===r&&(P.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&&(O.current=i),"function"!=typeof o)return void V(!0);const l=null!=(t=m?w:v)?t:Me,a={...F.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:H.current,theme:l,...a,onThemeChange(){Oe()}});T.current=c,"function"==typeof(n=c.setTheme)&&(Be=n,null!=Me&&null!=Ne&&Ce(Me,Be).then(()=>Te()).catch(()=>{})),$.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,Y(!0)}catch{e&&V(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!oe&&O.current)try{const t=O.current(String(null!=(e=u.code)?e:""));t&&re(t)}catch{}},[oe,u.code,u.language]);const Pe=o(()=>String(u.language||oe||ne||"plaintext"),[oe,ne,u.language]),Ie=o(()=>ie(Pe),[Pe]),Re=o(()=>le(Ie),[Ie]),He=o(()=>ae(Ie),[Ie]),Fe=o(()=>!!g&&("html"===Ie||"svg"===Ie),[Ie,g]),ze=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(z)return;if(!Z||!X)return;const e=T.current;(null==e?void 0:e.setTheme)&&qe&&Ce(qe,e.setTheme).then(Oe).catch(()=>{})},[Z,qe,Oe,z,X]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{Oe()},Le.add(e),()=>{Le.delete(e)}},[Oe]);const Ue=d(async()=>{var e,t;if(z)return null;if(!X)return null;if(fe)return null;if(Xe)return null;const n=T.current,r=E.current;if(!n||!r||!n.createEditor)return null;const o=Ae.current,i=o.diff?"diff":"single",l=A.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(_.current===i&&l===r&&a)return null;if(j.current)return j.current;W.current+=1;const c=W.current;G(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=$.current)||e.call($),_.current=null,A.current=null,Q(!1);const p=Re;if(o.diff?"function"==typeof n.createDiffEditor?(_.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(_.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(_.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),A.current=r,W.current!==c)return;const g=Number(null==(d=R.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){be(g),Se(g);try{const e="diff"===_.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{}}Oe(),pe||fe||_e(!1),Q(!0)}catch{W.current===c&&V(!0)}})().finally(()=>{j.current===s&&(j.current=null)});return j.current=s,s},[_e,fe,pe,Re,Xe,Oe,z,X]);s(()=>{z||U&&X&&(fe||Xe?We():Ue())},[fe,Ue,U,We,Xe,z,X]),s(()=>{var e;if(z)return;if(!U)return;if(!X)return;if(fe)return;if(Xe)return;const t=T.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=oe;if(!o&&O.current)try{o=ie(O.current(n)),o&&de(o)}catch{}const i=le(o||Ie);if(t.createEditor&&E.current){try{await Promise.resolve(Ue())}catch{}const e=j.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&&_e(!0)})()},[_e,Ie,oe,fe,Z,Ue,pe,U,u.code,u.diff,u.originalCode,u.updatedCode,Xe,z,X]),s(()=>{if(z)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(()=>_e(pe)):null;return null==e&&_e(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[_e,fe,pe,h,U,Xe,z,X]),s(()=>{var e,t,n;if(!f)return;if(z)return;const r=T.current;if(r){try{const o="diff"===_.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:Ee})}catch{}_e(pe)}},[_e,f,pe,Ee,u.diff,z]);const Ye=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),m)},[m]),Ze=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(!Fe)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,Fe,u,a,xe]);return z?/* @__PURE__ */e(De,{node:u}):/* @__PURE__ */n("div",{ref:S,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:[
15
+ /* @__PURE__ */e("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:i,title:t.title||"Preview"})]})}),document.body)}let ve=!1,ye=null,xe=!1;async function ke(){if(ye)return ye;if(xe)return null;try{return ye=await import("stream-monaco"),await async function(e){if(ve)return;ve=!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()}(ye),ye}catch{return xe=!0,null}}let be=null,Ce=!1,Me=null,Ne=null,Be=null,Le=null,Te=null;const Ee=/* @__PURE__ */new WeakMap;let Se=0;function De(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=Ee.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Ee.set(e,t),t}catch{}const n="__theme_"+ ++Se;return Ee.set(e,n),n}return String(e)}(e);return n?(be!==t&&(be=t),Ce||Te!==n?!Me||Le!==n&&Ne!==n?(Be=e,Le=n,Me||(Ce=!0,Me=(async()=>{for(;null!=Be&&null!=Le;){const e=Be,t=Le;if(Be=null,Le=null,Te===t)continue;const n=be;if(!n)break;try{Ne=t,await Promise.resolve(n(e)),Te=t}catch{}}})().finally(()=>{Ce=!1,Me=null,Ne=null}),Me)):Me:Promise.resolve()):Promise.resolve()}let $e=null,_e=null,je=null;const Ae=/* @__PURE__ */new Set,We=/* @__PURE__ */new WeakMap;let Oe=0;function Pe(){for(const e of Array.from(Ae))try{e()}catch{}}function Ie({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 Re={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function Fe(r){var l;const a={...Re,...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,showTooltips:T}=a,E=c(null),S=c(null),$=c(null),_=c(null),j=c(null),A=c(null),W=c(null),O=c(0),P=c(null),I=c(null),R=D(),F=c(y),H=c(x),z=c(y),[V,K]=i(!1),[q,U]=i(()=>"undefined"==typeof window),[Y,Z]=i(!1),[G,J]=i(!1),[Q,ne]=i(!1),[re,oe]=i(()=>u.language||"plaintext"),[ie,le]=i(()=>de(u.language)),[ae,ce]=i(!1),[se,me]=i(!1),[he,ve]=i(!1),[ye,xe]=i(!1),[be,Ce]=i(0),{t:Me}=X(),[Ne,Be]=i(()=>{const e=Number(null==y?void 0:y.fontSize);return Number.isFinite(e)&&e>0?e:14}),[Le,Te]=i(Ne),Ee=o(()=>!1!==T,[T]),Se=d(()=>{var e,t;const n=null!=(t=null==(e=F.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},[]),We=d(e=>{var t,n,r,o;if(V)return;const i=E.current,l=$.current;if(!i||!l)return;const a="diff"===A.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=Se();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"===A.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{}},[Se,V]);s(()=>{F.current=y},[y]),s(()=>pe(()=>{Ce(e=>e+1)}),[]),s(()=>{le(de(u.language))},[u.language]);const Oe=c(u);Oe.current=u;const Fe=d(()=>{var e;O.current+=1;try{null==(e=_.current)||e.call(_)}catch{}j.current=null,A.current=null,W.current=null,ne(!1),J(!1)},[]),He=d(()=>{var e,t,n,r,o,i;const l=E.current,a=S.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;O.current+=1,null==(e=_.current)||e.call(_),_.current=null,j.current=null,A.current=null,W.current=null,P.current=null,null==(n=null==(t=I.current)?void 0:t.destroy)||n.call(t),I.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(q)return;const n=S.current;if(!n)return;null==(t=null==(e=I.current)?void 0:e.destroy)||t.call(e);const r=R(n,{rootMargin:"400px"});return I.current=r,r.isVisible()&&U(!0),r.whenVisible.then(()=>U(!0)),()=>{r.destroy(),I.current===r&&(I.current=null)}},[R,q]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await ke();if(!e)return;if(!r)return void K(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(P.current=i),"function"!=typeof o)return void K(!0);const l=null!=(t=m?w:v)?t:$e,a={...z.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:H.current,theme:l,...a,onThemeChange(){He()}});$.current=c,"function"==typeof(n=c.setTheme)&&(je=n,null!=$e&&null!=_e&&De($e,je).then(()=>Pe()).catch(()=>{})),_.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,Z(!0)}catch{e&&K(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!ie&&P.current)try{const t=P.current(String(null!=(e=u.code)?e:""));t&&oe(t)}catch{}},[ie,u.code,u.language]);const ze=o(()=>String(u.language||ie||re||"plaintext"),[ie,re,u.language]),Ve=o(()=>de(ze),[ze]),Xe=o(()=>ue(Ve),[Ve]),Ke=o(()=>ge(Ve),[Ve,be]),qe=o(()=>!!g&&("html"===Ve||"svg"===Ve),[Ve,g]),Ue=o(()=>{const e=Ve;return e?fe[e]||e.charAt(0).toUpperCase()+e.slice(1):fe[""]||"Plain Text"},[Ve]),Ye=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]),Ze=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]),Ge=!1===p&&h,Je=o(()=>m?w:v,[w,m,v]);s(()=>{if(V)return;if(!G||!q)return;const e=$.current;(null==e?void 0:e.setTheme)&&Je&&De(Je,e.setTheme).then(He).catch(()=>{})},[G,Je,He,V,q]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{He()},Ae.add(e),()=>{Ae.delete(e)}},[He]);const Qe=d(async()=>{var e,t;if(V)return null;if(!q)return null;if(he)return null;if(Ge)return null;const n=$.current,r=E.current;if(!n||!r||!n.createEditor)return null;const o=Oe.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(A.current===i&&l===r&&a)return null;if(j.current)return j.current;O.current+=1;const c=O.current;J(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=_.current)||e.call(_),A.current=null,W.current=null,ne(!1);const p=Xe;if(o.diff?"function"==typeof n.createDiffEditor?(A.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(A.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(A.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),W.current=r,O.current!==c)return;const g=Number(null==(d=F.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){Be(g),Te(g);try{const e="diff"===A.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{}}He(),se||he||We(!1),ne(!0)}catch{O.current===c&&K(!0)}})().finally(()=>{j.current===s&&(j.current=null)});return j.current=s,s},[We,he,se,Xe,Ge,He,V,q]);s(()=>{V||Y&&q&&(he||Ge?Fe():Qe())},[he,Qe,Y,Fe,Ge,V,q]),s(()=>{var e;if(V)return;if(!Y)return;if(!q)return;if(he)return;if(Ge)return;const t=$.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=ie;if(!o&&P.current)try{o=de(P.current(n)),o&&le(o)}catch{}const i=ue(o||Ve);if(t.createEditor&&E.current){try{await Promise.resolve(Qe())}catch{}const e=j.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{}se&&We(!0)})()},[We,Ve,ie,he,G,Qe,se,Y,u.code,u.diff,u.originalCode,u.updatedCode,Ge,V,q]),s(()=>{if(V)return;if(!Y)return;if(!q)return;if(he)return;if(Ge)return;if(!se&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>We(se)):null;return null==e&&We(se),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[We,he,se,h,Y,Ge,V,q]),s(()=>{var e,t,n;if(!f)return;if(V)return;const r=$.current;if(r){try{const o="diff"===A.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:Le})}catch{}We(se)}},[We,f,se,Le,u.diff,V]),s(()=>{Ee||te(!0)},[Ee]);const et=d((e,t)=>{if(!Ee)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,m))},[m,Ee]),tt=d(()=>{Ee&&te()},[Ee]),nt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Ye)),ce(!0),null==(e=a.onCopy)||e.call(a,String(Ye)),setTimeout(()=>ce(!1),1e3)}catch{}},[a,Ye]),rt=d(()=>{if(!qe)return;const e="html"===Ve?"text/html":"image/svg+xml",t="html"===Ve?Me("artifacts.htmlPreviewTitle")||"HTML Preview":Me("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof a.onPreviewCode?"html"===Ve&&xe(e=>!e):a.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${Ve}-${Date.now()}`})},[Ve,qe,u,a,Me]);return V?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n("div",{ref:S,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:Ze,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
- /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:He}}),
19
- /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:ze})]}),
18
+ /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:Ke}}),
19
+ /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:Ue})]}),
20
20
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
21
- /* @__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":fe,onClick:()=>we(e=>!e),onMouseEnter:e=>Ye(e,fe?xe("common.expand")||"Expand":xe("common.collapse")||"Collapse"),onFocus:e=>Ye(e,fe?xe("common.expand")||"Expand":xe("common.collapse")||"Collapse"),onMouseLeave:Ze,onBlur:Ze,children:/* @__PURE__ */e("svg",{style:{rotate:fe?"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"})})}),L&&f&&/* @__PURE__ */n(t,{children:[
22
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ee<=10,onClick:()=>Se(e=>Math.max(10,e-1)),onMouseEnter:e=>Ye(e,xe("common.decrease")||"Decrease"),onFocus:e=>Ye(e,xe("common.decrease")||"Decrease"),onMouseLeave:Ze,onBlur:Ze,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
23
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ee===ke,onClick:()=>Se(ke),onMouseEnter:e=>Ye(e,xe("common.reset")||"Reset"),onFocus:e=>Ye(e,xe("common.reset")||"Reset"),onMouseLeave:Ze,onBlur:Ze,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:[
21
+ /* @__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":he,onClick:()=>ve(e=>!e),onMouseEnter:e=>et(e,he?Me("common.expand")||"Expand":Me("common.collapse")||"Collapse"),onFocus:e=>et(e,he?Me("common.expand")||"Expand":Me("common.collapse")||"Collapse"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{style:{rotate:he?"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"})})}),L&&f&&/* @__PURE__ */n(t,{children:[
22
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le<=10,onClick:()=>Te(e=>Math.max(10,e-1)),onMouseEnter:e=>et(e,Me("common.decrease")||"Decrease"),onFocus:e=>et(e,Me("common.decrease")||"Decrease"),onMouseLeave:tt,onBlur:tt,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
23
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le===Ne,onClick:()=>Te(Ne),onMouseEnter:e=>et(e,Me("common.reset")||"Reset"),onFocus:e=>et(e,Me("common.reset")||"Reset"),onMouseLeave:tt,onBlur:tt,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:[
24
24
  /* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
25
25
  /* @__PURE__ */e("path",{d:"M3 3v5h5"})]})})}),
26
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ee>=36,onClick:()=>Se(e=>Math.min(36,e+1)),onMouseEnter:e=>Ye(e,xe("common.increase")||"Increase"),onFocus:e=>Ye(e,xe("common.increase")||"Increase"),onMouseLeave:Ze,onBlur:Ze,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),M&&/* @__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":ue?xe("common.copied")||"Copied":xe("common.copy")||"Copy",onClick:Ge,onMouseEnter:e=>Ye(e,ue?xe("common.copied")||"Copied":xe("common.copy")||"Copy"),onFocus:e=>Ye(e,ue?xe("common.copied")||"Copied":xe("common.copy")||"Copy"),onMouseLeave:Ze,onBlur:Ze,children:/* @__PURE__ */e("svg",ue?{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:[
26
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le>=36,onClick:()=>Te(e=>Math.min(36,e+1)),onMouseEnter:e=>et(e,Me("common.increase")||"Increase"),onFocus:e=>et(e,Me("common.increase")||"Increase"),onMouseLeave:tt,onBlur:tt,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),M&&/* @__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":ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy",onClick:nt,onMouseEnter:e=>et(e,ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy"),onFocus:e=>et(e,ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",ae?{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:[
27
27
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
28
- /* @__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"})]})})}),N&&/* @__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":pe,onClick:()=>ge(e=>!e),onMouseEnter:e=>Ye(e,pe?xe("common.collapse")||"Collapse":xe("common.expand")||"Expand"),onFocus:e=>Ye(e,pe?xe("common.collapse")||"Collapse":xe("common.expand")||"Expand"),onMouseLeave:Ze,onBlur:Ze,children:/* @__PURE__ */e("svg",pe?{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"})})}),Fe&&B&&/* @__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":xe("common.preview")||"Preview",onClick:Je,onMouseEnter:e=>Ye(e,xe("common.preview")||"Preview"),onFocus:e=>Ye(e,xe("common.preview")||"Preview"),onMouseLeave:Ze,onBlur:Ze,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */n("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
28
+ /* @__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"})]})})}),N&&/* @__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":se,onClick:()=>me(e=>!e),onMouseEnter:e=>et(e,se?Me("common.collapse")||"Collapse":Me("common.expand")||"Expand"),onFocus:e=>et(e,se?Me("common.collapse")||"Collapse":Me("common.expand")||"Expand"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",se?{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"})})}),qe&&B&&/* @__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":Me("common.preview")||"Preview",onClick:rt,onMouseEnter:e=>et(e,Me("common.preview")||"Preview"),onFocus:e=>et(e,Me("common.preview")||"Preview"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */n("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
29
29
  /* @__PURE__ */e("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),
30
30
  /* @__PURE__ */e("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})]})})})]})]}),
31
- /* @__PURE__ */n("div",{className:`code-block-body${fe?" code-block-body--collapsed":""}${pe?" code-block-body--expanded":""}`,children:[!fe&&(!!p||!h)&&(z?/* @__PURE__ */e(De,{node:u}):/* @__PURE__ */n(t,{children:[
32
- /* @__PURE__ */e("div",{ref:E,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:J?"visible":"hidden"},"aria-hidden":!J}),!J&&/* @__PURE__ */e("div",{style:{position:"absolute",inset:0,overflow:"auto",padding:"1rem"},children:/* @__PURE__ */e("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${ze}`,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(Ve)})})})]})),!p&&h&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
31
+ /* @__PURE__ */n("div",{className:`code-block-body${he?" code-block-body--collapsed":""}${se?" code-block-body--expanded":""}`,children:[!he&&(!!p||!h)&&(V?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n(t,{children:[
32
+ /* @__PURE__ */e("div",{ref:E,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:Q?"visible":"hidden"},"aria-hidden":!Q}),!Q&&/* @__PURE__ */e("div",{style:{position:"absolute",inset:0,overflow:"auto",padding:"1rem"},children:/* @__PURE__ */e("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${Ue}`,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(Ye)})})})]})),!p&&h&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
33
33
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
34
34
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
35
- /* @__PURE__ */e("div",{className:"skeleton-line short"})]})})]}),ve&&!a.onPreviewCode&&Fe&&"html"===Ie&&/* @__PURE__ */e(se,{code:String(null!=(l=u.code)?l:""),isDark:m,onClose:()=>ye(!1)}),
36
- /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:ue?xe("common.copied")||"Copied":""})]})}function _e(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=_e(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ae(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=_e(e))&&(r&&(r+=" "),r+=t);return r}const We=()=>import("./index-GGJFJL7K.js");let Oe=null,Pe=We;function Ie(e){Pe=e,Oe=null}function Re(e){Ie(null!=e?e:We)}function He(){Ie(null)}function Fe(){return"function"==typeof Pe}const ze={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Ve={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},Ke=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Xe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function qe(e){if(!e)return"";const t=e.trim();return Xe.test(t)?t:""}function Ue(r){var l,a;const u={...ze,...r},{t:m}=K(),[h,p]=i(!1),[g,f]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,M]=i(""),[N,B]=i(null),[L,E]=i(!1),S=c(0),T=c(null),D=c(!1),$=c(!1),j=c(0),_=c(null),A=c(!1),W=c(null),O=c(null),P=c(!1),I=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",R=w||!y||!C,H=!!C,F=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),z=o(()=>{if(N)return{minHeight:`${N}px`}},[N]);s(()=>{P.current=L},[L]);const V=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),X=d((e=!1)=>{if(D.current||"undefined"==typeof window)return;if($.current)return;if(P.current)return void(A.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-j.current;if(!e&&n<t)return A.current=!0,void(null==_.current&&(_.current=window.setTimeout(()=>{_.current=null,A.current&&(A.current=!1,X(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,j.current=Date.now(),U()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs]),q=d(async()=>{if(T.current)return T.current;const e=await async function(){if(Oe)return Oe;const e=Pe;if(!e)return null;let t;try{t=await e()}catch(n){if(e===We)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Oe=function(e){var t;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),Oe):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?T.current=t:"function"==typeof e.compile&&(T.current=e),T.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(T.current=new e.D2,T.current):("function"==typeof e.compile&&(T.current=e),T.current)},[]),U=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||$.current)return;if(u.loading&&!u.progressiveRender)return;if(!I)return M(""),void b(null);const i=++S.current;E(!0),b(null);try{const l=await q();if(!l)return x(!1),v(!0),M(""),void b("D2 is not available.");if("function"!=typeof l.compile||"function"!=typeof l.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const a=await l.compile(I);if(i!==S.current)return;const c=null!=(e=null==a?void 0:a.diagram)?e:a,s=null!=(n=null!=(t=null==a?void 0:a.renderOptions)?t:null==a?void 0:a.options)?n:{},d=null!=(r=u.themeId)?r:s.themeID,m=null!=(o=u.darkThemeId)?o:s.darkThemeID,h={...s};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=s.themeOverrides&&"object"==typeof s.themeOverrides?s.themeOverrides:null;h.themeOverrides={...Ve,...e||{}}}const p=await l.render(c,h);if(i!==S.current)return;const g=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(p);if(!g)throw new Error("D2 render returned empty output.");const f=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";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"";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(Ke.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=qe(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.outerHTML}(g);M(f||""),u.loading&&v(!1),b(null)}catch(l){if(i!==S.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),v(!0))}finally{i===S.current&&(E(!1),A.current&&(A.current=!1,X()))}},[I,q,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,X]),Y=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(I),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[I]),Z=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}},[C]),G=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),J=d(()=>{te()},[]);return s(()=>{X()},[I,u.loading,u.isDark,X]),s(()=>{u.loading||X(!0)},[u.loading,X]),s(()=>{const e=requestAnimationFrame(()=>V());return()=>cancelAnimationFrame(e)},[R,C,I,V]),s(()=>{X();const e=requestAnimationFrame(()=>V());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{V()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;$.current=!0,null!=_.current&&(clearTimeout(_.current),_.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[X,V]),/* @__PURE__ */n("div",{className:Ae("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */n("div",{className:"d2-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:[
35
+ /* @__PURE__ */e("div",{className:"skeleton-line short"})]})})]}),ye&&!a.onPreviewCode&&qe&&"html"===Ve&&/* @__PURE__ */e(we,{code:String(null!=(l=u.code)?l:""),isDark:m,onClose:()=>xe(!1)}),
36
+ /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:ae?Me("common.copied")||"Copied":""})]})}function He(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=He(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ze(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=He(e))&&(r&&(r+=" "),r+=t);return r}const Ve=()=>import("@terrastruct/d2");let Xe=null,Ke=Ve;function qe(e){Ke=e,Xe=null}function Ue(e){qe(null!=e?e:Ve)}function Ye(){qe(null)}function Ze(){return"function"==typeof Ke}const Ge={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Je={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},Qe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],et=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function tt(e){if(!e)return"";const t=e.trim();return et.test(t)?t:""}function nt(r){var l,a;const u={...Ge,...r},{t:m}=X(),[h,p]=i(!1),[g,f]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,M]=i(""),[N,B]=i(null),[L,T]=i(!1),E=c(0),S=c(null),D=c(!1),$=c(!1),_=c(0),j=c(null),A=c(!1),W=c(null),O=c(null),P=c(!1),I=c(()=>{}),R=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",F=w||!y||!C,H=!!C,z=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),V=o(()=>{if(N)return{minHeight:`${N}px`}},[N]);s(()=>{P.current=L},[L]);const K=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),q=d((e=!1)=>{if(D.current||"undefined"==typeof window)return;if($.current)return;if(P.current)return void(A.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-_.current;if(!e&&n<t)return A.current=!0,void(null==j.current&&(j.current=window.setTimeout(()=>{j.current=null,A.current&&(A.current=!1,q(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,_.current=Date.now(),I.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs]),U=d(async()=>{if(S.current)return S.current;const e=await async function(){if(Xe)return Xe;const e=Ke;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Ve)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Xe=function(e){var t;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),Xe):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?S.current=t:"function"==typeof e.compile&&(S.current=e),S.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(S.current=new e.D2,S.current):("function"==typeof e.compile&&(S.current=e),S.current)},[]),Y=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||$.current)return;if(u.loading&&!u.progressiveRender)return;if(!R)return M(""),void b(null);const i=++E.current;T(!0),b(null);try{const l=await U();if(!l)return x(!1),v(!0),M(""),void b("D2 is not available.");if("function"!=typeof l.compile||"function"!=typeof l.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const a=await l.compile(R);if(i!==E.current)return;const c=null!=(e=null==a?void 0:a.diagram)?e:a,s=null!=(n=null!=(t=null==a?void 0:a.renderOptions)?t:null==a?void 0:a.options)?n:{},d=null!=(r=u.themeId)?r:s.themeID,m=null!=(o=u.darkThemeId)?o:s.darkThemeID,h={...s};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=s.themeOverrides&&"object"==typeof s.themeOverrides?s.themeOverrides:null;h.themeOverrides={...Je,...e||{}}}const p=await l.render(c,h);if(i!==E.current)return;const g=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(p);if(!g)throw new Error("D2 render returned empty output.");const f=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";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"";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(Qe.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=tt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.outerHTML}(g);M(f||""),u.loading&&v(!1),b(null)}catch(l){if(i!==E.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),v(!0))}finally{i===E.current&&(T(!1),A.current&&(A.current=!1,q()))}},[R,U,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,q]);s(()=>{I.current=Y},[Y]);const Z=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(R),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[R]),G=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}},[C]),J=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),Q=d(()=>{te()},[]);return s(()=>{q()},[R,u.loading,u.isDark,q]),s(()=>{u.loading||q(!0)},[u.loading,q]),s(()=>{const e=requestAnimationFrame(()=>K());return()=>cancelAnimationFrame(e)},[F,C,R,K]),s(()=>{q();const e=requestAnimationFrame(()=>K());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{K()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;$.current=!0,null!=j.current&&(clearTimeout(j.current),j.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[q,K]),/* @__PURE__ */n("div",{className:ze("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */n("div",{className:"d2-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:[
37
37
  /* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
38
- /* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */n("div",{className:Ae("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
39
- /* @__PURE__ */e("button",{type:"button",className:Ae("mode-btn px-2 py-1 text-xs rounded",!w&&"is-active"),onClick:()=>v(!1),onMouseEnter:e=>G(e,m("common.preview")||"Preview"),onFocus:e=>G(e,m("common.preview")||"Preview"),onMouseLeave:J,onBlur:J,children:m("common.preview")||"Preview"}),
40
- /* @__PURE__ */e("button",{type:"button",className:Ae("mode-btn px-2 py-1 text-xs rounded",w&&"is-active"),onClick:()=>v(!0),onMouseEnter:e=>G(e,m("common.source")||"Source"),onFocus:e=>G(e,m("common.source")||"Source"),onMouseLeave:J,onBlur:J,children:m("common.source")||"Source"})]}),u.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":h?m("common.copied")||"Copied":m("common.copy")||"Copy",onClick:Y,onMouseEnter:e=>G(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onFocus:e=>G(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onMouseLeave:J,onBlur:J,children:/* @__PURE__ */e("svg",h?{xmlns:"http://www.w3.org/2000/svg","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","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:[
38
+ /* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */n("div",{className:ze("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
39
+ /* @__PURE__ */e("button",{type:"button",className:ze("mode-btn px-2 py-1 text-xs rounded",!w&&"is-active"),onClick:()=>v(!1),onMouseEnter:e=>J(e,m("common.preview")||"Preview"),onFocus:e=>J(e,m("common.preview")||"Preview"),onMouseLeave:Q,onBlur:Q,children:m("common.preview")||"Preview"}),
40
+ /* @__PURE__ */e("button",{type:"button",className:ze("mode-btn px-2 py-1 text-xs rounded",w&&"is-active"),onClick:()=>v(!0),onMouseEnter:e=>J(e,m("common.source")||"Source"),onFocus:e=>J(e,m("common.source")||"Source"),onMouseLeave:Q,onBlur:Q,children:m("common.source")||"Source"})]}),u.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":h?m("common.copied")||"Copied":m("common.copy")||"Copy",onClick:Z,onMouseEnter:e=>J(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onFocus:e=>J(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",h?{xmlns:"http://www.w3.org/2000/svg","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","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:[
41
41
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
42
- /* @__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"})]})})}),u.showExportButton&&C&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":m("common.export")||"Export",onClick:Z,onMouseEnter:e=>G(e,m("common.export")||"Export"),onFocus:e=>G(e,m("common.export")||"Export"),onMouseLeave:J,onBlur:J,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg","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:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})})}),u.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":g,onClick:()=>f(e=>!e),onMouseEnter:e=>G(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>G(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:J,onBlur:J,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${g?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","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"})})})]})]}),!g&&/* @__PURE__ */e("div",{ref:W,className:"d2-block-body",style:z,children:u.loading&&!H?/* @__PURE__ */n("div",{className:"d2-source px-4 py-4",children:[
43
- /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:I})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */e(t,{children:/* @__PURE__ */n("div",R?{className:"d2-source px-4 py-4",children:[
44
- /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:I})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:F,children:[
45
- /* @__PURE__ */e("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */e("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function Ye(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
42
+ /* @__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"})]})})}),u.showExportButton&&C&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":m("common.export")||"Export",onClick:G,onMouseEnter:e=>J(e,m("common.export")||"Export"),onFocus:e=>J(e,m("common.export")||"Export"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg","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:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})})}),u.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":g,onClick:()=>f(e=>!e),onMouseEnter:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${g?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","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"})})})]})]}),!g&&/* @__PURE__ */e("div",{ref:W,className:"d2-block-body",style:V,children:u.loading&&!H?/* @__PURE__ */n("div",{className:"d2-source px-4 py-4",children:[
43
+ /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:R})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */e(t,{children:/* @__PURE__ */n("div",F?{className:"d2-source px-4 py-4",children:[
44
+ /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:R})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:z,children:[
45
+ /* @__PURE__ */e("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */e("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function rt(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
46
46
  return e("dl",{className:"definition-list","data-index-key":l,children:a.map((t,r)=>/* @__PURE__ */n("div",{className:"mb-4",children:[
47
47
  /* @__PURE__ */e("dt",{className:"definition-term font-semibold",children:o&&i?M(t.term,o,`${String(null!=l?l:"definition")}-term-${r}`,i):null}),
48
- /* @__PURE__ */e("dd",{className:"definition-desc ml-4",children:o&&i?M(t.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function Ze(t){var n;const{node:r}=t;/* @__PURE__ */
49
- return e("span",{className:"emoji-node",children:null!=(n=r.name)?n:r.markup})}function Ge(t){/* @__PURE__ */
50
- return e("em",{className:"emphasis-node",children:t.children})}function Je(t){const{node:n}=t,r=d(e=>{var t;if(e.preventDefault(),"undefined"==typeof document)return;const r=document.getElementById(`fnref-${String(null!=(t=n.id)?t:"")}`);r&&r.scrollIntoView({behavior:"smooth"})},[n.id]);/* @__PURE__ */
51
- return e("a",{className:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${n.id}`,title:`Back to reference ${n.id}`,onClick:r,children:"↩︎"})}function Qe(t){const{node:n,ctx:r,renderNode:o,indexKey:i}=t;/* @__PURE__ */
52
- return e("div",{id:`footnote-${n.id}`,className:"footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2",children:/* @__PURE__ */e("div",{className:"flex-1",children:r&&o?C(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function et(t){const{node:r}=t,i=o(()=>`#footnote-${r.id}`,[r.id]),l=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(i);t&&t.scrollIntoView({behavior:"smooth"})},[i]);/* @__PURE__ */
53
- return e("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:l,children:/* @__PURE__ */n("a",{href:i,title:`View footnote ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function tt(t){/* @__PURE__ */
54
- return e("br",{className:"hard-break"})}function nt(t){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=t,a=Math.min(6,Math.max(1,Number(n.level)||1)),c=`h${a}`,s=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=s?s:{};/* @__PURE__ */
55
- return e(c,{dir:"auto",className:Ae("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?C(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function rt(t){/* @__PURE__ */
56
- return e("mark",{className:"highlight-node",children:t.children})}const ot=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),it=/* @__PURE__ */new Set(["script"]),lt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function at(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const ct=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),st=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function dt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function ut(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=dt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function mt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();ot.has(e)||lt.has(e)&&r&&at(r)||(t[n]=r)}return t}function ht(e,t){const n=e.toLowerCase();return!ct.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function pt(l){const{node:a,placeholder:d,customId:m}=l,h=D(),[p,g]=i(null),f=c(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(a.content),k=Boolean(a.loading),C=u(W,O,O),M=o(()=>{var e;return null!=(e=l.customComponents)?e:I(m)},[m,l.customComponents,C]);s(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=f.current)||e.destroy(),f.current=null,!k)return v(!0),void x(a.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return f.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),f.current=null}},[p,k,a.content,h]),s(()=>()=>{var e;null==(e=f.current)||e.destroy(),f.current=null},[]),s(()=>{k&&!w||x(a.content)},[k,a.content,w]);const N=o(()=>{var e;return b(null!=(e=a.attrs)?e:void 0)},[a.attrs]),B=o(()=>{var e;return function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(ht(r[1],t))return!0;return!1}(null!=(e=a.content)?e:"",M)},[M,a.content]),L=o(()=>B&&a.content?function(e,t){if(!e)return[];try{const n=function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){i<e.length&&e.slice(i).trim()&&o.push({type:"text",content:e.slice(i)});break}if(l>i){const t=e.slice(i,l);t.trim()&&o.push({type:"text",content:t})}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s)o.push({type:"tag_close",tagName:c.slice(1).trim()});else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||st.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e);let o=0;const i=[],l=[];for(const e of n)if("text"===e.type){if(i.length>0&&i[i.length-1].blocked)continue;(i.length>0?i[i.length-1].children:l).push(e.content)}else if("self_closing"===e.type){if(it.has(e.tagName.toLowerCase()))continue;const n=mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=ht(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;s?(i.length>0?i[i.length-1].children:l).push(r.createElement(s,{...n,key:c})):(i.length>0?i[i.length-1].children:l).push(r.createElement(e.tagName,{...ut(n),key:c,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:it.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=ht(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...ut(n),key:c,suppressHydrationWarning:!0},...e.children);i.length>0?i[i.length-1].children.push(d):l.push(d)}}for(;i.length>0;){const e=i.pop();if(e.blocked)continue;const n=mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=ht(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...ut(n),key:c,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(a.content,M):null,[M,a.content,B]);/* @__PURE__ */
48
+ /* @__PURE__ */e("dd",{className:"definition-desc ml-4",children:o&&i?M(t.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function ot(t){var n;const{node:r}=t;/* @__PURE__ */
49
+ return e("span",{className:"emoji-node",children:null!=(n=r.name)?n:r.markup})}function it(t){/* @__PURE__ */
50
+ return e("em",{className:"emphasis-node",children:t.children})}function lt(t){const{node:n}=t,r=d(e=>{var t;if(e.preventDefault(),"undefined"==typeof document)return;const r=document.getElementById(`fnref-${String(null!=(t=n.id)?t:"")}`);r&&r.scrollIntoView({behavior:"smooth"})},[n.id]);/* @__PURE__ */
51
+ return e("a",{className:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${n.id}`,title:`Back to reference ${n.id}`,onClick:r,children:"↩︎"})}function at(t){const{node:n,ctx:r,renderNode:o,indexKey:i}=t;/* @__PURE__ */
52
+ return e("div",{id:`footnote-${n.id}`,className:"footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2",children:/* @__PURE__ */e("div",{className:"flex-1",children:r&&o?C(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function ct(t){const{node:r}=t,i=o(()=>`#footnote-${r.id}`,[r.id]),l=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(i);t&&t.scrollIntoView({behavior:"smooth"})},[i]);/* @__PURE__ */
53
+ return e("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:l,children:/* @__PURE__ */n("a",{href:i,title:`View footnote ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function st(t){/* @__PURE__ */
54
+ return e("br",{className:"hard-break"})}function dt(t){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=t,a=Math.min(6,Math.max(1,Number(n.level)||1)),c=`h${a}`,s=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=s?s:{};/* @__PURE__ */
55
+ return e(c,{dir:"auto",className:ze("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?C(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function ut(t){/* @__PURE__ */
56
+ return e("mark",{className:"highlight-node",children:t.children})}const mt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),ht=/* @__PURE__ */new Set(["script"]),pt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function gt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const ft=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),wt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function vt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function yt(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=vt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function xt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();mt.has(e)||pt.has(e)&&r&&gt(r)||(t[n]=r)}return t}function kt(e,t){const n=e.toLowerCase();return!ft.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function bt(l){const{node:a,placeholder:d,customId:m}=l,h=D(),[p,g]=i(null),f=c(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(a.content),k=Boolean(a.loading),C=u(W,O,O),M=o(()=>{var e;return null!=(e=l.customComponents)?e:I(m)},[m,l.customComponents,C]);s(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=f.current)||e.destroy(),f.current=null,!k)return v(!0),void x(a.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return f.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),f.current=null}},[p,k,a.content,h]),s(()=>()=>{var e;null==(e=f.current)||e.destroy(),f.current=null},[]),s(()=>{k&&!w||x(a.content)},[k,a.content,w]);const N=o(()=>{var e;return b(null!=(e=a.attrs)?e:void 0)},[a.attrs]),B=o(()=>{var e;return function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(kt(r[1],t))return!0;return!1}(null!=(e=a.content)?e:"",M)},[M,a.content]),L=o(()=>B&&a.content?function(e,t){if(!e)return[];try{const n=function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){i<e.length&&e.slice(i).trim()&&o.push({type:"text",content:e.slice(i)});break}if(l>i){const t=e.slice(i,l);t.trim()&&o.push({type:"text",content:t})}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s)o.push({type:"tag_close",tagName:c.slice(1).trim()});else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||wt.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e);let o=0;const i=[],l=[];for(const e of n)if("text"===e.type){if(i.length>0&&i[i.length-1].blocked)continue;(i.length>0?i[i.length-1].children:l).push(e.content)}else if("self_closing"===e.type){if(ht.has(e.tagName.toLowerCase()))continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;s?(i.length>0?i[i.length-1].children:l).push(r.createElement(s,{...n,key:c})):(i.length>0?i[i.length-1].children:l).push(r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:ht.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);i.length>0?i[i.length-1].children.push(d):l.push(d)}}for(;i.length>0;){const e=i.pop();if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(a.content,M):null,[M,a.content,B]);/* @__PURE__ */
57
57
  return e("div",{ref:g,className:"html-block-node",...N,children:w?B&&L?/* @__PURE__ */e(t,{children:L}):/* @__PURE__ */e("div",{dangerouslySetInnerHTML:{__html:null!=y?y:""}}):/* @__PURE__ */e("div",{className:"html-block-node__placeholder",children:null!=d?d:/* @__PURE__ */n(t,{children:[
58
58
  /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar"}),
59
59
  /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-4/5"}),
60
- /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const gt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),ft=/* @__PURE__ */new Set(["script"]),wt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),vt=(()=>{try{return Boolean(!1)}catch{}return!1})();function yt(e){vt&&console.warn(e)}function xt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const kt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bt=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Ct(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Mt(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=Ct(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function Nt(e,t){const n=e.toLowerCase();return!bt.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function Bt(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return"true"===e||""===e||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const t=Number(e);if(""!==e&&!Number.isNaN(t))return t}return e}function Lt(e){return e.trim().length>0}function Et(e,t,n,o,i){if(ft.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();gt.has(e)||wt.has(e)&&r&&xt(r)||(t[n]=r)}return t}(t),a=l.key,c=null!=a&&""!==a?a:i;if(Nt(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Bt(r,n);return t}(l);return r.createElement(t,{...i,key:c},...n)}return r.createElement(e,{...Mt(l),key:c},...n)}function St(t){const{node:n,customId:o}=t,l=c(null),[a,d]=i(!1);s(()=>{d(!0)},[]);const u=I(o),m=r.useMemo(()=>{const e=n.content;if(!e)return{mode:"html",content:""};if(!function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(Nt(r[1],t))return!0;return!1}(e,u))return{mode:"html",content:e};const t=function(e,t){if(!e)return[];try{const n=function(e,t){let n=0;const r=[],o=[];for(const i of e)if("text"===i.type)(r.length>0?r[r.length-1].children:o).push(i.content);else if("self_closing"===i.type){const e=Et(i.tagName,i.attrs||{},[],t,"ms-html-"+n++),l=r.length>0?r[r.length-1].children:o;null!=e&&l.push(e)}else if("tag_open"===i.type)r.push({tagName:i.tagName,children:[],attrs:i.attrs});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let l=-1;for(let t=r.length-1;t>=0;t--)if(r[t].tagName.toLowerCase()===e){l=t;break}if(-1!==l)for(;r.length>l;){const i=r.pop(),a=Et(i.tagName,i.attrs||{},i.children,t,"ms-html-"+n++);r.length>0?null!=a&&r[r.length-1].children.push(a):null!=a&&o.push(a),i.tagName.toLowerCase()!==e&&r.length>l&&yt(`Auto-closing unclosed tag: <${i.tagName}>`)}else yt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=Et(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),yt(`Auto-closing unclosed tag: <${e.tagName}>`)}return o}(function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){if(i<e.length){const t=e.slice(i);Lt(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);Lt(t)&&o.push({type:"text",content:t})}if(e.startsWith("![CDATA[",l+1)){const t=e.indexOf("]]>",l);if(-1!==t){o.push({type:"text",content:e.slice(l,t+3)}),i=t+3;continue}break}if(e.startsWith("!",l+1)){const t=e.indexOf(">",l);if(-1!==t){i=t+1;continue}break}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s){const e=c.slice(1).trim();o.push({type:"tag_close",tagName:e})}else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||kt.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e),t);return n}catch(r){return n=r,vt&&console.error("Failed to parse HTML to React nodes:",n),null}var n}(e,u);return null===t?{mode:"html",content:e}:{mode:"dynamic",nodes:t}},[n.content,u]);return s(()=>{var e;if(!a||!l.current||"html"!==m.mode)return;const t=l.current;t.innerHTML="";const r=document.createElement("template");r.innerHTML=null!=(e=n.content)?e:"",t.appendChild(r.content.cloneNode(!0))},[n.content,m.mode,a]),n.loading&&!n.autoClosed?/* @__PURE__ */e("span",{className:"html-inline-node html-inline-node--loading",children:n.content}):"dynamic"===m.mode?/* @__PURE__ */e("span",{className:"html-inline-node",style:{display:"inline"},children:m.nodes}):/* @__PURE__ */e("span",{ref:l,className:"html-inline-node",style:{display:"inline"}})}const Tt={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function Dt(r){var l,a,d,u,m,h;const p={...Tt,...r},g=D(),[f,w]=i(null),v=c(null),[y,x]=i(()=>"undefined"==typeof window||!1===p.lazy),[k,b]=i(!1),[C,M]=i(!1),[N,B]=i(!1);s(()=>{var e;if(!p.lazy)return;const t=f;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=g(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[f,g,p.lazy]),s(()=>()=>{var e;null==(e=v.current)||e.destroy(),v.current=null},[]);const L=o(()=>C&&p.fallbackSrc?p.fallbackSrc:p.node.src,[C,p.fallbackSrc,p.node.src]);s(()=>{b(!1),M(!1)},[L]),s(()=>{B(!1)},[p.node.src]);const E=o(()=>/\.svg(?:\?|$)/i.test(String(L)),[L]),S=!p.lazy||y,T=E?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
60
+ /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const Ct=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),Mt=/* @__PURE__ */new Set(["script"]),Nt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Bt=(()=>{try{return Boolean(!1)}catch{}return!1})();function Lt(e){Bt&&console.warn(e)}function Tt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const Et=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),St=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Dt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function $t(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=Dt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function _t(e,t){const n=e.toLowerCase();return!St.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function jt(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return"true"===e||""===e||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const t=Number(e);if(""!==e&&!Number.isNaN(t))return t}return e}function At(e){return e.trim().length>0}function Wt(e,t,n,o,i){if(Mt.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();Ct.has(e)||Nt.has(e)&&r&&Tt(r)||(t[n]=r)}return t}(t),a=l.key,c=null!=a&&""!==a?a:i;if(_t(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=jt(r,n);return t}(l);return r.createElement(t,{...i,key:c},...n)}return r.createElement(e,{...$t(l),key:c},...n)}function Ot(t){const{node:n,customId:o}=t,l=c(null),[a,d]=i(!1);s(()=>{d(!0)},[]);const u=I(o),m=r.useMemo(()=>{const e=n.content;if(!e)return{mode:"html",content:""};if(!function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(_t(r[1],t))return!0;return!1}(e,u))return{mode:"html",content:e};const t=function(e,t){if(!e)return[];try{const n=function(e,t){let n=0;const r=[],o=[];for(const i of e)if("text"===i.type)(r.length>0?r[r.length-1].children:o).push(i.content);else if("self_closing"===i.type){const e=Wt(i.tagName,i.attrs||{},[],t,"ms-html-"+n++),l=r.length>0?r[r.length-1].children:o;null!=e&&l.push(e)}else if("tag_open"===i.type)r.push({tagName:i.tagName,children:[],attrs:i.attrs});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let l=-1;for(let t=r.length-1;t>=0;t--)if(r[t].tagName.toLowerCase()===e){l=t;break}if(-1!==l)for(;r.length>l;){const i=r.pop(),a=Wt(i.tagName,i.attrs||{},i.children,t,"ms-html-"+n++);r.length>0?null!=a&&r[r.length-1].children.push(a):null!=a&&o.push(a),i.tagName.toLowerCase()!==e&&r.length>l&&Lt(`Auto-closing unclosed tag: <${i.tagName}>`)}else Lt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=Wt(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),Lt(`Auto-closing unclosed tag: <${e.tagName}>`)}return o}(function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){if(i<e.length){const t=e.slice(i);At(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);At(t)&&o.push({type:"text",content:t})}if(e.startsWith("![CDATA[",l+1)){const t=e.indexOf("]]>",l);if(-1!==t){o.push({type:"text",content:e.slice(l,t+3)}),i=t+3;continue}break}if(e.startsWith("!",l+1)){const t=e.indexOf(">",l);if(-1!==t){i=t+1;continue}break}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s){const e=c.slice(1).trim();o.push({type:"tag_close",tagName:e})}else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||Et.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e),t);return n}catch(r){return n=r,Bt&&console.error("Failed to parse HTML to React nodes:",n),null}var n}(e,u);return null===t?{mode:"html",content:e}:{mode:"dynamic",nodes:t}},[n.content,u]);return s(()=>{var e;if(!a||!l.current||"html"!==m.mode)return;const t=l.current;t.innerHTML="";const r=document.createElement("template");r.innerHTML=null!=(e=n.content)?e:"",t.appendChild(r.content.cloneNode(!0))},[n.content,m.mode,a]),n.loading&&!n.autoClosed?/* @__PURE__ */e("span",{className:"html-inline-node html-inline-node--loading",children:n.content}):"dynamic"===m.mode?/* @__PURE__ */e("span",{className:"html-inline-node",style:{display:"inline"},children:m.nodes}):/* @__PURE__ */e("span",{ref:l,className:"html-inline-node",style:{display:"inline"}})}const Pt={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function It(r){var l,a,d,u,m,h;const p={...Pt,...r},g=D(),[f,w]=i(null),v=c(null),[y,x]=i(()=>"undefined"==typeof window||!1===p.lazy),[k,b]=i(!1),[C,M]=i(!1),[N,B]=i(!1);s(()=>{var e;if(!p.lazy)return;const t=f;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=g(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[f,g,p.lazy]),s(()=>()=>{var e;null==(e=v.current)||e.destroy(),v.current=null},[]);const L=o(()=>C&&p.fallbackSrc?p.fallbackSrc:p.node.src,[C,p.fallbackSrc,p.node.src]);s(()=>{b(!1),M(!1)},[L]),s(()=>{B(!1)},[p.node.src]);const T=o(()=>/\.svg(?:\?|$)/i.test(String(L)),[L]),E=!p.lazy||y,S=T?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
61
61
  return n("figure",{ref:w,className:"image-node",children:[
62
- /* @__PURE__ */e("div",{className:"image-node__inner",children:p.node.loading||C||!S?C?/* @__PURE__ */n("div",{className:"image-node__error",children:[
62
+ /* @__PURE__ */e("div",{className:"image-node__inner",children:p.node.loading||C||!E?C?/* @__PURE__ */n("div",{className:"image-node__error",children:[
63
63
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */e("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})}),
64
- /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]}):/* @__PURE__ */e("div",{className:"image-node__placeholder",style:T,children:p.usePlaceholder?/* @__PURE__ */n(t,{children:[
64
+ /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]}):/* @__PURE__ */e("div",{className:"image-node__placeholder",style:S,children:p.usePlaceholder?/* @__PURE__ */n(t,{children:[
65
65
  /* @__PURE__ */e("span",{className:"image-node__spinner","aria-hidden":"true"}),
66
- /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:null!=(h=p.node.raw)?h:"Loading image…"})},"placeholder"):/* @__PURE__ */e("img",{src:L,alt:String(null!=(a=null!=(l=p.node.alt)?l:p.node.title)?a:""),title:String(null!=(u=null!=(d=p.node.title)?d:p.node.alt)?u:""),className:"image-node__img"+(k?" is-loaded":""),style:E?{minHeight:p.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:p.lazy?"lazy":"eager",decoding:"async",tabIndex:k?0:-1,"aria-label":null!=(m=p.node.alt)?m:"Preview image",onError:()=>{var e;p.fallbackSrc&&!N?(B(!0),M(!0)):(M(!0),null==(e=p.onError)||e.call(p,p.node.src))},onLoad:()=>{var e;b(!0),M(!1),null==(e=p.onLoad)||e.call(p,L)},onClick:e=>{var t;e.preventDefault(),k&&!C&&(null==(t=p.onClick)||t.call(p,[e,L]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */e("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let $t=null,jt=null;const _t=/* @__PURE__ */e("svg",{width:"1em",height:"1em",viewBox:"0 0 291 300",fill:"none",className:"w-4 h-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */n("g",{children:[
66
+ /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:null!=(h=p.node.raw)?h:"Loading image…"})},"placeholder"):/* @__PURE__ */e("img",{src:L,alt:String(null!=(a=null!=(l=p.node.alt)?l:p.node.title)?a:""),title:String(null!=(u=null!=(d=p.node.title)?d:p.node.alt)?u:""),className:"image-node__img"+(k?" is-loaded":""),style:T?{minHeight:p.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:p.lazy?"lazy":"eager",decoding:"async",tabIndex:k?0:-1,"aria-label":null!=(m=p.node.alt)?m:"Preview image",onError:()=>{var e;p.fallbackSrc&&!N?(B(!0),M(!0)):(M(!0),null==(e=p.onError)||e.call(p,p.node.src))},onLoad:()=>{var e;b(!0),M(!1),null==(e=p.onLoad)||e.call(p,L)},onClick:e=>{var t;e.preventDefault(),k&&!C&&(null==(t=p.onClick)||t.call(p,[e,L]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */e("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let Rt=null,Ft=null;const Ht=/* @__PURE__ */e("svg",{width:"1em",height:"1em",viewBox:"0 0 291 300",fill:"none",className:"w-4 h-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */n("g",{children:[
67
67
  /* @__PURE__ */e("path",{d:"M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.69C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z",fill:"#FF6376"}),
68
68
  /* @__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"}),
69
69
  /* @__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"}),
70
70
  /* @__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"}),
71
- /* @__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"})]})}),At={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Wt(r){const o={...At,...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),E=c(null),S=c(null),T=c({x:0,y:0}),D=c(null),$=o.node.code,j=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]),_=d(async()=>{var e,t;if(!L.current)return;const n=L.current;try{const r=await async function(){return jt||$t||($t=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),jt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),$t)}();if(!r)return void console.warn("Infographic library failed to load.");D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});D.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||_()},[$,p,m,_]),s(()=>()=>{var e,t;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const A=d(()=>{y(!1),E.current&&(E.current.innerHTML=""),S.current=null,document.body.style.overflow=""},[]),W=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&A()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,A]),s(()=>{v&&setTimeout(()=>{if(L.current&&E.current){E.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),E.current.appendChild(e),S.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&S.current&&(S.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const O=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)},[]),P=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;T.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-T.current.x,y:n-T.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",F=p||m;/* @__PURE__ */
71
+ /* @__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"})]})}),zt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Vt(r){const o={...zt,...r},{t:l}=X(),[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),T=c(null),E=c(null),S=c({x:0,y:0}),D=c(null),$=o.node.code,_=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 Ft||Rt||(Rt=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),Ft=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Rt)}();if(!r)return void console.warn("Infographic library failed to load.");D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});D.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;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const A=d(()=>{y(!1),T.current&&(T.current.innerHTML=""),E.current=null,document.body.style.overflow=""},[]),W=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&A()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,A]),s(()=>{v&&setTimeout(()=>{if(L.current&&T.current){T.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),T.current.appendChild(e),E.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&E.current&&(E.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const O=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)},[]),P=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;S.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-S.current.x,y:n-S.current.y})},R=()=>B(!1),F=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",H=p||m;/* @__PURE__ */
72
72
  return n(t,{children:[
73
- /* @__PURE__ */n("div",{className:Ae("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:Ae("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:[
74
- /* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[_t,
75
- /* @__PURE__ */e("span",{className:Ae("text-sm font-medium font-mono truncate",o.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),o.showModeToggle&&/* @__PURE__ */n("div",{className:Ae("flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"),children:[
76
- /* @__PURE__ */e("button",{className:Ae("px-2.5 py-1 text-xs rounded transition-colors",p?o.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":o.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>g(!1),onMouseEnter:e=>ee(e.currentTarget,l("common.preview")||"Preview","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[
73
+ /* @__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:[
74
+ /* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Ht,
75
+ /* @__PURE__ */e("span",{className:ze("text-sm font-medium font-mono truncate",o.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),o.showModeToggle&&/* @__PURE__ */n("div",{className:ze("flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"),children:[
76
+ /* @__PURE__ */e("button",{className:ze("px-2.5 py-1 text-xs rounded transition-colors",p?o.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":o.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>g(!1),onMouseEnter:e=>ee(e.currentTarget,l("common.preview")||"Preview","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[
77
77
  /* @__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:"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"}),
79
79
  /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})}),
80
80
  /* @__PURE__ */e("span",{children:l("common.preview")||"Preview"})]})}),
81
- /* @__PURE__ */e("button",{className:Ae("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:[
81
+ /* @__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:[
82
82
  /* @__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"})}),
83
83
  /* @__PURE__ */e("span",{children:l("common.source")||"Source"})]})})]}),
84
- /* @__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:j,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:[
84
+ /* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:F,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:F,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:[
85
85
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
86
- /* @__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:Ae(H,F&&"opacity-50 cursor-not-allowed"),disabled:F,onClick:O,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:[
86
+ /* @__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(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:O,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:[
87
87
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
88
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:Ae(H,F&&"opacity-50 cursor-not-allowed"),disabled:F,onClick:W,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:Ae("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:Ae("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:[
89
- /* @__PURE__ */e("button",{className:Ae("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:"+"}),
90
- /* @__PURE__ */e("button",{className:Ae("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:"-"}),
91
- /* @__PURE__ */n("button",{className:Ae("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),"%"]})]})}),
92
- /* @__PURE__ */e("div",{className:Ae("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:f},onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R,children:/* @__PURE__ */e("div",{className:Ae("absolute inset-0 cursor-grab",N&&"cursor-grabbing"),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${k})`},children:/* @__PURE__ */e("div",{ref:L,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&x(
93
- /* @__PURE__ */e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:A,role:"dialog","aria-modal":"true",children:/* @__PURE__ */n("div",{className:Ae("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",o.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
88
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:ze(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:W,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:[
89
+ /* @__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:"+"}),
90
+ /* @__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:"-"}),
91
+ /* @__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),"%"]})]})}),
92
+ /* @__PURE__ */e("div",{className:ze("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:f},onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R,children:/* @__PURE__ */e("div",{className:ze("absolute inset-0 cursor-grab",N&&"cursor-grabbing"),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${k})`},children:/* @__PURE__ */e("div",{ref:L,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&x(
93
+ /* @__PURE__ */e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:A,role:"dialog","aria-modal":"true",children:/* @__PURE__ */n("div",{className:ze("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",o.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
94
94
  /* @__PURE__ */n("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
95
- /* @__PURE__ */e("button",{className:Ae("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:"+"}),
96
- /* @__PURE__ */e("button",{className:Ae("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:"-"}),
97
- /* @__PURE__ */n("button",{className:Ae("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),"%"]}),
98
- /* @__PURE__ */e("button",{className:Ae("inline-flex items-center justify-center p-2 rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:A,children:"X"})]}),
99
- /* @__PURE__ */e("div",{ref:E,className:Ae("w-full h-full flex items-center justify-center p-4 overflow-hidden",!N&&"cursor-grab",N&&"cursor-grabbing"),onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R})]})}),document.body)]})}function Ot(t){const{node:n}=t;/* @__PURE__ */
100
- return e("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:n.code})}function Pt(t){/* @__PURE__ */
101
- return e("ins",{className:"insert-node",children:t.children})}function It(t){var r,i,l,a,c;const{node:s,ctx:u,renderNode:m,indexKey:h}=t,p=!1!==t.showTooltip,g=null!=(r=t.isDark)?r:null==u?void 0:u.isDark,f=o(()=>{var e,n,r,o,i,l;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px";return{"--link-color":null!=(e=t.color)?e:"#0366d6","--underline-height":`${null!=(n=t.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(r=t.animationOpacity)?r:.9),"--underline-duration":`${null!=(o=t.animationDuration)?o:.8}s`,"--underline-timing":null!=(i=t.animationTiming)?i:"linear","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(l=t.animationIteration)?l:"infinite"}},[t.animationDuration,t.animationIteration,t.animationOpacity,t.animationTiming,t.color,t.underlineBottom,t.underlineHeight]),w=String(null!=(l=null!=(i=s.title)?i:s.href)?l:""),v=d(e=>{p&&ee(e.currentTarget,String(s.title||s.href||s.text||""),"top",!1,(e.clientX,e.clientY),g)},[g,s.href,s.text,s.title,p]),y=d(()=>{p&&te()},[p]);return s.loading?/* @__PURE__ */e("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */n("span",{className:"link-text-wrapper relative inline-flex",children:[
95
+ /* @__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:"+"}),
96
+ /* @__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:"-"}),
97
+ /* @__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),"%"]}),
98
+ /* @__PURE__ */e("button",{className:ze("inline-flex items-center justify-center p-2 rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:A,children:"X"})]}),
99
+ /* @__PURE__ */e("div",{ref:T,className:ze("w-full h-full flex items-center justify-center p-4 overflow-hidden",!N&&"cursor-grab",N&&"cursor-grabbing"),onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R})]})}),document.body)]})}function Xt(t){const{node:n}=t;/* @__PURE__ */
100
+ return e("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:n.code})}function Kt(t){/* @__PURE__ */
101
+ return e("ins",{className:"insert-node",children:t.children})}function qt(t){var r,i,l,a,c;const{node:s,ctx:u,renderNode:m,indexKey:h}=t,p=!1!==t.showTooltip,g=null!=(r=t.isDark)?r:null==u?void 0:u.isDark,f=o(()=>{var e,n,r,o,i,l;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px";return{"--link-color":null!=(e=t.color)?e:"#0366d6","--underline-height":`${null!=(n=t.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(r=t.animationOpacity)?r:.9),"--underline-duration":`${null!=(o=t.animationDuration)?o:.8}s`,"--underline-timing":null!=(i=t.animationTiming)?i:"linear","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(l=t.animationIteration)?l:"infinite"}},[t.animationDuration,t.animationIteration,t.animationOpacity,t.animationTiming,t.color,t.underlineBottom,t.underlineHeight]),w=String(null!=(l=null!=(i=s.title)?i:s.href)?l:""),v=d(e=>{p&&ee(e.currentTarget,String(s.title||s.href||s.text||""),"top",!1,(e.clientX,e.clientY),g)},[g,s.href,s.text,s.title,p]),y=d(()=>{p&&te()},[p]);return s.loading?/* @__PURE__ */e("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */n("span",{className:"link-text-wrapper relative inline-flex",children:[
102
102
  /* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:null!=(a=s.text)?a:""})}),
103
- /* @__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 Rt(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
104
- 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 Ht(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||Rt;/* @__PURE__ */
105
- return e(a,{className:Ae("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__ */
106
- 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 Ft=null,zt=null,Vt=!1;const Kt=/* @__PURE__ */new Map,Xt=/* @__PURE__ */new Map;let qt=5;const Ut=/* @__PURE__ */new Set;function Yt(){if(Kt.size<qt&&Ut.size){const e=Array.from(Ut);Ut.clear();for(const t of e)try{t()}catch{}}}function Zt(e){Ft=e,zt=null,Ft.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Kt.get(t);if(o)if(Kt.delete(t),clearTimeout(o.timeoutId),Yt(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(Xt.set(e,n),Xt.size>200){const e=Xt.keys().next().value;Xt.delete(e)}}o.resolve(n)}},Ft.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Kt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Kt.clear(),Yt()}}function Gt(){var e;Ft&&(null==(e=Ft.terminate)||e.call(Ft)),Ft=null,zt=null}function Jt(e){Vt=!!e,Ft&&Ft.postMessage({type:"init",debug:Vt})}const Qt="WORKER_BUSY";async function en(e,t=!0,n=2e3,r){if(performance.now(),zt)return Promise.reject(zt);const o=`${t?"d":"i"}:${e}`,i=Xt.get(o);if(i)return Promise.resolve(i);const l=Ft||(zt=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),zt.name="WORKER_INIT_ERROR",zt.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(zt);if(Kt.size>=qt){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Qt,e.busy=!0,e.inFlight=Kt.size,e.max=qt,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(()=>{Kt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Yt()},n),s=()=>{},d=()=>{Kt.delete(a),clearTimeout(c),Ut.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),Yt()};r&&r.addEventListener("abort",d,{once:!0}),Kt.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:Vt})}catch(u){Kt.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),Yt()}})}function tn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(Xt.set(r,n),Xt.size>200){const e=Xt.keys().next().value;Xt.delete(e)}}function nn(){Xt.clear()}function rn(e){qt=Math.max(1,Math.floor(e)),Yt()}function on(e=1500,t){return Kt.size<qt?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(){Ut.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}),Ut.add(l)})}const ln={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function an(e){null!=e.timeout&&(ln.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(ln.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(ln.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(ln.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function cn(){return{...ln}}async function sn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:ln.timeout,c=null!=(o=n.waitTimeout)?o:ln.waitTimeout,s=null!=(i=n.backoffMs)?i:ln.backoffMs,d=null!=(l=n.maxRetries)?l:ln.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):ln.maxRetries,m=n.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await en(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==Qt||h>=u)throw p;if(h++,await on(c,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*h))}}}let dn=null,un=!1;async function mn(){if(dn)return dn;if(un)return null;try{return dn=await import("katex"),await import("katex/contrib/mhchem"),dn}catch{return un=!0,null}}function hn({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?(sn(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===Qt||"WORKER_TIMEOUT"===i){const e=await mn();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),tn(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 pn({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 sn(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===Qt||"WORKER_TIMEOUT"===r){const e=await mn();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),tn(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:[
103
+ /* @__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 Ut(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
104
+ 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 Yt(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||Ut;/* @__PURE__ */
105
+ 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__ */
106
+ 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 Zt=null,Gt=null,Jt=!1;const Qt=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map;let tn=5;const nn=/* @__PURE__ */new Set;function rn(){if(Qt.size<tn&&nn.size){const e=Array.from(nn);nn.clear();for(const t of e)try{t()}catch{}}}function on(e){Zt=e,Gt=null,Zt.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Qt.get(t);if(o)if(Qt.delete(t),clearTimeout(o.timeoutId),rn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(en.set(e,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}o.resolve(n)}},Zt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Qt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Qt.clear(),rn()}}function ln(){var e;Zt&&(null==(e=Zt.terminate)||e.call(Zt)),Zt=null,Gt=null}function an(e){Jt=!!e,Zt&&Zt.postMessage({type:"init",debug:Jt})}const cn="WORKER_BUSY";async function sn(e,t=!0,n=2e3,r){if(performance.now(),Gt)return Promise.reject(Gt);const o=`${t?"d":"i"}:${e}`,i=en.get(o);if(i)return Promise.resolve(i);const l=Zt||(Gt=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Gt.name="WORKER_INIT_ERROR",Gt.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Gt);if(Qt.size>=tn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=cn,e.busy=!0,e.inFlight=Qt.size,e.max=tn,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(()=>{Qt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),rn()},n),s=()=>{},d=()=>{Qt.delete(a),clearTimeout(c),nn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),rn()};r&&r.addEventListener("abort",d,{once:!0}),Qt.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:Jt})}catch(u){Qt.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),rn()}})}function dn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(en.set(r,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}function un(){en.clear()}function mn(e){tn=Math.max(1,Math.floor(e)),rn()}function hn(e=1500,t){return Qt.size<tn?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(){nn.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}),nn.add(l)})}const pn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function gn(e){null!=e.timeout&&(pn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(pn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(pn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(pn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function fn(){return{...pn}}async function wn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:pn.timeout,c=null!=(o=n.waitTimeout)?o:pn.waitTimeout,s=null!=(i=n.backoffMs)?i:pn.backoffMs,d=null!=(l=n.maxRetries)?l:pn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):pn.maxRetries,m=n.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await sn(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==cn||h>=u)throw p;if(h++,await hn(c,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*h))}}}let vn=null,yn=!1;async function xn(){if(vn)return vn;if(yn)return null;try{return vn=await import("katex"),await import("katex/contrib/mhchem"),vn}catch{return yn=!0,null}}function kn({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?(wn(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===cn||"WORKER_TIMEOUT"===i){const e=await xn();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),dn(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 bn({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 wn(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===cn||"WORKER_TIMEOUT"===r){const e=await xn();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),dn(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:[
107
107
  /* @__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:[
108
108
  /* @__PURE__ */e("span",{className:"math-inline__spinner","aria-hidden":"true"}),
109
- /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}let gn=null,fn=null;const wn=/* @__PURE__ */new Map;let vn=5,yn=!1;function xn(e){yn=!!e}function kn(e){Number.isFinite(e)&&e>0&&(vn=Math.floor(e))}function bn(){return{inFlight:wn.size,max:vn}}const Cn="WORKER_BUSY";function Mn(e){gn=e,fn=null;const t=e;gn.onmessage=e=>{if(gn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=wn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},gn.onerror=e=>{var n,r;if(gn===t)if(0!==wn.size){try{yn?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 wn.entries())n.reject(new Error(`Worker error: ${e.message}`));wn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},gn.onmessageerror=e=>{var n,r;if(gn===t)if(0!==wn.size){try{yn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of wn.entries())t.reject(new Error("Worker messageerror"));wn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Nn(){var e;if(gn)try{for(const[e,t]of wn.entries())t.reject(new Error("Worker cleared"));wn.clear(),null==(e=gn.terminate)||e.call(gn)}catch{}gn=null,fn=null}function Bn(e,t,n=1400){if(fn)return Promise.reject(fn);const r=gn||(fn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),fn.name="WORKER_INIT_ERROR",fn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(fn);if(wn.size>=vn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Cn,e.inFlight=wn.size,e.max=vn,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),wn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};wn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return wn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=wn.get(l);null==t||t.reject(e)},n)})}async function Ln(e,t,n=1400){return Bn("canParse",{code:e,theme:t},n)}async function En(e,t,n=2400){return Bn("findPrefix",{code:e,theme:t},n)}function Sn(){var e;null==(e=null==gn?void 0:gn.terminate)||e.call(gn),gn=null,fn=null,wn.clear()}let Tn=null,Dn=!1,$n=null,jn=null;function _n(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($n!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),$n=r}catch{}}const An="undefined"!=typeof window?m:s,Wn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},On=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Pn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function In(e){if(!e)return"";const t=e.trim();return Pn.test(t)?t:""}function Rn(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Hn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Rn(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(On.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=In(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(Rn(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Fn={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 zn(r){var l,a,u,h,p,g,f,w,v;const y={...Fn,...r},{t:k}=K(),b=o(()=>ae("mermaid"),[]),C=null!=(a=null==(l=y.node)?void 0:l.code)?a:"",M=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),N=null!=(u=y.workerTimeoutMs)?u:Fn.workerTimeoutMs,B=null!=(h=y.parseTimeoutMs)?h:Fn.parseTimeoutMs,L=null!=(p=y.renderTimeoutMs)?p:Fn.renderTimeoutMs,E=null!=(g=y.fullRenderTimeoutMs)?g:Fn.fullRenderTimeoutMs,[S,T]=i(!1),[$,j]=i(!1),[_,A]=i(!1),[W,O]=i(!1),[P,I]=i(1),[R,H]=i({x:0,y:0}),[F,z]=i(!1),[V,X]=i(!1),[q,U]=i(!1),[Y,Z]=i(null),[G,J]=i(!1),[Q,ne]=i(()=>null==y.maxHeight?"360px":y.maxHeight),[re,oe]=i("undefined"==typeof window),ie=c(null),le=c(null),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c(null),he=c({x:0,y:0}),pe=c(0),ge=c({}),fe=c(""),we=c(!1),ve=c(null),ye=c(!1),xe=c({zoom:1,translateX:0,translateY:0,containerHeight:Q||"360px"}),ke=D(),be=Boolean(null!=(w=null==(f=y.node)?void 0:f.loading)?w:y.loading),Ce=y.isDark?"dark":"light",Me=Boolean(y.isStrict),Ne=o(()=>Me?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Wn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Me]);s(()=>{ye.current=q},[q]),s(()=>{ge.current={}},[Ce,M,Me]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Tn)return _n(Tn,e),Tn;if(jn){const t=await jn;return t&&_n(t,e),t}if(Dn)return null;try{Dn=!0,jn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Tn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Tn)throw new Error("Mermaid module did not export expected API");return _n(Tn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),Tn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{jn=null}})();const t=await jn;return t&&_n(t,e),t}catch{return null}}(Ne);e||(ie.current=t,T(Boolean(t)),we.current||j(!t))})(),()=>{e=!0}},[Ne]),s(()=>{const e=le.current;if(!e)return;const t=ke(e,{rootMargin:"400px"});return ve.current=t,t.isVisible()&&oe(!0),t.whenVisible.then(()=>oe(!0)),()=>{t.destroy(),ve.current=null}},[ke]),s(()=>{if("undefined"==typeof document)return;if(!G)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[G]);const Be=d(e=>{const t=le.current,n=se.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;ne(`${Math.min(c,i)}px`)},[]);s(()=>{if(!le.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)}(()=>Be(t))});return e.observe(le.current),()=>e.disconnect()},[Be]),s(()=>()=>{Sn()},[]),m(()=>{!$&&se.current&&ge.current[Ce]&&(se.current.innerHTML=ge.current[Ce],Be())},[$,Ce,Be]);const Le=d(async(e,t,n)=>{var r;if(!ie.current||!se.current)return!1;X(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Kn(e,t),l=await qn(()=>ie.current.render(o,i),{timeoutMs:E,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Hn(se.current,l.svg,Me);return null==(r=l.bindFunctions)||r.call(l,se.current),Be(),ge.current[t]=a,U(!0),Z(null),!0}catch(o){return be||Z(o instanceof Error?o.message:String(o)),!1}finally{X(!1)}},[E,be,Me,Be]),Ee=d(async(e,t,n)=>{var r;if(ie.current&&se.current){X(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Kn(Xn(e)||e,t),l=await qn(()=>ie.current.render(o,i),{timeoutMs:L,signal:n});(null==l?void 0:l.svg)&&(Hn(se.current,l.svg,Me),null==(r=l.bindFunctions)||r.call(l,se.current),Be())}catch{}finally{X(!1)}}},[L,be,Me,Be]),Se=d(async(e,t)=>{if(!e.trim())return Rn(se.current),U(!1),void(fe.current="");const n=e.replace(/\s+/g,"");if(n===fe.current&&ye.current)return;const r=++pe.current;try{if(await async function(e,t,n){try{if(await Ln(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=Kn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await qn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await qn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ce,{workerTimeout:N,parseTimeout:B,mermaid:ie.current,signal:t}),(null==t?void 0:t.aborted)||pe.current!==r)return;return void(await Le(e,Ce,t)&&(fe.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 En(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Xn(e)}(e,Ce,{workerTimeout:N,signal:t});if(!n||(null==t?void 0:t.aborted)||pe.current!==r)return;await Ee(n,Ce,t)}catch{}},[B,Le,Ee,Ce,N]);s(()=>{if(!re||$||_)return;if(!ie.current)return;const e=new AbortController;return Se(M,e.signal),()=>e.abort()},[M,_,Se,$,re,S]);const Te=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,y.isDark)},[y.isDark]),De=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(M)),O(!0),null==(t=y.onCopy)||t.call(y,M),setTimeout(()=>O(!1),1e3)}catch{}},[M,y]),$e=d(()=>{var e,t,n;const r=null!=(t=null==(e=se.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=Un(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onExport)||n.call(y,i),i.defaultPrevented||function(e,t){const n=null!=t?t:Un(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)},[y]),je=d(()=>{me.current=null,Rn(ue.current)},[]),_e=d(()=>{J(!1),je()},[je]),We=d(()=>{var e,t,n;const r=null!=(t=null==(e=se.current)?void 0:e.querySelector("svg"))?t:null,o=r?Un(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onOpenModal)||n.call(y,i),i.defaultPrevented||J(!0)},[y]);s(()=>{if(!G)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,G]),An(()=>{if(!G)return;const e=ue.current,t=le.current;if(!e||!t)return;const n=`translate(${R.x}px, ${R.y}px) scale(${P})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(me.current=o,o.style.transform=n),Rn(e),e.appendChild(r)},[G]),s(()=>{G&&me.current&&(me.current.style.transform=`translate(${R.x}px, ${R.y}px) scale(${P})`)},[G,R.x,R.y,P]);const Oe=$||V||_,Pe=o(()=>y.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",[y.isDark]),Ie=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=y.onToggleMode)||t.call(y,e,n),!n.defaultPrevented)if(we.current=!0,"preview"===e){j(!1);const e=xe.current;I(e.zoom),H({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else xe.current={zoom:P,translateX:R.x,translateY:R.y,containerHeight:Q},j(!0)},[M,Q,Se,y,Ce,R.x,R.y,Be,P]),Re=d(e=>{if(!1===y.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=le.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-R.x,o=e.clientY-n.top-R.y,i=.01*-e.deltaY,l=Vn(P+i,.5,3);if(l===P)return;const a=l/P;H({x:R.x-r*(a-1),y:R.y-o*(a-1)}),I(l)},[R,P]),He=d((e,t)=>{z(!0),he.current={x:e-R.x,y:t-R.y}},[R.x,R.y]),Fe=d((e,t)=>{F&&H({x:e-he.current.x,y:t-he.current.y})},[F]),ze=d(()=>{z(!1)},[]),Ve=/* @__PURE__ */n("div",{className:"relative",children:[y.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:[
110
- /* @__PURE__ */e("button",{type:"button",className:Ae("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,k("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>I(Vn(P+.1,.5,3)),children:"+"}),
111
- /* @__PURE__ */e("button",{type:"button",className:Ae("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,k("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>I(Vn(P-.1,.5,3)),children:"−"}),
112
- /* @__PURE__ */n("button",{type:"button",className:Ae("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Te(e,k("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{I(1),H({x:0,y:0})},children:[Math.round(100*P),"%"]})]})}),
113
- /* @__PURE__ */n("div",{ref:le,className:Ae("min-h-[360px] relative transition-all duration-100 overflow-hidden block",y.isDark?"bg-gray-900":"bg-gray-50"),style:{height:Q,maxHeight:null!=(v=y.maxHeight)?v:void 0},onWheel:Re,onMouseDown:e=>{0===e.button&&(e.preventDefault(),He(e.clientX,e.clientY))},onMouseMove:e=>Fe(e.clientX,e.clientY),onMouseUp:ze,onMouseLeave:ze,onTouchStart:e=>{const t=e.touches[0];t&&He(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Fe(t.clientX,t.clientY)},onTouchEnd:ze,children:[
114
- /* @__PURE__ */e("div",{ref:ce,"data-mermaid-wrapper":!0,className:Ae("absolute inset-0 cursor-grab",{"cursor-grabbing":F}),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${P})`},children:/* @__PURE__ */e("div",{ref:se,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(V||be)&&/* @__PURE__ */n("div",{className:"mermaid-loading",children:[
109
+ /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}let Cn=null,Mn=null;const Nn=/* @__PURE__ */new Map;let Bn=5,Ln=!1;function Tn(e){Ln=!!e}function En(e){Number.isFinite(e)&&e>0&&(Bn=Math.floor(e))}function Sn(){return{inFlight:Nn.size,max:Bn}}const Dn="WORKER_BUSY";function $n(e){Cn=e,Mn=null;const t=e;Cn.onmessage=e=>{if(Cn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=Nn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Cn.onerror=e=>{var n,r;if(Cn===t)if(0!==Nn.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 Nn.entries())n.reject(new Error(`Worker error: ${e.message}`));Nn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Cn.onmessageerror=e=>{var n,r;if(Cn===t)if(0!==Nn.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 Nn.entries())t.reject(new Error("Worker messageerror"));Nn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function _n(){var e;if(Cn)try{for(const[e,t]of Nn.entries())t.reject(new Error("Worker cleared"));Nn.clear(),null==(e=Cn.terminate)||e.call(Cn)}catch{}Cn=null,Mn=null}function jn(e,t,n=1400){if(Mn)return Promise.reject(Mn);const r=Cn||(Mn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Mn.name="WORKER_INIT_ERROR",Mn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Mn);if(Nn.size>=Bn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Dn,e.inFlight=Nn.size,e.max=Bn,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),Nn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};Nn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return Nn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=Nn.get(l);null==t||t.reject(e)},n)})}async function An(e,t,n=1400){return jn("canParse",{code:e,theme:t},n)}async function Wn(e,t,n=2400){return jn("findPrefix",{code:e,theme:t},n)}function On(){var e;null==(e=null==Cn?void 0:Cn.terminate)||e.call(Cn),Cn=null,Mn=null,Nn.clear()}let Pn=null,In=!1,Rn=null,Fn=null;function Hn(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(Rn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Rn=r}catch{}}const zn="undefined"!=typeof window?m:s,Vn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Xn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Kn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function qn(e){if(!e)return"";const t=e.trim();return Kn.test(t)?t:""}function Un(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Yn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Un(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(Xn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=qn(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(Un(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Zn={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 Gn(r){var l,a,u,h,p,g,f,w,v;const y={...Zn,...r},{t:k}=X(),b=o(()=>ge("mermaid"),[]),C=null!=(a=null==(l=y.node)?void 0:l.code)?a:"",M=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),N=null!=(u=y.workerTimeoutMs)?u:Zn.workerTimeoutMs,B=null!=(h=y.parseTimeoutMs)?h:Zn.parseTimeoutMs,L=null!=(p=y.renderTimeoutMs)?p:Zn.renderTimeoutMs,T=null!=(g=y.fullRenderTimeoutMs)?g:Zn.fullRenderTimeoutMs,[E,S]=i(!1),[$,_]=i(!1),[j,A]=i(!1),[W,O]=i(!1),[P,I]=i(1),[R,F]=i({x:0,y:0}),[H,z]=i(!1),[V,K]=i(!1),[q,U]=i(!1),[Y,Z]=i(null),[G,J]=i(!1),[Q,ne]=i(()=>null==y.maxHeight?"360px":y.maxHeight),[re,oe]=i("undefined"==typeof window),ie=c(null),le=c(null),ae=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({}),fe=c(""),we=c(!1),ve=c(null),ye=c(!1),xe=c({zoom:1,translateX:0,translateY:0,containerHeight:Q||"360px"}),ke=D(),be=Boolean(null!=(w=null==(f=y.node)?void 0:f.loading)?w:y.loading),Ce=y.isDark?"dark":"light",Me=Boolean(y.isStrict),Ne=o(()=>Me?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Vn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Me]);s(()=>{ye.current=q},[q]),s(()=>{pe.current={}},[Ce,M,Me]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Pn)return Hn(Pn,e),Pn;if(Fn){const t=await Fn;return t&&Hn(t,e),t}if(In)return null;try{In=!0,Fn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Pn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Pn)throw new Error("Mermaid module did not export expected API");return Hn(Pn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),Pn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Fn=null}})();const t=await Fn;return t&&Hn(t,e),t}catch{return null}}(Ne);e||(ie.current=t,S(Boolean(t)),we.current||_(!t))})(),()=>{e=!0}},[Ne]),s(()=>{const e=le.current;if(!e)return;const t=ke(e,{rootMargin:"400px"});return ve.current=t,t.isVisible()&&oe(!0),t.whenVisible.then(()=>oe(!0)),()=>{t.destroy(),ve.current=null}},[ke]),s(()=>{if("undefined"==typeof document)return;if(!G)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[G]);const Be=d(e=>{const t=le.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;ne(`${Math.min(c,i)}px`)},[]);s(()=>{if(!le.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)}(()=>Be(t))});return e.observe(le.current),()=>e.disconnect()},[Be]),s(()=>()=>{On()},[]),m(()=>{!$&&ce.current&&pe.current[Ce]&&(ce.current.innerHTML=pe.current[Ce],Be())},[$,Ce,Be]);const Le=d(async(e,t,n)=>{var r;if(!ie.current||!ce.current)return!1;K(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Qn(e,t),l=await tr(()=>ie.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Yn(ce.current,l.svg,Me);return null==(r=l.bindFunctions)||r.call(l,ce.current),Be(),pe.current[t]=a,U(!0),Z(null),!0}catch(o){return be||Z(o instanceof Error?o.message:String(o)),!1}finally{K(!1)}},[T,be,Me,Be]),Te=d(async(e,t,n)=>{var r;if(ie.current&&ce.current){K(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Qn(er(e)||e,t),l=await tr(()=>ie.current.render(o,i),{timeoutMs:L,signal:n});(null==l?void 0:l.svg)&&(Yn(ce.current,l.svg,Me),null==(r=l.bindFunctions)||r.call(l,ce.current),Be())}catch{}finally{K(!1)}}},[L,be,Me,Be]),Ee=d(async(e,t)=>{if(!e.trim())return Un(ce.current),U(!1),void(fe.current="");const n=e.replace(/\s+/g,"");if(n===fe.current&&ye.current)return;const r=++he.current;try{if(await async function(e,t,n){try{if(await An(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=Qn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await tr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await tr(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ce,{workerTimeout:N,parseTimeout:B,mermaid:ie.current,signal:t}),(null==t?void 0:t.aborted)||he.current!==r)return;return void(await Le(e,Ce,t)&&(fe.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 Wn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return er(e)}(e,Ce,{workerTimeout:N,signal:t});if(!n||(null==t?void 0:t.aborted)||he.current!==r)return;await Te(n,Ce,t)}catch{}},[B,Le,Te,Ce,N]);s(()=>{if(!re||$||j)return;if(!ie.current)return;const e=new AbortController;return Ee(M,e.signal),()=>e.abort()},[M,j,Ee,$,re,E]);const Se=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,y.isDark)},[y.isDark]),De=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(M)),O(!0),null==(t=y.onCopy)||t.call(y,M),setTimeout(()=>O(!1),1e3)}catch{}},[M,y]),$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=nr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onExport)||n.call(y,i),i.defaultPrevented||function(e,t){const n=null!=t?t:nr(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)},[y]),_e=d(()=>{ue.current=null,Un(de.current)},[]),je=d(()=>{J(!1),_e()},[_e]),Ae=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null,o=r?nr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onOpenModal)||n.call(y,i),i.defaultPrevented||J(!0)},[y]);s(()=>{if(!G)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&je()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[je,G]),zn(()=>{if(!G)return;const e=de.current,t=le.current;if(!e||!t)return;const n=`translate(${R.x}px, ${R.y}px) scale(${P})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(ue.current=o,o.style.transform=n),Un(e),e.appendChild(r)},[G]),s(()=>{G&&ue.current&&(ue.current.style.transform=`translate(${R.x}px, ${R.y}px) scale(${P})`)},[G,R.x,R.y,P]);const We=$||V||j,Oe=o(()=>y.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",[y.isDark]),Pe=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=y.onToggleMode)||t.call(y,e,n),!n.defaultPrevented)if(we.current=!0,"preview"===e){_(!1);const e=xe.current;I(e.zoom),F({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else xe.current={zoom:P,translateX:R.x,translateY:R.y,containerHeight:Q},_(!0)},[M,Q,Ee,y,Ce,R.x,R.y,Be,P]),Ie=d(e=>{if(!1===y.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=le.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-R.x,o=e.clientY-n.top-R.y,i=.01*-e.deltaY,l=Jn(P+i,.5,3);if(l===P)return;const a=l/P;F({x:R.x-r*(a-1),y:R.y-o*(a-1)}),I(l)},[R,P]),Re=d((e,t)=>{z(!0),me.current={x:e-R.x,y:t-R.y}},[R.x,R.y]),Fe=d((e,t)=>{H&&F({x:e-me.current.x,y:t-me.current.y})},[H]),He=d(()=>{z(!1)},[]),Ve=/* @__PURE__ */n("div",{className:"relative",children:[y.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:[
110
+ /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>I(Jn(P+.1,.5,3)),children:"+"}),
111
+ /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>I(Jn(P-.1,.5,3)),children:"−"}),
112
+ /* @__PURE__ */n("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{I(1),F({x:0,y:0})},children:[Math.round(100*P),"%"]})]})}),
113
+ /* @__PURE__ */n("div",{ref:le,className:ze("min-h-[360px] relative transition-all duration-100 overflow-hidden block",y.isDark?"bg-gray-900":"bg-gray-50"),style:{height:Q,maxHeight:null!=(v=y.maxHeight)?v:void 0},onWheel:Ie,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Re(e.clientX,e.clientY))},onMouseMove:e=>Fe(e.clientX,e.clientY),onMouseUp:He,onMouseLeave:He,onTouchStart:e=>{const t=e.touches[0];t&&Re(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Fe(t.clientX,t.clientY)},onTouchEnd:He,children:[
114
+ /* @__PURE__ */e("div",{ref:ae,"data-mermaid-wrapper":!0,className:ze("absolute inset-0 cursor-grab",{"cursor-grabbing":H}),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${P})`},children:/* @__PURE__ */e("div",{ref:ce,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(V||be)&&/* @__PURE__ */n("div",{className:"mermaid-loading",children:[
115
115
  /* @__PURE__ */e("span",{className:"mermaid-spinner"}),
116
- /* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),Ke=y.showHeader&&/* @__PURE__ */n("div",{className:Ae("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",y.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
116
+ /* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),Xe=y.showHeader&&/* @__PURE__ */n("div",{className:ze("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",y.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
117
117
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
118
118
  /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:b}}),
119
- /* @__PURE__ */e("span",{className:Ae("text-sm font-medium font-mono truncate",y.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),y.showModeToggle&&S&&/* @__PURE__ */n("div",{className:Ae("flex items-center space-x-1 rounded-md p-0.5",y.isDark?"bg-gray-700":"bg-gray-100"),children:[
120
- /* @__PURE__ */e("button",{type:"button",className:Ae("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Ie("preview"),onMouseEnter:e=>Te(e,k("common.preview")),onFocus:e=>Te(e,k("common.preview")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
119
+ /* @__PURE__ */e("span",{className:ze("text-sm font-medium font-mono truncate",y.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),y.showModeToggle&&E&&/* @__PURE__ */n("div",{className:ze("flex items-center space-x-1 rounded-md p-0.5",y.isDark?"bg-gray-700":"bg-gray-100"),children:[
120
+ /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Pe("preview"),onMouseEnter:e=>Se(e,k("common.preview")),onFocus:e=>Se(e,k("common.preview")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
121
121
  /* @__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:"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"}),
123
123
  /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})}),
124
124
  /* @__PURE__ */e("span",{children:k("common.preview")})]})}),
125
- /* @__PURE__ */e("button",{type:"button",className:Ae("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Ie("source"),onMouseEnter:e=>Te(e,k("common.source")),onFocus:e=>Te(e,k("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
125
+ /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Pe("source"),onMouseEnter:e=>Se(e,k("common.source")),onFocus:e=>Se(e,k("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
126
126
  /* @__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"})}),
127
127
  /* @__PURE__ */e("span",{children:k("common.source")})]})})]}),
128
- /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[y.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,"aria-pressed":_,onClick:()=>A(e=>!e),onMouseEnter:e=>Te(e,k(_?"common.expand":"common.collapse")),onFocus:e=>Te(e,k(_?"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"})})}),y.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Pe,onClick:De,onMouseEnter:e=>Te(e,k(W?"common.copySuccess":"common.copy")),onFocus:e=>Te(e,k(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:[
128
+ /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[y.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Oe,"aria-pressed":j,onClick:()=>A(e=>!e),onMouseEnter:e=>Se(e,k(j?"common.expand":"common.collapse")),onFocus:e=>Se(e,k(j?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:j?"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"})})}),y.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Oe,onClick:De,onMouseEnter:e=>Se(e,k(W?"common.copySuccess":"common.copy")),onFocus:e=>Se(e,k(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:[
129
129
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
130
- /* @__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"})]})})}),y.showExportButton&&S&&/* @__PURE__ */e("button",{type:"button",className:Ae(Pe,Oe?"opacity-50 cursor-not-allowed":""),disabled:Oe,onClick:$e,onMouseEnter:e=>Te(e,k("common.export")),onFocus:e=>Te(e,k("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:[
130
+ /* @__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"})]})})}),y.showExportButton&&E&&/* @__PURE__ */e("button",{type:"button",className:ze(Oe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:$e,onMouseEnter:e=>Se(e,k("common.export")),onFocus:e=>Se(e,k("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:[
131
131
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
132
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),y.showFullscreenButton&&S&&/* @__PURE__ */e("button",{type:"button",className:Ae(Pe,Oe?"opacity-50 cursor-not-allowed":""),disabled:Oe,onClick:G?_e:We,onMouseEnter:e=>Te(e,k(G?"common.minimize":"common.open")),onFocus:e=>Te(e,k(G?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",G?{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"})})})]})]}),Xe=/* @__PURE__ */n("div",{children:[$?/* @__PURE__ */e("div",{className:Ae("p-4",y.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:M})}):Ve,Y&&/* @__PURE__ */e("div",{className:"mermaid-error",children:Y})]});/* @__PURE__ */
132
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),y.showFullscreenButton&&E&&/* @__PURE__ */e("button",{type:"button",className:ze(Oe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:G?je:Ae,onMouseEnter:e=>Se(e,k(G?"common.minimize":"common.open")),onFocus:e=>Se(e,k(G?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",G?{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:[$?/* @__PURE__ */e("div",{className:ze("p-4",y.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:M})}):Ve,Y&&/* @__PURE__ */e("div",{className:"mermaid-error",children:Y})]});/* @__PURE__ */
133
133
  return n(t,{children:[
134
- /* @__PURE__ */n("div",{className:Ae("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",y.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":be}),children:[Ke,
135
- /* @__PURE__ */e("div",{ref:de,style:{display:_?"none":""},children:Xe})]}),G&&"undefined"!=typeof document&&x(
136
- /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>_e(),children:/* @__PURE__ */n("div",{className:Ae("mermaid-modal-panel",{"is-dark":y.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
134
+ /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",y.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":be}),children:[Xe,
135
+ /* @__PURE__ */e("div",{ref:se,style:{display:j?"none":""},children:Ke})]}),G&&"undefined"!=typeof document&&x(
136
+ /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>je(),children:/* @__PURE__ */n("div",{className:ze("mermaid-modal-panel",{"is-dark":y.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
137
137
  /* @__PURE__ */n("div",{className:"mermaid-modal-header",children:[
138
138
  /* @__PURE__ */e("span",{className:"mermaid-modal-title",children:`Mermaid ${k("common.preview")}`}),
139
- /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:_e,children:k("common.close")})]}),
140
- /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:ue,className:"mermaid-modal-content"})})]})}),document.body)]})}function Vn(e,t,n){return Math.min(Math.max(e,t),n)}function Kn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function Xn(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 qn(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 Un(e){return(new XMLSerializer).serializeToString(e)}function Yn(e){const{node:t}=e;/* @__PURE__ */
141
- return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function Zn(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
139
+ /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:je,children:k("common.close")})]}),
140
+ /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:de,className:"mermaid-modal-content"})})]})}),document.body)]})}function Jn(e,t,n){return Math.min(Math.max(e,t),n)}function Qn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function er(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 tr(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 nr(e){return(new XMLSerializer).serializeToString(e)}function rr(e){const{node:t}=e;/* @__PURE__ */
141
+ return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function or(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
142
142
  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(
143
143
  /* @__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(
144
- /* @__PURE__ */e(r.Fragment,{children:a(t,`${String(null!=c?c:"paragraph")}-block-${n}`,l)},`${String(null!=c?c:"paragraph")}-block-${n}`))):m.push(t)}),h(),u.length?/* @__PURE__ */e(t,{children:u}):/* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(d,l,String(null!=c?c:"paragraph"),a)})}function Gn(t){const{node:n}=t,r=d(e=>{var r;null==(r=t.onClick)||r.call(t,e,n.id,t.messageId,t.threadId)},[n.id,t]);/* @__PURE__ */
145
- return e("span",{className:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabIndex:0,onClick:r,onMouseEnter:e=>{var r;null==(r=t.onMouseEnter)||r.call(t,e,n.id,t.messageId,t.threadId)},onMouseLeave:e=>{var r;null==(r=t.onMouseLeave)||r.call(t,e,n.id,t.messageId,t.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function Jn(t){/* @__PURE__ */
146
- return e("s",{className:"strikethrough-node",children:t.children})}function Qn(t){/* @__PURE__ */
147
- return e("strong",{className:"strong-node",children:t.children})}function er(t){/* @__PURE__ */
148
- return e("sub",{className:"subscript-node",children:t.children})}function tr(t){/* @__PURE__ */
149
- return e("sup",{className:"superscript-node",children:t.children})}function nr(t){var r;const{node:o,ctx:i,renderNode:l,indexKey:a}=t,c=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],s=Boolean(null==o?void 0:o.loading),d=Array.isArray(null==o?void 0:o.rows)?o.rows:[],u=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
144
+ /* @__PURE__ */e(r.Fragment,{children:a(t,`${String(null!=c?c:"paragraph")}-block-${n}`,l)},`${String(null!=c?c:"paragraph")}-block-${n}`))):m.push(t)}),h(),u.length?/* @__PURE__ */e(t,{children:u}):/* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(d,l,String(null!=c?c:"paragraph"),a)})}function ir(t){const{node:n}=t,r=d(e=>{var r;null==(r=t.onClick)||r.call(t,e,n.id,t.messageId,t.threadId)},[n.id,t]);/* @__PURE__ */
145
+ return e("span",{className:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabIndex:0,onClick:r,onMouseEnter:e=>{var r;null==(r=t.onMouseEnter)||r.call(t,e,n.id,t.messageId,t.threadId)},onMouseLeave:e=>{var r;null==(r=t.onMouseLeave)||r.call(t,e,n.id,t.messageId,t.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function lr(t){/* @__PURE__ */
146
+ return e("s",{className:"strikethrough-node",children:t.children})}function ar(t){/* @__PURE__ */
147
+ return e("strong",{className:"strong-node",children:t.children})}function cr(t){/* @__PURE__ */
148
+ return e("sub",{className:"subscript-node",children:t.children})}function sr(t){/* @__PURE__ */
149
+ return e("sup",{className:"superscript-node",children:t.children})}function dr(t){var r;const{node:o,ctx:i,renderNode:l,indexKey:a}=t,c=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],s=Boolean(null==o?void 0:o.loading),d=Array.isArray(null==o?void 0:o.rows)?o.rows:[],u=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
150
150
  return n("div",{className:"table-node-wrapper","data-index-key":a,children:[
151
- /* @__PURE__ */n("table",{className:Ae("my-8 text-sm table-node",s&&"table-node--loading"),"aria-busy":s,children:[
152
- /* @__PURE__ */e("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */e("tr",{className:"border-b",children:c.map((t,n)=>/* @__PURE__ */e("th",{className:Ae("font-semibold p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-th-${n}`,l):null},`header-${n}`))})}),
151
+ /* @__PURE__ */n("table",{className:ze("my-8 text-sm table-node",s&&"table-node--loading"),"aria-busy":s,children:[
152
+ /* @__PURE__ */e("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */e("tr",{className:"border-b",children:c.map((t,n)=>/* @__PURE__ */e("th",{className:ze("font-semibold p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-th-${n}`,l):null},`header-${n}`))})}),
153
153
  /* @__PURE__ */e("tbody",{children:d.map((t,n)=>{var r;/* @__PURE__ */
154
- return e("tr",{className:Ae("border-[var(--table-border,#cbd5e1)]",n<d.length-1&&"border-b"),children:null==(r=t.cells)?void 0:r.map((t,r)=>/* @__PURE__ */e("td",{className:Ae("p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-row-${n}-${r}`,l):null},`cell-${n}-${r}`))},`row-${n}`)})})]}),s&&/* @__PURE__ */n("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
154
+ return e("tr",{className:ze("border-[var(--table-border,#cbd5e1)]",n<d.length-1&&"border-b"),children:null==(r=t.cells)?void 0:r.map((t,r)=>/* @__PURE__ */e("td",{className:ze("p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-row-${n}-${r}`,l):null},`cell-${n}-${r}`))},`row-${n}`)})})]}),s&&/* @__PURE__ */n("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
155
155
  /* @__PURE__ */e("span",{className:"table-node__spinner","aria-hidden":"true"}),
156
- /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function rr(t){const{node:n,children:r}=t;/* @__PURE__ */
157
- return e("span",{className:Ae("text-node whitespace-pre-wrap break-words",n.center&&"text-node-center"),children:null!=r?r:n.content})}function or(){/* @__PURE__ */
158
- return e("hr",{className:"hr-node thematic-break"})}function ir(t){const{node:n,ctx:i,renderNode:l,indexKey:a}=t,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?b(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
159
- return e("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((t,n)=>/* @__PURE__ */e(r.Fragment,{children:l(t,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function lr(e,t){const n=String(null!=e?e:"");if(!t)return n;const r=new RegExp(String.raw`^\s*<\s*${t}(?:\s[^>]*)?>\s*`,"i"),o=new RegExp(String.raw`\s*<\s*\/\s*${t}\s*>\s*$`,"i");return n.replace(r,"").replace(o,"")}function ar(t,n,o){var i,l,a;const c=null!=(i=o.customComponents)?i:I(o.customId),s=c[t.type];if(s)return r.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter});if("html_block"===t.type||"html_inline"===t.type){const e=String(null!=(l=t.tag)?l:"").trim().toLowerCase()||function(e){const t=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return t?t[1].toLowerCase():""}(t.content),i=e?c[e]:null;if(i){const l={...t,type:e,tag:e,content:lr(t.content,e)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter})}}switch(t.type){case"text":/* @__PURE__ */
160
- return e(rr,{node:t,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
161
- return e(rr,{node:{type:"text",content:null!=(a=t.content)?a:"",center:t.center},typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
162
- return e(Zn,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
163
- return e(nt,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
164
- return e(pr,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
165
- return e(Ht,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
166
- return e(Rt,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
167
- return e(nr,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
168
- return e(Ye,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
169
- return e(Qe,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
170
- return e(et,{node:t},n);case"footnote_anchor":/* @__PURE__ */
171
- return e(Je,{node:t},n);case"admonition":/* @__PURE__ */
172
- return e(B,{node:t,ctx:o,renderNode:ar,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
173
- return e(tt,{node:t,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
174
- return e(It,{node:t,ctx:o,renderNode:ar,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
175
- return e(Dt,{node:t},n);case"inline_code":/* @__PURE__ */
176
- return e(Ot,{node:t,typewriter:o.typewriter},n);case"code_block":return function(t,n,o,i){var l,a,c,s;const d=ie(String(t.language||""));if("mermaid"===d){const l=i.mermaid;if(l)return r.createElement(l,{key:n,node:t,isDark:o.isDark});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
177
- return e(zn,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Wt,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Ue,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */e(De,{node:t},n):/* @__PURE__ */e(je,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(l=o.codeBlockThemes)?void 0:l.monacoOptions,themes:null==(a=o.codeBlockThemes)?void 0:a.themes,minWidth:null==(c=o.codeBlockThemes)?void 0:c.minWidth,maxWidth:null==(s=o.codeBlockThemes)?void 0:s.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o,c);case"strong":/* @__PURE__ */
178
- return e(Qn,{node:t,children:C(t.children,o,`${String(n)}-strong`,ar)},n);case"emphasis":/* @__PURE__ */
179
- return e(Ge,{node:t,children:C(t.children,o,`${String(n)}-em`,ar)},n);case"strikethrough":/* @__PURE__ */
180
- return e(Jn,{node:t,children:C(t.children,o,`${String(n)}-strike`,ar)},n);case"highlight":/* @__PURE__ */
181
- return e(rt,{node:t,children:C(t.children,o,`${String(n)}-highlight`,ar)},n);case"insert":/* @__PURE__ */
182
- return e(Pt,{node:t,children:C(t.children,o,`${String(n)}-insert`,ar)},n);case"subscript":/* @__PURE__ */
183
- return e(er,{node:t,children:C(t.children,o,`${String(n)}-sub`,ar)},n);case"superscript":/* @__PURE__ */
184
- return e(tr,{node:t,children:C(t.children,o,`${String(n)}-sup`,ar)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
185
- return e(F,{node:t,typewriter:o.typewriter},n);case"emoji":/* @__PURE__ */
186
- return e(Ze,{node:t,typewriter:o.typewriter},n);case"thematic_break":/* @__PURE__ */
187
- return e(or,{},n);case"math_inline":/* @__PURE__ */
188
- return e(pn,{node:t},n);case"math_block":/* @__PURE__ */
189
- return e(hn,{node:t},n);case"reference":/* @__PURE__ */
190
- return e(Gn,{node:t,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */e(pt,{node:t,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */e(St,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
191
- return e(ir,{node:t,ctx:o,renderNode:ar,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
192
- return e(Yn,{node:t},n)}}const cr={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},sr=h();function dr(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 ur(e){return/^[a-z][a-z0-9-]*$/.test(e)}const mr=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u})=>{var m,h,p,g,f,w,v;const y=D(),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,E=!1!==t.viewportPriority,S=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,T=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&E},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,E,L]),[$,j]=i(()=>S?Math.min(r.length,C):r.length),_=c($);s(()=>{_.current=$},[$]);const A=S?$:r.length,[W,O]=i(0),[P,I]=i({start:0,end:r.length}),R=c(/* @__PURE__ */new Map),[H,F]=i(0),z=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),Y=c($),Z=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:S}),ie=T||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(P.start,e)),n=Math.max(t,Math.min(P.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,P,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(P.end+N,C),t=Math.min(r.length,e);return Math.max($,t)},[r.length,L,P.end,N,C,$]);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(P.start,r.length)):0,ue=L?se(Math.min(P.end,r.length),r.length):0,me=d(()=>{null!=Z.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(Z.current),Z.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(!S)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)))},[S,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!S)return;const i=ne.current;if(_.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();j(t=>{const n=Math.min(ne.current,t+Math.max(1,e));return _.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;Z.current=null,G.current=null,J.current=null,Q.current=!1;const r=ee.current;if(ee.current=null,a(null!=r?r:l),_.current>=ne.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;_.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));_.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?Z.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>s(),d):s()}):G.current=window.setTimeout(()=>s(),d)}},[he,k,S,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!==S;if(oe.current={batchSize:b,initial:C,delay:c,enabled:S},(l||s||!S)&&me(),(l||s)&&(te.current=Math.max(1,b||1),U.current.clear()),!o)return _.current=0,void j(0);const d=ne.current;if(!S)return _.current=d,void j(d);if(l||s){const e=Math.min(d,C);return _.current=e,j(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(_.current,d);u!==_.current&&(_.current=u,j(u)),_.current<d&&pe(Math.max(1,b||1))},[me,S,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(W,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})},[W,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 z.current[t],K.current.delete(t),X.current.delete(t),q.current.delete(t))},[]);s(()=>{ge(A)},[ge,A]),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&&F(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(U.current))n>=e&&U.current.delete(n)},[r.length]);const fe=d((e,t)=>{T&&t&&(z.current[e]=!0),t&&L&&O(t=>e>t?e:t)},[T,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),T&&!t&&delete z.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(()=>{})},[T,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),F(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),F(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=>!(S&&e>=_.current)&&(!T||e<C||!0===z.current[e]),[T,S,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&&$>Y.current&&O($-1),Y.current=$},[$,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__ */
193
- return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":t.customId,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:ar(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}),hr=t=>{const n={...cr,...t},r=c(null),i=c(null),l=u(W,O,O),a=o(()=>I(n.customId),[n.customId,l]),d=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=o(()=>Object.keys(a).map(String).map(e=>e.trim().toLowerCase()).filter(ur),[a]),g=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:[],...m].map(dr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,l]),f=o(()=>{const e=g;return e&&0!==e.length?h(d,{customHtmlTags:e}):h(d)},[d,g]),w=o(()=>{const e=f;return n.customMarkdownIt?n.customMarkdownIt(e):e},[f,n.customMarkdownIt]),v=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=g.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:g}:{}}:r},[g,n.final,n.parseOptions]),y=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!=w?w:sr,v)),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,v,w,n.customId,l,g]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!y.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)},[y,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=Ee.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Ee.set(e,t),t}catch{}const n="__theme_"+ ++Se;return Ee.set(e,n),n}return String(e)}(e);t&&Ne!==t&&(Me=e,Ne=t,Be&&Ce(Me,Be).then(()=>Te()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const x=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),k=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:x,typewriter:n.typewriter,customComponents:a,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,x,n.typewriter,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockProps,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,a]);/* @__PURE__ */
194
- return e(T,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(mr,{props:n,parsedNodes:y,renderCtx:k,indexPrefix:x,containerRef:r})})};function pr(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
195
- return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(hr,{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 gr(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),[E,S]=i(14),[T,D]=i(E),$=c(null),j=c(null),_=c(null),A=c(null),W=c(!1),O=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),P=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(!A.current&&!W.current){W.current=!0;try{const e=await import("stream-markdown");A.current=e.createShikiStreamRenderer}catch{}}},[]),H=d(async()=>{if(await R(),$.current&&j.current)if(!_.current&&A.current&&(_.current=A.current(j.current,{theme:O(),themes:l.themes}),L(!0)),_.current)if(!1===l.stream&&l.loading)P(l.node.code);else{P(l.node.code);try{await _.current.updateCode(l.node.code,u),I()}catch{}}else P(l.node.code);else P(l.node.code)},[I,R,O,u,l.loading,l.node.code,l.stream,l.themes,P]);s(()=>(H(),()=>{var e;null==(e=_.current)||e.dispose(),_.current=null}),[H]),s(()=>{_.current&&_.current.setTheme(O())},[O]),s(()=>{_.current&&(!1===l.stream&&l.loading||(P(l.node.code),Promise.resolve(_.current.updateCode(l.node.code,u)).then(()=>I()).catch(()=>{})))},[I,u,l.loading,l.node.code,l.stream,P]);const F=d((e,t)=>{ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),l.isDark)},[l.isDark]),z=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:`${T}px`}),[T]);return s(()=>{S(14),D(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:[
156
+ /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function ur(t){const{node:n,children:r}=t;/* @__PURE__ */
157
+ return e("span",{className:ze("text-node whitespace-pre-wrap break-words",n.center&&"text-node-center"),children:null!=r?r:n.content})}function mr(){/* @__PURE__ */
158
+ return e("hr",{className:"hr-node thematic-break"})}function hr(t){const{node:n,ctx:i,renderNode:l,indexKey:a}=t,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?b(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
159
+ return e("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((t,n)=>/* @__PURE__ */e(r.Fragment,{children:l(t,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function pr(e,t){const n=String(null!=e?e:"");if(!t)return n;const r=new RegExp(String.raw`^\s*<\s*${t}(?:\s[^>]*)?>\s*`,"i"),o=new RegExp(String.raw`\s*<\s*\/\s*${t}\s*>\s*$`,"i");return n.replace(r,"").replace(o,"")}function gr(t,n,o){var i,l,a;const c=null!=(i=o.customComponents)?i:I(o.customId),s=c[t.type];if(s)return r.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter});if("html_block"===t.type||"html_inline"===t.type){const e=String(null!=(l=t.tag)?l:"").trim().toLowerCase()||function(e){const t=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return t?t[1].toLowerCase():""}(t.content),i=e?c[e]:null;if(i){const l={...t,type:e,tag:e,content:pr(t.content,e)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter})}}switch(t.type){case"text":/* @__PURE__ */
160
+ return e(ur,{node:t,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
161
+ return e(ur,{node:{type:"text",content:null!=(a=t.content)?a:"",center:t.center},typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
162
+ return e(or,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
163
+ return e(dt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
164
+ return e(br,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
165
+ return e(Yt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
166
+ return e(Ut,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
167
+ return e(dr,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
168
+ return e(rt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
169
+ return e(at,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
170
+ return e(ct,{node:t},n);case"footnote_anchor":/* @__PURE__ */
171
+ return e(lt,{node:t},n);case"admonition":/* @__PURE__ */
172
+ return e(B,{node:t,ctx:o,renderNode:gr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
173
+ return e(st,{node:t,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
174
+ return e(qt,{node:t,ctx:o,renderNode:gr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
175
+ return e(It,{node:t},n);case"inline_code":/* @__PURE__ */
176
+ return e(Xt,{node:t,typewriter:o.typewriter},n);case"code_block":return function(t,n,o,i){var l,a,c,s;const d=de(String(t.language||""));if("mermaid"===d){const l=i.mermaid;if(l)return r.createElement(l,{key:n,node:t,isDark:o.isDark});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
177
+ return e(Gn,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Vt,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(nt,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */e(Ie,{node:t},n):/* @__PURE__ */e(Fe,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(l=o.codeBlockThemes)?void 0:l.monacoOptions,themes:null==(a=o.codeBlockThemes)?void 0:a.themes,minWidth:null==(c=o.codeBlockThemes)?void 0:c.minWidth,maxWidth:null==(s=o.codeBlockThemes)?void 0:s.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o,c);case"strong":/* @__PURE__ */
178
+ return e(ar,{node:t,children:C(t.children,o,`${String(n)}-strong`,gr)},n);case"emphasis":/* @__PURE__ */
179
+ return e(it,{node:t,children:C(t.children,o,`${String(n)}-em`,gr)},n);case"strikethrough":/* @__PURE__ */
180
+ return e(lr,{node:t,children:C(t.children,o,`${String(n)}-strike`,gr)},n);case"highlight":/* @__PURE__ */
181
+ return e(ut,{node:t,children:C(t.children,o,`${String(n)}-highlight`,gr)},n);case"insert":/* @__PURE__ */
182
+ return e(Kt,{node:t,children:C(t.children,o,`${String(n)}-insert`,gr)},n);case"subscript":/* @__PURE__ */
183
+ return e(cr,{node:t,children:C(t.children,o,`${String(n)}-sub`,gr)},n);case"superscript":/* @__PURE__ */
184
+ return e(sr,{node:t,children:C(t.children,o,`${String(n)}-sup`,gr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
185
+ return e(H,{node:t,typewriter:o.typewriter},n);case"emoji":/* @__PURE__ */
186
+ return e(ot,{node:t,typewriter:o.typewriter},n);case"thematic_break":/* @__PURE__ */
187
+ return e(mr,{},n);case"math_inline":/* @__PURE__ */
188
+ return e(bn,{node:t},n);case"math_block":/* @__PURE__ */
189
+ return e(kn,{node:t},n);case"reference":/* @__PURE__ */
190
+ return e(ir,{node:t,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */e(bt,{node:t,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */e(Ot,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
191
+ return e(hr,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
192
+ return e(rr,{node:t},n)}}const fr={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},wr=h();function vr(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 yr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const xr=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u})=>{var m,h,p,g,f,w,v;const y=D(),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,T=!1!==t.viewportPriority,E=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,S=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&T},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,T,L]),[$,_]=i(()=>E?Math.min(r.length,C):r.length),j=c($);s(()=>{j.current=$},[$]);const A=E?$:r.length,[W,O]=i(0),[P,I]=i({start:0,end:r.length}),R=c(/* @__PURE__ */new Map),[F,H]=i(0),z=c({}),V=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),K=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Set),Y=c($),Z=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:E}),ie=S||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)},[F]),ae=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(P.start,e)),n=Math.max(t,Math.min(P.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,P,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(P.end+N,C),t=Math.min(r.length,e);return Math.max($,t)},[r.length,L,P.end,N,C,$]);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(P.start,r.length)):0,ue=L?se(Math.min(P.end,r.length),r.length):0,me=d(()=>{null!=Z.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(Z.current),Z.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(!E)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)))},[E,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!E)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;Z.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?Z.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>s(),d):s()}):G.current=window.setTimeout(()=>s(),d)}},[he,k,E,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!==E;if(oe.current={batchSize:b,initial:C,delay:c,enabled:E},(l||s||!E)&&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(!E)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,E,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(W,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})},[W,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 z.current[t],X.current.delete(t),K.current.delete(t),q.current.delete(t))},[]);s(()=>{ge(A)},[ge,A]),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&&H(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(U.current))n>=e&&U.current.delete(n)},[r.length]);const fe=d((e,t)=>{S&&t&&(z.current[e]=!0),t&&L&&O(t=>e>t?e:t)},[S,L]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),ve=d((e,t)=>{const n=X.current;if(t?n.set(e,t):n.delete(e),!ie||!t)return we(e),S&&!t&&delete z.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(()=>{})},[S,we,fe,y,C,ie,L]),ye=d(e=>{const t=K.current.get(e);if(t)return t;const n=t=>ve(e,t);return K.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(R.current.has(e)&&(R.current.delete(e),H(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),H(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=>!(E&&e>=j.current)&&(!S||e<C||!0===z.current[e]),[S,E,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 X.current.entries())t&&ve(e,t)},[ve]),s(()=>{L&&$>Y.current&&O($-1),Y.current=$},[$,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__ */
193
+ return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":t.customId,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:gr(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}),kr=t=>{const n={...fr,...t},r=c(null),i=c(null),l=u(W,O,O),a=o(()=>I(n.customId),[n.customId,l]),d=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=o(()=>Object.keys(a).map(String).map(e=>e.trim().toLowerCase()).filter(yr),[a]),g=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:[],...m].map(vr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,l]),f=o(()=>{const e=g;return e&&0!==e.length?h(d,{customHtmlTags:e}):h(d)},[d,g]),w=o(()=>{const e=f;return n.customMarkdownIt?n.customMarkdownIt(e):e},[f,n.customMarkdownIt]),v=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=g.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:g}:{}}:r},[g,n.final,n.parseOptions]),y=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!=w?w:wr,v)),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,v,w,n.customId,l,g]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!y.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==de(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(()=>{ke()},{timeout:900});return()=>o(i)},[y,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=We.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return We.set(e,t),t}catch{}const n="__theme_"+ ++Oe;return We.set(e,n),n}return String(e)}(e);t&&_e!==t&&($e=e,_e=t,je&&De($e,je).then(()=>Pe()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const x=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),k=o(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips]),b=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:x,typewriter:n.typewriter,customComponents:a,showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:k,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,x,n.typewriter,n.showTooltips,n.renderCodeBlocksAsPre,n.codeBlockStream,k,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,a]);/* @__PURE__ */
194
+ return e(S,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(xr,{props:n,parsedNodes:y,renderCtx:b,indexPrefix:x,containerRef:r})})};function br(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
195
+ return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(kr,{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 Cr(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(()=>de(a),[a]),[h,p]=i(0);s(()=>pe(()=>{p(e=>e+1)}),[]);const g=o(()=>{const e=fe[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),f=o(()=>ge(m),[m,h]),{t:w}=X(),v=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),y=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]),[x,k]=i(!1),[b,C]=i(!1),[M,N]=i(!1),[B,L]=i(""),[T,E]=i(!1),[S,D]=i(14),[$,_]=i(S),j=o(()=>!1!==l.showTooltips,[l.showTooltips]),A=c(null),W=c(null),O=c(null),P=c(null),I=c(!1),R=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),F=d(e=>{if(!e)return L(""),void E(!1);var t;L(`<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>`),E(!1)},[]),H=d(()=>{L(""),E(!0)},[]),z=d(async()=>{if(!P.current&&!I.current){I.current=!0;try{const e=await import("stream-markdown");P.current=e.createShikiStreamRenderer}catch{}}},[]),V=d(async()=>{if(await z(),A.current&&W.current)if(!O.current&&P.current&&(O.current=P.current(W.current,{theme:R(),themes:l.themes}),E(!0)),O.current)if(!1===l.stream&&l.loading)F(l.node.code);else{F(l.node.code);try{await O.current.updateCode(l.node.code,u),H()}catch{}}else F(l.node.code);else F(l.node.code)},[H,z,R,u,l.loading,l.node.code,l.stream,l.themes,F]);s(()=>(V(),()=>{var e;null==(e=O.current)||e.dispose(),O.current=null}),[V]),s(()=>{O.current&&O.current.setTheme(R())},[R]),s(()=>{O.current&&(!1===l.stream&&l.loading||(F(l.node.code),Promise.resolve(O.current.updateCode(l.node.code,u)).then(()=>H()).catch(()=>{})))},[H,u,l.loading,l.node.code,l.stream,F]),s(()=>{j||te(!0)},[j]);const K=d((e,t)=>{if(!j)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,l.isDark))},[l.isDark,j]),q=d(()=>{j&&te()},[j]),U=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),k(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>k(!1),1e3)}catch{}},[l]),Y=d(()=>{var e;if(!v)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})},[v,u,l]),Z=o(()=>({fontSize:`${$}px`}),[$]);return s(()=>{D(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:y,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:[
196
196
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
197
- /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:p}}),
198
- /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:h})]}),
197
+ /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:f}}),
198
+ /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:g})]}),
199
199
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
200
- /* @__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":b,onClick:()=>C(e=>!e),onMouseEnter:e=>F(e,b?g("common.expand")||"Expand":g("common.collapse")||"Collapse"),onFocus:e=>F(e,b?g("common.expand")||"Expand":g("common.collapse")||"Collapse"),onMouseLeave:z,onBlur:z,children:/* @__PURE__ */e("svg",{style:{rotate:b?"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"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */n(t,{children:[
201
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:T<=10,onClick:()=>D(e=>Math.max(10,e-1)),onMouseEnter:e=>F(e,g("common.decrease")||"Decrease"),onFocus:e=>F(e,g("common.decrease")||"Decrease"),onMouseLeave:z,onBlur:z,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
202
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:T===E,onClick:()=>D(E),onMouseEnter:e=>F(e,g("common.reset")||"Reset"),onFocus:e=>F(e,g("common.reset")||"Reset"),onMouseLeave:z,onBlur:z,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:[
200
+ /* @__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":M,onClick:()=>N(e=>!e),onMouseEnter:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onFocus:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{style:{rotate:M?"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"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */n(t,{children:[
201
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$<=10,onClick:()=>_(e=>Math.max(10,e-1)),onMouseEnter:e=>K(e,w("common.decrease")||"Decrease"),onFocus:e=>K(e,w("common.decrease")||"Decrease"),onMouseLeave:q,onBlur:q,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
202
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$===S,onClick:()=>_(S),onMouseEnter:e=>K(e,w("common.reset")||"Reset"),onFocus:e=>K(e,w("common.reset")||"Reset"),onMouseLeave:q,onBlur:q,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:[
203
203
  /* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
204
204
  /* @__PURE__ */e("path",{d:"M3 3v5h5"})]})})}),
205
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:T>=36,onClick:()=>D(e=>Math.min(36,e+1)),onMouseEnter:e=>F(e,g("common.increase")||"Increase"),onFocus:e=>F(e,g("common.increase")||"Increase"),onMouseLeave:z,onBlur:z,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),l.showCopyButton&&/* @__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":v?g("common.copied")||"Copied":g("common.copy")||"Copy",onClick:V,onMouseEnter:e=>F(e,v?g("common.copied")||"Copied":g("common.copy")||"Copy"),onFocus:e=>F(e,v?g("common.copied")||"Copied":g("common.copy")||"Copy"),onMouseLeave:z,onBlur:z,children:/* @__PURE__ */e("svg",v?{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:[
205
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$>=36,onClick:()=>_(e=>Math.min(36,e+1)),onMouseEnter:e=>K(e,w("common.increase")||"Increase"),onFocus:e=>K(e,w("common.increase")||"Increase"),onMouseLeave:q,onBlur:q,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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),l.showCopyButton&&/* @__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":x?w("common.copied")||"Copied":w("common.copy")||"Copy",onClick:U,onMouseEnter:e=>K(e,x?w("common.copied")||"Copied":w("common.copy")||"Copy"),onFocus:e=>K(e,x?w("common.copied")||"Copied":w("common.copy")||"Copy"),onMouseLeave:q,onBlur:q,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:"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:[
206
206
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
207
- /* @__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=>F(e,x?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onFocus:e=>F(e,x?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onMouseLeave:z,onBlur:z,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=>F(e,g("common.preview")||"Preview"),onFocus:e=>F(e,g("common.preview")||"Preview"),onMouseLeave:z,onBlur:z,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:[
207
+ /* @__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":b,onClick:()=>C(e=>!e),onMouseEnter:e=>K(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onFocus:e=>K(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",b?{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"})})}),v&&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":w("common.preview")||"Preview",onClick:Y,onMouseEnter:e=>K(e,w("common.preview")||"Preview"),onFocus:e=>K(e,w("common.preview")||"Preview"),onMouseLeave:q,onBlur:q,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:[
208
208
  /* @__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"}),
209
- /* @__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:[
210
- /* @__PURE__ */e("div",{ref:j,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:[
209
+ /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!M&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:A,className:"code-block-content",style:{...Z,maxHeight:b?"none":"500px",overflowY:b?"visible":"auto",overflowX:"auto"},children:[
210
+ /* @__PURE__ */e("div",{ref:W,className:"code-block-render"}),!T&&B&&/* @__PURE__ */e("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:B}})]}),!l.stream&&l.loading&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
211
211
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
212
212
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
213
213
  /* @__PURE__ */e("div",{className:"skeleton-line short"})]})}),
214
- /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:v?g("common.copied")||"Copied":""})]})}function fr(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(
215
- /* @__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,pr as BlockquoteNode,F as CheckboxNode,je as CodeBlockNode,Ue as D2BlockNode,Ye as DefinitionListNode,Ze as EmojiNode,Ge as EmphasisNode,Yn as FallbackComponent,Je as FootnoteAnchorNode,Qe as FootnoteNode,et as FootnoteReferenceNode,tt as HardBreakNode,nt as HeadingNode,rt as HighlightNode,pt as HtmlBlockNode,St as HtmlInlineNode,se as HtmlPreviewFrame,Dt as ImageNode,Wt as InfographicBlockNode,Ot as InlineCodeNode,Pt as InsertNode,It as LinkNode,Rt as ListItemNode,Ht as ListNode,Cn as MERMAID_WORKER_BUSY_CODE,gr as MarkdownCodeBlockNode,hn as MathBlockNode,pn as MathInlineNode,zn as MermaidBlockNode,hr as NodeRenderer,Zn as ParagraphNode,De as PreCodeNode,je as ReactCodeBlockNode,Gn as ReferenceNode,Jn as StrikethroughNode,Qn as StrongNode,er as SubscriptNode,tr as SuperscriptNode,nr as TableNode,rr as TextNode,or as ThematicBreakNode,fr as Tooltip,ir as VmrContainerNode,Qt as WORKER_BUSY_CODE,Ln as canParseOffthread,H as clearGlobalCustomComponents,nn as clearKaTeXCache,Gt as clearKaTeXWorker,Nn as clearMermaidWorker,hr as default,He as disableD2,Re as enableD2,En as findPrefixOffthread,I as getCustomNodeComponents,cn as getKaTeXBackpressureDefaults,ae as getLanguageIcon,bn as getMermaidWorkerLoad,Fe as isD2Enabled,ce as languageMap,ie as normalizeLanguageIdentifier,R as removeCustomComponents,en as renderKaTeXInWorker,sn as renderKaTeXWithBackpressure,ar as renderNode,le as resolveMonacoLanguageId,P as setCustomComponents,Ie as setD2Loader,V as setDefaultI18nMap,an as setKaTeXBackpressureDefaults,tn as setKaTeXCache,rn as setKaTeXConcurrencyLimit,Zt as setKaTeXWorker,Jt as setKaTeXWorkerDebug,re as setLanguageIconResolver,Mn as setMermaidWorker,xn as setMermaidWorkerClientDebug,kn as setMermaidWorkerMaxConcurrency,Sn as terminateWorker,K as useSafeI18n,on as waitForKaTeXWorkerSlot};
214
+ /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:x?w("common.copied")||"Copied":""})]})}function Mr(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(
215
+ /* @__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,br as BlockquoteNode,H as CheckboxNode,Fe as CodeBlockNode,nt as D2BlockNode,rt as DefinitionListNode,ot as EmojiNode,it as EmphasisNode,rr as FallbackComponent,lt as FootnoteAnchorNode,at as FootnoteNode,ct as FootnoteReferenceNode,st as HardBreakNode,dt as HeadingNode,ut as HighlightNode,bt as HtmlBlockNode,Ot as HtmlInlineNode,we as HtmlPreviewFrame,It as ImageNode,Vt as InfographicBlockNode,Xt as InlineCodeNode,Kt as InsertNode,qt as LinkNode,Ut as ListItemNode,Yt as ListNode,Dn as MERMAID_WORKER_BUSY_CODE,Cr as MarkdownCodeBlockNode,kn as MathBlockNode,bn as MathInlineNode,Gn as MermaidBlockNode,kr as NodeRenderer,or as ParagraphNode,Ie as PreCodeNode,Fe as ReactCodeBlockNode,ir as ReferenceNode,lr as StrikethroughNode,ar as StrongNode,cr as SubscriptNode,sr as SuperscriptNode,dr as TableNode,ur as TextNode,mr as ThematicBreakNode,Mr as Tooltip,hr as VmrContainerNode,cn as WORKER_BUSY_CODE,An as canParseOffthread,F as clearGlobalCustomComponents,un as clearKaTeXCache,ln as clearKaTeXWorker,_n as clearMermaidWorker,kr as default,Ye as disableD2,Ue as enableD2,Wn as findPrefixOffthread,I as getCustomNodeComponents,fn as getKaTeXBackpressureDefaults,ge as getLanguageIcon,Sn as getMermaidWorkerLoad,Ze as isD2Enabled,fe as languageMap,de as normalizeLanguageIdentifier,he as preloadExtendedLanguageIcons,R as removeCustomComponents,sn as renderKaTeXInWorker,wn as renderKaTeXWithBackpressure,gr as renderNode,ue as resolveMonacoLanguageId,P as setCustomComponents,qe as setD2Loader,V as setDefaultI18nMap,gn as setKaTeXBackpressureDefaults,dn as setKaTeXCache,mn as setKaTeXConcurrencyLimit,on as setKaTeXWorker,an as setKaTeXWorkerDebug,ae as setLanguageIconResolver,$n as setMermaidWorker,Tn as setMermaidWorkerClientDebug,En as setMermaidWorkerMaxConcurrency,pe as subscribeLanguageIconsRevision,On as terminateWorker,X as useSafeI18n,hn as waitForKaTeXWorkerSlot};