markstream-react 0.0.31 → 0.0.33

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.
Files changed (97) hide show
  1. package/README.md +11 -0
  2. package/dist/Tooltip-CjIRU2iQ.js +209 -0
  3. package/dist/index-BQw8Blc5.js +87 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.d.ts +65 -622
  6. package/dist/index.js +1 -211
  7. package/dist/index.px.css +1 -1
  8. package/dist/index.tailwind.css +1 -1
  9. package/dist/languageIcon-BiAQ6aSb.js +3 -0
  10. package/dist/markstream-react.css +1 -0
  11. package/dist/next.d.ts +737 -0
  12. package/dist/next.js +2 -0
  13. package/dist/server.d.ts +543 -0
  14. package/dist/server.js +1 -0
  15. package/dist/tailwind.ts +1 -1
  16. package/dist/types/components/AdmonitionNode/AdmonitionNode.d.ts +11 -0
  17. package/dist/types/components/BlockquoteNode/BlockquoteNode.d.ts +7 -0
  18. package/dist/types/components/CheckboxNode/CheckboxNode.d.ts +6 -0
  19. package/dist/types/components/CodeBlockNode/CodeBlockNode.d.ts +13 -0
  20. package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.d.ts +9 -0
  21. package/dist/types/components/CodeBlockNode/PreCodeNode.d.ts +2 -0
  22. package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -0
  23. package/dist/types/components/CodeBlockNode/monacoThemeRegistry.d.ts +7 -0
  24. package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +4 -0
  25. package/dist/types/components/D2BlockNode/D2BlockNode.d.ts +2 -0
  26. package/dist/types/components/D2BlockNode/d2.d.ts +6 -0
  27. package/dist/types/components/D2BlockNode/index.d.ts +2 -0
  28. package/dist/types/components/DefinitionListNode/DefinitionListNode.d.ts +6 -0
  29. package/dist/types/components/EmojiNode/EmojiNode.d.ts +7 -0
  30. package/dist/types/components/EmphasisNode/EmphasisNode.d.ts +5 -0
  31. package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.d.ts +6 -0
  32. package/dist/types/components/FootnoteNode/FootnoteNode.d.ts +8 -0
  33. package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.d.ts +6 -0
  34. package/dist/types/components/HardBreakNode/HardBreakNode.d.ts +5 -0
  35. package/dist/types/components/HeadingNode/HeadingNode.d.ts +9 -0
  36. package/dist/types/components/HighlightNode/HighlightNode.d.ts +5 -0
  37. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +12 -0
  38. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +8 -0
  39. package/dist/types/components/ImageNode/ImageNode.d.ts +9 -0
  40. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.d.ts +15 -0
  41. package/dist/types/components/InfographicBlockNode/index.d.ts +2 -0
  42. package/dist/types/components/InfographicBlockNode/infographic.d.ts +1 -0
  43. package/dist/types/components/InlineCodeNode/InlineCodeNode.d.ts +6 -0
  44. package/dist/types/components/InsertNode/InsertNode.d.ts +5 -0
  45. package/dist/types/components/LinkNode/LinkNode.d.ts +21 -0
  46. package/dist/types/components/ListItemNode/ListItemNode.d.ts +12 -0
  47. package/dist/types/components/ListNode/ListNode.d.ts +8 -0
  48. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +36 -0
  49. package/dist/types/components/Math/MathBlockNode.d.ts +2 -0
  50. package/dist/types/components/Math/MathInlineNode.d.ts +2 -0
  51. package/dist/types/components/Math/katex.d.ts +1 -0
  52. package/dist/types/components/MathBlockNode/MathBlockNode.d.ts +2 -0
  53. package/dist/types/components/MathInlineNode/MathInlineNode.d.ts +2 -0
  54. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.d.ts +15 -0
  55. package/dist/types/components/MermaidBlockNode/index.d.ts +2 -0
  56. package/dist/types/components/MermaidBlockNode/mermaid.d.ts +1 -0
  57. package/dist/types/components/NodeRenderer/FallbackComponent.d.ts +5 -0
  58. package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +1 -0
  59. package/dist/types/components/NodeRenderer.d.ts +4 -0
  60. package/dist/types/components/ParagraphNode/ParagraphNode.d.ts +7 -0
  61. package/dist/types/components/PreCodeNode/PreCodeNode.d.ts +2 -0
  62. package/dist/types/components/ReferenceNode/ReferenceNode.d.ts +15 -0
  63. package/dist/types/components/StrikethroughNode/StrikethroughNode.d.ts +5 -0
  64. package/dist/types/components/StrongNode/StrongNode.d.ts +5 -0
  65. package/dist/types/components/SubscriptNode/SubscriptNode.d.ts +5 -0
  66. package/dist/types/components/SuperscriptNode/SuperscriptNode.d.ts +5 -0
  67. package/dist/types/components/TableNode/TableNode.d.ts +8 -0
  68. package/dist/types/components/TextNode/TextNode.d.ts +7 -0
  69. package/dist/types/components/ThematicBreakNode/ThematicBreakNode.d.ts +2 -0
  70. package/dist/types/components/Tooltip/Tooltip.d.ts +15 -0
  71. package/dist/types/components/VmrContainerNode/VmrContainerNode.d.ts +9 -0
  72. package/dist/types/context/viewportPriority.d.ts +17 -0
  73. package/dist/types/customComponents.d.ts +9 -0
  74. package/dist/types/i18n/useSafeI18n.d.ts +10 -0
  75. package/dist/types/index.d.ts +65 -0
  76. package/dist/types/next.d.ts +297 -0
  77. package/dist/types/renderers/renderChildren.d.ts +7 -0
  78. package/dist/types/renderers/renderNode.d.ts +4 -0
  79. package/dist/types/server-renderer/html.d.ts +2 -0
  80. package/dist/types/server-renderer/index.d.ts +166 -0
  81. package/dist/types/server-renderer/katex.d.ts +1 -0
  82. package/dist/types/server.d.ts +54 -0
  83. package/dist/types/tailwind-entry.d.ts +1 -0
  84. package/dist/types/tooltip/singletonTooltip.d.ts +7 -0
  85. package/dist/types/types/component-props.d.ts +208 -0
  86. package/dist/types/types/node-component.d.ts +12 -0
  87. package/dist/types/types.d.ts +82 -0
  88. package/dist/types/utils/languageIcon.d.ts +8 -0
  89. package/dist/types/utils/languageIconExtended.d.ts +1 -0
  90. package/dist/types/utils/performanceMonitor.d.ts +78 -0
  91. package/dist/types/utils/safeRaf.d.ts +2 -0
  92. package/dist/types/utils/streamingTextState.d.ts +23 -0
  93. package/dist/types/workers/katexRenderer.worker.d.ts +0 -0
  94. package/dist/types/workers/katexWorkerClient.d.ts +31 -0
  95. package/dist/types/workers/mermaidParser.worker.d.ts +1 -0
  96. package/dist/types/workers/mermaidWorkerClient.d.ts +14 -0
  97. package/package.json +11 -3
@@ -0,0 +1,209 @@
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,useContext as l,useRef as a,createContext as s,useEffect as c,useCallback as d,useSyncExternalStore as u,useLayoutEffect as m}from"react";import{getMarkdown as h,parseMarkdownToStructure as p}from"stream-markdown-parser";import{f,n as g,e as w,b as v,a as y,l as x,h as b,i as k,j as C,g as M,t as N,B}from"./languageIcon-BiAQ6aSb.js";import{createPortal as L}from"react-dom";import{autoUpdate as S,computePosition as E,offset as T,flip as D,shift as $}from"@floating-ui/dom";const P={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function W(n){const{node:r,ctx:l,renderNode:a,indexKey:s,isDark:c}=n,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__ */
2
+ return e("div",{className:`admonition admonition-${d}${c?" is-dark":""}`,"data-index-key":s,children:[
3
+ /* @__PURE__ */e("div",{id:p,className:"admonition-header",children:[P[d]&&/* @__PURE__ */t("span",{className:"admonition-icon",children:P[d]}),
4
+ /* @__PURE__ */t("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */t("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${p}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */t("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */t("div",{id:`${p}-content`,className:"admonition-content","aria-labelledby":p,children:l&&a?f(r.children,l,String(null!=s?s:p),a):null})]})}const A=s(null);function R(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document;let r=null,o=null;const i=/* @__PURE__ */new Map;return(l,a)=>{var s,c;const d={current:!1};let u,m=!1;const h=new Promise(e=>{u=()=>{m||(m=!0,e())}}),p=()=>{if(i.has(l)){i.delete(l);try{null==r||r.unobserve(l)}catch{}}if(!i.size){try{null==r||r.disconnect()}catch{}r=null,o=null}};if(!n||!t())return d.current=!0,u(),{isVisible:()=>!0,whenVisible:h,destroy:p};const f=((t,l)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const a=((t,n)=>{var r;return{root:null!=(r=e())?r:null,rootMargin:t,threshold:n}})(t,l);if(r&&(c=a,(s=o)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return r;var s,c;if(r)try{r.disconnect()}catch{}r=new IntersectionObserver(e=>{for(const t of e){const e=i.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){e.state.current=!0;try{e.resolve()}catch{}try{r.unobserve(t.target)}catch{}i.delete(t.target)}}},{root:a.root,rootMargin:a.rootMargin,threshold:a.threshold}),o=a;for(const e of i.keys())r.observe(e);return r})(null!=(s=null==a?void 0:a.rootMargin)?s:"300px",null!=(c=null==a?void 0:a.threshold)?c:0);return f?(i.set(l,{resolve:u,state:d}),f.observe(l),{isVisible:()=>d.current,whenVisible:h,destroy:p}):(d.current=!0,u(),{isVisible:()=>!0,whenVisible:h,destroy:p})}}const O=R(()=>null,()=>!0);function _({getRoot:e,enabled:n=!0,children:r}){const i=a(n);i.current=n;const l=a(e);l.current=e;const s=o(()=>R(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
5
+ return t(A.Provider,{value:s,children:r})}function j(){var e;return null!=(e=l(A))?e:O}function I(e){const{node:n}=e;/* @__PURE__ */
6
+ return t("span",{className:"checkbox-node",children:/* @__PURE__ */t("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const H={"common.copy":"Copy","common.copied":"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 F(e){Object.assign(H,e)}function z(){return{t:e=>{var t;return null!=(t=H[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 V=null,K=null,U=null,X=null,q=null,Y=null;function Z(){X&&(clearTimeout(X),X=null),q&&(clearTimeout(q),q=null)}async function G(e){if(!V||!K)return;const{x:t,y:n}=await E(K,V,{placement:e,middleware:[T(8),D(),$({padding:8})],strategy:"fixed"});V.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function J(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(V||"undefined"==typeof document||(V=document.createElement("div"),V.className="ms-tooltip",V.setAttribute("role","tooltip"),V.dataset.visible="false",V.style.position="fixed",V.style.left="0px",V.style.top="0px",V.style.transform="translate3d(0,0,0)",document.body.appendChild(V)),!V)return;Z();const l=async()=>{if(V){K=e,V.textContent=t,V.dataset.placement=n,V.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",V.dataset.visible="false",Y=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,V.id=Y;try{e.setAttribute("aria-describedby",Y)}catch{}await G(n),V.dataset.visible="true",null==U||U(),U=S(e,V,()=>{G(n)})}};r?l():X=setTimeout(l,80)}function Q(e=!1){if(!V)return;Z();const t=()=>{if(V){if(V.dataset.visible="false",K&&Y)try{K.removeAttribute("aria-describedby")}catch{}K=null,Y=null,U&&(U(),U=null)}};e?t():q=setTimeout(t,120)}function ee(n){const{t:r}=z(),i=o(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.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: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.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>`},[n.code,n.isDark]);return c(()=>{const e=e=>{var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[n]),"undefined"==typeof document?null:L(
7
+ /* @__PURE__ */t("div",{className:"html-preview-frame__backdrop"+(n.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var e;return null==(e=n.onClose)?void 0:e.call(n)},children:/* @__PURE__ */e("div",{className:"html-preview-frame"+(n.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
8
+ /* @__PURE__ */e("div",{className:"html-preview-frame__header",children:[
9
+ /* @__PURE__ */e("div",{className:"html-preview-frame__title",children:[
10
+ /* @__PURE__ */t("span",{className:"html-preview-frame__dot"}),
11
+ /* @__PURE__ */t("span",{className:"html-preview-frame__label",children:n.title||`HTML ${r("common.preview")}`})]}),
12
+ /* @__PURE__ */t("button",{type:"button",className:"html-preview-frame__close"+(n.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=n.onClose)?void 0:e.call(n)},children:"×"})]}),
13
+ /* @__PURE__ */t("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",src:"about:blank",srcDoc:i,title:n.title||"Preview"})]})}),document.body)}let te=!1,ne=null,re=!1;async function oe(){if(ne)return ne;if(re)return null;try{return ne=await import("stream-monaco"),await async function(e){if(te)return;te=!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()}(ne),ne}catch{return re=!0,null}}let ie=null,le=!1,ae=null,se=null,ce=null,de=null,ue=null;const me=/* @__PURE__ */new WeakMap;let he=0;function pe(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=me.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return me.set(e,t),t}catch{}const n="__theme_"+ ++he;return me.set(e,n),n}return String(e)}(e);return n?(ie!==t&&(ie=t),le||ue!==n?!ae||de!==n&&se!==n?(ce=e,de=n,ae||(le=!0,ae=(async()=>{for(;null!=ce&&null!=de;){const e=ce,t=de;if(ce=null,de=null,ue===t)continue;const n=ie;if(!n)break;try{se=t,await Promise.resolve(n(e)),ue=t}catch{}}})().finally(()=>{le=!1,ae=null,se=null}),ae)):ae:Promise.resolve()):Promise.resolve()}let fe=null,ge=null,we=null;const ve=/* @__PURE__ */new Set,ye=/* @__PURE__ */new WeakMap;let xe=0;function be(){for(const e of Array.from(ve))try{e()}catch{}}function ke({node:e}){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==e?void 0:e.language),[e]),i=r?`Code block: ${r}`:"Code block";/* @__PURE__ */
14
+ return t("pre",{className:`language-${r}`,"aria-busy":!0===(null==e?void 0:e.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */t("code",{translate:"no",children:String(null!=(n=null==e?void 0:e.code)?n:"")})})}const Ce={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Me=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Ne(e){var t;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const n=e;return{...Me,...n,enabled:null==(t=n.enabled)||t}}return{...Me}}function Be(e,t){var n;const r=t?{...t}:{};if(!e)return r;const o=void 0===r.diffHideUnchangedRegions?{...Me}:Ne(r.diffHideUnchangedRegions),i=void 0===r.hideUnchangedRegions?void 0:Ne(r.hideUnchangedRegions),l=null!=(n=r.diffUnchangedRegionStyle)?n:"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:12,lineNumbersMinChars:2,glyphMargin:!1,fontSize:13,lineHeight:30,renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,padding:{top:10,bottom:"line-info"===l||"line-info-basic"===l||"metadata"===l?22:14},diffHideUnchangedRegions:o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:l,diffHunkActionsOnHover:!0,diffHunkHoverHideDelayMs:160,...r,...void 0===i?{}:{hideUnchangedRegions:i},diffHideUnchangedRegions:o}}function Le(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Se(e){const t=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,r,o]=t.slice(0,3).map(Number);return.2126*n+.7152*r+.0722*o}function Ee(r){var l;const s={...Ce,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:f,enableFontSizeControl:b,darkTheme:k,lightTheme:C,monacoOptions:M,themes:N,minWidth:B,maxWidth:L,showHeader:S,showCopyButton:E,showExpandButton:T,showPreviewButton:D,showCollapseButton:$,showFontSizeButtons:P,showTooltips:W}=s,A=a(null),R=a(null),O=a(null),_=a(null),I=a(null),H=a(null),F=a(null),V=a(0),K=a(null),U=a(null),X=j(),q=a(M),Y=a(null),Z=a(null),[G,te]=i(!1),[ne,re]=i(()=>"undefined"==typeof window),[ie,le]=i(!1),[ae,se]=i(!1),[ce,de]=i(!1),[ue,me]=i(()=>u.language||"plaintext"),[he,ye]=i(()=>g(u.language)),[xe,Me]=i(!1),[Ne,Ee]=i(!1),[Te,De]=i(!1),[$e,Pe]=i(!1),[We,Ae]=i(0),{t:Re}=z(),Oe=o(()=>Be(Boolean(u.diff),M),[M,u.diff]),[_e,je]=i(()=>{var e;const t=Number(null==(e=Be(Boolean(u.diff),M))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:14}),[Ie,He]=i(_e),Fe=o(()=>!1!==W,[W]),ze=d(()=>{var e,t;const n=null!=(t=null==(e=q.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},[]),Ve=d(e=>{var t,n,r,o;if(G)return;const i=A.current,l=O.current;if(!i||!l)return;const a="diff"===H.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const s=ze();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(s)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===H.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,s);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[ze,G]);c(()=>w(()=>{Ae(e=>e+1)}),[]),c(()=>{ye(g(u.language))},[u.language]);const Ke=a(u);Ke.current=u;const Ue=d(()=>{var e;V.current+=1;try{null==(e=_.current)||e.call(_)}catch{}I.current=null,H.current=null,F.current=null,de(!1),se(!1)},[]),Xe=d(()=>{var e,t,n,r,o,i;const l=A.current,a=R.current;if(!l||!a)return;if(u.diff)return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");const s=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(s):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(),c=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();if(function(e,t,n,r){if(!n)return!1;const o=Se(e),i=Se(t);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(c,l,"plaintext"===v(String(u.language||he||ue||"plaintext")),a.classList.contains("is-dark")))return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");l&&a.style.setProperty("--vscode-editor-foreground",l),c&&a.style.setProperty("--vscode-editor-background",c),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[he,ue,u.diff,u.language]),qe=o(()=>m?k:C,[k,m,C]),Ye=d(()=>{var e;const t=null==Oe?void 0:Oe.theme,n=null!=(e=null!=qe?qe:t)?e:fe,r=Array.isArray(N)?N:[];if(!r.length||null==n)return n;const o=Le(n),i=r.map(e=>Le(e)).filter(e=>!!e);if(!o||i.includes(o))return n;const l=Le(t);return null!=t&&l&&i.includes(l)?t:r[0]},[qe,Oe,N]),Ze=o(()=>Ye(),[Ye]),Ge=o(()=>function(e,t){var n;const r=(null!=(n=Le(e))?n:"").toLowerCase();return r?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>r.includes(e))&&!["light","latte","dawn","lotus"].some(e=>r.includes(e)):t}(Ze,Boolean(m)),[m,Ze]),Je=o(()=>{if(!u.diff)return Ge?"dark":"light";const e=null==Oe?void 0:Oe.diffAppearance;return"light"===e||"dark"===e?e:m?"dark":"light"},[m,u.diff,Ge,Oe]),Qe=o(()=>u.diff?"dark"===Je:Ge,[Je,u.diff,Ge]),et=d(()=>({wordWrap:"on",wrappingIndent:"same",themes:N,...Oe||{},theme:Ze,...u.diff?{diffAppearance:Je}:{},onThemeChange(){Xe()}}),[Je,u.diff,Ze,Oe,Xe,N]),tt=d(()=>{const e=et(),t=Y.current;if(!t)return Y.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[et]),nt=o(()=>{var e,t,n,r,o,i,l;return JSON.stringify({diffLineStyle:null!=(e=null==Oe?void 0:Oe.diffLineStyle)?e:"background",diffUnchangedRegionStyle:null!=(t=null==Oe?void 0:Oe.diffUnchangedRegionStyle)?t:"line-info",diffHideUnchangedRegions:null==(n=null==Oe?void 0:Oe.diffHideUnchangedRegions)||n,renderSideBySide:null==(r=null==Oe?void 0:Oe.renderSideBySide)||r,enableSplitViewResizing:null==(o=null==Oe?void 0:Oe.enableSplitViewResizing)||o,ignoreTrimWhitespace:null==(i=null==Oe?void 0:Oe.ignoreTrimWhitespace)||i,originalEditable:null!=(l=null==Oe?void 0:Oe.originalEditable)&&l})},[Oe]);c(()=>{q.current=Oe,tt()},[Oe,tt]),c(()=>()=>{var e,t,n;V.current+=1,null==(e=_.current)||e.call(_),_.current=null,I.current=null,H.current=null,F.current=null,K.current=null,null==(n=null==(t=U.current)?void 0:t.destroy)||n.call(t),U.current=null},[]),c(()=>{var e,t;if("undefined"==typeof window)return;if(ne)return;const n=R.current;if(!n)return;null==(t=null==(e=U.current)?void 0:e.destroy)||t.call(e);const r=X(n,{rootMargin:"400px"});return U.current=r,r.isVisible()&&re(!0),r.whenVisible.then(()=>re(!0)),()=>{r.destroy(),U.current===r&&(U.current=null)}},[X,ne]),c(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:O.current?(tt(),()=>{e=!1}):((async()=>{try{const n=await oe();if(!e)return;if(!n)return void te(!0);const r=n.useMonaco,o=n.detectLanguage;if("function"==typeof o&&(K.current=o),"function"!=typeof r)return void te(!0);const i=r(tt());O.current=i,"function"==typeof(t=i.setTheme)&&(we=t,null!=fe&&null!=ge&&pe(fe,we).then(()=>be()).catch(()=>{})),_.current="function"==typeof i.safeClean?()=>i.safeClean():"function"==typeof i.cleanupEditor?()=>i.cleanupEditor():null,le(!0)}catch{e&&te(!0)}var t})(),()=>{e=!1})},[tt]),c(()=>{var e;if(!u.language&&!he&&K.current)try{const t=K.current(String(null!=(e=u.code)?e:""));t&&me(t)}catch{}},[he,u.code,u.language]);const rt=o(()=>String(u.language||he||ue||"plaintext"),[he,ue,u.language]),ot=o(()=>g(rt),[rt]),it=o(()=>v(ot),[ot]),lt=o(()=>"plaintext"===it,[it]),at=o(()=>y(ot),[ot,We]),st=o(()=>!!f&&("html"===ot||"svg"===ot),[ot,f]),ct=o(()=>{const e=ot;return e?x[e]||e.charAt(0).toUpperCase()+e.slice(1):x[""]||"Plain Text"},[ot]),dt=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]),ut=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(B),r=e(L);return n&&(t.minWidth=n),r&&(t.maxWidth=r),u.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color=`var(--vscode-editor-foreground, ${Qe?"#e5e7eb":"#111827"})`,t.backgroundColor=`var(--vscode-editor-background, ${Qe?"#111827":"#ffffff"})`,t.borderColor=Qe?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[L,B,u.diff,Qe]),mt=o(()=>{if(!u.diff)return{color:`var(--vscode-editor-foreground, ${Qe?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${Qe?"#111827":"#ffffff"})`}},[u.diff,Qe]),ht=!1===p&&h;c(()=>{if(G)return;if(!ie)return;if(!ae||!ne)return;const e=O.current;tt();const t=()=>{var t;u.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),Xe(),Te||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ve(Ne)):null)&&Ve(Ne)};(null==e?void 0:e.setTheme)&&Ze?pe(Ze,e.setTheme).then(t).catch(()=>{}):t()},[Ve,Te,ae,Je,Ne,ie,u.diff,Ze,Xe,tt,G,ne]),c(()=>{var e;if("undefined"!=typeof window)return e=()=>{Xe()},ve.add(e),()=>{ve.delete(e)}},[Xe]);const pt=d(async()=>{var e,t;if(G)return null;if(!ne)return null;if(Te)return null;if(ht)return null;const n=O.current,r=A.current;if(!n||!r||!n.createEditor)return null;tt();const o=Ke.current,i=o.diff?"diff":"single",l=F.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(H.current===i&&l===r&&a)return null;if(I.current)return I.current;V.current+=1;const s=V.current;se(!0);const c=(async()=>{var e,t,i,l,a,c,d,u,m,h;try{null==(e=_.current)||e.call(_),H.current=null,F.current=null,de(!1);const p=it;if(o.diff?"function"==typeof n.createDiffEditor?(H.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(H.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(H.current="single",await n.createEditor(r,String(null!=(c=o.code)?c:""),p)),F.current=r,V.current!==s)return;const f=Number(null==(d=q.current)?void 0:d.fontSize);if(Number.isFinite(f)&&f>0){je(f),He(f);try{const e="diff"===H.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:f,automaticLayout:!1})}catch{}}Xe(),Ne||Te||Ve(!1),de(!0)}catch{V.current===s&&te(!0)}})().finally(()=>{I.current===c&&(I.current=null)});return I.current=c,c},[Ve,Te,Ne,it,ht,Xe,tt,G,ne]);c(()=>{tt();const e=Z.current;if(Z.current=nt,!u.diff)return;if(G)return;if(!ie||!ne||!ae)return;if(Te||ht)return;if(e===nt)return;let t=!1;return(async()=>{if(Ue(),!t)try{await pt()}catch{}})(),()=>{t=!0}},[Te,ae,pt,ie,nt,u.diff,Ue,ht,tt,G,ne]),c(()=>{G||ie&&ne&&(Te||ht?Ue():pt())},[Te,pt,ie,Ue,ht,G,ne]),c(()=>{var e;if(G)return;if(!ie)return;if(!ne)return;if(Te)return;if(ht)return;const t=O.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=he;if(!o&&K.current)try{o=g(K.current(n)),o&&ye(o)}catch{}const i=v(o||ot);if(t.createEditor&&A.current){try{await Promise.resolve(pt())}catch{}const e=I.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{}Ne&&Ve(!0)})()},[Ve,ot,he,Te,ae,pt,Ne,ie,u.code,u.diff,u.originalCode,u.updatedCode,ht,G,ne]),c(()=>{if(G)return;if(!ie)return;if(!ne)return;if(Te)return;if(ht)return;if(!Ne&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ve(Ne)):null;return null==e&&Ve(Ne),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ve,Te,Ne,h,ie,ht,G,ne]),c(()=>{var e,t,n;if(!b)return;if(G)return;const r=O.current;if(r){try{const o="diff"===H.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:Ie})}catch{}Ve(Ne)}},[Ve,b,Ne,Ie,u.diff,G]),c(()=>{Fe||Q(!0)},[Fe]);const ft=d((e,t)=>{if(!Fe)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),J(n,t,"top",!1,0,Qe))},[Qe,Fe]),gt=d(()=>{Fe&&Q()},[Fe]),wt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(dt)),Me(!0),null==(e=s.onCopy)||e.call(s,String(dt)),setTimeout(()=>Me(!1),1e3)}catch{}},[s,dt]),vt=d(()=>{if(!st)return;const e="html"===ot?"text/html":"image/svg+xml",t="html"===ot?Re("artifacts.htmlPreviewTitle")||"HTML Preview":Re("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof s.onPreviewCode?"html"===ot&&Pe(e=>!e):s.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${ot}-${Date.now()}`})},[ot,st,u,s,Re]);return G?/* @__PURE__ */t(ke,{node:u}):/* @__PURE__ */e("div",{ref:R,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Qe?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",Qe?"is-dark":"",u.diff?"is-diff":"",lt?"is-plain-text":""].join(" "),style:ut,children:[S&&/* @__PURE__ */e("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:mt,children:[
15
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
16
+ /* @__PURE__ */t("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:at}}),
17
+ /* @__PURE__ */t("span",{className:"text-sm font-medium font-mono truncate",children:ct})]}),
18
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[$&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":Te,onClick:()=>De(e=>!e),onMouseEnter:e=>ft(e,Te?Re("common.expand")||"Expand":Re("common.collapse")||"Collapse"),onFocus:e=>ft(e,Te?Re("common.expand")||"Expand":Re("common.collapse")||"Collapse"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("svg",{style:{rotate:Te?"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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),P&&b&&/* @__PURE__ */e(n,{children:[
19
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ie<=10,onClick:()=>He(e=>Math.max(10,e-1)),onMouseEnter:e=>ft(e,Re("common.decrease")||"Decrease"),onFocus:e=>ft(e,Re("common.decrease")||"Decrease"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
20
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ie===_e,onClick:()=>He(_e),onMouseEnter:e=>ft(e,Re("common.reset")||"Reset"),onFocus:e=>ft(e,Re("common.reset")||"Reset"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
21
+ /* @__PURE__ */t("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
22
+ /* @__PURE__ */t("path",{d:"M3 3v5h5"})]})})}),
23
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ie>=36,onClick:()=>He(e=>Math.min(36,e+1)),onMouseEnter:e=>ft(e,Re("common.increase")||"Increase"),onFocus:e=>ft(e,Re("common.increase")||"Increase"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),E&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":xe?Re("common.copied")||"Copied":Re("common.copy")||"Copy",onClick:wt,onMouseEnter:e=>ft(e,xe?Re("common.copied")||"Copied":Re("common.copy")||"Copy"),onFocus:e=>ft(e,xe?Re("common.copied")||"Copied":Re("common.copy")||"Copy"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("svg",xe?{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__ */t("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__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
24
+ /* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
25
+ /* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),T&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":Ne,onClick:e=>{Ee(e=>!e),ft(e,Ne?Re("common.expand")||"Expand":Re("common.collapse")||"Collapse")},onMouseEnter:e=>ft(e,Ne?Re("common.collapse")||"Collapse":Re("common.expand")||"Expand"),onFocus:e=>ft(e,Ne?Re("common.collapse")||"Collapse":Re("common.expand")||"Expand"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("svg",Ne?{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__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})}),st&&D&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Re("common.preview")||"Preview",onClick:vt,onMouseEnter:e=>ft(e,Re("common.preview")||"Preview"),onFocus:e=>ft(e,Re("common.preview")||"Preview"),onMouseLeave:gt,onBlur:gt,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */e("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
26
+ /* @__PURE__ */t("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"}),
27
+ /* @__PURE__ */t("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"})]})})})]})]}),
28
+ /* @__PURE__ */e("div",{className:`code-block-body${Te?" code-block-body--collapsed":""}${Ne?" code-block-body--expanded":""}`,children:[!Te&&(!!p||!h)&&(G?/* @__PURE__ */t(ke,{node:u}):/* @__PURE__ */e("div",{className:"code-editor-layer",children:[
29
+ /* @__PURE__ */t("div",{ref:A,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:ce?"visible":"hidden"},"aria-hidden":!ce}),!ce&&/* @__PURE__ */t("div",{className:"code-editor-fallback-surface",children:/* @__PURE__ */t("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${ct}`,tabIndex:0,children:/* @__PURE__ */t("code",{translate:"no",children:String(dt)})})})]})),!p&&h&&/* @__PURE__ */t("div",{className:"code-loading-placeholder",children:/* @__PURE__ */e("div",{className:"loading-skeleton",children:[
30
+ /* @__PURE__ */t("div",{className:"skeleton-line"}),
31
+ /* @__PURE__ */t("div",{className:"skeleton-line"}),
32
+ /* @__PURE__ */t("div",{className:"skeleton-line short"})]})})]}),$e&&!s.onPreviewCode&&st&&"html"===ot&&/* @__PURE__ */t(ee,{code:String(null!=(l=u.code)?l:""),isDark:m,onClose:()=>Pe(!1)}),
33
+ /* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:xe?Re("common.copied")||"Copied":""})]})}function Te(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=Te(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function De(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Te(e))&&(r&&(r+=" "),r+=t);return r}const $e=()=>import("@terrastruct/d2");let Pe=null,We=$e;function Ae(e){We=e,Pe=null}function Re(e){Ae(null!=e?e:$e)}function Oe(){Ae(null)}function _e(){return"function"==typeof We}async function je(){if(Pe)return Pe;const e=We;if(!e)return null;let t;try{t=await e()}catch(n){if(e===$e)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Pe=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),Pe):null}const Ie={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},He={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"},Fe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],ze=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Ve(e){if(!e)return"";const t=e.trim();return ze.test(t)?t:""}function Ke(r){var l,s;const u={...Ie,...r},{t:m}=z(),[h,p]=i(!1),[f,g]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[b,k]=i(null),[C,M]=i(""),[N,B]=i(null),[L,S]=i(!1),E=a(0),T=a(null),D=a(!1),$=a(!1),P=a(0),W=a(null),A=a(!1),R=a(null),O=a(null),_=a(!1),j=a(()=>{}),I=null!=(s=null==(l=u.node)?void 0:l.code)?s:"",H=w||!y||!C,F=!!C,V=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),K=o(()=>{if(H&&N)return{minHeight:`${N}px`}},[N,H]);c(()=>{_.current=L},[L]);const U=d(()=>{const e=R.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(_.current)return void(A.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-P.current;if(!e&&n<t)return A.current=!0,void(null==W.current&&(W.current=window.setTimeout(()=>{W.current=null,A.current&&(A.current=!1,X(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,P.current=Date.now(),j.current()};"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 je();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)},[]),Y=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 k(null);const i=++E.current;S(!0),k(null);try{const l=await q();if(!l)return x(!1),v(!0),M(""),void k("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!==E.current)return;const s=null!=(e=null==a?void 0:a.diagram)?e:a,c=null!=(n=null!=(t=null==a?void 0:a.renderOptions)?t:null==a?void 0:a.options)?n:{},d=null!=(r=u.themeId)?r:c.themeID,m=null!=(o=u.darkThemeId)?o:c.darkThemeID,h={...c};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=c.themeOverrides&&"object"==typeof c.themeOverrides?c.themeOverrides:null;h.themeOverrides={...He,...e||{}}}const p=await l.render(s,h);if(i!==E.current)return;const f=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(p);if(!f)throw new Error("D2 render returned empty output.");const g=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(Fe.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Ve(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.classList.add("markstream-d2-root-svg"),r.outerHTML}(f);M(g||""),u.loading&&v(!1),k(null)}catch(l){if(i!==E.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||k(e),e.includes("@terrastruct/d2")&&(x(!1),v(!0))}finally{i===E.current&&(S(!1),A.current&&(A.current=!1,X()))}},[I,q,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,X]);c(()=>{j.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(I),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[I]),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]),ee=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&J(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),te=d(()=>{Q()},[]);return c(()=>{X()},[I,u.loading,u.isDark,X]),c(()=>{u.loading||X(!0)},[u.loading,X]),c(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[H,C,I,U]),c(()=>{X();const e=requestAnimationFrame(()=>U());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{U()});O.current=e,R.current&&e.observe(R.current)}return()=>{var t;$.current=!0,null!=W.current&&(clearTimeout(W.current),W.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[X,U]),/* @__PURE__ */e("div",{className:De("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__ */e("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:[
34
+ /* @__PURE__ */t("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */t("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
35
+ /* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */e("div",{className:De("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
36
+ /* @__PURE__ */t("button",{type:"button",className:De("mode-btn px-2 py-1 text-xs rounded",!w&&"is-active"),onClick:()=>v(!1),onMouseEnter:e=>ee(e,m("common.preview")||"Preview"),onFocus:e=>ee(e,m("common.preview")||"Preview"),onMouseLeave:te,onBlur:te,children:m("common.preview")||"Preview"}),
37
+ /* @__PURE__ */t("button",{type:"button",className:De("mode-btn px-2 py-1 text-xs rounded",w&&"is-active"),onClick:()=>v(!0),onMouseEnter:e=>ee(e,m("common.source")||"Source"),onFocus:e=>ee(e,m("common.source")||"Source"),onMouseLeave:te,onBlur:te,children:m("common.source")||"Source"})]}),u.showCopyButton&&/* @__PURE__ */t("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=>ee(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onFocus:e=>ee(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onMouseLeave:te,onBlur:te,children:/* @__PURE__ */t("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__ */t("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__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
38
+ /* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
39
+ /* @__PURE__ */t("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__ */t("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=>ee(e,m("common.export")||"Export"),onFocus:e=>ee(e,m("common.export")||"Export"),onMouseLeave:te,onBlur:te,children:/* @__PURE__ */t("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__ */t("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__ */t("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":f,onClick:()=>g(e=>!e),onMouseEnter:e=>ee(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>ee(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:te,onBlur:te,children:/* @__PURE__ */t("svg",{style:{transform:`rotate(${f?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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})})]})]}),!f&&/* @__PURE__ */t("div",{ref:R,className:"d2-block-body",style:K,children:u.loading&&!F?/* @__PURE__ */e("div",{className:"d2-source px-4 py-4",children:[
40
+ /* @__PURE__ */t("pre",{className:"d2-code",children:/* @__PURE__ */t("code",{children:I})}),b&&/* @__PURE__ */t("p",{className:"d2-error mt-2 text-xs",children:b})]}):/* @__PURE__ */t(n,{children:/* @__PURE__ */e("div",H?{className:"d2-source px-4 py-4",children:[
41
+ /* @__PURE__ */t("pre",{className:"d2-code",children:/* @__PURE__ */t("code",{children:I})}),b&&/* @__PURE__ */t("p",{className:"d2-error mt-2 text-xs",children:b})]}:{className:"d2-render",style:V,children:[
42
+ /* @__PURE__ */t("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),b&&/* @__PURE__ */t("p",{className:"d2-error px-4 pb-3 text-xs",children:b})]})})})]})}function Ue(n){const{node:r,ctx:o,renderNode:i,indexKey:l}=n,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
43
+ return t("dl",{className:"definition-list","data-index-key":l,children:a.map((n,r)=>/* @__PURE__ */e("div",{className:"mb-4",children:[
44
+ /* @__PURE__ */t("dt",{className:"definition-term font-semibold",children:o&&i?b(n.term,o,`${String(null!=l?l:"definition")}-term-${r}`,i):null}),
45
+ /* @__PURE__ */t("dd",{className:"definition-desc ml-4",children:o&&i?b(n.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function Xe(e){var n;const{node:r}=e;/* @__PURE__ */
46
+ return t("span",{className:"emoji-node",children:null!=(n=r.name)?n:r.markup})}function qe(e){/* @__PURE__ */
47
+ return t("em",{className:"emphasis-node",children:e.children})}function Ye(e){const{node:n}=e,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__ */
48
+ return t("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 Ze(e){const{node:n,ctx:r,renderNode:o,indexKey:i}=e;/* @__PURE__ */
49
+ return t("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__ */t("div",{className:"flex-1",children:r&&o?f(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function Ge(n){const{node:r}=n,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__ */
50
+ return t("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:l,children:/* @__PURE__ */e("a",{href:i,title:`View footnote ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function Je(e){/* @__PURE__ */
51
+ return t("br",{className:"hard-break"})}function Qe(e){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=e,a=Math.min(6,Math.max(1,Number(n.level)||1)),s=`h${a}`,c=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=c?c:{};/* @__PURE__ */
52
+ return t(s,{dir:"auto",className:De("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?f(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function et(e){/* @__PURE__ */
53
+ return t("mark",{className:"highlight-node",children:e.children})}const tt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),nt=/* @__PURE__ */new Set(["script"]),rt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function ot(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 it=/* @__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"]),lt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function at(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function st(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=at(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 ct(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();tt.has(e)||rt.has(e)&&r&&ot(r)||(t[n]=r)}return t}function dt(e,t){const n=e.toLowerCase();return!it.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function ut(l){const{node:s,placeholder:d,customId:m}=l,h=j(),[p,f]=i(null),g=a(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(s.content),b=Boolean(s.loading),B=u(k,C,C),L=o(()=>{var e;return null!=(e=l.customComponents)?e:M(m)},[m,l.customComponents,B]);c(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=g.current)||e.destroy(),g.current=null,!b)return v(!0),void x(s.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return g.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),g.current=null}},[p,b,s.content,h]),c(()=>()=>{var e;null==(e=g.current)||e.destroy(),g.current=null},[]),c(()=>{b&&!w||x(s.content)},[b,s.content,w]);const S=o(()=>{var e;return N(null!=(e=s.attrs)?e:void 0)},[s.attrs]),E=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(dt(r[1],t))return!0;return!1}(null!=(e=s.content)?e:"",L)},[L,s.content]),T=o(()=>E&&s.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 s=e.slice(l+1,a).trim(),c=s.startsWith("/"),d=s.endsWith("/");if(c)o.push({type:"tag_close",tagName:s.slice(1).trim()});else{const e=s.indexOf(" ");let i,l="";-1===e?i=d?s.slice(0,-1).trim():s.trim():(i=s.slice(0,e).trim(),l=s.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||lt.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(nt.has(e.tagName.toLowerCase()))continue;const n=ct(e.attrs||{}),a=n.key,s=null!=a&&""!==a?a:"ms-html-"+o++,c=dt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;c?(i.length>0?i[i.length-1].children:l).push(r.createElement(c,{...n,key:s})):(i.length>0?i[i.length-1].children:l).push(r.createElement(e.tagName,{...st(n),key:s,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:nt.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=ct(e.attrs||{}),a=n.key,s=null!=a&&""!==a?a:"ms-html-"+o++,c=dt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=c?r.createElement(c,{...n,key:s},...e.children):r.createElement(e.tagName,{...st(n),key:s,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=ct(e.attrs||{}),a=n.key,s=null!=a&&""!==a?a:"ms-html-"+o++,c=dt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=c?r.createElement(c,{...n,key:s},...e.children):r.createElement(e.tagName,{...st(n),key:s,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(s.content,L):null,[L,s.content,E]);/* @__PURE__ */
54
+ return t("div",{ref:f,className:"html-block-node",...S,children:w?E&&T?/* @__PURE__ */t(n,{children:T}):/* @__PURE__ */t("div",{dangerouslySetInnerHTML:{__html:null!=y?y:""}}):/* @__PURE__ */t("div",{className:"html-block-node__placeholder",children:null!=d?d:/* @__PURE__ */e(n,{children:[
55
+ /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar"}),
56
+ /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-4/5"}),
57
+ /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const mt=/* @__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"]),ht=/* @__PURE__ */new Set(["script"]),pt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),ft=(()=>{try{return Boolean(!1)}catch{}return!1})();function gt(e){ft&&console.warn(e)}function wt(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 vt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yt=/* @__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 xt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function bt(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=xt(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 kt(e,t){const n=e.toLowerCase();return!yt.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function Ct(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 Mt(e){return e.trim().length>0}function Nt(e,t,n,o,i){if(ht.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();mt.has(e)||pt.has(e)&&r&&wt(r)||(t[n]=r)}return t}(t),a=l.key,s=null!=a&&""!==a?a:i;if(kt(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Ct(r,n);return t}(l);return r.createElement(t,{...i,key:s},...n)}return r.createElement(e,{...bt(l),key:s},...n)}function Bt(e){const{node:n,customId:o}=e,l=a(null),[s,d]=i(!1);c(()=>{d(!0)},[]);const u=M(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(kt(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=Nt(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=Nt(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&&gt(`Auto-closing unclosed tag: <${i.tagName}>`)}else gt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=Nt(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),gt(`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);Mt(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);Mt(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 s=e.slice(l+1,a).trim(),c=s.startsWith("/"),d=s.endsWith("/");if(c){const e=s.slice(1).trim();o.push({type:"tag_close",tagName:e})}else{const e=s.indexOf(" ");let i,l="";-1===e?i=d?s.slice(0,-1).trim():s.trim():(i=s.slice(0,e).trim(),l=s.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||vt.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,ft&&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 c(()=>{var e;if(!s||!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,s]),n.loading&&!n.autoClosed?/* @__PURE__ */t("span",{className:"html-inline-node html-inline-node--loading",children:n.content}):"dynamic"===m.mode?/* @__PURE__ */t("span",{className:"html-inline-node",style:{display:"inline"},children:m.nodes}):/* @__PURE__ */t("span",{ref:l,className:"html-inline-node",style:{display:"inline"}})}const Lt={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function St(r){var l,s,d,u,m,h;const p={...Lt,...r},f=j(),[g,w]=i(null),v=a(null),[y,x]=i(()=>"undefined"==typeof window||!1===p.lazy),[b,k]=i(!1),[C,M]=i(!1),[N,B]=i(!1);c(()=>{var e;if(!p.lazy)return;const t=g;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=f(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[g,f,p.lazy]),c(()=>()=>{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]);c(()=>{k(!1),M(!1)},[L]),c(()=>{B(!1)},[p.node.src]);const S=o(()=>/\.svg(?:\?|$)/i.test(String(L)),[L]),E=!p.lazy||y,T=S?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
58
+ return e("figure",{ref:w,className:"image-node",children:[
59
+ /* @__PURE__ */t("div",{className:"image-node__inner",children:p.node.loading||C||!E?C?/* @__PURE__ */e("div",{className:"image-node__error",children:[
60
+ /* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */t("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"})}),
61
+ /* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]}):/* @__PURE__ */t("div",{className:"image-node__placeholder",style:T,children:p.usePlaceholder?/* @__PURE__ */e(n,{children:[
62
+ /* @__PURE__ */t("span",{className:"image-node__spinner","aria-hidden":"true"}),
63
+ /* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:null!=(h=p.node.raw)?h:"Loading image…"})},"placeholder"):/* @__PURE__ */t("img",{src:L,alt:String(null!=(s=null!=(l=p.node.alt)?l:p.node.title)?s:""),title:String(null!=(u=null!=(d=p.node.title)?d:p.node.alt)?u:""),className:"image-node__img"+(b?" is-loaded":""),style:S?{minHeight:p.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:p.lazy?"lazy":"eager",decoding:"async",tabIndex:b?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;k(!0),M(!1),null==(e=p.onLoad)||e.call(p,L)},onClick:e=>{var t;e.preventDefault(),b&&!C&&(null==(t=p.onClick)||t.call(p,[e,L]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */t("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let Et=null,Tt=null;const Dt=/* @__PURE__ */t("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__ */e("g",{children:[
64
+ /* @__PURE__ */t("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"}),
65
+ /* @__PURE__ */t("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"}),
66
+ /* @__PURE__ */t("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"}),
67
+ /* @__PURE__ */t("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"}),
68
+ /* @__PURE__ */t("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"})]})}),$t={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Pt(r){const o={...$t,...r},{t:l}=z(),[s,u]=i(!1),[m,h]=i(!1),[p,f]=i(!1),[g,w]=i("360px"),[v,y]=i(!1),[x,b]=i(1),[k,C]=i({x:0,y:0}),[M,N]=i(!1),B=a(null),S=a(null),E=a(null),T=a({x:0,y:0}),D=a(null),$=o.node.code,P=d(e=>{if(!o.maxHeight||"none"===o.maxHeight)return`${e}px`;const t=Number.parseFloat(String(o.maxHeight));return Number.isFinite(t)?`${Math.min(e,t)}px`:`${e}px`},[o.maxHeight]),W=d(()=>{const e=B.current;if(!e)return;const t=e.scrollHeight;t>0&&w(P(t))},[P]),A=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]),R=d(async()=>{var e,t;if(!B.current)return;const n=B.current;try{const r=await async function(){return Tt||Et||(Et=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),Tt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Et)}();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(()=>{W()},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>`}},[$,W]);c(()=>{p||m||R()},[$,p,m,R]),c(()=>()=>{var e,t;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const O=d(()=>{y(!1),S.current&&(S.current.innerHTML=""),E.current=null,document.body.style.overflow=""},[]),_=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);c(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&O()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,O]),c(()=>{v&&setTimeout(()=>{if(B.current&&S.current){S.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=B.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),S.current.appendChild(e),E.current=e,e.style.transform=`translate(${k.x}px, ${k.y}px) scale(${x})`}},0)},[v]),c(()=>{v&&E.current&&(E.current.style.transform=`translate(${k.x}px, ${k.y}px) scale(${x})`)},[v,k,x]);const j=d(()=>{var e;const t=null==(e=B.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)},[]),I=e=>{N(!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-k.x,y:n-k.y}},H=e=>{if(!M)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;C({x:t-T.current.x,y:n-T.current.y})},F=()=>N(!1),V=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",K=p||m;/* @__PURE__ */
69
+ return e(n,{children:[
70
+ /* @__PURE__ */e("div",{className:De("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__ */e("div",{className:De("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:[
71
+ /* @__PURE__ */e("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Dt,
72
+ /* @__PURE__ */t("span",{className:De("text-sm font-medium font-mono truncate",o.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),o.showModeToggle&&/* @__PURE__ */e("div",{className:De("flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"),children:[
73
+ /* @__PURE__ */t("button",{className:De("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:()=>f(!1),onMouseEnter:e=>J(e.currentTarget,l("common.preview")||"Preview","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
74
+ /* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
75
+ /* @__PURE__ */t("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"}),
76
+ /* @__PURE__ */t("circle",{cx:"12",cy:"12",r:"3"})]})}),
77
+ /* @__PURE__ */t("span",{children:l("common.preview")||"Preview"})]})}),
78
+ /* @__PURE__ */t("button",{className:De("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:()=>f(!0),onMouseEnter:e=>J(e.currentTarget,l("common.source")||"Source","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
79
+ /* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
80
+ /* @__PURE__ */t("span",{children:l("common.source")||"Source"})]})})]}),
81
+ /* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */t("button",{className:V,onClick:()=>h(!m),onMouseEnter:e=>J(e.currentTarget,m?l("common.expand")||"Expand":l("common.collapse")||"Collapse","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),o.showCopyButton&&/* @__PURE__ */t("button",{className:V,onClick:A,onMouseEnter:e=>J(e.currentTarget,s?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */t("svg",s?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("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__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
82
+ /* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
83
+ /* @__PURE__ */t("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__ */t("button",{className:De(V,K&&"opacity-50 cursor-not-allowed"),disabled:K,onClick:j,onMouseEnter:e=>J(e.currentTarget,l("common.export")||"Export","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
84
+ /* @__PURE__ */t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
85
+ /* @__PURE__ */t("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */t("button",{className:De(V,K&&"opacity-50 cursor-not-allowed"),disabled:K,onClick:_,onMouseEnter:e=>J(e.currentTarget,v?l("common.minimize")||"Minimize":l("common.open")||"Open","top",!1,0,o.isDark),onMouseLeave:()=>Q(),children:/* @__PURE__ */t("svg",v?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!m&&/* @__PURE__ */t("div",{children:p?/* @__PURE__ */t("div",{className:De("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */t("pre",{className:De("text-sm font-mono whitespace-pre-wrap",o.isDark?"text-gray-300":"text-gray-700"),children:$})}):/* @__PURE__ */e("div",{className:"relative",children:[o.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
86
+ /* @__PURE__ */t("button",{className:De("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(x+.1,3)),children:"+"}),
87
+ /* @__PURE__ */t("button",{className:De("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(x-.1,.5)),children:"-"}),
88
+ /* @__PURE__ */e("button",{className:De("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),C({x:0,y:0})},children:[Math.round(100*x),"%"]})]})}),
89
+ /* @__PURE__ */t("div",{className:De("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:g},onMouseDown:I,onMouseMove:H,onMouseUp:F,onMouseLeave:F,onTouchStart:I,onTouchMove:H,onTouchEnd:F,children:/* @__PURE__ */t("div",{className:De("absolute inset-0 cursor-grab",M&&"cursor-grabbing"),style:{transform:`translate(${k.x}px, ${k.y}px) scale(${x})`},children:/* @__PURE__ */t("div",{ref:B,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&L(
90
+ /* @__PURE__ */t("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:O,role:"dialog","aria-modal":"true",children:/* @__PURE__ */e("div",{className:De("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:[
91
+ /* @__PURE__ */e("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
92
+ /* @__PURE__ */t("button",{className:De("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(x+.1,3)),children:"+"}),
93
+ /* @__PURE__ */t("button",{className:De("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(x-.1,.5)),children:"-"}),
94
+ /* @__PURE__ */e("button",{className:De("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),C({x:0,y:0})},children:[Math.round(100*x),"%"]}),
95
+ /* @__PURE__ */t("button",{className:De("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:O,children:"X"})]}),
96
+ /* @__PURE__ */t("div",{ref:S,className:De("w-full h-full flex items-center justify-center p-4 overflow-hidden",!M&&"cursor-grab",M&&"cursor-grabbing"),onMouseDown:I,onMouseMove:H,onMouseUp:F,onMouseLeave:F,onTouchStart:I,onTouchMove:H,onTouchEnd:F})]})}),document.body)]})}function Wt({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:r,streamRenderVersionChanged:o=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return r?n.streamedDelta&&i===e?o?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:function({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}({nextContent:e,previousContent:null!=t?t:i,typewriterEnabled:r}):{settledContent:e,streamedDelta:"",appended:!1}}function At(r){var o,l;const{node:s,children:d,ctx:u,indexKey:m,typewriter:h}=r,p=String(null!=(o=s.code)?o:""),f=null==(l=null!=h?h:null==u?void 0:u.typewriter)||l,g=null==m||""===m?"":String(m),[w,v]=i(p),[y,x]=i(""),[b,k]=i(0),C=a({settledContent:p,streamedDelta:""}),M=(e,t)=>{C.current={settledContent:e,streamedDelta:t},v(e),x(t)};return c(()=>{if(null!=d)return void M("","");const e=null==u?void 0:u.textStreamState,t=C.current,n=g?null==e?void 0:e.get(g):void 0,r=Wt({nextContent:p,persistedContent:n,currentState:t,typewriterEnabled:f});M(r.settledContent,r.streamedDelta),r.appended&&k(e=>e+1),g&&(null==e||e.set(g,p))},[d,p,null==u?void 0:u.textStreamState,g,f]),/* @__PURE__ */t("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:d||/* @__PURE__ */e(n,{children:[w?/* @__PURE__ */t("span",{children:w}):null,y?/* @__PURE__ */t("span",{className:De("text-node-stream-delta",b%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>{C.current.streamedDelta&&M((()=>{const{settledContent:e,streamedDelta:t}=C.current;return e+t})(),"")},children:y}):null]})})}function Rt(e){/* @__PURE__ */
97
+ return t("ins",{className:"insert-node",children:e.children})}function Ot(n){var r,o;const{node:l,children:s,ctx:d,indexKey:u,typewriter:m}=n,h=String(null!=(r=l.content)?r:""),p=null==(o=null!=m?m:null==d?void 0:d.typewriter)||o,f=null==u||""===u?"":String(u),[g,w]=i(h),[v,y]=i(""),[x,b]=i(0),k=a(null==d?void 0:d.streamRenderVersion),C=a({settledContent:h,streamedDelta:""}),M=(e,t)=>{C.current={settledContent:e,streamedDelta:t},w(e),y(t)};return c(()=>{const e=null==d?void 0:d.streamRenderVersion,t=e!==k.current;if(null!=s)return M("",""),void(k.current=e);const n=null==d?void 0:d.textStreamState,r=C.current,o=f?null==n?void 0:n.get(f):void 0,i=Wt({nextContent:h,persistedContent:o,currentState:r,typewriterEnabled:p,streamRenderVersionChanged:t});M(i.settledContent,i.streamedDelta),i.appended&&b(e=>e+1),f&&(null==n||n.set(f,h)),k.current=e},[s,h,null==d?void 0:d.textStreamState,null==d?void 0:d.streamRenderVersion,f,p]),null!=s?/* @__PURE__ */t("span",{className:De("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:s}):/* @__PURE__ */e("span",{className:De("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:[g?/* @__PURE__ */t("span",{children:g}):null,v?/* @__PURE__ */t("span",{className:De("text-node-stream-delta",x%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>{C.current.streamedDelta&&M((()=>{const{settledContent:e,streamedDelta:t}=C.current;return e+t})(),"")},children:v}):null]})}function _t(n){var r,i,l,a;const{node:s,ctx:c,renderNode:u,indexKey:m}=n,h=!1!==n.showTooltip,p=null!=(r=n.isDark)?r:null==c?void 0:c.isDark,g=o(()=>{var e,t,r,o,i,l;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",s=null!=(e=n.animationOpacity)?e:.35,c=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(r=n.underlineHeight)?r:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(c),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(i=n.animationTiming)?i:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(l=n.animationIteration)?l:"infinite"}},[n.animationDuration,n.animationIteration,n.animationOpacity,n.animationTiming,n.color,n.underlineBottom,n.underlineHeight]),w="string"==typeof s.title&&s.title.trim().length>0?s.title:String(null!=(i=s.href)?i:""),v=d(e=>{h&&J(e.currentTarget,String(s.title||s.href||s.text||""),"top",!1,(e.clientX,e.clientY),p)},[p,s.href,s.text,s.title,h]),y=d(()=>{h&&Q()},[h]);return s.loading?/* @__PURE__ */t("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:g,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
98
+ /* @__PURE__ */t("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */t(Ot,{node:{type:"text",content:String(null!=(l=s.text)?l:"")},ctx:c,indexKey:`${String(null!=m?m:"link")}-loading`,typewriter:n.typewriter})}),
99
+ /* @__PURE__ */t("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */t("a",{className:"link-node",href:s.href,title:h?"":w,"aria-label":`Link: ${w}`,target:"_blank",rel:"noopener noreferrer",style:g,onMouseEnter:v,onMouseLeave:y,children:c&&u?f(s.children,c,String(null!=m?m:"link"),u):/* @__PURE__ */t(Ot,{node:{type:"text",content:String(null!=(a=s.text)?a:"")},ctx:c,indexKey:`${String(null!=m?m:"link")}-fallback`,typewriter:n.typewriter})})}function jt(e){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=e;/* @__PURE__ */
100
+ return t("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?f(n.children,r,String(null!=l?l:"list-item"),o):null})}function It(e){var n;const{node:r,ctx:o,renderNode:i,indexKey:l}=e,a=r.ordered?"ol":"ul",s=r.ordered&&r.start?r.start:void 0,c=o&&M(o.customId).list_item||jt;/* @__PURE__ */
101
+ return t(a,{className:De("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:s,children:null==(n=r.items)?void 0:n.map((e,n)=>{var a;/* @__PURE__ */
102
+ return t(c,{node:e,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 Ht=null,Ft=null,zt=!1;const Vt=/* @__PURE__ */new Map,Kt=/* @__PURE__ */new Map;let Ut=5;const Xt=/* @__PURE__ */new Set;function qt(){if(Vt.size<Ut&&Xt.size){const e=Array.from(Xt);Xt.clear();for(const t of e)try{t()}catch{}}}function Yt(e){Ht=e,Ft=null,Ht.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Vt.get(t);if(o)if(Vt.delete(t),clearTimeout(o.timeoutId),qt(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(Kt.set(e,n),Kt.size>200){const e=Kt.keys().next().value;Kt.delete(e)}}o.resolve(n)}},Ht.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Vt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Vt.clear(),qt()}}function Zt(){var e;Ht&&(null==(e=Ht.terminate)||e.call(Ht)),Ht=null,Ft=null}function Gt(e){zt=!!e,Ht&&Ht.postMessage({type:"init",debug:zt})}const Jt="WORKER_BUSY";async function Qt(e,t=!0,n=2e3,r){if(performance.now(),Ft)return Promise.reject(Ft);const o=`${t?"d":"i"}:${e}`,i=Kt.get(o);if(i)return Promise.resolve(i);const l=Ht||(Ft=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Ft.name="WORKER_INIT_ERROR",Ft.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Ft);if(Vt.size>=Ut){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Jt,e.busy=!0,e.inFlight=Vt.size,e.max=Ut,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),s=setTimeout(()=>{Vt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),qt()},n),c=()=>{},d=()=>{Vt.delete(a),clearTimeout(s),Xt.delete(c);const e=new Error("Aborted");e.name="AbortError",i(e),qt()};r&&r.addEventListener("abort",d,{once:!0}),Vt.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:s});try{l.postMessage({id:a,content:e,displayMode:t,debug:zt})}catch(u){Vt.delete(a),clearTimeout(s),r&&r.removeEventListener("abort",d),i(u),qt()}})}function en(e,t,n){const r=`${t?"d":"i"}:${e}`;if(Kt.set(r,n),Kt.size>200){const e=Kt.keys().next().value;Kt.delete(e)}}function tn(){Kt.clear()}function nn(e){Ut=Math.max(1,Math.floor(e)),qt()}function rn(e=1500,t){return Vt.size<Ut?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(){Xt.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}),Xt.add(l)})}const on={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function ln(e){null!=e.timeout&&(on.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(on.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(on.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(on.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function an(){return{...on}}async function sn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:on.timeout,s=null!=(o=n.waitTimeout)?o:on.waitTimeout,c=null!=(i=n.backoffMs)?i:on.backoffMs,d=null!=(l=n.maxRetries)?l:on.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):on.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 Qt(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==Jt||h>=u)throw p;if(h++,await rn(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}c>0&&await new Promise(e=>setTimeout(e,c*h))}}}let cn=null,dn=!1;async function un(){if(cn)return cn;if(dn)return null;try{return cn=await import("katex"),await import("katex/contrib/mhchem"),cn}catch{return dn=!0,null}}function mn({node:e}){const n=a(null),[r,o]=i(!0),l=a(0);return c(()=>{var t;let r=!1;const i=new AbortController,a=++l.current,s=null!=(t=e.content)?t:"";return s?(sn(s,!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 t=>{if(r||a!==l.current)return;if(!n.current)return;const i=(null==t?void 0:t.code)||(null==t?void 0:t.name);if("WORKER_INIT_ERROR"===i||(null==t?void 0:t.fallbackToRenderer)||i===Jt||"WORKER_TIMEOUT"===i){const t=await un();if(t)try{const i=t.renderToString(s,{throwOnError:e.loading,displayMode:!0});return void(!r&&a===l.current&&n.current&&(n.current.innerHTML=i,o(!1),en(s,!0,i)))}catch{}}e.loading||(n.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[e.content,e.loading,e.raw]),/* @__PURE__ */t("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */t("div",{ref:n,className:r?"math-rendering":void 0})})}function hn({node:n}){const r=a(null),o=a(null),[l,s]=i(!0),d=a(0);return c(()=>{var e;let t=!1;const r=new AbortController,i=++d.current,l=null!=(e=n.content)?e:"";if(!l)return s(!1),()=>r.abort();const a="$$"===n.markup;return sn(l,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{t||i!==d.current||o.current&&(o.current.innerHTML=e,s(!1))}).catch(async e=>{if(t||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===Jt||"WORKER_TIMEOUT"===r){const e=await un();if(e)try{const r=e.renderToString(l,{throwOnError:n.loading,displayMode:a});return void(!t&&i===d.current&&o.current&&(o.current.innerHTML=r,s(!1),en(l,a,r)))}catch{}}n.loading||(o.current.textContent=n.raw,s(!1))}),()=>{t=!0,r.abort()}},[n.content,n.loading,n.raw,n.markup]),/* @__PURE__ */e("span",{ref:r,className:"math-inline-wrapper",children:[
103
+ /* @__PURE__ */t("span",{ref:o,className:"math-inline"+(l?" math-inline--hidden":"")}),l&&/* @__PURE__ */e("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
104
+ /* @__PURE__ */t("span",{className:"math-inline__spinner","aria-hidden":"true"}),
105
+ /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function pn(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let fn=null,gn=null;const wn=/* @__PURE__ */new Map;let vn=5,yn=!1;function xn(e){yn=!!e}function bn(e){Number.isFinite(e)&&e>0&&(vn=Math.floor(e))}function kn(){return{inFlight:wn.size,max:vn}}const Cn="WORKER_BUSY";function Mn(e){fn=e,gn=null;const t=e;fn.onmessage=e=>{if(fn!==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))},fn.onerror=e=>{var n,r;if(fn===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)},fn.onmessageerror=e=>{var n,r;if(fn===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(fn)try{for(const[e,t]of wn.entries())t.reject(new Error("Worker cleared"));wn.clear(),null==(e=fn.terminate)||e.call(fn)}catch{}fn=null,gn=null}function Bn(e,t,n=1400){if(gn)return Promise.reject(gn);const r=fn||(gn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),gn.name="WORKER_INIT_ERROR",gn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(gn);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,s=null;const c=()=>{a||(a=!0,null!=s&&clearTimeout(s),wn.delete(l))},d={resolve:e=>{c(),o(e)},reject:e=>{c(),i(e)}};wn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return wn.delete(l),void i(u)}s=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 Sn(e,t,n=2400){return Bn("findPrefix",{code:e,theme:t},n)}function En(){var e;null==(e=null==fn?void 0:fn.terminate)||e.call(fn),fn=null,gn=null,wn.clear()}let Tn=null,Dn=!1,$n=null,Pn=null;function Wn(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:c,Rn={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],_n=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function jn(e){if(!e)return"";const t=e.trim();return _n.test(t)?t:""}function In(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"";In(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=jn(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(In(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,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function zn(r){var l,s,u,h,p,f,g,w,v,x;const b={...Fn,...r},{t:k}=z(),C=o(()=>y("mermaid"),[]),M=null!=(s=null==(l=b.node)?void 0:l.code)?s:"",N=o(()=>M.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[M]),B=null!=(u=b.workerTimeoutMs)?u:Fn.workerTimeoutMs,S=null!=(h=b.parseTimeoutMs)?h:Fn.parseTimeoutMs,E=null!=(p=b.renderTimeoutMs)?p:Fn.renderTimeoutMs,T=null!=(f=b.fullRenderTimeoutMs)?f:Fn.fullRenderTimeoutMs,D=Math.max(0,null!=(g=b.renderDebounceMs)?g:Fn.renderDebounceMs),[$,P]=i(!1),[W,A]=i(!1),[R,O]=i(!1),[_,I]=i(!1),[H,F]=i(1),[V,K]=i({x:0,y:0}),[U,X]=i(!1),[q,Y]=i(!1),[Z,G]=i(!1),[ee,te]=i(null),[ne,re]=i(!1),[oe,ie]=i("360px"),[le,ae]=i("undefined"==typeof window),se=a(null),ce=a(null),de=a(null),ue=a(null),me=a(null),he=a(null),pe=a(null),fe=a({x:0,y:0}),ge=a(0),we=a({}),ve=a(""),ye=a(!1),xe=a(null),be=a(!1),ke=a({zoom:1,translateX:0,translateY:0,containerHeight:oe||"360px"}),Ce=j(),Me=Boolean(null!=(v=null==(w=b.node)?void 0:w.loading)?v:b.loading),Ne=b.isDark?"dark":"light",Be=Boolean(b.isStrict),Le=o(()=>Be?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Rn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Be]);c(()=>{be.current=Z},[Z]),c(()=>{we.current={}},[Ne,N,Be]),c(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Tn)return Wn(Tn,e),Tn;if(Pn){const t=await Pn;return t&&Wn(t,e),t}if(Dn)return null;try{Dn=!0,Pn=(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 Wn(Tn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),Tn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Pn=null}})();const t=await Pn;return t&&Wn(t,e),t}catch{return null}}(Le);e||(se.current=t,P(Boolean(t)),ye.current||A(!t))})(),()=>{e=!0}},[Le]),c(()=>{const e=ce.current;if(!e)return;const t=Ce(e,{rootMargin:"400px"});return xe.current=t,t.isVisible()&&ae(!0),t.whenVisible.then(()=>ae(!0)),()=>{t.destroy(),xe.current=null}},[Ce]),c(()=>{if("undefined"==typeof document)return;if(!ne)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[ne]);const Se=d(()=>{if(!b.maxHeight||"none"===b.maxHeight)return null;const e=Number.parseFloat(String(b.maxHeight));return Number.isFinite(e)?e:null},[b.maxHeight]),Ee=d(e=>{const t=ce.current,n=ue.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),s=Number.isFinite(a)&&a>0?a:i,c=Se(),d=null==c?s:Math.min(s,c);ie(`${d}px`)},[Se]);c(()=>{if(!ce.current||"undefined"==typeof ResizeObserver)return;if(W||R)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;pn(()=>Ee(t))});return e.observe(ce.current),()=>e.disconnect()},[R,W,Ee]),c(()=>{W||R||Ee()},[R,b.maxHeight,W,Ee]),c(()=>()=>{En()},[]),m(()=>{!W&&ue.current&&we.current[Ne]&&(Hn(ue.current,we.current[Ne],Be),pn(()=>Ee()))},[W,Be,Ne,Ee]);const Te=d(async(e,t,n)=>{var r;if(!se.current||!ue.current)return!1;Y(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Kn(e,t),l=await Xn(()=>se.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Hn(ue.current,l.svg,Be);return null==(r=l.bindFunctions)||r.call(l,ue.current),Ee(),we.current[t]=a,G(!0),te(null),!0}catch(o){if(!Me){if("function"==typeof b.onRenderError&&ue.current&&!0===b.onRenderError(o,N,ue.current))return!1;te(o instanceof Error?o.message:String(o))}return!1}finally{Y(!1)}},[T,Me,Be,Ee]),$e=d(async(e,t,n)=>{var r;if(se.current&&ue.current){Y(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Kn(Un(e)||e,t),l=await Xn(()=>se.current.render(o,i),{timeoutMs:E,signal:n});(null==l?void 0:l.svg)&&(Hn(ue.current,l.svg,Be),null==(r=l.bindFunctions)||r.call(l,ue.current),Ee())}catch{}finally{Y(!1)}}},[E,Me,Be,Ee]),Pe=d(async(e,t)=>{if(!e.trim())return In(ue.current),G(!1),void(ve.current="");const n=e.replace(/\s+/g,"");if(n===ve.current&&be.current)return;const r=++ge.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 Xn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Xn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ne,{workerTimeout:B,parseTimeout:S,mermaid:se.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;return void(await Te(e,Ne,t)&&(ve.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 Sn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Un(e)}(e,Ne,{workerTimeout:B,signal:t});if(!n||(null==t?void 0:t.aborted)||ge.current!==r)return;await $e(n,Ne,t)}catch{}},[S,Te,$e,Ne,B]),We=d(()=>le&&!W&&!R,[R,W,le]);c(()=>{if(!We())return;if(!se.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&We()&&Pe(N,e.signal)},D);return()=>{e.abort(),window.clearTimeout(t)}},[N,We,$,Pe,D]);const Ae=d((e,t)=>{e.clientX,e.clientY,J(e.currentTarget,t,"top",!1,0,b.isDark)},[b.isDark]),Re=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),I(!0),null==(t=b.onCopy)||t.call(b,N),setTimeout(()=>I(!1),1e3)}catch{}},[N,b]),Oe=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=qn(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=b.onExport)||n.call(b,i),i.defaultPrevented||function(e,t){const n=null!=t?t:qn(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)},[b]),_e=d(()=>{pe.current=null,In(he.current)},[]),je=d(()=>{re(!1),_e()},[_e]),Ie=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null,o=r?qn(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=b.onOpenModal)||n.call(b,i),i.defaultPrevented||re(!0)},[b]);c(()=>{if(!ne)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,ne]),An(()=>{if(!ne)return;const e=he.current,t=ce.current;if(!e||!t)return;const n=`translate(${V.x}px, ${V.y}px) scale(${H})`,r=t.cloneNode(!0);r.classList.add("fullscreen"),r.style.height="100%",r.style.maxHeight="100%";const o=r.querySelector("[data-mermaid-wrapper]");o&&(pe.current=o,o.style.transform=n),In(e),e.appendChild(r)},[ne]),c(()=>{ne&&pe.current&&(pe.current.style.transform=`translate(${V.x}px, ${V.y}px) scale(${H})`)},[ne,V.x,V.y,H]);const He=W||q||R,Fe=o(()=>b.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",[b.isDark]),ze=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=b.onToggleMode)||t.call(b,e,n),!n.defaultPrevented)if(ye.current=!0,"preview"===e){A(!1);const e=ke.current;F(e.zoom),K({x:e.translateX,y:e.translateY}),ie(e.containerHeight)}else ke.current={zoom:H,translateX:V.x,translateY:V.y,containerHeight:oe},A(!0)},[N,oe,Pe,b,Ne,V.x,V.y,Ee,H]),Ve=d(e=>{if(!1===b.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=ce.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-V.x,o=e.clientY-n.top-V.y,i=.01*-e.deltaY,l=Vn(H+i,.5,3);if(l===H)return;const a=l/H;K({x:V.x-r*(a-1),y:V.y-o*(a-1)}),F(l)},[V,H]),Ke=d((e,t)=>{X(!0),fe.current={x:e-V.x,y:t-V.y}},[V.x,V.y]),Ue=d((e,t)=>{U&&K({x:e-fe.current.x,y:t-fe.current.y})},[U]),Xe=d(()=>{X(!1)},[]),qe=/* @__PURE__ */e("div",{className:"relative",children:[b.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
106
+ /* @__PURE__ */t("button",{type:"button",className:De("p-2 text-xs rounded transition-colors",b.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ae(e,k("common.zoomIn")),onMouseLeave:()=>Q(),onClick:()=>F(Vn(H+.1,.5,3)),children:"+"}),
107
+ /* @__PURE__ */t("button",{type:"button",className:De("p-2 text-xs rounded transition-colors",b.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ae(e,k("common.zoomOut")),onMouseLeave:()=>Q(),onClick:()=>F(Vn(H-.1,.5,3)),children:"−"}),
108
+ /* @__PURE__ */e("button",{type:"button",className:De("p-2 text-xs rounded transition-colors",b.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ae(e,k("common.resetZoom")),onMouseLeave:()=>Q(),onClick:()=>{F(1),K({x:0,y:0})},children:[Math.round(100*H),"%"]})]})}),
109
+ /* @__PURE__ */e("div",{ref:ce,className:De("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",b.isDark?"bg-gray-900":"bg-gray-50"),style:{height:oe,maxHeight:null!=(x=b.maxHeight)?x:void 0},onWheel:Ve,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Ke(e.clientX,e.clientY))},onMouseMove:e=>Ue(e.clientX,e.clientY),onMouseUp:Xe,onMouseLeave:Xe,onTouchStart:e=>{const t=e.touches[0];t&&Ke(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Ue(t.clientX,t.clientY)},onTouchEnd:Xe,children:[
110
+ /* @__PURE__ */t("div",{ref:de,"data-mermaid-wrapper":!0,className:De("absolute inset-0 cursor-grab",{"cursor-grabbing":U}),style:{transform:`translate(${V.x}px, ${V.y}px) scale(${H})`},children:/* @__PURE__ */t("div",{ref:ue,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(q||Me)&&/* @__PURE__ */e("div",{className:"mermaid-loading",children:[
111
+ /* @__PURE__ */t("span",{className:"mermaid-spinner"}),
112
+ /* @__PURE__ */t("span",{children:"Rendering diagram…"})]})]})]}),Ye=b.showHeader&&/* @__PURE__ */e("div",{className:De("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",b.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
113
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
114
+ /* @__PURE__ */t("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:C}}),
115
+ /* @__PURE__ */t("span",{className:De("text-sm font-medium font-mono truncate",b.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),b.showModeToggle&&$&&/* @__PURE__ */e("div",{className:De("flex items-center space-x-1 rounded-md p-0.5",b.isDark?"bg-gray-700":"bg-gray-100"),children:[
116
+ /* @__PURE__ */t("button",{type:"button",className:De("px-2.5 py-1 text-xs rounded transition-colors",W?b.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":b.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>ze("preview"),onMouseEnter:e=>Ae(e,k("common.preview")),onFocus:e=>Ae(e,k("common.preview")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[
117
+ /* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
118
+ /* @__PURE__ */t("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"}),
119
+ /* @__PURE__ */t("circle",{cx:"12",cy:"12",r:"3"})]})}),
120
+ /* @__PURE__ */t("span",{children:k("common.preview")})]})}),
121
+ /* @__PURE__ */t("button",{type:"button",className:De("px-2.5 py-1 text-xs rounded transition-colors",W?b.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":b.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>ze("source"),onMouseEnter:e=>Ae(e,k("common.source")),onFocus:e=>Ae(e,k("common.source")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[
122
+ /* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
123
+ /* @__PURE__ */t("span",{children:k("common.source")})]})})]}),
124
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[b.showCollapseButton&&/* @__PURE__ */t("button",{type:"button",className:Fe,"aria-pressed":R,onClick:()=>O(e=>!e),onMouseEnter:e=>Ae(e,k(R?"common.expand":"common.collapse")),onFocus:e=>Ae(e,k(R?"common.expand":"common.collapse")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */t("svg",{style:{rotate:R?"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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),b.showCopyButton&&/* @__PURE__ */t("button",{type:"button",className:Fe,onClick:Re,onMouseEnter:e=>Ae(e,k(_?"common.copied":"common.copy")),onFocus:e=>Ae(e,k(_?"common.copied":"common.copy")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */t("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__ */t("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__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
125
+ /* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
126
+ /* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),b.showExportButton&&$&&/* @__PURE__ */t("button",{type:"button",className:De(Fe,He?"opacity-50 cursor-not-allowed":""),disabled:He,onClick:Oe,onMouseEnter:e=>Ae(e,k("common.export")),onFocus:e=>Ae(e,k("common.export")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
127
+ /* @__PURE__ */t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
128
+ /* @__PURE__ */t("path",{d:"m7 10l5 5l5-5"})]})})}),b.showFullscreenButton&&$&&/* @__PURE__ */t("button",{type:"button",className:De(Fe,He?"opacity-50 cursor-not-allowed":""),disabled:He,onClick:ne?je:Ie,onMouseEnter:e=>Ae(e,k(ne?"common.minimize":"common.open")),onFocus:e=>Ae(e,k(ne?"common.minimize":"common.open")),onMouseLeave:()=>Q(),onBlur:()=>Q(),children:/* @__PURE__ */t("svg",ne?{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__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),Ze=/* @__PURE__ */e("div",{children:[W?/* @__PURE__ */t("div",{className:De("p-4",b.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */t("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:N})}):qe,ee&&/* @__PURE__ */t("div",{className:"mermaid-error",children:ee})]});/* @__PURE__ */
129
+ return e(n,{children:[
130
+ /* @__PURE__ */e("div",{className:De("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",b.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Me}),children:[Ye,
131
+ /* @__PURE__ */t("div",{ref:me,style:{display:R?"none":""},children:Ze})]}),ne&&"undefined"!=typeof document&&L(
132
+ /* @__PURE__ */t("div",{className:"mermaid-modal-overlay",onClick:()=>je(),children:/* @__PURE__ */e("div",{className:De("mermaid-modal-panel",{"is-dark":b.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
133
+ /* @__PURE__ */e("div",{className:"mermaid-modal-header",children:[
134
+ /* @__PURE__ */t("span",{className:"mermaid-modal-title",children:`Mermaid ${k("common.preview")}`}),
135
+ /* @__PURE__ */t("button",{type:"button",className:"mermaid-modal-close",onClick:je,children:k("common.close")})]}),
136
+ /* @__PURE__ */t("div",{className:"mermaid-modal-body",children:/* @__PURE__ */t("div",{ref:he,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 Un(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 Xn(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,s(),o(new DOMException("Aborted","AbortError")))}function s(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,s(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,s(),t(e))}).catch(e=>{i||(i=!0,s(),o(e))})})}function qn(e){return(new XMLSerializer).serializeToString(e)}function Yn(t){const{node:n}=t;/* @__PURE__ */
137
+ return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==n?void 0:n.type)]})}function Zn(e){var o;const{node:i,ctx:l,renderNode:a,indexKey:s,children:c}=e;if(!l||!a)/* @__PURE__ */
138
+ return t("p",{dir:"auto",className:"paragraph-node",children:c});const d=null!=(o=i.children)?o:[],u=[],m=[],h=()=>{if(!m.length)return;const e=u.length;u.push(
139
+ /* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:f(m.slice(),l,`${String(null!=s?s:"paragraph")}-${e}`,a)},`${String(null!=s?s:"paragraph")}-inline-${e}`)),m.length=0};return d.forEach((e,n)=>{B.has(e.type)?(h(),u.push(
140
+ /* @__PURE__ */t(r.Fragment,{children:a(e,`${String(null!=s?s:"paragraph")}-block-${n}`,l)},`${String(null!=s?s:"paragraph")}-block-${n}`))):m.push(e)}),h(),u.length?/* @__PURE__ */t(n,{children:u}):/* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:f(d,l,String(null!=s?s:"paragraph"),a)})}function Gn(e){const{node:n}=e,r=d(t=>{var r;null==(r=e.onClick)||r.call(e,t,n.id,e.messageId,e.threadId)},[n.id,e]);/* @__PURE__ */
141
+ return t("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:t=>{var r;null==(r=e.onMouseEnter)||r.call(e,t,n.id,e.messageId,e.threadId)},onMouseLeave:t=>{var r;null==(r=e.onMouseLeave)||r.call(e,t,n.id,e.messageId,e.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function Jn(e){/* @__PURE__ */
142
+ return t("s",{className:"strikethrough-node",children:e.children})}function Qn(e){/* @__PURE__ */
143
+ return t("strong",{className:"strong-node",children:e.children})}function er(e){/* @__PURE__ */
144
+ return t("sub",{className:"subscript-node",children:e.children})}function tr(e){/* @__PURE__ */
145
+ return t("sup",{className:"superscript-node",children:e.children})}function nr(n){var r;const{node:o,ctx:i,renderNode:l,indexKey:a}=n,s=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],c=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__ */
146
+ return e("div",{className:"table-node-wrapper","data-index-key":a,children:[
147
+ /* @__PURE__ */e("table",{className:De("my-8 text-sm table-node",c&&"table-node--loading"),"aria-busy":c,children:[
148
+ /* @__PURE__ */t("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */t("tr",{className:"border-b",children:s.map((e,n)=>/* @__PURE__ */t("th",{className:De("font-semibold p-[calc(4/7*1em)]",u(e.align)),dir:"auto",children:i&&l?b(e.children,i,`${String(null!=a?a:"table")}-th-${n}`,l):null},`header-${n}`))})}),
149
+ /* @__PURE__ */t("tbody",{children:d.map((e,n)=>{var r;/* @__PURE__ */
150
+ return t("tr",{className:De("border-[var(--table-border,#cbd5e1)]",n<d.length-1&&"border-b"),children:null==(r=e.cells)?void 0:r.map((e,r)=>/* @__PURE__ */t("td",{className:De("p-[calc(4/7*1em)]",u(e.align)),dir:"auto",children:i&&l?b(e.children,i,`${String(null!=a?a:"table")}-row-${n}-${r}`,l):null},`cell-${n}-${r}`))},`row-${n}`)})})]}),c&&/* @__PURE__ */e("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
151
+ /* @__PURE__ */t("span",{className:"table-node__spinner","aria-hidden":"true"}),
152
+ /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function rr(){/* @__PURE__ */
153
+ return t("hr",{className:"hr-node thematic-break"})}function or(e){const{node:n,ctx:i,renderNode:l,indexKey:a}=e,s=`vmr-container vmr-container-${n.name}`,c=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?N(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
154
+ return t("div",{className:s,...c,children:i&&l&&Array.isArray(n.children)?n.children.map((e,n)=>/* @__PURE__ */t(r.Fragment,{children:l(e,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function ir(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 lr(e,n,o){var i,l,a;const s=null!=(i=o.customComponents)?i:M(o.customId),c=s[e.type];if(c)return r.createElement(c,{key:n,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter});if("html_block"===e.type||"html_inline"===e.type){const t=String(null!=(l=e.tag)?l:"").trim().toLowerCase()||function(e){const t=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return t?t[1].toLowerCase():""}(e.content),i=t?s[t]:null;if(i){const l={...e,type:t,tag:t,content:ir(e.content,t)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter})}}switch(e.type){case"text":/* @__PURE__ */
155
+ return t(Ot,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
156
+ return t(Ot,{node:{type:"text",content:null!=(a=e.content)?a:"",center:e.center},ctx:o,indexKey:n,typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
157
+ return t(Zn,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
158
+ return t(Qe,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
159
+ return t(hr,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
160
+ return t(It,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
161
+ return t(jt,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
162
+ return t(nr,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
163
+ return t(Ue,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
164
+ return t(Ze,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
165
+ return t(Ge,{node:e},n);case"footnote_anchor":/* @__PURE__ */
166
+ return t(Ye,{node:e},n);case"admonition":/* @__PURE__ */
167
+ return t(W,{node:e,ctx:o,renderNode:lr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
168
+ return t(Je,{node:e,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
169
+ return t(_t,{node:e,ctx:o,renderNode:lr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
170
+ return t(St,{node:e},n);case"inline_code":/* @__PURE__ */
171
+ return t(At,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter},n);case"code_block":return function(e,n,o,i){var l,a,s,c;const d=g(String(e.language||""));if("mermaid"===d){const l=i.mermaid;if(l)return r.createElement(l,{key:n,node:e,isDark:o.isDark,...o.mermaidProps||{}});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
172
+ return t(zn,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.mermaidProps||{}},n)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:n,node:e,isDark:o.isDark,...o.infographicProps||{}}):/* @__PURE__ */t(Pt,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.infographicProps||{}},n)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:n,node:e,isDark:o.isDark,...o.d2Props||{}}):/* @__PURE__ */t(Ke,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.d2Props||{}},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */t(ke,{node:e},n):/* @__PURE__ */t(Ee,{node:e,loading:Boolean(e.loading),stream:o.codeBlockStream,monacoOptions:null==(l=o.codeBlockThemes)?void 0:l.monacoOptions,themes:null==(a=o.codeBlockThemes)?void 0:a.themes,minWidth:null==(s=o.codeBlockThemes)?void 0:s.minWidth,maxWidth:null==(c=o.codeBlockThemes)?void 0:c.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(e,n,o,s);case"strong":/* @__PURE__ */
173
+ return t(Qn,{node:e,children:f(e.children,o,`${String(n)}-strong`,lr)},n);case"emphasis":/* @__PURE__ */
174
+ return t(qe,{node:e,children:f(e.children,o,`${String(n)}-em`,lr)},n);case"strikethrough":/* @__PURE__ */
175
+ return t(Jn,{node:e,children:f(e.children,o,`${String(n)}-strike`,lr)},n);case"highlight":/* @__PURE__ */
176
+ return t(et,{node:e,children:f(e.children,o,`${String(n)}-highlight`,lr)},n);case"insert":/* @__PURE__ */
177
+ return t(Rt,{node:e,children:f(e.children,o,`${String(n)}-insert`,lr)},n);case"subscript":/* @__PURE__ */
178
+ return t(er,{node:e,children:f(e.children,o,`${String(n)}-sub`,lr)},n);case"superscript":/* @__PURE__ */
179
+ return t(tr,{node:e,children:f(e.children,o,`${String(n)}-sup`,lr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
180
+ return t(I,{node:e,typewriter:o.typewriter},n);case"emoji":/* @__PURE__ */
181
+ return t(Xe,{node:e,typewriter:o.typewriter},n);case"thematic_break":/* @__PURE__ */
182
+ return t(rr,{},n);case"math_inline":/* @__PURE__ */
183
+ return t(hn,{node:e},n);case"math_block":/* @__PURE__ */
184
+ return t(mn,{node:e},n);case"reference":/* @__PURE__ */
185
+ return t(Gn,{node:e,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===e.type?/* @__PURE__ */t(ut,{node:e,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */t(Bt,{node:e,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
186
+ return t(or,{node:e,ctx:o,renderNode:lr,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
187
+ return t(Yn,{node:e},n)}}const ar={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 cr(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 dr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const ur=r.memo(({props:n,parsedNodes:r,renderCtx:l,indexPrefix:s,containerRef:u})=>{var m,h,p,f,g,w,v;const y=j(),x="undefined"!=typeof window,b="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,k=Math.max(0,Math.trunc(null!=(m=n.renderBatchSize)?m:80)),C=Math.max(0,Math.trunc(null!=(h=n.initialRenderBatchSize)?h:k||r.length)),M=!1!==n.batchRendering&&k>0&&x,N=Math.max(0,null!=(p=n.liveNodeBuffer)?p:60),B=Math.max(1,null!=(f=n.maxLiveNodes)?f:320),L=(null!=(g=n.maxLiveNodes)?g:0)>0&&r.length>B,S=!1!==n.viewportPriority,E=M&&(null!=(w=n.maxLiveNodes)?w:0)<=0,T=o(()=>{var e;return!1!==n.deferNodesUntilVisible&&!((null!=(e=n.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&S},[r.length,n.deferNodesUntilVisible,n.maxLiveNodes,S,L]),[D,$]=i(()=>E?Math.min(r.length,C):r.length),P=a(D);c(()=>{P.current=D},[D]);const W=E?D:r.length,[A,R]=i(0),[O,_]=i({start:0,end:r.length}),I=a(/* @__PURE__ */new Map),[H,F]=i(0),z=a({}),V=a(/* @__PURE__ */new Map),K=a(/* @__PURE__ */new Map),U=a(/* @__PURE__ */new Map),X=a(/* @__PURE__ */new Map),q=a(/* @__PURE__ */new Set),Y=a(D),Z=a(null),G=a(null),J=a(null),Q=a(!1),ee=a(null),te=a(Math.max(1,k||1)),ne=a(r.length),re=a({key:n.indexKey,total:r.length}),oe=a({batchSize:k,initial:C,delay:null!=(v=n.renderBatchDelay)?v:16,enabled:E}),ie=T||L,le=o(()=>{const e=I.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[H]),ae=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(O.start,e)),n=Math.max(t,Math.min(O.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,O,L]),se=o(()=>{if(!L)return r.length;const e=Math.max(O.end+N,C),t=Math.min(r.length,e);return Math.max(D,t)},[r.length,L,O.end,N,C,D]);ne.current=se;const ce=d((e,t)=>{var n;if(e>=t)return 0;const r=I.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:le;return o},[le]),de=L?ce(0,Math.min(O.start,r.length)):0,ue=L?ce(Math.min(O.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 t;if(!E)return;const r=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),o=Math.max(1,k||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,n.renderBatchBudgetMs,k]),pe=d((e,t={})=>{var r,o;if(!E)return;const i=ne.current;if(P.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 P.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();he(n-t)},s=()=>{const e=Math.max(1,Math.round(te.current));pe(e)},c=e=>{var t;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),P.current>=ne.current)return;if(!e)return void s();const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6);for(;P.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));P.current<ne.current&&s()};if(!x||t.immediate)return void c();const d=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(ee.current=null!=ee.current?Math.max(ee.current,l):l,!Q.current){if(Q.current=!0,b){const e=Math.max(0,null!=(o=n.renderBatchIdleTimeoutMs)?o:120);return void(J.current=window.requestIdleCallback(e=>c(e),{timeout:e}))}"function"==typeof requestAnimationFrame?Z.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>c(),d):c()}):G.current=window.setTimeout(()=>c(),d)}},[he,b,E,x,n.renderBatchDelay,n.renderBatchBudgetMs,n.renderBatchIdleTimeoutMs]);c(()=>{var e;const t=n.indexKey,o=r.length,i=re.current,l=void 0!==t?t!==i.key:o!==i.total;re.current={key:t,total:o};const a=oe.current,s=null!=(e=n.renderBatchDelay)?e:16,c=a.batchSize!==k||a.initial!==C||a.delay!==s||a.enabled!==E;if(oe.current={batchSize:k,initial:C,delay:s,enabled:E},(l||c||!E)&&me(),(l||c)&&(te.current=Math.max(1,k||1),q.current.clear()),!o)return P.current=0,void $(0);const d=ne.current;if(!E)return P.current=d,void $(d);if(l||c){const e=Math.min(d,C);return P.current=e,$(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(P.current,d);u!==P.current&&(P.current=u,$(u)),P.current<d&&pe(Math.max(1,k||1))},[me,E,x,r.length,n.indexKey,n.renderBatchDelay,k,C,pe]),c(()=>{if(!L)return void _({start:0,end:r.length});const e=r.length;if(!e)return void _({start:0,end:0});const t=Math.max(0,Math.min(A,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))}_({start:n,end:o})},[A,N,B,r.length,L]),c(()=>()=>{me();for(const e of V.current.values())e.destroy();V.current.clear()},[me]);const fe=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),U.current.delete(t),X.current.delete(t))},[]);c(()=>{fe(W)},[fe,W]),c(()=>{const e=r.length;let t=!1;for(const n of Array.from(I.current.keys()))n>=e&&(I.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(q.current))n>=e&&q.current.delete(n)},[r.length]);const ge=d((e,t)=>{T&&t&&(z.current[e]=!0),t&&L&&R(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&&ge(e,!0));if(e<C&&!L)return we(e),void ge(e,!0);we(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ge(e,!0),r.whenVisible.then(()=>ge(e,!0)).catch(()=>{})},[T,we,ge,y,C,ie,L]),ye=d(e=>{const t=U.current.get(e);if(t)return t;const n=t=>ve(e,t);return U.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(I.current.has(e)&&(I.current.delete(e),F(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&I.current.get(e)!==n&&(I.current.set(e,n),F(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),be=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>xe(e,t);return X.current.set(e,n),n},[xe]),ke=d(e=>!(E&&e>=P.current)&&(!T||e<C||!0===z.current[e]),[T,E,C]),Ce=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);c(()=>{for(const[e,t]of K.current.entries())t&&ve(e,t)},[ve]),c(()=>{L&&D>Y.current&&R(D-1),Y.current=D},[D,L]);const Me=L?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${de}px`},"aria-hidden":"true"}):null,Ne=L?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
188
+ return e("div",{ref:u,className:`markstream-react markdown-renderer${n.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":n.customId,onClick:n.onClick,onMouseOver:Ce(n.onMouseOver),onMouseOut:Ce(n.onMouseOut),children:[Me,ae.map(({node:e,index:r})=>{var o;const i=ke(r),a=null!=(o=I.current.get(r))?o:le,c=!1!==n.typewriter&&"code_block"!==e.type&&!q.current.has(r)&&i;return c&&q.current.add(r),/* @__PURE__ */t("div",{ref:ye(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */t("div",i?{ref:be(r),className:"node-content"+(c?" typewriter-node":""),children:lr(e,`${s}-${r}`,l)}:{className:"node-placeholder",style:{height:`${a}px`}})},`${s}-${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}),mr=e=>{var n,r;const i={...ar,...e},l=a(null),s=a(null),d=a(/* @__PURE__ */new Map),m=a(null),f=a(0);(null==(n=m.current)?void 0:n.content)===i.content&&(null==(r=m.current)?void 0:r.nodes)===i.nodes||(f.current+=1,m.current={content:i.content,nodes:i.nodes});const w=u(k,C,C),v=o(()=>M(i.customId),[i.customId,w]),y=o(()=>i.customId?`renderer-${i.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[i.customId]),x=o(()=>Object.keys(v).map(String).map(e=>e.trim().toLowerCase()).filter(dr),[v]),b=o(()=>{var e,t,n;const r=null!=(t=(null!=(e=i.parseOptions)?e:{}).customHtmlTags)?t:[],o=[...null!=(n=i.customHtmlTags)?n:[],...Array.isArray(r)?r:[],...x].map(cr).filter(Boolean);return Array.from(new Set(o))},[i.customId,i.customHtmlTags,i.parseOptions,x,w]),N=o(()=>{const e=b;return e&&0!==e.length?h(y,{customHtmlTags:e}):h(y)},[y,b]),B=o(()=>{const e=N;return i.customMarkdownIt?i.customMarkdownIt(e):e},[N,i.customMarkdownIt]),L=o(()=>{var e,t;const n=null!=(e=i.parseOptions)?e:{},r=null!=(t=i.final)?t:n.final,o=null!=r,l=b.length>0;return o||l?{...n,...o?{final:r}:{},...l?{customHtmlTags:b}:{}}:n},[b,i.final,i.parseOptions]),S=o(()=>{var e,t;const n=Boolean(i.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,r=n?performance.now():0;let o=[];return Array.isArray(i.nodes)&&i.nodes.length?o=i.nodes.map(e=>({...e})):i.content&&(o=p(i.content,null!=B?B:sr,L)),n&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-r),nodes:o.length,contentLength:null!=(t=null==(e=i.content)?void 0:e.length)?t:0}),o},[i.content,i.debugPerformance,i.nodes,L,B,i.customId,w,b]);c(()=>{var e,t;if("undefined"==typeof window)return;if(i.renderCodeBlocksAsPre)return;if(!S.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==g(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const n=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)},r=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),o=n(()=>{oe()},{timeout:900});return()=>r(o)},[S,i.renderCodeBlocksAsPre]),c(()=>{if("undefined"==typeof window)return;if(i.renderCodeBlocksAsPre)return;const e=i.isDark?i.codeBlockDarkTheme:i.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&s.current!==t&&(s.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=ye.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return ye.set(e,t),t}catch{}const n="__theme_"+ ++xe;return ye.set(e,n),n}return String(e)}(e);t&&ge!==t&&(fe=e,ge=t,we&&pe(fe,we).then(()=>be()).catch(()=>{}))}(e))},[i.codeBlockDarkTheme,i.codeBlockLightTheme,i.isDark,i.renderCodeBlocksAsPre]);const E=o(()=>null!=i.indexKey?String(i.indexKey):"markdown-renderer",[i.indexKey]),T=o(()=>({..."boolean"==typeof i.showTooltips?{showTooltips:i.showTooltips}:{},...i.codeBlockProps||{}}),[i.codeBlockProps,i.showTooltips]),D=o(()=>({...i.mermaidProps||{}}),[i.mermaidProps]),$=o(()=>({...i.d2Props||{}}),[i.d2Props]),P=o(()=>({...i.infographicProps||{}}),[i.infographicProps]),W=o(()=>({customId:i.customId,isDark:i.isDark,indexKey:E,typewriter:i.typewriter,textStreamState:d.current,streamRenderVersion:f.current,customComponents:v,showTooltips:i.showTooltips,renderCodeBlocksAsPre:i.renderCodeBlocksAsPre,codeBlockStream:i.codeBlockStream,codeBlockProps:T,mermaidProps:D,d2Props:$,infographicProps:P,codeBlockThemes:{themes:i.themes,monacoOptions:i.codeBlockMonacoOptions,minWidth:i.codeBlockMinWidth,maxWidth:i.codeBlockMaxWidth},events:{onCopy:i.onCopy,onHandleArtifactClick:i.onHandleArtifactClick}}),[i.customId,i.isDark,E,i.typewriter,i.showTooltips,i.renderCodeBlocksAsPre,i.codeBlockStream,T,D,$,P,i.themes,i.codeBlockMonacoOptions,i.codeBlockMinWidth,i.codeBlockMaxWidth,f.current,i.onCopy,i.onHandleArtifactClick,v]);/* @__PURE__ */
189
+ return t(_,{getRoot:()=>l.current,enabled:!1!==i.viewportPriority,children:/* @__PURE__ */t(ur,{props:i,parsedNodes:S,renderCtx:W,indexPrefix:E,containerRef:l})})};function hr(e){var n,r,o,i,l,a;const{node:s,ctx:c,renderNode:d,indexKey:u,children:m}=e;/* @__PURE__ */
190
+ return t("blockquote",{className:"blockquote-node",dir:"auto",cite:s.cite,children:null!=m?m:c&&d?/* @__PURE__ */t(mr,{nodes:s.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:c.customId,isDark:c.isDark,typewriter:c.typewriter,viewportPriority:!0,codeBlockStream:c.codeBlockStream,renderCodeBlocksAsPre:c.renderCodeBlocksAsPre,codeBlockProps:c.codeBlockProps,themes:null==(n=c.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=c.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=c.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=c.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=c.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=c.codeBlockThemes)?void 0:a.maxWidth,showTooltips:c.showTooltips,onCopy:c.events.onCopy,onHandleArtifactClick:c.events.onHandleArtifactClick}):null})}function pr(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,showCollapseButton:!0,showFontSizeButtons:!0,...r},s=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"}(s),[s]),m=o(()=>g(s),[s]),[h,p]=i(0);c(()=>w(()=>{p(e=>e+1)}),[]);const f=o(()=>{const e=x[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),v=o(()=>y(m),[m,h]),{t:b}=z(),k=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),C=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]),[M,N]=i(!1),[B,L]=i(!1),[S,E]=i(!1),[T,D]=i(""),[$,P]=i(!1),[W,A]=i(14),[R,O]=i(W),_=o(()=>!1!==l.showTooltips,[l.showTooltips]),j=a(null),I=a(null),H=a(null),F=a(null),V=a(!1),K=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),U=d(e=>{if(!e)return D(""),void P(!1);var t;D(`<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>`),P(!1)},[]),X=d(()=>{D(""),P(!0)},[]),q=d(async()=>{if(!F.current&&!V.current){V.current=!0;try{const e=await import("stream-markdown");F.current=e.createShikiStreamRenderer}catch{}}},[]),Y=d(async()=>{if(await q(),j.current&&I.current)if(!H.current&&F.current&&(H.current=F.current(I.current,{theme:K(),themes:l.themes}),P(!0)),H.current)if(!1===l.stream&&l.loading)U(l.node.code);else{U(l.node.code);try{await H.current.updateCode(l.node.code,u),X()}catch{}}else U(l.node.code);else U(l.node.code)},[X,q,K,u,l.loading,l.node.code,l.stream,l.themes,U]);c(()=>(Y(),()=>{var e;null==(e=H.current)||e.dispose(),H.current=null}),[Y]),c(()=>{H.current&&H.current.setTheme(K())},[K]),c(()=>{H.current&&(!1===l.stream&&l.loading||(U(l.node.code),Promise.resolve(H.current.updateCode(l.node.code,u)).then(()=>X()).catch(()=>{})))},[X,u,l.loading,l.node.code,l.stream,U]),c(()=>{_||Q(!0)},[_]);const Z=d((e,t)=>{if(!_)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),J(n,t,"top",!1,0,l.isDark))},[l.isDark,_]),G=d(()=>{_&&Q()},[_]),ee=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),N(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>N(!1),1e3)}catch{}},[l]),te=d(()=>{var e;if(!k)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})},[k,u,l]),ne=o(()=>({fontSize:`${R}px`}),[R]);return c(()=>{A(14),O(14)},[]),/* @__PURE__ */e("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:C,children:[l.showHeader&&/* @__PURE__ */e("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:[
191
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[
192
+ /* @__PURE__ */t("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:v}}),
193
+ /* @__PURE__ */t("span",{className:"text-sm font-medium font-mono",children:f})]}),
194
+ /* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[l.showCollapseButton&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":S,onClick:()=>E(e=>!e),onMouseEnter:e=>Z(e,S?b("common.expand")||"Expand":b("common.collapse")||"Collapse"),onFocus:e=>Z(e,S?b("common.expand")||"Expand":b("common.collapse")||"Collapse"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("svg",{style:{rotate:S?"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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */e(n,{children:[
195
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:R<=10,onClick:()=>O(e=>Math.max(10,e-1)),onMouseEnter:e=>Z(e,b("common.decrease")||"Decrease"),onFocus:e=>Z(e,b("common.decrease")||"Decrease"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
196
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:R===W,onClick:()=>O(W),onMouseEnter:e=>Z(e,b("common.reset")||"Reset"),onFocus:e=>Z(e,b("common.reset")||"Reset"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
197
+ /* @__PURE__ */t("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
198
+ /* @__PURE__ */t("path",{d:"M3 3v5h5"})]})})}),
199
+ /* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:R>=36,onClick:()=>O(e=>Math.min(36,e+1)),onMouseEnter:e=>Z(e,b("common.increase")||"Increase"),onFocus:e=>Z(e,b("common.increase")||"Increase"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),l.showCopyButton&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":M?b("common.copied")||"Copied":b("common.copy")||"Copy",onClick:ee,onMouseEnter:e=>Z(e,M?b("common.copied")||"Copied":b("common.copy")||"Copy"),onFocus:e=>Z(e,M?b("common.copied")||"Copied":b("common.copy")||"Copy"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("svg",M?{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__ */t("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__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
200
+ /* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
201
+ /* @__PURE__ */t("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__ */t("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:e=>{L(e=>!e),Z(e,B?b("common.expand")||"Expand":b("common.collapse")||"Collapse")},onMouseEnter:e=>Z(e,B?b("common.collapse")||"Collapse":b("common.expand")||"Expand"),onFocus:e=>Z(e,B?b("common.collapse")||"Collapse":b("common.expand")||"Expand"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("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__ */t("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__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})}),k&&l.showPreviewButton&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":b("common.preview")||"Preview",onClick:te,onMouseEnter:e=>Z(e,b("common.preview")||"Preview"),onFocus:e=>Z(e,b("common.preview")||"Preview"),onMouseLeave:G,onBlur:G,children:/* @__PURE__ */t("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("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
202
+ /* @__PURE__ */t("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"}),
203
+ /* @__PURE__ */t("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!S&&(!!l.stream||!l.loading)&&/* @__PURE__ */e("div",{ref:j,className:"code-block-content",style:{...ne,maxHeight:B?"none":"500px",overflowY:B?"visible":"auto",overflowX:"auto"},children:[
204
+ /* @__PURE__ */t("div",{ref:I,className:"code-block-render"}),!$&&T&&/* @__PURE__ */t("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:T}})]}),!l.stream&&l.loading&&/* @__PURE__ */t("div",{className:"code-loading-placeholder",children:/* @__PURE__ */e("div",{className:"loading-skeleton",children:[
205
+ /* @__PURE__ */t("div",{className:"skeleton-line"}),
206
+ /* @__PURE__ */t("div",{className:"skeleton-line"}),
207
+ /* @__PURE__ */t("div",{className:"skeleton-line short"})]})}),
208
+ /* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:M?b("common.copied")||"Copied":""})]})}function fr(e){var n;const r=a(null),[l,s]=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}(e.isDark),[e.isDark]);return c(()=>{if(!e.visible)return void s(!1);if(!e.anchorEl||!r.current)return void s(!0);let t=null,n=!1;const o=async()=>{var t,o;if(!e.anchorEl||!r.current)return;const{x:i,y:l}=await E(e.anchorEl,r.current,{placement:null!=(t=e.placement)?t:"top",middleware:[T(null!=(o=e.offset)?o:8),D(),$({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||s(!0)}),t=S(e.anchorEl,r.current,o),()=>{n=!0,null==t||t()}},[e.anchorEl,e.offset,e.placement,e.visible,l]),"undefined"==typeof document?null:e.visible&&l?L(
209
+ /* @__PURE__ */t("div",{id:null!=(n=e.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:e.content}),document.body):null}export{_e as $,W as A,hr as B,I as C,Ke as D,Xe as E,Yn as F,fr as G,Je as H,St as I,Ln as J,tn as K,_t as L,Cn as M,mr as N,Zt as O,Zn as P,Nn as Q,Gn as R,Jn as S,nr as T,Oe as U,or as V,Jt as W,Re as X,Sn as Y,an as Z,kn as _,Ee as a,Qt as a0,sn as a1,lr as a2,Ae as a3,F as a4,ln as a5,en as a6,nn as a7,Yt as a8,Gt as a9,Mn as aa,xn as ab,bn as ac,En as ad,z as ae,rn as af,je as ag,Ue as b,qe as c,Ye as d,Ze as e,Ge as f,Qe as g,et as h,ut as i,Bt as j,ee as k,Pt as l,At as m,Rt as n,jt as o,It as p,pr as q,mn as r,hn as s,zn as t,ke as u,Qn as v,er as w,tr as x,Ot as y,rr as z};