markstream-octane 0.1.0-beta.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.px.css +1 -1
- package/dist/server.d.ts +0 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/dist/types/types/component-props.d.ts +0 -1
- package/package.json +20 -20
- package/dist/types/components/CodeBlockNode/monaco.d.ts +0 -2
- package/dist/types/components/CodeBlockNode/monacoThemeRegistry.d.ts +0 -8
- package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +0 -5
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +0 -34
- package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +0 -2
package/dist/client/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// octane-no-slot: compiler-assigned hook slots are already present.
|
|
2
|
-
import*as e from"octane";import{Fragment as t,__s as n,attachRef as o,bag0 as r,bag1 as i,bag10 as l,bag12 as a,bag13 as s,bag15 as c,bag3 as d,bag4 as u,bag5 as m,bag6 as f,bag7 as h,bag8 as p,bagOf as y,child as g,childTextHole as b,clone as v,createContext as w,createElement as x,createPortal as k,createScopedElement as S,createScopedValue as C,delegateEvents as M,hookSlots as N,htextSwap as $,mapSlot as B,markDangerouslySetInnerHTMLChildren as T,positionalChildren as E,queueRefAttach as L,queueRefDetach as D,setAriaAttribute as j,setAttribute as P,setCheckedCheckable as _,setClassAttr as R,setHostPropSources as A,setStyle as F,setText as I,sibling as H,snapshotSpread as O,template as W,textHole as z,useCallback as K,useContext as V,useEffect as q,useLayoutEffect as U,useMemo as X,useRef as Y,useState as Z,useSyncExternalStore as G,withSlot as J}from"octane";import{BLOCKED_HTML_TAGS as Q,NON_STRUCTURING_HTML_TAGS as ee,convertHtmlAttrsToProps as te,getHtmlTagFromContent as ne,getMarkdown as oe,hasCustomHtmlComponents as re,isCustomHtmlComponentTag as ie,isHtmlTagBlocked as le,isHtmlTagHardBlocked as ae,mergeCustomHtmlTags as se,normalizeCustomHtmlTagName as ce,parseMarkdownToStructure as de,sanitizeHtmlAttrs as ue,sanitizeHtmlContent as me,sanitizeHtmlTokenAttrs as fe,sanitizeImageSrc as he,shouldOpenLinkInNewTab as pe,shouldRenderUnknownHtmlTagAsText as ye,stripCustomHtmlWrapper as ge,toSafeSvgElement as be,tokenAttrsToRecord as ve,tokenizeHtml as we}from"stream-markdown-parser";import{createSmoothMarkdownStream as xe,normalizeShikiLanguage as ke}from"markstream-core";import{autoUpdate as Se,computePosition as Ce,flip as Me,offset as Ne,shift as $e}from"@floating-ui/dom";var Be=/* @__PURE__ */new Set(["table","code_block","html_block","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function Te(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=n??!0,e):e,{})}function Ee(t,n,o,r){if("function"!=typeof r)throw new TypeError("renderNodeChildren expected a function, received "+typeof r);if(!Array.isArray(t)||0===t.length)return null;const i=[];for(let l=0;l<t.length;l++){const a=t[l];if(a){if("label_open"===a.type){const s=[];for(l++;l<t.length;){const e=t[l];if("label_close"===e?.type)break;e&&s.push(e),l++}const c=`${o}-label-${l}`;i.push(e.createElement("label",{key:c,...Te(a.attrs)},Ee(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function Le(e,t,n,o){return Ee(e,t,`${n}-inline`,o)}var De=/* @__PURE__ */W('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),je=/* @__PURE__ */N(3),Pe=/* @__PURE__ */Symbol(je),_e=/* @__PURE__ */Symbol(je+1),Re=/* @__PURE__ */Symbol(je+2),Ae=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r,i,l,a,s,c,d,u;const m=v(De);e=m,n=m;const f=g(m);r=f,i=f;const h=g(f);l=h;const p=H(h,1);a=p,s=f,c=H(p,1),d=m,u=H(f,1),o=y(t,m,{a:void 0,b:e,c:void 0,d:n,e:void 0,f:r,g:i,h:l,i:null,j:void 0,k:a,l:null,m:void 0,n:s,o:c,p:null,q:void 0,r:d,s:u,t:null,u:void 0})}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"data-index-key",t),o.c=t)}{const t=e.h2;o.e!==t&&(P(o.f,"id",t),o.e=t)}{const n=e.h3,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.j!==n){o.j=n;const e=o.i;null==e||r||null===n?o.i=z(t,1,o.g,n,o.h,!0):I(e,n)}}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.m!==n){const e=o.l;null==e||r||null===n?o.l=b(t,2,o.k,n,e):I(e,n),o.m=n}}{const n=e.h5,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){o.q=n;const e=o.p;null==e||r||null===n?o.p=z(t,3,o.n,n,o.o,!0):I(e,n)}}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.u!==n){o.u=n;const e=o.t;null==e||r||null===n?o.t=z(t,4,o.r,n,o.s,!0):I(e,n)}}}),Fe={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function Ie(e){const{node:t,ctx:n,renderNode:o,indexKey:r,isDark:i}=e,l=String(t.kind||"note"),a=X(()=>t.title&&String(t.title).trim().length?String(t.title):l.charAt(0).toUpperCase()+l.slice(1),[l,t.title],Pe),[s,c]=Z(()=>!!t.collapsible&&!(t.open??1),_e),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],Re);return x(Ae,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Fe[l]&&S("span",{className:"admonition-icon"},()=>Fe[l]),h4:a,h5:t.collapsible&&C(()=>S("button",{type:"button",className:"admonition-toggle","aria-expanded":!s,"aria-controls":`${d}-content`,title:s?"Expand":"Collapse",onClick:()=>c(e=>!e)},()=>S("span",{},()=>s?"▶":"▼"))),h6:!s&&C(()=>S("div",{id:`${d}-content`,className:"admonition-content","aria-labelledby":d},()=>n&&o?Ee(t.children,n,String(r??d),o):null))})}Ie.$$singleRoot=!0;var He=w(!1),Oe=w(null);function We(){return V(Oe)}var ze=/* @__PURE__ */N(3),Ke=/* @__PURE__ */Symbol(ze),Ve=/* @__PURE__ */Symbol(ze+1),qe=/* @__PURE__ */Symbol(ze+2),Ue=w(null);function Xe(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,o=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,r=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null;let i=null,l=null;const a=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set;let c=null;const d=()=>{if(!a.size){try{i?.disconnect()}catch{}i=null,l=null,s.size||(()=>{if(null!=c){try{r?.(c)}catch{}c=null}})()}},u=e=>{const t=a.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{i?.unobserve(e)}catch{}a.delete(e),s.delete(e),d()}},m=()=>{o&&null==c&&s.size&&(c=o(()=>{c=null;const e=s.values().next().value;e&&(s.delete(e),u(e),s.size&&m())},{timeout:1200}))};return(o,r)=>{const c={current:!1};let f=!1;const{promise:h,resolve:p}=Promise.withResolvers(),y=()=>{f||(f=!0,p())},g=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g};const b=((t,o)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,o);if(i&&(c=r,(s=l)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return i;var s,c;if(i)try{i.disconnect()}catch{}i=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&u(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),l=r;for(const e of a.keys())i.observe(e);return i})(r?.rootMargin??"300px",r?.threshold??0);return b?(a.set(o,{resolve:y,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:g}):(c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Ye=Xe(()=>null,()=>!0);function Ze({getRoot:e,enabled:t=!0,children:n}){const o=Y(t,Ke);o.current=t;const r=Y(e,Ve);r.current=e;const i=X(()=>Xe(()=>r.current?.()??null,()=>o.current),[],qe);return S(Ue.Provider,{value:i},()=>n)}function Ge(){return V(Ue)??Ye}var Je="__global__",Qe="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",et=(()=>{const e=globalThis;if(e[Qe])return e[Qe];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[Qe]=t,t})();function tt(){et.revision++;for(const e of Array.from(et.listeners))try{e()}catch{}}function nt(e){return et.listeners.add(e),()=>{et.listeners.delete(e)}}function ot(){return et.revision}function rt(e,t){"string"==typeof e?et.scopedComponents[e]={...t||{}}:et.scopedComponents[Je]={...e},tt()}function it(e){const t=et.scopedComponents[Je]||{};if(!e)return t;const n=et.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function lt(e){if(e===Je)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete et.scopedComponents[e],tt()}function at(){delete et.scopedComponents[Je],tt()}function st(e){return e?.markstreamDisplay}function ct(e,t){return e.markstreamDisplay=t,e}function dt(e){return e}function ut(e){return e}function mt(e={}){const t=Y(null,ht);t.current||(t.current=xe(e));const n=t.current,[o,r]=Z(()=>n.getSnapshot(),pt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],yt),X(()=>({...o,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,o],gt)}var ft=/* @__PURE__ */N(4),ht=/* @__PURE__ */Symbol(ft),pt=/* @__PURE__ */Symbol(ft+1),yt=/* @__PURE__ */Symbol(ft+2),gt=/* @__PURE__ */Symbol(ft+3),bt=/* @__PURE__ */W('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),vt=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=v(bt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function wt(e){const{node:t}=e;return x(vt,{h0:Boolean(t.checked)})}wt.$$singleRoot=!0;var xt={"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 kt(e){Object.assign(xt,e)}function St(){return{t:e=>xt[e]??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)}}var Ct=null,Mt=null,Nt=null,$t=null,Bt=null,Tt=null;function Et(){$t&&(clearTimeout($t),$t=null),Bt&&(clearTimeout(Bt),Bt=null)}async function Lt(e){if(!Ct||!Mt)return;const{x:t,y:n}=await Ce(Mt,Ct,{placement:e,middleware:[Ne(8),Me(),$e({padding:8})],strategy:"fixed"});Ct.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Dt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Ct||"undefined"==typeof document||((Ct=document.createElement("div")).className="markstream-octane ms-tooltip",Ct.setAttribute("role","tooltip"),Ct.dataset.visible="false",Ct.style.position="fixed",Ct.style.left="0px",Ct.style.top="0px",Ct.style.transform="translate3d(0,0,0)",document.body.appendChild(Ct)),!Ct)return;Et();const l=async()=>{if(Ct){Mt=e,Ct.textContent=t,Ct.dataset.placement=n,Ct.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",Ct.dataset.visible="false",Tt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Ct.id=Tt;try{e.setAttribute("aria-describedby",Tt)}catch{}await Lt(n),Ct.dataset.visible="true",Nt?.(),Nt=Se(e,Ct,()=>{Lt(n)})}};o?l():$t=setTimeout(l,80)}function jt(e=!1){if(!Ct)return;Et();const t=()=>{if(Ct){if(Ct.dataset.visible="false",Mt&&Tt)try{Mt.removeAttribute("aria-describedby")}catch{}Mt=null,Tt=null,Nt&&(Nt(),Nt=null)}};e?t():Bt=setTimeout(t,120)}var Pt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n',_t=null,Rt=null,At=null,Ft=/* @__PURE__ */new Set;function It(e){_t=e??null}var Ht={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",d2lang:"d2",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"},Ot={"":Pt,plain:Pt,text:Pt,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'};function Wt(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}function zt(e){const t=Wt(e);return Ht[t]??t}function Kt(e){const t=zt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"shell":return"zsh";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}async function Vt(){return Rt||(At||(At=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Rt=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of Ft)try{e()}catch{}}(),Rt)).catch(()=>null)),At)}async function qt(){await Vt()}function Ut(e){return Ft.add(e),()=>{Ft.delete(e)}}function Xt(e){if(_t){const t=_t(e);if(null!=t&&""!==t)return t}const t=zt(e),n=Ot[t];if(n)return n;const o=Rt?.[t];return o||(Vt(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n')}var Yt={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",csharp:"C#",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"},Zt=Array.from(/* @__PURE__ */new Set([...Object.keys(Ht),...Object.values(Ht),...Object.keys(Ot),...Object.keys(Yt),"c","diff","go","java","php","ruby","rust","sql","yaml"]));function Gt(e){const t=Wt(e);return!!t&&!Zt.includes(t)&&Zt.some(e=>e.startsWith(t))}var Jt=/* @__PURE__ */N(4),Qt=/* @__PURE__ */Symbol(Jt),en=/* @__PURE__ */Symbol(Jt+1),tn=/* @__PURE__ */Symbol(Jt+2),nn=/* @__PURE__ */Symbol(Jt+3),on=void 0!==import.meta&&Boolean(!1),rn=null;function ln(e){const{t:t}=J(Qt,St,Qt),n=X(()=>{const t=e.code||"",n=t.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?t:`<!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: ${e.isDark?"#020617":"#ffffff"};\n color: ${e.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 ${t}\n </body>\n</html>`},[e.code,e.isDark],en),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!on||"undefined"==typeof console||rn===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(rn=e,console.warn("[markstream-octane] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(t),t):void 0!==t?"":!0===n?"allow-scripts":"";var t,n},[e.htmlPreviewAllowScripts,e.htmlPreviewSandbox],tn);return q(()=>{const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||e.onClose?.()};return"undefined"!=typeof window&&window.addEventListener("keydown",t),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",t)}},[e],nn),"undefined"==typeof document?null:k(C(()=>S("div",{className:"markstream-octane html-preview-frame__backdrop"+(e.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>e.onClose?.()},()=>C(()=>S("div",{className:"html-preview-frame"+(e.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation()},()=>E([S("div",{className:"html-preview-frame__header"},()=>E([S("div",{className:"html-preview-frame__title"},()=>E([x("span",{className:"html-preview-frame__dot"}),S("span",{className:"html-preview-frame__label"},()=>e.title||`HTML ${t("common.preview")}`)])),C(()=>x("button",{type:"button",className:"html-preview-frame__close"+(e.isDark?" html-preview-frame__close--dark":""),onClick:()=>e.onClose?.()},"\n ×\n "))])),C(()=>x("iframe",{className:"html-preview-frame__iframe",sandbox:o,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:n,title:e.title||"Preview"}))]))))),document.body)}var an=!1,sn=null,cn=!1;async function dn(){if(sn)return sn;if(cn)return null;try{if(!(sn=function(e){const t="function"==typeof e?.createCodeBlockRuntime||"function"==typeof e?.useMonaco?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return"function"!=typeof n?null:{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:t?.detectLanguage?.bind(t),preloadStreamDiffs:t?.preloadStreamDiffs?.bind(t)}}(await import("stream-diffs/markstream"))))throw new Error("Invalid stream-diffs runtime");return await async function(e){an||(an=!0,e?.preloadStreamDiffs&&await e.preloadStreamDiffs())}(sn),sn}catch{return cn=!0,null}}var un=/* @__PURE__ */W('<pre data-markstream-pre="1" tabindex="0"></pre>'),mn=/* @__PURE__ */N(6),fn=/* @__PURE__ */Symbol(mn),hn=/* @__PURE__ */Symbol(mn+1),pn=/* @__PURE__ */Symbol(mn+2),yn=/* @__PURE__ */Symbol(mn+3),gn=/* @__PURE__ */Symbol(mn+4),bn=/* @__PURE__ */Symbol(mn+5),vn=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r,i,l,a,s;const d=v(un);e=d,n=d,r=d,i=d,l=d,a=d,s=d,o=c(t,d,void 0,e,void 0,n,void 0,r,void 0,i,void 0,l,void 0,a,s,null,void 0)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(F(o.d,t,o.c),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-busy",t),o.e=t)}{const t=e.h3;o.g!==t&&(j(o.h,"aria-label",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"data-language",t),o.i=t)}{const t=e.h5;o.k!==t&&(P(o.l,"data-markstream-line-numbers",t),o.k=t)}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.o!==n){const e=o.n;null==e||r||null===n?o.n=b(t,1,o.m,n,e):I(e,n),o.o=n}}});function wn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function xn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function kn(e){return e.startsWith("-")&&!e.startsWith("---")}function Sn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Cn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function Mn(e,t,n,o,r={}){const i=0===String(e??"").trim().length;return{code:e,empty:i,kind:i&&"hunk"!==t&&!r.preserveBlankKind?"context":t,key:n,number:o}}function Nn(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?Mn(e,"hunk",`inline-hunk-${n}`,""):kn(e)?Mn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Sn(e)?Mn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):Mn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function $n(e,t){const n=xn(e),o=xn(t),r=function(e,t){const n=e.length,o=t.length;if((n+1)*(o+1)>15e5)return null;const r=o+1,i=new Uint16Array((n+1)*(o+1));for(let c=n-1;c>=0;c--)for(let n=o-1;n>=0;n--){const o=c*r+n;e[c]===t[n]?i[o]=i[(c+1)*r+n+1]+1:i[o]=Math.max(i[(c+1)*r+n],i[c*r+n+1])}const l=[];let a=0,s=0;for(;a<n&&s<o;)e[a]===t[s]?(l.push({originalIndex:a,modifiedIndex:s}),a++,s++):i[(a+1)*r+s]>=i[a*r+s+1]?a++:s++;return l}(n,o);if(r){const e=[];let t=0,i=0;for(const l of r){for(;t<l.originalIndex;)e.push(Mn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Cn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(Mn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Cn(o,i)})),i++;e.push(Mn(o[l.modifiedIndex],"context",`inline-context-source-${l.originalIndex}-${l.modifiedIndex}`,l.modifiedIndex+1)),t=l.originalIndex+1,i=l.modifiedIndex+1}for(;t<n.length;)e.push(Mn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Cn(n,t)})),t++;for(;i<o.length;)e.push(Mn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Cn(o,i)})),i++;return e}const i=[];let l=0,a=n.length-1,s=o.length-1;for(;l<=a&&l<=s&&n[l]===o[l];)i.push(Mn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(Mn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(Mn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Cn(n,d)}));for(let d=l;d<=s;d++)i.push(Mn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Cn(o,d)}));return i.concat(c)}function Bn(e,t=!1,n=wn(e?.language)){const o=(r=e?.code,String(r??"").split(/\r\n|\n|\r/));var r;if(!function(e,t,n){const o=e.some(e=>kn(e)),r=e.some(e=>Sn(e));return o&&r||function(e,t){if("diff"===t)return!0;const n=String(e?.raw??"").split(/\r?\n/,1)[0]?.trim()??"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(n)}(t,n)&&(o||r)}(o,e,n)&&function(e){return null!=e?.originalCode||null!=e?.updatedCode}(e)){if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:$n(e?.originalCode,e?.updatedCode)}];const n=xn(e?.originalCode),o=xn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>Mn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Cn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>Mn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Cn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Nn(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(Mn(d,"hunk",`original-hunk-${c}`,"")),l.push(Mn(d,"hunk",`modified-hunk-${c}`,""));else if(kn(d))i.push(Mn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Sn(d))l.push(Mn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(Mn(e,"context",`original-context-${c}`,a++)),l.push(Mn(e,"context",`modified-context-${c}`,s++))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:i},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:l}]}function Tn({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=X(()=>wn(e?.language),[e],fn),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=X(()=>c?Bn(e,!0===o,l):[],[o,c,e,l],hn),u=X(()=>function(e){if(!0===e?.diff)return String(e?.code??"");const t=String(e?.code??"");return!0===e?.loading?t:t.replace(/\r\n$|\n$|\r$/,"")}(e),[e],pn),m=X(()=>function(e){let t=1;for(let n=0;n<e.length;n++)"\n"===e[n]?t++:"\r"===e[n]&&(t++,"\n"===e[n+1]&&n++);return t}(u),[u],yn),f=X(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],gn),h=X(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(2,String(m).length)}ch`,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}},[m,c,r],bn);return x(vn,{h0:[a,n,r?"markstream-pre--line-numbers":"",c?"markstream-pre--diff-preview":"",c&&o?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),h1:h?{...i,...h}:i,h2:!0===e?.loading,h3:s,h4:l,h5:r?"1":void 0,h6:c?S("code",{translate:"no",className:"markstream-pre__diff-code"},()=>d.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-pane",e.className].join(" ")},()=>e.lines.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-line",`markstream-pre__diff-line--${e.kind}`,e.empty?"markstream-pre__diff-line--empty":""].filter(Boolean).join(" ")},()=>E([x("span",{className:"markstream-pre__diff-rail","aria-hidden":"true"}),S("span",{className:"markstream-pre__diff-number","aria-hidden":"true"},()=>e.number),S("span",{className:"markstream-pre__diff-content"},()=>S("span",{className:"markstream-pre__diff-content-inner"},()=>e.code))])))))):S(t,{},()=>E([r&&S("span",{className:"markstream-pre__line-numbers","aria-hidden":"true"},()=>S("span",{className:"markstream-pre__line-numbers-text"},()=>f)),S("code",{translate:"no",className:"markstream-pre__code"},()=>u)]))})}Tn.$$singleRoot=!0;var En=/* @__PURE__ */W('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),Ln=/* @__PURE__ */W('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Dn=["r","a","b"],jn=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,c,d,u;const m=v(En),f=g(m);{const l=e.h0;n=l,i=f,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=f,a=f,c=f;const h=H(f,1);d=h,u=h,r=s(t,m,n,i,void 0,l,void 0,a,void 0,c,void 0,d,u,null,void 0),t.refFields=Dn}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-hidden",t),r.g=t)}{const t=e.h4;r.i!==t&&(F(r.j,t,r.i),r.i=t)}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.m!==n){const e=r.l;null==e||o||null===n?r.l=b(t,1,r.k,n,e):I(e,n),r.m=n}}}),Pn=/* @__PURE__ */N(96),_n=/* @__PURE__ */Symbol(Pn),Rn=/* @__PURE__ */Symbol(Pn+1),An=/* @__PURE__ */Symbol(Pn+2),Fn=/* @__PURE__ */Symbol(Pn+3),In=/* @__PURE__ */Symbol(Pn+4),Hn=/* @__PURE__ */Symbol(Pn+5),On=/* @__PURE__ */Symbol(Pn+6),Wn=/* @__PURE__ */Symbol(Pn+7),zn=/* @__PURE__ */Symbol(Pn+8),Kn=/* @__PURE__ */Symbol(Pn+9),Vn=/* @__PURE__ */Symbol(Pn+10),qn=/* @__PURE__ */Symbol(Pn+11),Un=/* @__PURE__ */Symbol(Pn+12),Xn=/* @__PURE__ */Symbol(Pn+13),Yn=/* @__PURE__ */Symbol(Pn+14),Zn=/* @__PURE__ */Symbol(Pn+15),Gn=/* @__PURE__ */Symbol(Pn+16),Jn=/* @__PURE__ */Symbol(Pn+17),Qn=/* @__PURE__ */Symbol(Pn+18),eo=/* @__PURE__ */Symbol(Pn+19),to=/* @__PURE__ */Symbol(Pn+20),no=/* @__PURE__ */Symbol(Pn+21),oo=/* @__PURE__ */Symbol(Pn+22),ro=/* @__PURE__ */Symbol(Pn+23),io=/* @__PURE__ */Symbol(Pn+24),lo=/* @__PURE__ */Symbol(Pn+25),ao=/* @__PURE__ */Symbol(Pn+26),so=/* @__PURE__ */Symbol(Pn+27),co=/* @__PURE__ */Symbol(Pn+28),uo=/* @__PURE__ */Symbol(Pn+29),mo=/* @__PURE__ */Symbol(Pn+30),fo=/* @__PURE__ */Symbol(Pn+31),ho=/* @__PURE__ */Symbol(Pn+32),po=/* @__PURE__ */Symbol(Pn+33),yo=/* @__PURE__ */Symbol(Pn+34),go=/* @__PURE__ */Symbol(Pn+35),bo=/* @__PURE__ */Symbol(Pn+36),vo=/* @__PURE__ */Symbol(Pn+37),wo=/* @__PURE__ */Symbol(Pn+38),xo=/* @__PURE__ */Symbol(Pn+39),ko=/* @__PURE__ */Symbol(Pn+40),So=/* @__PURE__ */Symbol(Pn+41),Co=/* @__PURE__ */Symbol(Pn+42),Mo=/* @__PURE__ */Symbol(Pn+43),No=/* @__PURE__ */Symbol(Pn+44),$o=/* @__PURE__ */Symbol(Pn+45),Bo=/* @__PURE__ */Symbol(Pn+46),To=/* @__PURE__ */Symbol(Pn+47),Eo=/* @__PURE__ */Symbol(Pn+48),Lo=/* @__PURE__ */Symbol(Pn+49),Do=/* @__PURE__ */Symbol(Pn+50),jo=/* @__PURE__ */Symbol(Pn+51),Po=/* @__PURE__ */Symbol(Pn+52),_o=/* @__PURE__ */Symbol(Pn+53),Ro=/* @__PURE__ */Symbol(Pn+54),Ao=/* @__PURE__ */Symbol(Pn+55),Fo=/* @__PURE__ */Symbol(Pn+56),Io=/* @__PURE__ */Symbol(Pn+57),Ho=/* @__PURE__ */Symbol(Pn+58),Oo=/* @__PURE__ */Symbol(Pn+59),Wo=/* @__PURE__ */Symbol(Pn+60),zo=/* @__PURE__ */Symbol(Pn+61),Ko=/* @__PURE__ */Symbol(Pn+62),Vo=/* @__PURE__ */Symbol(Pn+63),qo=/* @__PURE__ */Symbol(Pn+64),Uo=/* @__PURE__ */Symbol(Pn+65),Xo=/* @__PURE__ */Symbol(Pn+66),Yo=/* @__PURE__ */Symbol(Pn+67),Zo=/* @__PURE__ */Symbol(Pn+68),Go=/* @__PURE__ */Symbol(Pn+69),Jo=/* @__PURE__ */Symbol(Pn+70),Qo=/* @__PURE__ */Symbol(Pn+71),er=/* @__PURE__ */Symbol(Pn+72),tr=/* @__PURE__ */Symbol(Pn+73),nr=/* @__PURE__ */Symbol(Pn+74),or=/* @__PURE__ */Symbol(Pn+75),rr=/* @__PURE__ */Symbol(Pn+76),ir=/* @__PURE__ */Symbol(Pn+77),lr=/* @__PURE__ */Symbol(Pn+78),ar=/* @__PURE__ */Symbol(Pn+79),sr=/* @__PURE__ */Symbol(Pn+80),cr=/* @__PURE__ */Symbol(Pn+81),dr=/* @__PURE__ */Symbol(Pn+82),ur=/* @__PURE__ */Symbol(Pn+83),mr=/* @__PURE__ */Symbol(Pn+84),fr=/* @__PURE__ */Symbol(Pn+85),hr=/* @__PURE__ */Symbol(Pn+86),pr=/* @__PURE__ */Symbol(Pn+87),yr=/* @__PURE__ */Symbol(Pn+88),gr=/* @__PURE__ */Symbol(Pn+89),br=/* @__PURE__ */Symbol(Pn+90),vr=/* @__PURE__ */Symbol(Pn+91),wr=/* @__PURE__ */Symbol(Pn+92),xr=/* @__PURE__ */Symbol(Pn+93),kr=/* @__PURE__ */Symbol(Pn+94),Sr=/* @__PURE__ */Symbol(Pn+95),Cr=["r","a","b"],Mr=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s,c,d,u,m,f,h,p,b,w;const x=v(Ln);{const l=e.h0;n=l,i=x,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=x,a=x;const k=H(g(x),1);s=k,c=x,d=g(x),u=k;const S=g(k);m=S,f=k,h=H(S,1),p=x;const C=H(k,1);b=C,w=H(C,1),r=y(t,x,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:null,l:void 0,m:u,n:m,o:null,p:void 0,q:f,r:h,s:null,t:void 0,u:p,v:b,w:null,x:void 0,y:w,z:null,A:void 0}),t.refFields=Cr}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h4;r.g!==t&&(R(r.h,t),r.g=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,1,r.i,n,r.j,!0):I(e,n)}}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,2,r.m,n,r.n,!0):I(e,n)}}{const n=e.h6,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,3,r.q,n,r.r,!0):I(e,n)}}{const n=e.h7,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.x!==n){r.x=n;const e=r.w;null==e||o||null===n?r.w=z(t,4,r.u,n,r.v,!0):I(e,n)}}{const n=e.h8,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.A!==n){const e=r.z;null==e||o||null===n?r.z=b(t,5,r.y,n,e):I(e,n),r.A=n}}}),Nr="undefined"!=typeof window?U:q,$r={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Br=12;function Tr({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return x(jn,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(Tn,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Er(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Lr(e,t){return"number"!=typeof e||!Number.isFinite(e)||e<0?{top:t,bottom:t}:{top:e,bottom:e}}function Dr(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const o=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},r={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...r,...n,parseDiffOptions:{...r.parseDiffOptions,...o}}}function jr(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}function Pr(e){const t=String(e??"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,o,r]=t.slice(0,3).map(Number);return.2126*n+.7152*o+.0722*r}function _r(e){const t=String(e??"").trim().toLowerCase();if(!t||"transparent"===t)return!0;const n=t.match(/^#([0-9a-f]{8})$/);if(n)return 0===Number.parseInt(n[1].slice(6),16);const o=t.match(/^#([0-9a-f]{4})$/);if(o)return 0===Number.parseInt(o[1][3]+o[1][3],16);const r=t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1]?.split(/[\s,/]+/).filter(Boolean);return 4===r?.length&&0===Number(r[3])}function Rr(e){const n={...$r,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,codeBlockOptions:u,themes:m,minWidth:f,maxWidth:h,showHeader:p,showCopyButton:y,showExpandButton:g,showPreviewButton:b,showCollapseButton:v,showFontSizeButtons:w,showLineNumbers:k,showTooltips:M}=n,N=Y(null,_n),$=Y(null,Rn),B=Y(null,An),T=Y(null,Fn),L=Y(null,In),D=Y(null,Hn),j=Y(null,On),P=Y(0,Wn),_=Y(null,zn),R=Y(null,Kn),A=J(Vn,Ge,Vn),F=Y(null,qn),I=Y(null,Un),H=Y(u,Xn),O=Y(null,Yn),W=Y([],Zn),z=Y(null,Gn),V=Y(null,Jn),U=Y(!1,Qn),G=Y(void 0,eo),[Q,ee]=Z(!1,to),[te,ne]=Z(()=>"undefined"==typeof window,no),[oe,re]=Z(!1,oo),[ie,le]=Z(!1,ro),[ae,se]=Z(!1,io),[ce,de]=Z(()=>o.language||"plaintext",lo),[ue,me]=Z(()=>zt(o.language),ao),[fe,he]=Z(!1,so),[pe,ye]=Z(!1,co),[ge,be]=Z(!1,uo),[ve,we]=Z(!1,mo),[xe,ke]=Z(0,fo),{t:Se}=J(ho,St,ho);q(()=>{U.current=pe},[pe],po);const Ce=X(()=>Dr(Boolean(o.diff),u),[u,o.diff],yo),[Me,Ne]=Z(()=>{const e=Number(Dr(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:Br},go),[$e,Be]=Z(Me,bo),Te=X(()=>!1!==M,[M],vo),Ee="boolean"==typeof k?k:!0!==Ce.disableLineNumbers,Le=Y(Ee,wo),De=Number(H.current?.fontSize),je=Number(u?.fontSize),Pe=H.current!==u&&Number.isFinite(De)&&De>0&&(!Number.isFinite(je)||je<=0),_e=K(()=>{const e=Ce.maxHeight??500;return"number"==typeof e&&Number.isFinite(e)?e:500},[Ce.maxHeight],xo);J(ko,Nr,()=>{const e=Number(Ce.fontSize),t=Number.isFinite(e)&&e>0?e:Br;Ne(t),Be(t)},[Ce.fontSize],ko);const Re=K(e=>{if(Q)return;const t=N.current,n=B.current;if(!t||!n)return;const o="diff"===D.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=_e(),i="diff"===D.current,l=i?"important":"";e?(t.style.minHeight="0px",t.style.setProperty("max-height","none",l),t.style.overflow="visible"):(t.style.minHeight="0px",t.style.setProperty("max-height",`${Math.ceil(r)}px`,l),t.style.overflow=i?"hidden":"auto");try{const n=()=>{if(i){const e=function(e){if("undefined"==typeof window)return null;try{const t=e.getBoundingClientRect();if(t.width<=0)return null;const n=[".stream-diffs-shell",".stream-diffs-shell .diffs-container",".stream-diffs-shell .diff-line",".stream-diffs-shell .diff-hunk"];let o=0;for(const r of Array.from(e.querySelectorAll(n.join(",")))){if(!(r instanceof HTMLElement))continue;const e=window.getComputedStyle(r);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=r.getBoundingClientRect();n.height<=0||n.bottom<=t.top||(o=Math.max(o,n.bottom-t.top))}return o>0?Math.ceil(o+4):null}catch{return null}}(t);if(null!=e)return e}if("function"==typeof o.getContentHeight)return o.getContentHeight();if(i&&"function"==typeof o.getModifiedEditor){const e=o.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}},a=Number(n());if(Number.isFinite(a)&&a>0){const n=e?a:Math.min(a,r);t.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,l)}o.layout?.()}catch{}},[_e,Q],So),Ae=K(e=>{if(Re(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Re(e),window.requestAnimationFrame(()=>{Re(e);const t=N.current;t&&null!=V.current&&(t.style.minHeight="0px",V.current=null)})});return window.setTimeout(()=>Re(e),180),()=>window.cancelAnimationFrame(t)},[Re],Co),Fe=K(()=>{const e=N.current,t=$.current?.querySelector(".code-editor-fallback-surface");if(!e||!t)return;const n=t.getBoundingClientRect().height;!Number.isFinite(n)||n<=0||(V.current=n,e.style.minHeight=`${Math.ceil(n)}px`)},[],Mo),Ie=K(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],No),He=K(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],z.current?.disconnect(),z.current=null},[],$o),Oe=K(()=>{He();const e=B.current,t=N.current;if(!e||!t||"diff"!==D.current)return;const n=()=>Ae(U.current),o=(e,t)=>{try{const o=e?.[t];if("function"!=typeof o)return;const r=o.call(e,n);r&&W.current.push(r)}catch{}},r=e.getDiffEditorView?.(),i=r?.getOriginalEditor?.(),l=r?.getModifiedEditor?.();if(o(r,"onDidUpdateDiff"),o(i,"onDidContentSizeChange"),o(l,"onDidContentSizeChange"),o(i,"onDidLayoutChange"),o(l,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),z.current=e}},[He,Ae],Bo);q(()=>Ut(()=>{ke(e=>e+1)}),[],To),q(()=>{me(zt(o.language))},[o.language],Eo);const We=Y(o,Lo);We.current=o;const ze=K(()=>{P.current+=1;try{T.current?.()}catch{}He(),L.current=null,D.current=null,j.current=null,V.current=null,se(!1),le(!1)},[He],Do),Ke=K(()=>{const e=N.current,t=$.current;if(!e||!t)return;t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),t.style.removeProperty("--vscode-editor-selectionBackground");const n=Er(Ce.tabSize)??4,r=Lr(Ce.padding,o.diff?0:8);if(e.style.setProperty("--diffs-tab-size",String(n)),"number"==typeof Ce.padding&&Number.isFinite(Ce.padding)&&Ce.padding>=0?e.style.setProperty("--diffs-gap-block",`${r.top}px`):e.style.removeProperty("--diffs-gap-block"),o.diff)return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");const i=e.querySelector(".stream-diffs-shell")??e;try{const n="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(i):null,r=String(n?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(n?.color??"").trim(),l=String(n?.getPropertyValue("--vscode-editor-background")??"").trim(),a=String(n?.backgroundColor??"").trim(),s=_r(l)?_r(a)?"":a:l,c=String(n?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=Pr(e),i=Pr(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(s,r,"plaintext"===Kt(String(o.language||ue||ce||"plaintext")),t.classList.contains("is-dark")))return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");r?e.style.setProperty("--vscode-editor-foreground",r):e.style.removeProperty("--vscode-editor-foreground"),s?e.style.setProperty("--vscode-editor-background",s):e.style.removeProperty("--vscode-editor-background"),c?e.style.setProperty("--vscode-editor-selectionBackground",c):e.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ue,ce,o.diff,o.language,Ce],jo),Ve=X(()=>r?c??m?.[0]??"vitesse-dark":d??m?.[1]??"vitesse-light",[c,r,d,m],Po),qe=K(()=>Ve,[Ve],_o),Ue=X(()=>qe(),[qe],Ro),Xe=X(()=>function(e,t){const n=(function(e){return"string"==typeof e?e:null}(e)??"").toLowerCase();return n?["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=>n.includes(e))&&!["light","latte","dawn","lotus"].some(e=>n.includes(e)):t}(Ue,Boolean(r)),[r,Ue],Ao),Ye=X(()=>o.diff?r?"dark":"light":Xe?"dark":"light",[r,o.diff,Xe],Fo),Ze=X(()=>o.diff?"dark"===Ye:Xe,[Ye,o.diff,Xe],Io),Je=X(()=>o.diff?"dark"===Ye:Boolean(r),[Ye,r,o.diff],Ho),Qe=X(()=>{const e=Ce,t=Er(e?.fontSize)??(Pe?Br:$e)??Br,n=Er(e?.lineHeight)??(t===Br?18:Math.max(12,Math.round(1.5*t))),r="string"==typeof e?.fontFamily&&e.fontFamily.trim()?e.fontFamily.trim():'Menlo, Monaco, "Courier New", monospace',i=Lr(e?.padding,o.diff?0:8),l=Er(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Pe,$e,o.diff,Ce],Oo),et=X(()=>!!o.diff&&"unified"===Ce.diffStyle,[o.diff,Ce],Wo),tt=X(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Qe.lineHeight}px`,"--markstream-pre-line-number-top":`${Qe.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Qe.fontSize}px`,lineHeight:`${Qe.lineHeight}px`,maxHeight:`${_e()}px`,overflow:"auto",paddingBottom:`${Qe.paddingBottom}px`,paddingTop:`${Qe.paddingTop}px`,tabSize:Qe.tabSize,whiteSpace:"scroll"===Ce.overflow?"pre":"pre-wrap","--markstream-code-font-family":Qe.fontFamily,fontFamily:Qe.fontFamily}),[_e,Qe,Ce.overflow],zo),nt=K(()=>{const e=Ce.maxHeight,t={...Ce||{},...null==e?{}:{MAX_HEIGHT:e},themes:m?[...m]:void 0,stream:!1,disableFileHeader:!0,theme:Ue,disableLineNumbers:!Ee,fontSize:Qe.fontSize,lineHeight:Qe.lineHeight,fontFamily:Qe.fontFamily,onThemeChange(){Ke()},themeType:r?"dark":"light"};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }","string"==typeof t.unsafeCSS?t.unsafeCSS:""].filter(Boolean).join("\n"),t},[r,Qe,Ue,Ce,Ee,Ke,m],Ko),ot=K(()=>{const e=nt(),t=F.current;if(!t)return F.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[nt],Vo),rt=K(e=>{const t=e(ot());return B.current=t,T.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[ot],qo),it=X(()=>JSON.stringify({diffStyle:Ce.diffStyle,expandUnchanged:Ce.expandUnchanged,collapsedContextThreshold:Ce.collapsedContextThreshold,hunkSeparators:Ce.hunkSeparators,lineDiffType:Ce.lineDiffType,maxLineDiffLength:Ce.maxLineDiffLength,expansionLineCount:Ce.expansionLineCount,context:Ce.parseDiffOptions?.context}),[Ce],Uo);q(()=>{ot()},[Ce,ot],Xo),q(()=>()=>{P.current+=1,T.current?.(),He(),T.current=null,L.current=null,D.current=null,j.current=null,B.current=null,I.current=null,_.current=null,R.current?.destroy?.(),R.current=null},[He],Yo),q(()=>{if("undefined"==typeof window)return;if(te)return;const e=$.current;if(!e)return;R.current?.destroy?.();const t=A(e,{rootMargin:"400px"});return R.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),R.current===t&&(R.current=null)}},[A,te],Zo),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(ot(),()=>{e=!1}):((async()=>{try{const t=await dn();if(!e)return;if(!t)return void ee(!0);const n=t.createCodeBlockRuntime,o=t.detectLanguage;if("function"==typeof o&&(_.current=o),"function"!=typeof n)return void ee(!0);I.current=n,rt(n),re(!0)}catch{e&&ee(!0)}})(),()=>{e=!1})},[rt,ot],Go),q(()=>{if(!o.language&&!ue&&_.current)try{const e=_.current(String(o.code??""));e&&de(e)}catch{}},[ue,o.code,o.language],Jo);const lt=X(()=>String(o.language||ue||ce||"plaintext"),[ue,ce,o.language],Qo),at=X(()=>zt(lt),[lt],er),st=X(()=>!!i&&Gt(lt),[i,lt],tr),ct=X(()=>st?"plaintext":Kt(at),[at,st],nr),dt=X(()=>"plaintext"===ct,[ct],or),ut=X(()=>Xt(at),[at,xe],rr),mt=X(()=>!!a&&("html"===at||"svg"===at),[at,a],ir),ft=X(()=>{const e=at;return e?Yt[e]||e.charAt(0).toUpperCase()+e.slice(1):Yt[""]||"Plain Text"},[at],lr),ht=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],ar),pt=X(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(f),r=e(h);return n&&(t.minWidth=n),r&&(t.maxWidth=r),o.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--markstream-code-fallback-fg, var(--code-fg))",t.backgroundColor="var(--markstream-code-fallback-bg, var(--code-bg, #fff))",t.borderColor=Je?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[h,f,o.diff,Je],sr),yt=X(()=>{if(!o.diff)return{color:"var(--markstream-code-fallback-fg, var(--code-fg))",backgroundColor:"var(--markstream-code-fallback-bg, var(--code-bg, #fff))"}},[o.diff],cr),gt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],dr),bt=!1===l&&i||!1!==l&&i&&!gt;q(()=>{if(Q)return;if(!oe)return;if(!ie||!te)return;const e=B.current;ot();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),Ke(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null)&&Ae(pe)};e?.setTheme&&Ue?Promise.resolve(e.setTheme(Ue)).then(t).catch(()=>{}):t()},[ge,ie,Ye,pe,oe,o.diff,Ue,Ae,Ke,ot,Q,te],ur);const vt=K(async()=>{if(Q)return null;if(!te)return null;if(ge)return null;if(bt)return null;const e=B.current,t=N.current;if(!e||!t||!e.createEditor)return null;ot();const n=We.current,o=n.diff?"diff":"single",r=j.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(D.current===o&&r===t&&i)return null;if(L.current)return L.current;P.current+=1;const l=P.current;le(!0);const a=(async()=>{try{T.current?.(),D.current=null,j.current=null,se(!1);const o=ct;if(n.diff?"function"==typeof e.createDiffEditor?(D.current="diff",await e.createDiffEditor(t,jr(n.originalCode),jr(n.updatedCode),o)):(D.current="single",await e.createEditor(t,jr(n.updatedCode??n.code),o)):(D.current="single",await e.createEditor(t,jr(n.code),o)),j.current=t,P.current!==l)return;const r=Number(Ce.fontSize),i=Number.isFinite(r)&&r>0?r:Br;if(Number.isFinite(i)&&i>0){Ne(i),Be(i);try{const t="diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.(),n=Er(Ce.lineHeight)??(i===Br?18:Math.max(12,Math.round(1.5*i)));t?.updateOptions?.({fontSize:i,lineHeight:n})}catch{}}if(Oe(),Ke(),Fe(),Re(pe),await Ie(),P.current!==l)return;Re(pe),se(!0),Ae(pe)}catch{P.current===l&&(G.current=ct,ee(!0))}})().finally(()=>{L.current===a&&(L.current=null)});return L.current=a,a},[Re,Oe,He,ge,pe,ct,Fe,Ce.fontSize,Ae,bt,Ke,ot,Q,te,Ie],mr);q(()=>{ot();const e=H.current!==u;H.current=u;const t=Le.current!==Ee;Le.current=Ee;const n=O.current;if(O.current=it,Q)return;if(!oe)return;let r=!1;if(e||t){const e=I.current;if(e){ze(),B.current=null,T.current=null;try{rt(e),r=!0}catch{return void ee(!0)}}}const i=Boolean(o.diff&&n!==it);if(!r&&!i)return;if(!te||!ie&&!r)return;if(ge||bt)return;let l=!1;return(async()=>{if(r||ze(),!l)try{await vt()}catch{}})(),()=>{l=!0}},[ge,u,ie,Ee,vt,rt,oe,it,o.diff,ze,bt,ot,Q,te],fr),q(()=>{if(Q){const e=G.current;if(void 0===e||e===ct)return;return G.current=void 0,ze(),void ee(!1)}oe&&te&&(ge||bt?ze():vt())},[ge,vt,ct,oe,ze,bt,Q,te],hr),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;const e=B.current;if(!e)return;const t=jr(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=zt(o.language)||ue;if(!n&&_.current)try{n=zt(_.current(t)),n&&me(n)}catch{}const r=st?"plaintext":Kt(n||at);if(e.createEditor&&N.current){try{await Promise.resolve(vt())}catch{}const e=L.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(jr(o.originalCode),jr(o.updatedCode),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}Ae(pe)})()},[at,ue,ge,ie,vt,pe,oe,o.code,o.diff,o.language,o.originalCode,o.updatedCode,Ae,st,bt,Q,te],pr),q(()=>{if(i)return;if(!oe||!te||ge||Q)return;const e=B.current;e&&(async()=>{try{o.diff&&e.finalizeDiff?await Promise.resolve(e.finalizeDiff()):e.finalizeCode&&await Promise.resolve(e.finalizeCode())}catch{}Ae(pe)})()},[ge,pe,i,o.diff,oe,Ae,Q,te],yr),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;if(!pe&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null;return null==e&&Ae(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,pe,i,oe,Ae,bt,Q,te],gr),q(()=>{if(!s)return;if(Q)return;const e=B.current;if(e){try{("diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:$e})}catch{}Ae(pe)}},[s,pe,$e,o.diff,Ae,Q],br),q(()=>{Te||jt(!0)},[Te],vr);const wt=K((e,t)=>{if(!Te)return;const n=e.currentTarget;n&&!n.disabled&&Dt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ze)},[Ze,Te],wr),xt=K(()=>{Te&&jt()},[Te],xr),kt=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(ht)),he(!0),n.onCopy?.(String(ht)),setTimeout(()=>he(!1),1e3)}catch{}},[n,ht],kr),Ct=K(()=>{if(!mt)return;const e="html"===at?"text/html":"image/svg+xml",t="html"===at?Se("artifacts.htmlPreviewTitle")||"HTML Preview":Se("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===at&&we(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${at}-${Date.now()}`})},[at,mt,o,n,Se],Sr);return x(Mr,{h0:$,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Je?"border-gray-700/30":"border-gray-200",i?"is-rendering":"",Je?"is-dark":"",o.diff?"is-diff":"",dt?"is-plain-text":""].join(" "),h2:pt,h3:p&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:yt},()=>E([S("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden"},()=>E([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:ut}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>ft)])),S("div",{className:"flex items-center space-x-2"},()=>E([v&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":ge,onClick:()=>be(e=>!e),onMouseEnter:e=>wt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onFocus:e=>wt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onMouseLeave:xt,onBlur:xt},()=>C(()=>x("svg",{style:{rotate:ge?"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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),w&&s&&S(t,{},()=>E([C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e<=10,onClick:()=>Be(e=>Math.max(10,e-1)),onMouseEnter:e=>wt(e,Se("common.decrease")||"Decrease"),onFocus:e=>wt(e,Se("common.decrease")||"Decrease"),onMouseLeave:xt,onBlur:xt},x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e===Me,onClick:()=>Be(Me),onMouseEnter:e=>wt(e,Se("common.reset")||"Reset"),onFocus:e=>wt(e,Se("common.reset")||"Reset"),onMouseLeave:xt,onBlur:xt},x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),x("path",{d:"M3 3v5h5"}))))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e>=36,onClick:()=>Be(e=>Math.min(36,e+1)),onMouseEnter:e=>wt(e,Se("common.increase")||"Increase"),onFocus:e=>wt(e,Se("common.increase")||"Increase"),onMouseLeave:xt,onBlur:xt},x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),y&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy",onClick:kt,onMouseEnter:e=>wt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onFocus:e=>wt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onMouseLeave:xt,onBlur:xt},()=>x("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"},fe?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),g&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":pe,onClick:e=>{ye(e=>!e),wt(e,pe?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse")},onMouseEnter:e=>wt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onFocus:e=>wt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onMouseLeave:xt,onBlur:xt},()=>x("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"},x("path",pe?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})))),mt&&b&&C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Se("common.preview")||"Preview",onClick:Ct,onMouseEnter:e=>wt(e,Se("common.preview")||"Preview"),onFocus:e=>wt(e,Se("common.preview")||"Preview"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},x("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"},x("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"}),x("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"})))))]))]))),h4:`code-block-body${ge?" code-block-body--collapsed":""}${pe?" code-block-body--expanded":""}`,h5:!ge&&(!!l||!i)&&C(Q?()=>x(Tn,{className:"code-fallback-plain m-0",diffInline:et,node:o,showLineNumbers:Ee,style:tt}):()=>x(Tr,{editorHostRef:N,editorReady:ae,node:o,preFallbackDiffInline:et,preFallbackStyle:tt,showLineNumbers:Ee,stream:l})),h6:!l&&i&&x("div",{className:"code-loading-placeholder"},x("div",{className:"loading-skeleton"},x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line short"}))),h7:ve&&!n.onPreviewCode&&mt&&"html"===at&&C(()=>x(ln,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>we(!1)})),h8:fe?Se("common.copied")||"Copied":""})}function Ar(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Ar(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Fr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ar(e))&&(o&&(o+=" "),o+=t);return o}Tr.$$singleRoot=!0,Rr.$$singleRoot=!0;var Ir=()=>import("@terrastruct/d2"),Hr=null,Or=Ir;function Wr(e){Or=e,Hr=null}function zr(e){Wr(e??Ir)}function Kr(){Wr(null)}function Vr(){return"function"==typeof Or}var qr=/* @__PURE__ */W("<div><!><!></div>"),Ur=/* @__PURE__ */N(41),Xr=/* @__PURE__ */Symbol(Ur),Yr=/* @__PURE__ */Symbol(Ur+1),Zr=/* @__PURE__ */Symbol(Ur+2),Gr=/* @__PURE__ */Symbol(Ur+3),Jr=/* @__PURE__ */Symbol(Ur+4),Qr=/* @__PURE__ */Symbol(Ur+5),ei=/* @__PURE__ */Symbol(Ur+6),ti=/* @__PURE__ */Symbol(Ur+7),ni=/* @__PURE__ */Symbol(Ur+8),oi=/* @__PURE__ */Symbol(Ur+9),ri=/* @__PURE__ */Symbol(Ur+10),ii=/* @__PURE__ */Symbol(Ur+11),li=/* @__PURE__ */Symbol(Ur+12),ai=/* @__PURE__ */Symbol(Ur+13),si=/* @__PURE__ */Symbol(Ur+14),ci=/* @__PURE__ */Symbol(Ur+15),di=/* @__PURE__ */Symbol(Ur+16),ui=/* @__PURE__ */Symbol(Ur+17),mi=/* @__PURE__ */Symbol(Ur+18),fi=/* @__PURE__ */Symbol(Ur+19),hi=/* @__PURE__ */Symbol(Ur+20),pi=/* @__PURE__ */Symbol(Ur+21),yi=/* @__PURE__ */Symbol(Ur+22),gi=/* @__PURE__ */Symbol(Ur+23),bi=/* @__PURE__ */Symbol(Ur+24),vi=/* @__PURE__ */Symbol(Ur+25),wi=/* @__PURE__ */Symbol(Ur+26),xi=/* @__PURE__ */Symbol(Ur+27),ki=/* @__PURE__ */Symbol(Ur+28),Si=/* @__PURE__ */Symbol(Ur+29),Ci=/* @__PURE__ */Symbol(Ur+30),Mi=/* @__PURE__ */Symbol(Ur+31),Ni=/* @__PURE__ */Symbol(Ur+32),$i=/* @__PURE__ */Symbol(Ur+33),Bi=/* @__PURE__ */Symbol(Ur+34),Ti=/* @__PURE__ */Symbol(Ur+35),Ei=/* @__PURE__ */Symbol(Ur+36),Li=/* @__PURE__ */Symbol(Ur+37),Di=/* @__PURE__ */Symbol(Ur+38),ji=/* @__PURE__ */Symbol(Ur+39),Pi=/* @__PURE__ */Symbol(Ur+40),_i=["r","a","b"],Ri=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,s,c,d,u;const m=v(qr);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=m,s=m;const f=g(m);c=f,d=m,u=H(f,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=_i}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const n=e.h2,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.h!==n){r.h=n;const e=r.g;null==e||o||null===n?r.g=z(t,1,r.e,n,r.f,!0):I(e,n)}}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,2,r.i,n,r.j,!0):I(e,n)}}}),Ai={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Fi={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"},Ii=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Hi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Oi(e){if(!e)return"";const t=e.trim();return Hi.test(t)?t:""}function Wi(e){const n={...Ai,...e},{t:o}=J(Xr,St,Xr),[r,i]=Z(!1,Yr),[l,a]=Z(!1,Zr),[s,c]=Z(!1,Gr),[d,u]=Z(!1,Jr),[m,f]=Z(null,Qr),[h,p]=Z("",ei),[y,g]=Z(null,ti),[b,v]=Z(!1,ni),[w,k]=Z(()=>"undefined"==typeof window,oi),M=Y(0,ri),N=Y(null,ii),$=Y(!1,li),B=Y(!1,ai),T=Y(0,si),L=Y(null,ci),D=Y(!1,di),j=Y(null,ui),P=Y(null,mi),_=Y(null,fi),R=Y(null,hi),A=Y(!1,pi),F=Y(()=>{},yi),I=J(gi,Ge,gi),H=n.node?.code??"",O=s||!d||!h,W=!!h,z=X(()=>{if(n.maxHeight)return{maxHeight:"number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight)}},[n.maxHeight],bi),V=X(()=>{if(O&&y)return{minHeight:`${y}px`}},[y,O],vi);q(()=>{A.current=b},[b],wi),q(()=>{const e=j.current;if(!e)return;const t=I(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),P.current=null}},[I],xi);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&g(e=>e!==t?t:e)},[],ki),G=K((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!w)return;if(A.current)return void(D.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-T.current;if(!e&&o<t)return D.current=!0,void(null==L.current&&(L.current=window.setTimeout(()=>{L.current=null,D.current&&(D.current=!1,G(!0))},Math.max(0,t-o))));$.current=!0;const r=()=>{$.current=!1,T.current=Date.now(),F.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[n.progressiveIntervalMs,w],Si),Q=K(async()=>{if(N.current)return N.current;const e=await async function(){if(Hr)return Hr;const e=Or;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Ir)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Hr=function(e){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 t=e.default??e;return"function"==typeof t?t:t?.D2&&"function"==typeof t.D2?t.D2:t}(t),Hr):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?N.current=t:"function"==typeof e.compile&&(N.current=e),N.current}return e?.D2&&"function"==typeof e.D2?(N.current=new e.D2,N.current):("function"==typeof e.compile&&(N.current=e),N.current)},[],Ci),ee=K(async()=>{if("undefined"==typeof window||B.current)return;if(!w)return;if(n.loading&&!n.progressiveRender)return;if(!H)return p(""),void f(null);const e=++M.current;v(!0),f(null);try{const t=await Q();if(!t)return u(!1),c(!0),p(""),void f("D2 is not available.");if("function"!=typeof t.compile||"function"!=typeof t.render)throw new Error("D2 instance is missing compile/render methods.");u(!0);const o=await t.compile(H);if(e!==M.current)return;const r=o?.diagram??o,i=o?.renderOptions??o?.options??{},l=n.themeId??i.themeID,a=n.darkThemeId??i.darkThemeID,s={...i};if(s.themeID=n.isDark&&null!=a?a:l,s.darkThemeID=null,s.darkThemeOverrides=null,n.isDark){const e=i.themeOverrides&&"object"==typeof i.themeOverrides?i.themeOverrides:null;s.themeOverrides={...Fi,...e||{}}}const d=await t.render(r,s);if(e!==M.current)return;const m=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(d);if(!m)throw new Error("D2 render returned empty output.");const h=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 o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ii.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Oi(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(m);p(h||""),n.loading&&c(!1),f(null)}catch(t){if(e!==M.current)return;const o=t?.message?String(t.message):"D2 render failed.";n.loading||f(o),o.includes("@terrastruct/d2")&&(u(!1),c(!0))}finally{e===M.current&&(v(!1),D.current&&(D.current=!1,G()))}},[H,Q,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,G,w],Mi);q(()=>{F.current=ee},[ee],Ni);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(H),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[H],$i),ne=K(()=>{if(h)try{const e=new Blob([h],{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)}},[h],Bi),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Dt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Ti),re=K(()=>{jt()},[],Ei);return q(()=>{G()},[H,n.loading,n.isDark,G],Li),q(()=>{n.loading||G(!0)},[n.loading,G],Di),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[O,h,H,U],ji),q(()=>{B.current=!1,G();const e=requestAnimationFrame(()=>U());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{U()});R.current=e,_.current&&e.observe(_.current)}return()=>{B.current=!0,null!=L.current&&(clearTimeout(L.current),L.current=null),R.current?.disconnect(),R.current=null,cancelAnimationFrame(e)}},[G,U],Pi),x(Ri,{h0:j,h1:Fr("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),h2:n.showHeader&&C(()=>S("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)"}},()=>E([x("div",{className:"flex items-center gap-x-2"},x("span",{className:"text-sm font-medium font-mono"},"D2")),S("div",{className:"flex items-center gap-x-2"},()=>E([n.showModeToggle&&C(()=>S("div",{className:Fr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>E([C(()=>S("button",{type:"button",className:Fr("mode-btn px-2 py-1 text-xs rounded",!s&&"is-active"),onClick:()=>c(!1),onMouseEnter:e=>oe(e,o("common.preview")||"Preview"),onFocus:e=>oe(e,o("common.preview")||"Preview"),onMouseLeave:re,onBlur:re},()=>o("common.preview")||"Preview")),C(()=>S("button",{type:"button",className:Fr("mode-btn px-2 py-1 text-xs rounded",s&&"is-active"),onClick:()=>c(!0),onMouseEnter:e=>oe(e,o("common.source")||"Source"),onFocus:e=>oe(e,o("common.source")||"Source"),onMouseLeave:re,onBlur:re},()=>o("common.source")||"Source"))]))),n.showCopyButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":r?o("common.copied")||"Copied":o("common.copy")||"Copy",onClick:te,onMouseEnter:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onFocus:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onMouseLeave:re,onBlur:re},()=>x("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"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":o("common.export")||"Export",onClick:ne,onMouseEnter:e=>oe(e,o("common.export")||"Export"),onFocus:e=>oe(e,o("common.export")||"Export"),onMouseLeave:re,onBlur:re},x("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"},x("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"})))),n.showCollapseButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":l,onClick:()=>a(e=>!e),onMouseEnter:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onFocus:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re},()=>C(()=>x("svg",{style:{transform:`rotate(${l?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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})))))]))]))),h3:!l&&C(()=>S("div",{ref:_,className:"d2-block-body",style:V},()=>n.loading&&!W?S("div",{className:"d2-source px-4 py-4"},()=>E([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>E([O?S("div",{className:"d2-source px-4 py-4"},()=>E([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):C(()=>S("div",{className:"d2-render",style:z},()=>E([C(()=>x("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:h}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}Wi.$$singleRoot=!0;var zi=/* @__PURE__ */W('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),Ki=/* @__PURE__ */W('<dl class="definition-list"><!></dl>'),Vi=(e,t)=>`${String(indexKey??"definition")}-${t}`;function qi(e,t,n){const o=t.block,[r,i,l]=n,a=o.itemIndex;let s=t.slots[0];if(void 0===s){let e,n;const o=v(zi),r=g(o);e=r,n=H(r,1),s=f(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?Le(e.term,r,`${String(i??"definition")}-term-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.c!==n){const e=s.b;null==e||o||null===n?s.b=b(t,1,s.a,n,e):I(e,n),s.c=n}}{const n=r&&l?Le(e.definition,r,`${String(i??"definition")}-desc-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.f!==n){const e=s.e;null==e||o||null===n?s.e=b(t,2,s.d,n,e):I(e,n),s.f=n}}}var Ui=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=v(Ki);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(P(o.b,"data-index-key",t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,Vi,qi,18,[e.h4,e.h5,e.h6],o.d,1)});function Xi(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(Ui,{h0:r,h1:i,h2:i.map,h3:(e,t)=>S("div",{key:`${String(r??"definition")}-${t}`,className:"mb-4"},()=>E([S("dt",{className:"definition-term font-semibold"},()=>n&&o?Le(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?Le(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}Xi.$$singleRoot=!0;var Yi=/* @__PURE__ */W('<span class="emoji-node"></span>'),Zi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Yi);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Gi(e){const{node:t}=e;return x(Zi,{h0:t.name??t.markup})}Gi.$$singleRoot=!0;var Ji=/* @__PURE__ */W('<em class="emphasis-node"></em>'),Qi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Ji);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function el(e){return x(Qi,{h0:e.children})}el.$$singleRoot=!0,M(["click"]);var tl=/* @__PURE__ */W('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),nl=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),ol=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=v(tl);n=l,r=l,i=l,l.$$click=e.h2,o=m(t,l,void 0,n,void 0,r,i)}else o.e.$$click=e.h2;{const t=e.h0;o.a!==t&&(P(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"title",t),o.c=t)}});function rl(e){const{node:t}=e,n=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=document.getElementById(`fnref-${String(t.id??"")}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],nl);return x(ol,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}rl.$$singleRoot=!0;var il=/* @__PURE__ */W('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),ll=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(il);e=r,n=g(r),o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function al(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return x(ll,{h0:`fnref--${t.id}`,h1:n&&o?Ee(t.children,n,String(r??`footnote-${t.id}`),o):null})}al.$$singleRoot=!0,M(["click"]);var sl=/* @__PURE__ */W('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),cl=/* @__PURE__ */N(3),dl=/* @__PURE__ */Symbol(cl),ul=/* @__PURE__ */Symbol(cl+1),ml=/* @__PURE__ */Symbol(cl+2),fl=["s","h","g"],hl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,s,c,d,u,m;const f=v(sl);n=f,r=f,f.$$click=e.h1;const h=g(f);i=O(e.h2),l=e.h3,s="footnote-link cursor-pointer",c=h,d=A(h,[[!0,i],[!1,"title",l],[!1,"className",s]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.h;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.g)}),T(h),u=h,m=H(g(h),1),o=a(t,f,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=fl}else{o.c.$$click=e.h1,o.d=O(e.h2);{const t=e.h3;o.e!==t&&(o.e=t)}{const e="footnote-link cursor-pointer";o.f!==e&&(o.f=e)}o.h=A(o.g,[[!0,o.d],[!1,"title",o.e],[!1,"className",o.f]],o.h,t,!0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.l!==n){o.l=n;const e=o.k;null==e||r||null===n?o.k=z(t,1,o.i,n,o.j,!0):I(e,n)}}});function pl(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],dl),o=X(()=>({href:n}),[n],ul),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(n);t&&t.scrollIntoView({behavior:"smooth"})},[n],ml);return x(hl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}pl.$$singleRoot=!0;var yl=/* @__PURE__ */W('<br class="hard-break"/>'),gl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,v(yl)))});function bl(e){return x(gl,{})}function vl(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e,l=Math.min(6,Math.max(1,Number(t.level)||1)),a=`h${l}`,{class:s,className:c,style:d,...u}=t?.attrs??{};return S(a,{dir:"auto",className:Fr("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?Ee(t.children,n,String(r??`heading-${l}`),o):null))}bl.$$singleRoot=!0;var wl=/* @__PURE__ */W('<mark class="highlight-node"></mark>'),xl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(wl);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function kl(e){return x(xl,{h0:e.children})}function Sl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Cl(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 o of t.split(";")){const e=o.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const r=Sl(e.slice(0,t).trim()),i=e.slice(t+1).trim();r&&(n[r]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}kl.$$singleRoot=!0;var Ml=we,Nl=ue;function $l(e,t){return ie(e,t)}function Bl(e,t){return re(e,t)}function Tl(e,t,n=!1){const o=Object.entries(t??{}),r=o.length>0?o.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${r} />`:`<${e}${r}>`}function El(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Ll(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Dl(t){if(null==t||"boolean"==typeof t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return t.map(Dl).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Dl(n.props.children);const o=Object.entries(n.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${n.type}${o}>${Dl(n.props.children)}</${n.type}>`}function jl(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Pl(e){const t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||Boolean(t?.loading));return{loading:n,autoClosed:n||Boolean(t?.autoClosed)}}function _l(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Rl(t,n,o,r,i,l,a,s=Pl(i)){const c=ce(t),d=l??function(e){return e.map(Dl).join("")}(o),u={type:c,tag:c,attrs:jl(n),content:d,raw:a??`${Tl(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Ll(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Al=/* @__PURE__ */W("<div></div>"),Fl=/* @__PURE__ */N(22),Il=/* @__PURE__ */Symbol(Fl),Hl=/* @__PURE__ */Symbol(Fl+1),Ol=/* @__PURE__ */Symbol(Fl+2),Wl=/* @__PURE__ */Symbol(Fl+3),zl=/* @__PURE__ */Symbol(Fl+4),Kl=/* @__PURE__ */Symbol(Fl+5),Vl=/* @__PURE__ */Symbol(Fl+6),ql=/* @__PURE__ */Symbol(Fl+7),Ul=/* @__PURE__ */Symbol(Fl+8),Xl=/* @__PURE__ */Symbol(Fl+9),Yl=/* @__PURE__ */Symbol(Fl+10),Zl=/* @__PURE__ */Symbol(Fl+11),Gl=/* @__PURE__ */Symbol(Fl+12),Jl=/* @__PURE__ */Symbol(Fl+13),Ql=/* @__PURE__ */Symbol(Fl+14),ea=/* @__PURE__ */Symbol(Fl+15),ta=/* @__PURE__ */Symbol(Fl+16),na=/* @__PURE__ */Symbol(Fl+17),oa=/* @__PURE__ */Symbol(Fl+18),ra=/* @__PURE__ */Symbol(Fl+19),ia=/* @__PURE__ */Symbol(Fl+20),la=/* @__PURE__ */Symbol(Fl+21),aa=["s","e","d"],sa=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s;const c=v(Al);n=e.h0,r="html-block-node",i=O(e.h1),l=c,a=A(c,[[!1,"ref",n],[!1,"className",r],[!0,i]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.e;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.d)}),s=c,o=p(t,c,n,r,i,l,a,s,null,void 0),t.refFields=aa}else{{const t=e.h0;o.a!==t&&(o.a=t)}{const e="html-block-node";o.b!==e&&(o.b=e)}o.c=O(e.h1),o.e=A(o.d,[[!1,"ref",o.a],[!1,"className",o.b],[!0,o.c]],o.e,t,!0)}{const n=e.h2;o.g=b(t,1,o.f,n,o.g),o.h=n}});function ca(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(Il,Ge,Il),[s,c]=Z(null,Hl),d=Y(null,Ol),[u,m]=Z(()=>"undefined"==typeof window,Wl),[f,h]=Z(o.content,zl),p=Boolean(o.loading),y=G(nt,ot,ot,Kl),g=X(()=>({...n.customComponents??n.ctx?.customComponents??it(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,y],Vl),b=X(()=>({...g,...n.ctx?.streamingComponents??{}}),[g,n.ctx?.streamingComponents],ql);q(()=>{if("undefined"==typeof window)return void m(!0);if(d.current?.destroy(),d.current=null,!p)return m(!0),void h(o.content);if(!s)return void m(!1);const e=a(s,{rootMargin:"400px"});return d.current=e,e.isVisible()&&m(!0),e.whenVisible.then(()=>m(!0)).catch(()=>{}),()=>{e.destroy(),d.current=null}},[s,p,o.content,a],Ul),q(()=>()=>{d.current?.destroy(),d.current=null},[],Xl),q(()=>{p&&!u||h(o.content)},[p,o.content,u],Yl);const v=X(()=>{const e=Te(fe(o.attrs??void 0,l));return e?Cl(e):void 0},[l,o.attrs],Zl),w=X(()=>String(o.tag??"").trim(),[o.tag],Gl),k=X(()=>ce(w),[w],Jl),M=X(()=>{const e=Te(fe(o.attrs??void 0,l,w));return e?Cl(e):void 0},[l,o.attrs,w],Ql),N=X(()=>te(ve(fe(o.attrs??void 0,l,k))),[l,o.attrs,k],ea),$=X(()=>Array.isArray(o.children)?o.children:[],[o.children],ta),B=$.length>0&&!!w&&!ee.has(w.toLowerCase())&&!le(w,l)&&!!n.ctx&&!!n.renderNode,T=X(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(M),[M],na),L=X(()=>"escape"!==l&&Bl(o.content??"",b),[b,l,o.content],oa),D=X(()=>L&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Ml(t);let l=0;const a=r.keyPrefix??"ms-html",s=[],c=[];for(const t of i){if("text"===t.type){if(s.length>0&&s[s.length-1].hardBlocked)continue;(s.length>0?s[s.length-1].children:c).push(t.content??""),s.length>0&&s[s.length-1].sourceParts.push(t.content??"");continue}const i=t.tagName;if(void 0===i)return null;if("self_closing"===t.type){const d=t.attrs||{},u=Tl(i,d,!0),m=$l(i,n),f=Boolean(Ll(i,r));if(Q.has(i.toLowerCase())||!m&&!f&&ae(i,o))continue;if(!m&&!f&&le(i,o)){(s.length>0?s[s.length-1].children:c).push(u),s.length>0&&s[s.length-1].sourceParts.push(u);continue}const h=Nl(d,o,i),p=h.key,y=null!=p&&""!==p?p:`${a}-${l++}`,g=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(f)b.push(Rl(i,d,[],y,r,"",u,{loading:!1,autoClosed:!1}));else if(g){const t=_l(i,h,r);b.push(e.createElement(g,{...t,key:y}))}else b.push(e.createElement(i,{...Cl(h),key:y,suppressHydrationWarning:!0}));s.length>0&&s[s.length-1].sourceParts.push(u);continue}if("tag_open"===t.type){const e=s.length>0&&s[s.length-1].hardBlocked,l=$l(i,n),a=Boolean(Ll(i,r));s.push({tagName:i,children:[],attrs:t.attrs,sourceParts:[],customComponent:l||a,hardBlocked:e||Q.has(i.toLowerCase())||!l&&!a&&ae(i,o),softBlocked:!e&&!l&&!a&&le(i,o)});continue}const d=i.toLowerCase();let u=-1;for(let e=s.length-1;e>=0;e--)if(s[e].tagName.toLowerCase()===d){u=e;break}if(-1!==u)for(;s.length>u;){const t=s.pop();if(!t)continue;const i=t.sourceParts.join(""),u=`${Tl(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[Tl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=Nl(t.attrs||{},o,t.tagName),c=s.key,f=null!=c&&""!==c?c:`${a}-${l++}`,h=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;if(Boolean(Ll(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Pl(r);m=Rl(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{..._l(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{...Cl(s),key:f,suppressHydrationWarning:!0},...t.children)}s.length>0?El(s[s.length-1].children,m):El(c,m),s.length>0&&!t.hardBlocked&&s[s.length-1].sourceParts.push(u)}}for(;s.length>0;){const t=s.pop();if(!t||t.hardBlocked)continue;const i=t.sourceParts.join(""),d=`${Tl(t.tagName,t.attrs)}${i}`;if(t.softBlocked){El(c,[Tl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=Nl(t.attrs||{},o,t.tagName),m=u.key,f=null!=m&&""!==m?m:`${a}-${l++}`,h=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;let p;p=Boolean(Ll(t.tagName,r))?Rl(t.tagName,t.attrs||{},t.children,f,r,i,d,Pl(r)):h?e.createElement(h,{..._l(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{...Cl(u),key:f,suppressHydrationWarning:!0},...t.children),c.push(p),s.length>0&&s[s.length-1].sourceParts.push(d)}return c}catch{return null}}(o.content,g,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[g,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,L],ra),j=X(()=>me(f??"",l),[l,f],ia),P=X(()=>B&&n.ctx&&n.renderNode?Ee($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],la),_=k?n.ctx?.htmlComponents?.[k]:void 0,R=S("div",{className:"html-block-node__placeholder"},()=>r??E([x("span",{className:"html-block-node__placeholder-bar"}),x("span",{className:"html-block-node__placeholder-bar w-4/5"}),x("span",{className:"html-block-node__placeholder-bar w-2/3"})]));return B&&_?e.createElement(_,N,P)??null:B?e.createElement(w,{...T,ref:c},u?P:R)??null:x(sa,{h0:c,h1:v,h2:u?L&&D?S(t,{},()=>E([D])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:j}})):R})}var da=/* @__PURE__ */W('<span class="html-inline-node"></span>'),ua=/* @__PURE__ */N(13),ma=/* @__PURE__ */Symbol(ua),fa=/* @__PURE__ */Symbol(ua+1),ha=/* @__PURE__ */Symbol(ua+2),pa=/* @__PURE__ */Symbol(ua+3),ya=/* @__PURE__ */Symbol(ua+4),ga=/* @__PURE__ */Symbol(ua+5),ba=/* @__PURE__ */Symbol(ua+6),va=/* @__PURE__ */Symbol(ua+7),wa=/* @__PURE__ */Symbol(ua+8),xa=/* @__PURE__ */Symbol(ua+9),ka=/* @__PURE__ */Symbol(ua+10),Sa=/* @__PURE__ */Symbol(ua+11),Ca=/* @__PURE__ */Symbol(ua+12),Ma=["r","a","b"],Na=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=v(da);{const l=e.h0;n=l,i=a,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=a,r=u(t,a,n,i,void 0,l),t.refFields=Ma}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(F(r.d,t,r.c),r.c=t)}}),$a=(()=>{try{return Boolean(!1)}catch{}return!1})();function Ba(e){$a&&console.warn(e)}function Ta(e,t,n=!1){const o=Object.entries(t??{}),r=o.length>0?o.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${r} />`:`<${e}${r}>`}function Ea(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function La(e,t){for(const n of Ml(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if($l(e,t)&&"block"===st(t[e]||t[e.toLowerCase()]))return!0}return!1}function Da(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function ja(t){if(null==t||"boolean"==typeof t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return t.map(ja).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return ja(n.props.children);const o=Object.entries(n.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${n.type}${o}>${ja(n.props.children)}</${n.type}>`}function Pa(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function _a(e){const t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||Boolean(t?.loading));return{loading:n,autoClosed:n||Boolean(t?.autoClosed)}}function Ra(t,n,o,r,i,l,a,s,c,d){const u=$l(t,r),m=Boolean(Da(t,a));if(Q.has(t.toLowerCase())||!u&&!m&&ae(t,l))return null;if(!u&&!m&&le(t,l))return[Ta(t,n),...o,`</${t}>`];const f=Nl(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=_a(i)){const c=ce(t),d=l??function(e){return e.map(ja).join("")}(o),u={type:c,tag:c,attrs:Pa(n),content:d,raw:a??`${Ta(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Da(t,i);return m?e.createElement(m,{key:r,node:u}):null}(t,n,o,String(p),a,s,c,d);if(u){const n=r[t]||r[t.toLowerCase()],i=te(f);return e.createElement(n,{...i,key:p},...o)}return e.createElement(t,{...Cl(f),key:p},...o)}function Aa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Y(null,ma),[a,s]=Z(!1,fa);q(()=>{s(!0)},[],ha);const c=e.useMemo(()=>({...n.ctx?.customComponents??it(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],pa),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],ya),u=e.useMemo(()=>me(o.content??"",i),[i,o.content],ga),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],ba),f=e.useMemo(()=>ce(m),[m],va),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],wa),p=e.useMemo(()=>te(ve(fe(o.attrs??void 0,i,f))),[i,o.attrs,f],xa),y=f?n.ctx?.htmlComponents?.[f]:void 0,g=h.length>0&&!!m&&"escape"!==i&&!le(m,i)&&!!n.ctx&&!!n.renderNode&&!!y,b=e.useMemo(()=>g&&n.ctx&&n.renderNode?Ee(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[g,n.ctx,n.indexKey,n.renderNode,h],ka),v=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Bl(e,d))return{mode:"html",content:e};const t=function(e,t,n="safe",o={}){if(!e)return[];try{return function(e,t,n="safe",o={}){let r=0;const i=o.keyPrefix??"ms-html",l=[],a=[];for(const s of e)if("text"===s.type){if(l.length>0&&l[l.length-1].hardBlocked)continue;(l.length>0?l[l.length-1].children:a).push(s.content),l.length>0&&l[l.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},c=Ta(s.tagName,e,!0),d=$l(s.tagName,t),u=Boolean(Da(s.tagName,o));if(Q.has(s.tagName.toLowerCase())||!d&&!u&&ae(s.tagName,n))continue;if(!d&&!u&&le(s.tagName,n)){(l.length>0?l[l.length-1].children:a).push(c),l.length>0&&l[l.length-1].sourceParts.push(c);continue}const m=Ra(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});Ea(l.length>0?l[l.length-1].children:a,m),l.length>0&&l[l.length-1].sourceParts.push(c)}else if("tag_open"===s.type){const e=l.length>0&&l[l.length-1].hardBlocked,r=$l(s.tagName,t),i=Boolean(Da(s.tagName,o));l.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:r||i,hardBlocked:e||Q.has(s.tagName.toLowerCase())||!r&&!i&&ae(s.tagName,n),softBlocked:!e&&!r&&!i&&le(s.tagName,n)})}else if("tag_close"===s.type){const e=s.tagName.toLowerCase();let c=-1;for(let t=l.length-1;t>=0;t--)if(l[t].tagName.toLowerCase()===e){c=t;break}if(-1!==c)for(;l.length>c;){const s=l.pop(),d=s.sourceParts.join(""),u=`${Ta(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Ta(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:_a(o);m=Ra(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?Ea(l[l.length-1].children,m):Ea(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Ba(`Auto-closing unclosed tag: <${s.tagName}>`)}else Ba(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${Ta(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[Ta(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ra(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,_a(o)),Ea(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Ba(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Ml(e),t,n,o)}catch(i){return r=i,$a&&console.error("Failed to parse HTML to Octane nodes:",r),null}var r}(e,c,i,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-inline"),nodeComponents:n.ctx?.streamingComponents,renderNode:n.renderNode,sourceNode:o});return null===t?{mode:"html",content:e}:{mode:"dynamic",block:La(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],Sa);return q(()=>{if(!a||!l.current||"html"!==v.mode)return;const e=l.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=u,e.appendChild(t.content.cloneNode(!0))},[v.mode,a,u],Ca),!o.loading||o.autoClosed||g||"dynamic"===v.mode?g?e.createElement(y,p,b)??null:"dynamic"===v.mode?v.block?S(t,{},()=>E([v.nodes])):C(()=>S("span",{className:"html-inline-node",style:{display:"inline"}},()=>v.nodes)):x(Na,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var Fa=/* @__PURE__ */N(5),Ia=/* @__PURE__ */Symbol(Fa),Ha=/* @__PURE__ */Symbol(Fa+1),Oa=/* @__PURE__ */Symbol(Fa+2),Wa=/* @__PURE__ */Symbol(Fa+3),za=/* @__PURE__ */Symbol(Fa+4),Ka={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Va(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function qa(e){const t={...Ka,...e},n=he(t.node.src),o=he(t.fallbackSrc),r=Va(n,o,t.node.loading),[i,l]=Z(!1,Ia),[a,s]=Z(!1,Ha),[c,d]=Z(r.src,Oa),[u,m]=Z(r.stage,Wa),f=c;q(()=>{const e=Va(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],za);const h=()=>{if("primary"===u&&o&&o!==c)return d(o),m("fallback"),l(!1),void s(!1);m("failed"),s(!0),t.onError?.(c)},p=()=>{l(!0),s(!1),t.onLoad?.(f)},y=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,f])};return!t.node.loading&&"failed"!==u&&f?C(()=>x("img",{key:"image",src:f,alt:String(t.node.alt??t.node.title??""),title:String(t.node.title??t.node.alt??""),className:"image-node__img"+(i?" is-loaded":""),loading:t.lazy?"lazy":"eager",decoding:"async",tabIndex:i?0:-1,"aria-label":t.node.alt??"Preview image",onError:h,onLoad:p,onClick:y})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?E([x("span",{className:"image-node__spinner","aria-hidden":"true"}),x("span",{className:"image-node__placeholder-text"},"Loading image...")]):S("span",{className:"image-node__placeholder-text"},()=>t.node.raw??"Loading image…")):t.node.loading||"failed"!==u?null:x("span",{className:"image-node__error"},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true"},x("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"})),x("span",{className:"image-node__placeholder-text"},"Image failed to load"))}function Ua(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Xa(e){const t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+60*t:360}function Ya(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var Za=null,Ga=null,Ja=/* @__PURE__ */N(35),Qa=/* @__PURE__ */Symbol(Ja),es=/* @__PURE__ */Symbol(Ja+1),ts=/* @__PURE__ */Symbol(Ja+2),ns=/* @__PURE__ */Symbol(Ja+3),os=/* @__PURE__ */Symbol(Ja+4),rs=/* @__PURE__ */Symbol(Ja+5),is=/* @__PURE__ */Symbol(Ja+6),ls=/* @__PURE__ */Symbol(Ja+7),as=/* @__PURE__ */Symbol(Ja+8),ss=/* @__PURE__ */Symbol(Ja+9),cs=/* @__PURE__ */Symbol(Ja+10),ds=/* @__PURE__ */Symbol(Ja+11),us=/* @__PURE__ */Symbol(Ja+12),ms=/* @__PURE__ */Symbol(Ja+13),fs=/* @__PURE__ */Symbol(Ja+14),hs=/* @__PURE__ */Symbol(Ja+15),ps=/* @__PURE__ */Symbol(Ja+16),ys=/* @__PURE__ */Symbol(Ja+17),gs=/* @__PURE__ */Symbol(Ja+18),bs=/* @__PURE__ */Symbol(Ja+19),vs=/* @__PURE__ */Symbol(Ja+20),ws=/* @__PURE__ */Symbol(Ja+21),xs=/* @__PURE__ */Symbol(Ja+22),ks=/* @__PURE__ */Symbol(Ja+23),Ss=/* @__PURE__ */Symbol(Ja+24),Cs=/* @__PURE__ */Symbol(Ja+25),Ms=/* @__PURE__ */Symbol(Ja+26),Ns=/* @__PURE__ */Symbol(Ja+27),$s=/* @__PURE__ */Symbol(Ja+28),Bs=/* @__PURE__ */Symbol(Ja+29),Ts=/* @__PURE__ */Symbol(Ja+30),Es=/* @__PURE__ */Symbol(Ja+31),Ls=/* @__PURE__ */Symbol(Ja+32),Ds=/* @__PURE__ */Symbol(Ja+33),js=/* @__PURE__ */Symbol(Ja+34),Ps=x("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"},x("g",{},x("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"}),x("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"}),x("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"}),x("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"}),x("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"}))),_s={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Rs(e){const n={..._s,...e},{t:o}=J(Qa,St,Qa),[r,i]=Z(!1,es),[l,a]=Z(!1,ts),[s,c]=Z(!1,ns),[d,u]=Z(!1,os),[m,f]=Z(()=>"undefined"==typeof window,rs),h=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?Ua(n.maxHeight):null,[n.maxHeight],is),y=X(()=>Ya(Ua(n.estimatedPreviewHeightPx)??Xa(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],ls),[g,b]=Z(`${y}px`,as),[v,w]=Z(!1,ss),[M,N]=Z(1,cs),[$,B]=Z({x:0,y:0},ds),[T,L]=Z(!1,us),D=Y(null,ms),j=Y(null,fs),P=Y(null,hs),_=Y(null,ps),R=Y(null,ys),A=Y({x:0,y:0},gs),F=Y(null,bs),I=J(vs,Ge,vs),H=K(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,y)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),y)}px`:`${Math.max(e,y)}px`},[y,n.maxHeight],ws),O=K(()=>{const e=D.current;if(!e)return;const t=e.scrollHeight;t>0&&b(H(t))},[H],xs);q(()=>{s||l||b(e=>{const t=Ua(e);return null!=t&&t>=y?e:`${y}px`})},[y,l,s],ks);const W=K(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],Ss),z=K(async()=>{if(!m)return;if(!D.current)return;const e=D.current;try{const t=await async function(){return Ga||Za||(Za=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),Ga=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Za)}();if(!t)return void console.warn("Infographic library failed to load.");F.current&&(F.current.destroy?.(),F.current=null),e.innerHTML="";const n=new t({container:e,width:"100%",height:"100%"});F.current=n,n.render(h),w(!0),setTimeout(()=>{O()},0)}catch(t){console.error("Failed to render infographic:",t),w(!1),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`}},[h,O,m],Cs);q(()=>{const e=j.current;if(!e)return;const t=I(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),P.current=null}},[I],Ms),q(()=>{!m||s||l||z()},[h,l,z,s,m],Ns),q(()=>()=>{F.current&&(F.current.destroy?.(),F.current=null)},[],$s);const V=K(()=>{u(!1),_.current&&(_.current.innerHTML=""),R.current=null,document.body.style.overflow=""},[],Bs),U=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Ts);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&V()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,V],Es),q(()=>{d&&setTimeout(()=>{if(D.current&&_.current){_.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=D.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),_.current.appendChild(e),R.current=e,e.style.transform=`translate(${$.x}px, ${$.y}px) scale(${M})`}},0)},[d],Ls),q(()=>{d&&R.current&&(R.current.style.transform=`translate(${$.x}px, ${$.y}px) scale(${M})`)},[d,$,M],Ds);const G=K(()=>{const e=D.current?.querySelector("svg");if(!e)return;const t=(new XMLSerializer).serializeToString(e),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=`infographic-${Date.now()}.svg`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)},[],js),Q=e=>{L(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;A.current={x:t-$.x,y:n-$.y}},ee=e=>{if(!T)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;B({x:t-A.current.x,y:n-A.current.y})},te=()=>L(!1),ne=n.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",oe=s||l;return S(t,{},()=>E([C(()=>S("div",{ref:j,"data-markstream-infographic":"1","data-markstream-mode":s?"source":v?"preview":"pending",className:Fr("my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":n.loading})},()=>E([n.showHeader&&C(()=>S("div",{className:Fr("flex justify-between items-center px-4 py-2.5 border-b",n.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200")},()=>E([S("div",{className:"flex items-center gap-x-2 overflow-hidden"},()=>E([Ps,C(()=>x("span",{className:Fr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:Fr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>E([C(()=>S("button",{className:Fr("px-2.5 py-1 text-xs rounded transition-colors",s?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>c(!1),onMouseEnter:e=>Dt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>S("div",{className:"flex items-center gap-x-1"},()=>E([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("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"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview")||"Preview")])))),C(()=>S("button",{className:Fr("px-2.5 py-1 text-xs rounded transition-colors",s?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>c(!0),onMouseEnter:e=>Dt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>S("div",{className:"flex items-center gap-x-1"},()=>E([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source")||"Source")]))))]))),S("div",{className:"flex items-center gap-x-1"},()=>E([n.showCollapseButton&&C(()=>S("button",{className:ne,onClick:()=>a(!l),onMouseEnter:e=>Dt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>C(()=>x("svg",{style:{rotate:l?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),n.showCopyButton&&C(()=>S("button",{className:ne,onClick:W,onMouseEnter:e=>Dt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&C(()=>x("button",{className:Fr(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:G,onMouseEnter:e=>Dt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>jt()},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&C(()=>S("button",{className:Fr(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:U,onMouseEnter:e=>Dt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},x("path",d?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),!l&&S("div",{},()=>s?C(()=>S("div",{className:Fr("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:Fr("text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)))):S("div",{className:"relative"},()=>E([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>E([C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>N(Math.min(M+.1,3))},"\n +\n ")),C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>N(Math.max(M-.1,.5))},"\n -\n ")),C(()=>S("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{N(1),B({x:0,y:0})}},()=>E([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{className:Fr("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:g,maxHeight:n.maxHeight??void 0},onMouseDown:Q,onMouseMove:ee,onMouseUp:te,onMouseLeave:te,onTouchStart:Q,onTouchMove:ee,onTouchEnd:te},()=>C(()=>S("div",{className:Fr("absolute inset-0 cursor-grab",T&&"cursor-grabbing"),style:{transform:`translate(${$.x}px, ${$.y}px) scale(${M})`}},()=>C(()=>x("div",{ref:D,className:"w-full text-center flex items-center justify-center min-h-full"}))))))])))]))),d&&"undefined"!=typeof document&&k(C(()=>S("div",{className:"markstream-octane fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:V,role:"dialog","aria-modal":"true"},()=>C(()=>S("div",{className:Fr("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",n.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation()},()=>E([S("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2"},()=>E([C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>N(Math.min(M+.1,3))},"+")),C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>N(Math.max(M-.1,.5))},"-")),C(()=>S("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{N(1),B({x:0,y:0})}},()=>E([Math.round(100*M),"\n %\n "]))),C(()=>x("button",{className:Fr("inline-flex items-center justify-center p-2 rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:V},"X"))])),C(()=>x("div",{ref:_,className:Fr("w-full h-full flex items-center justify-center p-4 overflow-hidden",!T&&"cursor-grab",T&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:ee,onMouseUp:te,onMouseLeave:te,onTouchStart:Q,onTouchMove:ee,onTouchEnd:te}))]))))),document.body)]))}var As=/* @__PURE__ */W('<code class="inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full"></code>'),Fs=/* @__PURE__ */N(6),Is=/* @__PURE__ */Symbol(Fs),Hs=/* @__PURE__ */Symbol(Fs+1),Os=/* @__PURE__ */Symbol(Fs+2),Ws=/* @__PURE__ */Symbol(Fs+3),zs=/* @__PURE__ */Symbol(Fs+4),Ks=/* @__PURE__ */Symbol(Fs+5),Vs=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(As);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function qs(e,t){return e.reduce((e,n)=>{const o=null==t||n.id===t?{...n,fading:!1}:n,r=e[e.length-1];return!r||r.fading||o.fading?e.push(o):e[e.length-1]={...r,content:r.content+o.content},e},[])}function Us(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.code??""),a=i??o?.fade??!0,s=null==r||""===r?"":String(r),[c,d]=Z(l?[{id:0,content:l,fading:!1}]:[],Is),u=J(Hs,We,Hs),m=Y(l,Os),f=Y(1,Ws),h=Y(void 0,zs);return q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==h.current;if(null!=n)return m.current="",d([]),void(h.current=e);const r=u?.textStreamState??o?.textStreamState,i=s?r?.get(s):void 0;let c=m.current;const p=Boolean(c===l&&i&&l.startsWith(i)&&l.length>i.length);if(p&&void 0!==i&&(c=i),a)if(l!==c)if(c&&l.startsWith(c)){const e=l.slice(c.length);d(t=>{if(p)return[{id:f.current++,content:c,fading:!1},{id:f.current++,content:e,fading:!0}];const n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:f.current++,content:e,fading:!0}]})}else d(l?[{id:f.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?qs(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:f.current++,content:l,fading:!1}]:[]:e);m.current=l,h.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],Ks),x(Vs,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void d(e=>e.some(e=>e.id===t&&e.fading)?qs(e,t):e);var t}:void 0},()=>e.content))})}Us.$$singleRoot=!0;var Xs=/* @__PURE__ */W('<ins class="insert-node"></ins>'),Ys=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Xs);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Zs(e){return x(Ys,{h0:e.children})}Zs.$$singleRoot=!0,M(["animationend"]);var Gs=/* @__PURE__ */W("<span></span>"),Js=/* @__PURE__ */W("<span><!></span>"),Qs=/* @__PURE__ */N(6),ec=/* @__PURE__ */Symbol(Qs),tc=/* @__PURE__ */Symbol(Qs+1),nc=/* @__PURE__ */Symbol(Qs+2),oc=/* @__PURE__ */Symbol(Qs+3),rc=/* @__PURE__ */Symbol(Qs+4),ic=/* @__PURE__ */Symbol(Qs+5),lc=e=>e.id;function ac(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=v(Gs);n=a,i=a,a.$$animationend=e.fading?()=>o(e.id):void 0,l=a,r=f(t,a,void 0,n,i,l,null,void 0)}else r.c.$$animationend=e.fading?()=>o(e.id):void 0;{const t=e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0;r.a!==t&&(R(r.b,t),r.a=t)}{const n=e.content,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.f!==n){const e=r.e;null==e||o||null===n?r.e=b(t,1,r.d,n,e):I(e,n),r.f=n}}}var sc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=v(Js);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,lc,ac,30,[e.h4],o.d,1)});function cc(e,t){return e.reduce((e,n)=>{const o=null==t||n.id===t?{...n,fading:!1}:n,r=e[e.length-1];return!r||r.fading||o.fading?e.push(o):e[e.length-1]={...r,content:r.content+o.content},e},[])}function dc(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.content??""),a=i??o?.fade??!0,s=null==r||""===r?"":String(r),[c,d]=Z(l?[{id:0,content:l,fading:!1}]:[],ec),u=J(tc,We,tc),m=Y(l,nc),f=Y(1,oc),h=Y(void 0,rc);q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==h.current;if(null!=n)return m.current="",d([]),void(h.current=e);const r=u?.textStreamState??o?.textStreamState,i=s?r?.get(s):void 0;let c=m.current;const p=Boolean(c===l&&i&&l.startsWith(i)&&l.length>i.length);if(p&&void 0!==i&&(c=i),a)if(l!==c)if(c&&l.startsWith(c)){const e=l.slice(c.length);d(t=>{if(p)return[{id:f.current++,content:c,fading:!1},{id:f.current++,content:e,fading:!0}];const n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:f.current++,content:e,fading:!0}]})}else d(l?[{id:f.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?cc(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:f.current++,content:l,fading:!1}]:[]:e);m.current=l,h.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],ic);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?cc(t,e):t)};return null!=n?C(()=>S("span",{className:Fr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):x(sc,{h0:Fr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center"),h1:c,h2:c.map,h3:e=>S("span",{key:e.id,className:e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>p(e.id):void 0},()=>e.content),h4:p})}M(["mouseenter","mouseleave"]);var uc=/* @__PURE__ */W('<a class="link-node"></a>',3),mc=/* @__PURE__ */N(4),fc=/* @__PURE__ */Symbol(mc),hc=/* @__PURE__ */Symbol(mc+1),pc=/* @__PURE__ */Symbol(mc+2),yc=/* @__PURE__ */Symbol(mc+3),gc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s,c,d,u;const m=v(uc);n=m,r=m,i=m,l=m,a=m,s=m,c=m,m.$$mouseenter=e.h6,d=m,m.$$mouseleave=e.h7,u=m,o=y(t,m,{a:void 0,b:n,c:void 0,d:r,e:void 0,f:i,g:void 0,h:l,i:void 0,j:a,k:void 0,l:s,m:c,n:d,o:u,p:null,q:void 0})}else o.m.$$mouseenter=e.h6,o.n.$$mouseleave=e.h7;{const t=e.h0;o.a!==t&&(P(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"title",t),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-label",t),o.e=t)}{const t=e.h3;o.g!==t&&(P(o.h,"target",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"rel",t),o.i=t)}{const t=e.h5;o.k!==t&&(F(o.l,t,o.k),o.k=t)}{const n=e.h8,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){const e=o.p;null==e||r||null===n?o.p=b(t,1,o.o,n,e):I(e,n),o.q=n}}});function bc(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=!1!==e.showTooltip,l=e.isDark??n?.isDark,a=X(()=>{const t=void 0!==e.underlineBottom?"number"==typeof e.underlineBottom?`${e.underlineBottom}px`:String(e.underlineBottom):"-3px",n=e.animationOpacity??.35,o=Math.max(.12,Math.min(.5*n,n));return{"--link-color":e.color??"#0366d6","--underline-height":`${e.underlineHeight??2}px`,"--underline-bottom":t,"--underline-opacity":String(n),"--underline-rest-opacity":String(o),"--underline-duration":`${e.animationDuration??1.6}s`,"--underline-timing":e.animationTiming??"ease-in-out","--underline-iteration":"number"==typeof e.animationIteration?String(e.animationIteration):e.animationIteration??"infinite"}},[e.animationDuration,e.animationIteration,e.animationOpacity,e.animationTiming,e.color,e.underlineBottom,e.underlineHeight],fc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],hc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&Dt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],pc),m=K(()=>{i&&jt()},[i],yc);return t.loading?C(()=>S("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:a},()=>S("span",{className:"link-text-wrapper relative inline-flex"},()=>E([S("span",{className:"leading-[normal] link-text"},()=>C(()=>x(dc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-loading`,typewriter:e.typewriter}))),x("span",{className:"link-loading-indicator","aria-hidden":"true"})])))):x(gc,{h0:s||void 0,h1:i?"":c,h2:`Link: ${c}`,h3:d?"_blank":void 0,h4:d?"noopener noreferrer":void 0,h5:a,h6:u,h7:m,h8:n&&o?Ee(t.children,n,String(r??"link"),o):C(()=>x(dc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var vc=/* @__PURE__ */W('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),wc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(vc);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"value",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function xc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(wc,{h0:null==r?void 0:r,h1:l??(n&&o?Ee(t.children,n,String(i??"list-item"),o):null)})}function kc(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=t.ordered?"ol":"ul",l=t.ordered&&t.start?t.start:void 0,a=n&&it(n.customId).list_item||xc;return S(i,{className:Fr("list-node my-5 pl-[calc(13/8*1em)]",t.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:l},()=>t.items?.map((e,i)=>x(a,{key:`${String(r??"list")}-${i}`,node:e,value:t.ordered?(t.start??1)+i:void 0,ctx:n,renderNode:o,indexKey:`${String(r??"list")}-${i}`,customId:n?.customId,isDark:n?.isDark,typewriter:n?.typewriter})))}function Sc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}xc.$$singleRoot=!0;var Cc=null,Mc=null,Nc=!1,$c=/* @__PURE__ */new Map,Bc=/* @__PURE__ */new Map,Tc=5,Ec=/* @__PURE__ */new Set;function Lc(){if($c.size<Tc&&Ec.size){const e=Array.from(Ec);Ec.clear();for(const t of e)try{t()}catch{}}}function Dc(e){Mc=null,(Cc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=$c.get(t);if(r)if($c.delete(t),clearTimeout(r.timeoutId),Lc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Bc.set(e,n),Bc.size>200){const e=Bc.keys().next();e.done||Bc.delete(e.value)}}r.resolve(n)}},Cc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of $c.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));$c.clear(),Lc()}}function jc(){Cc&&Cc.terminate?.(),Cc=null,Mc=null}function Pc(e){Nc=!!e,Cc&&Cc.postMessage({type:"init",debug:Nc})}var _c="WORKER_BUSY";async function Rc(e,t=!0,n=2e3,o){performance.now();const r=Sc(e);if(Mc)return Promise.reject(Mc);const i=`${t?"d":"i"}:${r}`,l=Bc.get(i);if(l)return Promise.resolve(l);const a=Cc||((Mc=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Mc.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Mc);if($c.size>=Tc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=_c,e.busy=!0,e.inFlight=$c.size,e.max=Tc,Promise.reject(e)}return new Promise((e,i)=>{if(o?.aborted){const e=/* @__PURE__ */new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),s=setTimeout(()=>{$c.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Lc()},n),c=()=>{},d=()=>{$c.delete(l),clearTimeout(s),Ec.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),Lc()};o&&o.addEventListener("abort",d,{once:!0}),$c.set(l,{resolve:t=>{o&&o.removeEventListener("abort",d),e(t)},reject:e=>{o&&o.removeEventListener("abort",d),i(e)},timeoutId:s});try{a.postMessage({id:l,content:r,displayMode:t,debug:Nc})}catch(u){$c.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),Lc()}})}function Ac(e,t,n){const o=`${t?"d":"i"}:${Sc(e)}`;if(Bc.set(o,n),Bc.size>200){const e=Bc.keys().next();e.done||Bc.delete(e.value)}}function Fc(){Bc.clear()}function Ic(e){Tc=Math.max(1,Math.floor(e)),Lc()}function Hc(e=1500,t){return $c.size<Tc?Promise.resolve():new Promise((n,o)=>{if(t?.aborted){const e=/* @__PURE__ */new Error("Aborted");return e.name="AbortError",void o(e)}let r=null;function i(){Ec.delete(l),null!=r&&clearTimeout(r),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",o(e)}r=e>0?setTimeout(()=>{i(),o(/* @__PURE__ */new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),Ec.add(l)})}var Oc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Wc(e){null!=e.timeout&&(Oc.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Oc.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Oc.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Oc.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function zc(){return{...Oc}}async function Kc(e,t=!0,n={}){const o=n.timeout??Oc.timeout,r=n.waitTimeout??Oc.waitTimeout,i=n.backoffMs??Oc.backoffMs,l=n.maxRetries??Oc.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):Oc.maxRetries,s=n.signal;let c=0;for(;;){if(s?.aborted){const e=/* @__PURE__ */new Error("Aborted");throw e.name="AbortError",e}try{return await Rc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await Hc(r,s).catch(()=>{}),s?.aborted){const e=/* @__PURE__ */new Error("Aborted");throw e.name="AbortError",e}i>0&&await new Promise(e=>setTimeout(e,i*c))}}}var Vc=null,qc=!1;async function Uc(){if(Vc)return Vc;if(qc)return null;try{return Vc=await import("katex"),await import("katex/contrib/mhchem"),Vc}catch{return qc=!0,null}}var Xc=/* @__PURE__ */W('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),Yc=/* @__PURE__ */N(9),Zc=/* @__PURE__ */Symbol(Yc),Gc=/* @__PURE__ */Symbol(Yc+1),Jc=/* @__PURE__ */Symbol(Yc+2),Qc=/* @__PURE__ */Symbol(Yc+3),ed=/* @__PURE__ */Symbol(Yc+4),td=/* @__PURE__ */Symbol(Yc+5),nd=/* @__PURE__ */Symbol(Yc+6),od=/* @__PURE__ */Symbol(Yc+7),rd=/* @__PURE__ */Symbol(Yc+8),id=["r","a","b","r","c","d"],ld=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=v(Xc);{const l=e.h0;n=l,i=c,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const d=c.firstChild;{const n=e.h1;l=n,a=d,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}s=d,r=f(t,c,n,i,l,a,void 0,s),t.refFields=id}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function ad({node:e}){const t=Y(null,Zc),n=Y(null,Gc),o=Y(null,Jc),r=J(Qc,Ge,Qc),[i,l]=Z(!0,ed),[a,s]=Z(()=>"undefined"==typeof window,td),c=Y(0,nd);return q(()=>{const e=t.current;if(!e)return;const n=r(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&s(!0),n.whenVisible.then(()=>s(!0)),()=>{n.destroy(),o.current=null}},[r],od),q(()=>{const t=Sc(e.content??"");if(!t)return n.current&&(n.current.innerHTML=""),void l(!1);if(!a)return void l(!0);let o=!1;const r=new AbortController,i=++c.current;return Kc(t,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:r.signal}).then(e=>{o||i!==c.current||(n.current&&(n.current.innerHTML=e),l(!1))}).catch(async r=>{if(o||i!==c.current)return;if(!n.current)return;const a=r?.code||r?.name;if("WORKER_INIT_ERROR"===a||r?.fallbackToRenderer||"WORKER_BUSY"===a||"WORKER_TIMEOUT"===a){const r=await Uc();if(r)try{const a=r.renderToString(t,{throwOnError:e.loading,displayMode:!0});return void(!o&&i===c.current&&n.current&&(n.current.innerHTML=a,l(!1),Ac(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],rd),x(ld,{h0:t,h1:n,h2:i?"math-rendering":void 0})}ad.$$singleRoot=!0;var sd=/* @__PURE__ */W('<span class="math-inline-wrapper"><span></span><!></span>'),cd=/* @__PURE__ */N(9),dd=/* @__PURE__ */Symbol(cd),ud=/* @__PURE__ */Symbol(cd+1),md=/* @__PURE__ */Symbol(cd+2),fd=/* @__PURE__ */Symbol(cd+3),hd=/* @__PURE__ */Symbol(cd+4),pd=/* @__PURE__ */Symbol(cd+5),yd=/* @__PURE__ */Symbol(cd+6),gd=/* @__PURE__ */Symbol(cd+7),bd=/* @__PURE__ */Symbol(cd+8),vd=["r","a","b","r","c","d"],wd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,a,s,c,d,u;const m=v(sd);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const f=g(m);{const n=e.h1;a=n,s=f,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}c=f,d=m,u=H(f,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=vd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.j!==n){r.j=n;const e=r.i;null==e||o||null===n?r.i=z(t,1,r.g,n,r.h,!0):I(e,n)}}});function xd({node:e}){const t=Y(null,dd),n=Y(null,ud),o=Y(null,md),r=J(fd,Ge,fd),[i,l]=Z(!0,hd),[a,s]=Z(()=>"undefined"==typeof window,pd),c=Y(0,yd);return q(()=>{const e=t.current;if(!e)return;const n=r(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&s(!0),n.whenVisible.then(()=>s(!0)),()=>{n.destroy(),o.current=null}},[r],gd),q(()=>{const t=Sc(e.content??"");if(!t)return n.current&&(n.current.innerHTML=""),void l(!1);if(!a)return void l(!0);let o=!1;const r=new AbortController,i=++c.current,s="$$"===e.markup;return Kc(t,s,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{o||i!==c.current||n.current&&(n.current.innerHTML=e,l(!1))}).catch(async r=>{if(o||i!==c.current)return;if(!n.current)return;const a=r?.code||r?.name;if("WORKER_INIT_ERROR"===a||r?.fallbackToRenderer||"WORKER_BUSY"===a||"WORKER_TIMEOUT"===a){const r=await Uc();if(r)try{const a=r.renderToString(t,{throwOnError:e.loading,displayMode:s});return void(!o&&i===c.current&&n.current&&(n.current.innerHTML=a,l(!1),Ac(t,s,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,e.markup,a],bd),x(wd,{h0:t,h1:n,h2:"math-inline"+(i?" math-inline--hidden":""),h3:i&&x("span",{className:"math-inline__loading",role:"status","aria-live":"polite"},x("span",{className:"math-inline__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}function kd(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Sd(e){const t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),n=Math.max(1,t.length),o=function(e){for(const t of e.split(/\r?\n/)){const e=t.trim();if(e&&!e.startsWith("%%"))return e.match(/^([A-Z][\w-]*)\b/i)?.[1]?.toLowerCase()||""}return""}(e);return"gantt"===o?220+28*n:"sequencediagram"===o?180+26*n:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*n:"flowchart"===o||"graph"===o?170+28*n:200+22*n}function Cd(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Md(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}xd.$$singleRoot=!0;var Nd=null,$d=null,Bd=/* @__PURE__ */new Map,Td=5,Ed=!1;function Ld(e){Ed=!!e}function Dd(e){Number.isFinite(e)&&e>0&&(Td=Math.floor(e))}function jd(){return{inFlight:Bd.size,max:Td}}var Pd="WORKER_BUSY";function _d(e){$d=null;const t=e;(Nd=e).onmessage=e=>{if(Nd!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Bd.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Nd.onerror=e=>{if(Nd===t)if(0!==Bd.size){try{Ed?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Bd.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Bd.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Nd.onmessageerror=e=>{if(Nd===t)if(0!==Bd.size){try{Ed?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Bd.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Bd.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Rd(){if(Nd)try{for(const[e,t]of Bd.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Bd.clear(),Nd.terminate?.()}catch{}Nd=null,$d=null}function Ad(e,t,n=1400){if($d)return Promise.reject($d);const o=Nd||(($d=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",$d.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject($d);if(Bd.size>=Td){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Pd,e.inFlight=Bd.size,e.max=Td,Promise.reject(e)}return new Promise((r,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,s=null;const c=()=>{a||(a=!0,null!=s&&clearTimeout(s),Bd.delete(l))};Bd.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Bd.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Bd.get(l)?.reject(e)},n)})}async function Fd(e,t,n=1400){return Ad("canParse",{code:e,theme:t},n)}async function Id(e,t,n=2400){return Ad("findPrefix",{code:e,theme:t},n)}function Hd(){Nd?.terminate?.(),Nd=null,$d=null,Bd.clear()}var Od=null,Wd=!1,zd=null,Kd=null;function Vd(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(zd!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),zd=n}catch{}}var qd=/* @__PURE__ */N(68),Ud=/* @__PURE__ */Symbol(qd),Xd=/* @__PURE__ */Symbol(qd+1),Yd=/* @__PURE__ */Symbol(qd+2),Zd=/* @__PURE__ */Symbol(qd+3),Gd=/* @__PURE__ */Symbol(qd+4),Jd=/* @__PURE__ */Symbol(qd+5),Qd=/* @__PURE__ */Symbol(qd+6),eu=/* @__PURE__ */Symbol(qd+7),tu=/* @__PURE__ */Symbol(qd+8),nu=/* @__PURE__ */Symbol(qd+9),ou=/* @__PURE__ */Symbol(qd+10),ru=/* @__PURE__ */Symbol(qd+11),iu=/* @__PURE__ */Symbol(qd+12),lu=/* @__PURE__ */Symbol(qd+13),au=/* @__PURE__ */Symbol(qd+14),su=/* @__PURE__ */Symbol(qd+15),cu=/* @__PURE__ */Symbol(qd+16),du=/* @__PURE__ */Symbol(qd+17),uu=/* @__PURE__ */Symbol(qd+18),mu=/* @__PURE__ */Symbol(qd+19),fu=/* @__PURE__ */Symbol(qd+20),hu=/* @__PURE__ */Symbol(qd+21),pu=/* @__PURE__ */Symbol(qd+22),yu=/* @__PURE__ */Symbol(qd+23),gu=/* @__PURE__ */Symbol(qd+24),bu=/* @__PURE__ */Symbol(qd+25),vu=/* @__PURE__ */Symbol(qd+26),wu=/* @__PURE__ */Symbol(qd+27),xu=/* @__PURE__ */Symbol(qd+28),ku=/* @__PURE__ */Symbol(qd+29),Su=/* @__PURE__ */Symbol(qd+30),Cu=/* @__PURE__ */Symbol(qd+31),Mu=/* @__PURE__ */Symbol(qd+32),Nu=/* @__PURE__ */Symbol(qd+33),$u=/* @__PURE__ */Symbol(qd+34),Bu=/* @__PURE__ */Symbol(qd+35),Tu=/* @__PURE__ */Symbol(qd+36),Eu=/* @__PURE__ */Symbol(qd+37),Lu=/* @__PURE__ */Symbol(qd+38),Du=/* @__PURE__ */Symbol(qd+39),ju=/* @__PURE__ */Symbol(qd+40),Pu=/* @__PURE__ */Symbol(qd+41),_u=/* @__PURE__ */Symbol(qd+42),Ru=/* @__PURE__ */Symbol(qd+43),Au=/* @__PURE__ */Symbol(qd+44),Fu=/* @__PURE__ */Symbol(qd+45),Iu=/* @__PURE__ */Symbol(qd+46),Hu=/* @__PURE__ */Symbol(qd+47),Ou=/* @__PURE__ */Symbol(qd+48),Wu=/* @__PURE__ */Symbol(qd+49),zu=/* @__PURE__ */Symbol(qd+50),Ku=/* @__PURE__ */Symbol(qd+51),Vu=/* @__PURE__ */Symbol(qd+52),qu=/* @__PURE__ */Symbol(qd+53),Uu=/* @__PURE__ */Symbol(qd+54),Xu=/* @__PURE__ */Symbol(qd+55),Yu=/* @__PURE__ */Symbol(qd+56),Zu=/* @__PURE__ */Symbol(qd+57),Gu=/* @__PURE__ */Symbol(qd+58),Ju=/* @__PURE__ */Symbol(qd+59),Qu=/* @__PURE__ */Symbol(qd+60),em=/* @__PURE__ */Symbol(qd+61),tm=/* @__PURE__ */Symbol(qd+62),nm=/* @__PURE__ */Symbol(qd+63),om=/* @__PURE__ */Symbol(qd+64),rm=/* @__PURE__ */Symbol(qd+65),im=/* @__PURE__ */Symbol(qd+66),lm=/* @__PURE__ */Symbol(qd+67),am="undefined"!=typeof window?U:q,sm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function cm(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function dm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(cm(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||cm(e),o}function um(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var mm={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:!0,enableMermaidInteractions:!1};function fm(e){const n={...mm,...e},{t:o}=J(Ud,St,Ud),r=X(()=>Xt("mermaid"),[],Xd),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],Yd),a=n.workerTimeoutMs??mm.workerTimeoutMs,s=n.parseTimeoutMs??mm.parseTimeoutMs,c=n.renderTimeoutMs??mm.renderTimeoutMs,d=n.fullRenderTimeoutMs??mm.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??mm.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?kd(n.maxHeight):null,[n.maxHeight],Zd),f=X(()=>Cd(kd(n.estimatedPreviewHeightPx)??Sd(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],Gd),[h,p]=Z(!1,Jd),[y,g]=Z(!1,Qd),[b,v]=Z(!1,eu),[w,M]=Z(!1,tu),[N,$]=Z(1,nu),[B,T]=Z({x:0,y:0},ou),[L,D]=Z(!1,ru),[j,P]=Z(!1,iu),[_,R]=Z(!1,lu),[A,F]=Z(null,au),[I,H]=Z(!1,su),[O,W]=Z(`${f}px`,cu),[z,V]=Z("undefined"==typeof window,du),G=Y(null,uu),Q=Y(null,mu),ee=Y(null,fu),te=Y(null,hu),ne=Y(null,pu),oe=Y(null,yu),re=Y(null,gu),ie=Y({x:0,y:0},bu),le=Y(0,vu),ae=Y({},wu),se=Y(null,xu),ce=Y("",ku),de=Y(!1,Su),ue=Y(null,Cu),me=Y(!1,Mu),fe=Y({zoom:1,translateX:0,translateY:0,containerHeight:O||"360px"},Nu),he=J($u,Ge,$u),pe=Boolean(n.node?.loading??n.loading),ye=n.isDark?"dark":"light",ge=Boolean(n.isStrict),be=!0===n.enableMermaidInteractions,ve=X(()=>ge?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:sm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ge],Bu);q(()=>{me.current=_},[_],Tu),q(()=>{y||b||W(e=>{const t=kd(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,y],Eu),q(()=>{ae.current={}},[ye,l,ge],Lu),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Od)return Vd(Od,e),Od;if(Kd){const t=await Kd;return t&&Vd(t,e),t}if(Wd)return null;try{Wd=!0,Kd=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(Od=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return Vd(Od,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Od}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{Kd=null}})();const t=await Kd;return t&&Vd(t,e),t}catch{return null}}(ve);e||(G.current=t,p(Boolean(t)),de.current||g(!t))})(),()=>{e=!0}},[ve],Du),q(()=>{const e=Q.current;if(!e)return;const t=he(e,{rootMargin:"400px"});return ue.current=t,t.isVisible()&&V(!0),t.whenVisible.then(()=>V(!0)),()=>{t.destroy(),ue.current=null}},[he],ju),q(()=>{if("undefined"==typeof document)return;if(!I)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[I],Pu);const we=K(()=>m,[m],_u),xe=K(e=>{const t=Q.current,o=te.current;if(!t||!o)return;const r=o.querySelector("svg");if(!r)return;let i=0,l=0;const a=r.getAttribute("viewBox");if(a){const e=a.split(" ");4===e.length&&(i=Number.parseFloat(e[2]),l=Number.parseFloat(e[3]))}if(i&&l||!r.hasAttribute("width")||!r.hasAttribute("height")||(i=Number.parseFloat(r.getAttribute("width")||"0"),l=Number.parseFloat(r.getAttribute("height")||"0")),!i||!l||Number.isNaN(i)||Number.isNaN(l))try{const e=r.getBBox();i=e.width,l=e.height}catch{return}if(!(i>0&&l>0))return;const s=(e??t.clientWidth)*(l/i),c=Number.isFinite(s)&&s>0?s:l,d=we(),u=null==d?c:Math.min(c,d);W(`${"none"===n.maxHeight?u:Math.max(u,f)}px`)},[f,n.maxHeight,we],Ru);q(()=>{if(!Q.current||"undefined"==typeof ResizeObserver)return;if(y||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Md(()=>xe(t))});return e.observe(Q.current),()=>e.disconnect()},[b,y,xe],Au),q(()=>{y||b||xe()},[b,n.maxHeight,y,xe],Fu),q(()=>()=>{Hd()},[],Iu),U(()=>{const e=ae.current[ye];!y&&te.current&&e?.svg&&(dm(te.current,e.svg)&&(se.current=e.bindFunctions??null,um(te.current,e.bindFunctions,be)),Md(()=>xe()))},[be,y,ye,xe],Hu);const ke=K(async(e,t,o)=>{if(!G.current||!te.current)return!1;P(!0);try{const n=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=ym(e,t),i=await wm(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=dm(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,um(te.current,i.bindFunctions,be),xe(),ae.current[t]={svg:l,bindFunctions:i.bindFunctions},R(!0),F(null),!0)}catch(r){if(!pe){if("function"==typeof n.onRenderError&&te.current&&!0===n.onRenderError(r,l,te.current))return!1;F(r instanceof Error?r.message:String(r))}return!1}finally{P(!1)}},[be,d,pe,xe],Ou),Se=K(async(e,t,n)=>{if(G.current&&te.current){P(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=ym(vm(e)||e,t),i=await wm(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=dm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,um(te.current,i.bindFunctions,be)),e&&xe()}}catch{}finally{P(!1)}}},[be,c,pe,xe],Wu),Ce=K(async(e,t)=>{if(!e.trim())return cm(te.current),R(!1),void(ce.current="");const n=e.replace(/\s+/g,"");if(n===ce.current&&me.current)return;const o=++le.current;if("gantt"===gm(e)){const i=vm(e);if(!i.trim())return;try{if(await pm(i,ye,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;i===e?await ke(e,ye,t)&&(ce.current=n):await Se(i,ye,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await pm(e,ye,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;return void(await ke(e,ye,t)&&(ce.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await Id(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return vm(e)}(e,ye,{workerTimeout:a,signal:t});if(!n||t?.aborted||le.current!==o)return;await Se(n,ye,t)}catch{}},[s,ke,Se,ye,a],zu),Me=K(()=>z&&!y&&!b,[b,y,z],Ku);q(()=>{if(!Me())return;if(!G.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Me()&&Ce(l,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[l,Me,h,Ce,u],Vu);const Ne=K((e,t)=>{e.clientX,e.clientY,Dt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],qu),$e=K(async()=>{try{await(navigator.clipboard?.writeText(l)),M(!0),n.onCopy?.(l),setTimeout(()=>M(!1),1e3)}catch{}},[l,n],Uu),Be=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=xm(e),o={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:t};n.onExport?.(o),o.defaultPrevented||function(e,t){const n=t??xm(e),o=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}(e,t)},[n],Xu),Te=K(()=>{re.current=null,cm(oe.current)},[],Yu),Ee=K(()=>{H(!1),Te()},[Te],Zu),Le=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?xm(e):null};n.onOpenModal?.(t),t.defaultPrevented||H(!0)},[n],Gu);q(()=>{if(!I)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Ee()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Ee,I],Ju),J(Qu,am,()=>{if(!I)return;const e=oe.current,t=Q.current;if(!e||!t)return;const n=`translate(${B.x}px, ${B.y}px) scale(${N})`,o=t.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="100%",o.style.maxHeight="100%";const r=o.querySelector("[data-mermaid-wrapper]");r&&(re.current=r,r.style.transform=n),cm(e),e.appendChild(o),um(e,se.current??ae.current[ye]?.bindFunctions,be)},[be,I,ye],Qu),q(()=>{I&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${N})`)},[I,B.x,B.y,N],em);const De=y||j||b,je=X(()=>n.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",[n.isDark],tm),Pe=K(e=>{const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(n.onToggleMode?.(e,t),!t.defaultPrevented)if(de.current=!0,"preview"===e){g(!1);const e=fe.current;$(e.zoom),T({x:e.translateX,y:e.translateY}),W(e.containerHeight)}else fe.current={zoom:N,translateX:B.x,translateY:B.y,containerHeight:O},g(!0)},[l,O,Ce,n,ye,B.x,B.y,xe,N],nm),_e=K(e=>{if(!1===n.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=Q.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-B.x,i=e.clientY-o.top-B.y,l=.01*-e.deltaY,a=hm(N+l,.5,3);if(a===N)return;const s=a/N;T({x:B.x-r*(s-1),y:B.y-i*(s-1)}),$(a)},[B,N],om),Re=K((e,t)=>{D(!0),ie.current={x:e-B.x,y:t-B.y}},[B.x,B.y],rm),Ae=K((e,t)=>{L&&T({x:e-ie.current.x,y:t-ie.current.y})},[L],im),Fe=K(()=>{D(!1)},[],lm),Ie=S("div",{className:"relative"},()=>E([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>E([C(()=>x("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ne(e,o("common.zoomIn")),onMouseLeave:()=>jt(),onClick:()=>$(hm(N+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ne(e,o("common.zoomOut")),onMouseLeave:()=>jt(),onClick:()=>$(hm(N-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Ne(e,o("common.resetZoom")),onMouseLeave:()=>jt(),onClick:()=>{$(1),T({x:0,y:0})}},()=>E([Math.round(100*N),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:Fr("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:O,maxHeight:n.maxHeight??void 0},onWheel:_e,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Re(e.clientX,e.clientY))},onMouseMove:e=>Ae(e.clientX,e.clientY),onMouseUp:Fe,onMouseLeave:Fe,onTouchStart:e=>{const t=e.touches[0];t&&Re(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Ae(t.clientX,t.clientY)},onTouchEnd:Fe},()=>E([C(()=>S("div",{ref:ee,"data-mermaid-wrapper":!0,className:Fr("absolute inset-0 cursor-grab",{"cursor-grabbing":L}),style:{transform:`translate(${B.x}px, ${B.y}px) scale(${N})`}},()=>C(()=>x("div",{ref:te,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})))),(j||pe)&&x("div",{className:"mermaid-loading"},x("span",{className:"mermaid-spinner"}),x("span",{},"Rendering diagram…"))])))])),He=n.showHeader&&C(()=>S("div",{className:Fr("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",n.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200")},()=>E([S("div",{className:"flex items-center space-x-2 overflow-hidden"},()=>E([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:r}})),C(()=>x("span",{className:Fr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"\n Mermaid\n "))])),n.showModeToggle&&h&&C(()=>S("div",{className:Fr("flex items-center space-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>E([C(()=>S("button",{type:"button",className:Fr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Pe("preview"),onMouseEnter:e=>Ne(e,o("common.preview")),onFocus:e=>Ne(e,o("common.preview")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>S("div",{className:"flex items-center space-x-1"},()=>E([x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("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"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview"))])))),C(()=>S("button",{type:"button",className:Fr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Pe("source"),onMouseEnter:e=>Ne(e,o("common.source")),onFocus:e=>Ne(e,o("common.source")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>S("div",{className:"flex items-center space-x-1"},()=>E([x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source"))]))))]))),S("div",{className:"flex items-center space-x-1"},()=>E([n.showCollapseButton&&C(()=>S("button",{type:"button",className:je,"aria-pressed":b,onClick:()=>v(e=>!e),onMouseEnter:e=>Ne(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Ne(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>C(()=>x("svg",{style:{rotate:b?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),n.showCopyButton&&C(()=>S("button",{type:"button",className:je,onClick:$e,onMouseEnter:e=>Ne(e,o(w?"common.copied":"common.copy")),onFocus:e=>Ne(e,o(w?"common.copied":"common.copy")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>x("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"},w?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:Fr(je,De?"opacity-50 cursor-not-allowed":""),disabled:De,onClick:Be,onMouseEnter:e=>Ne(e,o("common.export")),onFocus:e=>Ne(e,o("common.export")),onMouseLeave:()=>jt(),onBlur:()=>jt()},x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&h&&C(()=>S("button",{type:"button",className:Fr(je,De?"opacity-50 cursor-not-allowed":""),disabled:De,onClick:I?Ee:Le,onMouseEnter:e=>Ne(e,o(I?"common.minimize":"common.open")),onFocus:e=>Ne(e,o(I?"common.minimize":"common.open")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>x("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"},x("path",I?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),Oe=S("div",{},()=>E([y?C(()=>S("div",{className:Fr("p-4",n.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700")},()=>S("pre",{className:"text-sm font-mono whitespace-pre-wrap"},()=>l))):Ie,A&&S("div",{className:"mermaid-error"},()=>A)]));return S(t,{},()=>E([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":y?"source":_?"preview":"pending",className:Fr("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":pe})},()=>E([He,C(()=>S("div",{ref:ne,style:{display:b?"none":""}},()=>Oe))]))),I&&"undefined"!=typeof document&&k(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Ee()},()=>C(()=>S("div",{className:Fr("mermaid-modal-panel",{"is-dark":n.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},()=>E([S("div",{className:"mermaid-modal-header"},()=>E([S("span",{className:"mermaid-modal-title"},()=>`Mermaid ${o("common.preview")}`),C(()=>S("button",{type:"button",className:"mermaid-modal-close",onClick:Ee},()=>o("common.close")))])),S("div",{className:"mermaid-modal-body"},()=>C(()=>x("div",{ref:oe,className:"mermaid-modal-content"})))])))),document.body)]))}function hm(e,t,n){return Math.min(Math.max(e,t),n)}async function pm(e,t,n){try{if(await Fd(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===l?.name)throw l}if(!n.mermaid)throw new Error("Mermaid not available");const o=ym(e,t),r=n.mermaid;if("function"==typeof r.parse)return await wm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await wm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function ym(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function gm(e){for(const t of e.split(/\r?\n/)){const e=t.trim();if(e&&!e.startsWith("%%"))return e.match(/^([A-Z][\w-]*)\b/i)?.[1]?.toLowerCase()||""}return""}function bm(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function vm(e){if("gantt"===gm(e))return function(e){const t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){const e=t[t.length-1]?.trim();if(e&&!e.startsWith("%%")){if(bm(e))break;t.pop()}else t.pop()}return t.some(bm)?t.join("\n"):""}(e);const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function wm(e,t={}){const{timeoutMs:n,signal:o}=t;return o?.aborted?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,r)=>{let i=!1,l=null;function a(){i||(i=!0,s(),r(new DOMException("Aborted","AbortError")))}function s(){null!=l&&clearTimeout(l),o&&o.removeEventListener("abort",a)}o&&o.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,s(),r(/* @__PURE__ */new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,s(),t(e))}).catch(e=>{i||(i=!0,s(),r(e))})})}function xm(e){return(new XMLSerializer).serializeToString(e)}var km=/* @__PURE__ */W('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),Sm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l;const a=v(km),s=H(g(a),1);i=a,l=H(s,1);{const t=e.h0;n=$(s,t),r=t}o=f(t,a,n,r,i,l,null,void 0)}else{const t=e.h0;o.b!==t&&(I(o.a,t),o.b=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.f!==n){o.f=n;const e=o.e;null==e||r||null===n?o.e=z(t,1,o.c,n,o.d,!0):I(e,n)}}});function Cm(e){const{node:t}=e;return x(Sm,{h0:" ",h1:String(t?.type)})}function Mm(e,t,n){const o=ce(e.type),r=(n??[]).map(e=>ce(e)).filter(Boolean),i="html_inline"===o||"html_block"===o;if(!i&&!r.includes(o))return null;const l=i?ce(e.tag)||ne(e.content):ce(e.tag)||o;if(!l)return null;const a=r.includes(l),s=t[l]??t[o]??null,c=a||i?s:null;return{tag:l,isWhitelisted:a,component:c,display:st(c)}}function Nm(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function $m(e,t,n,o){const r=e.filter(e=>!Nm(e)),i=r.length>0&&r.every(e=>"image"===e.type||function(e){const t=function(e){return"link"===e?.type&&Array.isArray(e?.children)?e.children.filter(e=>!Nm(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return Ee(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Nm(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Nm(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Nm(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Bm(t){const{node:n,ctx:o,renderNode:r,indexKey:i,children:l}=t;if(!o||!r)return e.createElement("p",{dir:"auto",className:"paragraph-node"},l);const a=n.children??[],s={...o.customComponents??it(o.customId),...o.htmlComponents??{},...o.streamingComponents??{}},c=[],d=[],u=()=>{if(!d.length)return;const t=c.length;c.push(e.createElement("p",{key:`${String(i??"paragraph")}-inline-${t}`,dir:"auto",className:"paragraph-node"},$m(d.slice(),r,o,`${String(i??"paragraph")}-${t}`))),d.length=0};return a.forEach((e,t)=>{const n="escape"!==(o.htmlPolicy??"safe")||"html_inline"!==e.type&&"html_block"!==e.type;Be.has(e.type)||n&&function(e,t,n){return"block"===Mm(e,t,n)?.display}(e,s,o.customHtmlTags)?(u(),c.push(r(e,`${String(i??"paragraph")}-block-${t}`,o))):d.push(e)}),u(),c.length?e.createElement(e.Fragment,{},c):e.createElement("p",{dir:"auto",className:"paragraph-node"},$m(a,r,o,String(i??"paragraph")))}Cm.$$singleRoot=!0,M(["click","keydown","mouseenter","mouseleave"]);var Tm=/* @__PURE__ */W('<span class="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"></span>'),Em=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),Lm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=v(Tm);n=s,s.$$click=e.h0,r=s,s.$$mouseenter=e.h1,i=s,s.$$mouseleave=e.h2,l=s,s.$$keydown=e.h3,a=s,o=h(t,s,n,r,i,l,a,null,void 0)}else o.a.$$click=e.h0,o.b.$$mouseenter=e.h1,o.c.$$mouseleave=e.h2,o.d.$$keydown=e.h3;{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.g!==n){const e=o.f;null==e||r||null===n?o.f=b(t,1,o.e,n,e):I(e,n),o.g=n}}});function Dm(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],Em);return x(Lm,{h0:n,h1:n=>{e.onMouseEnter?.(n,t.id,e.messageId,e.threadId)},h2:n=>{e.onMouseLeave?.(n,t.id,e.messageId,e.threadId)},h3:e=>{"Enter"!==e.key&&" "!==e.key||n(e)},h4:t.id})}Dm.$$singleRoot=!0;var jm=/* @__PURE__ */W('<s class="strikethrough-node"></s>'),Pm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(jm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function _m(e){return x(Pm,{h0:e.children})}_m.$$singleRoot=!0;var Rm=/* @__PURE__ */W('<strong class="strong-node"></strong>'),Am=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Rm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Fm(e){return x(Am,{h0:e.children})}Fm.$$singleRoot=!0;var Im=/* @__PURE__ */W('<sub class="subscript-node"></sub>'),Hm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Im);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Om(e){return x(Hm,{h0:e.children})}Om.$$singleRoot=!0;var Wm=/* @__PURE__ */W('<sup class="superscript-node"></sup>'),zm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Wm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Km(e){return x(zm,{h0:e.children})}Km.$$singleRoot=!0;var Vm=/* @__PURE__ */W('<th dir="auto"><!><!></th>'),qm=/* @__PURE__ */W("<tr></tr>"),Um=/* @__PURE__ */W('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),Xm=/* @__PURE__ */N(5),Ym=/* @__PURE__ */Symbol(Xm),Zm=/* @__PURE__ */Symbol(Xm+1),Gm=/* @__PURE__ */Symbol(Xm+2),Jm=/* @__PURE__ */Symbol(Xm+3),Qm=/* @__PURE__ */Symbol(Xm+4),ef=(e,t)=>`header-${t}`;function tf(e,t,n){const o=t.block,[r,i,a,s,c,d]=n,u=o.itemIndex;let m=t.slots[0];if(void 0===m){let e,n,o,r,i;const a=v(Vm);e=a,n=a;const s=g(a);o=s,r=a,i=H(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=Fr("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?Le(e.children,i,`${String(s??"table")}-th-${u}`,c):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||m.f!==n){m.f=n;const e=m.e;null==e||o||null===n?m.e=z(t,1,m.c,n,m.d,!0):I(e,n)}}{const e=u<a.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${u+1} and ${u+2}`,onPointerDown:e=>d(u,e)})),n=null!==e&&("object"==typeof e||"function"==typeof e);if(n||m.j!==e){m.j=e;const o=m.i;null==o||n||null===e?m.i=z(t,2,m.g,e,m.h,!0):I(o,e)}}}var nf=(e,t)=>`row-${t}`;function of(e,t,n){const o=t.block,[r,i,l,a,s]=n,c=o.itemIndex;let d=t.slots[0];if(void 0===d){let e,n;const o=v(qm);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=Fr("border-[var(--table-border,#cbd5e1)]",c<r.length-1&&"border-b");d.a!==e&&(R(d.b,e),d.a=e)}{const n=e.cells?.map((e,t)=>S("td",{key:`cell-${c}-${t}`,className:Fr("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?Le(e.children,i,`${String(a??"table")}-row-${c}-${t}`,s):null)),o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||d.e!==n){const e=d.d;null==e||o||null===n?d.d=b(t,1,d.c,n,e):I(e,n),d.e=n}}}var rf=["r","c","d"],lf=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s,c,d,u,m,f,h,p,b;const w=v(Um);n=w;const x=g(w);{const n=e.h1;i=n,l=x,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}a=x,s=x;const k=H(g(x),1),S=g(k);c=S,d=g(S);const C=H(k,1);u=C,m=g(C),f=x,h=g(x),p=w,b=H(x,1),r=y(t,w,{a:void 0,b:n,c:i,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:u,l:m,m:f,n:h,o:null,p:void 0,q:p,r:b,s:null,t:void 0}),t.refFields=rf}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}{const t=e.h0;r.a!==t&&(P(r.b,"data-index-key",t),r.a=t)}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-busy",t),r.g=t)}B(t,1,r.i,e.h5,e.h6,e.h7,ef,tf,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,nf,of,18,[e.h12,e.h13,e.h14,e.h15,e.h16],r.l,1);{const n=e.h4,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,3,r.m,n,r.n,!0):I(e,n)}}{const n=e.h17,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,4,r.q,n,r.r,!0):I(e,n)}}});function af(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=Array.isArray(n?.header?.cells)?n.header.cells:[],a=Boolean(n?.loading),s=Array.isArray(n?.rows)?n.rows:[],c=e.useRef(null,Ym),d=e.useRef(null,Zm),u=e.useRef(null,Gm),[m,f]=e.useState([],Jm),h=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",p=()=>{const e=u.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),u.current=null),d.current=null},y=(e,t)=>{if(0!==t.button)return;const n=(()=>{const e=c.current?.querySelectorAll("thead th");return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))})(),o=n[e],r=n[e+1];if(!o||!r)return;t.preventDefault(),p(),d.current={index:e,startX:t.clientX,startWidth:o,nextStartWidth:r,widths:n},f(n);const i=e=>{const t=d.current;if(!t)return;e.preventDefault();const n=t.startWidth+t.nextStartWidth,o=Math.min(48,Math.floor(n/2)),r=Math.max(o,Math.min(n-o,Math.round(t.startWidth+e.clientX-t.startX))),i=[...t.widths];i[t.index]=r,i[t.index+1]=n-r,f(i)},l=()=>{p()};u.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)};return e.useEffect(()=>(p(),f([]),p),[l.length],Qm),x(lf,{h0:i,h1:c,h2:Fr("my-8 text-sm table-node",a&&"table-node--loading"),h3:a,h4:m.length>0&&S("colgroup",{},()=>l.map((e,t)=>x("col",{key:`col-${t}`,style:m[t]>0?{width:`${m[t]}px`}:void 0}))),h5:l,h6:l.map,h7:(e,t)=>S("th",{key:`header-${t}`,className:Fr("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>E([o&&r?Le(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>y(t,e)}))])),h8:[h,o,l,i,r,y],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:Fr("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:Fr("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?Le(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&x("div",{className:"table-node__loading",role:"status","aria-live":"polite"},x("span",{className:"table-node__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}af.$$singleRoot=!0;var sf=/* @__PURE__ */W('<hr class="hr-node thematic-break"/>'),cf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,v(sf)))});function df(){return x(cf,{})}df.$$singleRoot=!0;var uf=/* @__PURE__ */W("<div></div>"),mf=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),ff=["s","d","c"],hf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=v(uf);n=e.h0,r=O(e.h1),i=s,l=A(s,[[!1,"className",n],[!0,r]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.d;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.c)}),a=s,o=h(t,s,n,r,i,l,a,null,void 0),t.refFields=ff}else{{const t=e.h0;o.a!==t&&(o.a=t)}o.b=O(e.h1),o.d=A(o.c,[[!1,"className",o.a],[!0,o.b]],o.d,t,!0)}{const n=e.h2;o.f=b(t,1,o.e,n,o.f),o.g=n}});function pf(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=`vmr-container vmr-container-${n.name}`,a=X(()=>{if(n.attrs)return Array.isArray(n.attrs)?Te(n.attrs):n.attrs},[n.attrs],mf);return x(hf,{h0:l,h1:a,h2:o&&r&&Array.isArray(n.children)?n.children.map((t,n)=>S(e.Fragment,{key:`${String(i??"vmr-container")}-${n}`},()=>r(t,`${String(i??"vmr-container")}-${n}`,o))):null})}pf.$$singleRoot=!0;var yf=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function gf(e,t={}){const n={},o=new Set(t.omit??[]);if(!e||"object"!=typeof e)return n;const r=Object.getOwnPropertyDescriptors(e);for(const[i,l]of Object.entries(r))yf.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function bf(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function vf(t,n,o,r,i={}){const l=gf(r.codeBlockProps),a=r.events.onHandleArtifactClick?e=>{const t="image/svg+xml"===e.type?"image/svg+xml":"text/html";r.events.onHandleArtifactClick?.({node:null==e.content?n:{...n,code:e.content},artifactType:t,artifactTitle:e.title||("image/svg+xml"===t?"SVG Preview":"HTML Preview"),id:String(o)})}:void 0;return e.createElement(t,{key:o,node:n,loading:Boolean(n.loading)||!1===r.final,stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,codeBlockOptions:r.codeBlockOptions,...i,ctx:r,renderNode:xf,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function wf(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function xf(t,n,o){const r=o.customComponents??it(o.customId),i=o.streamingComponents??{},l=o.htmlComponents??{},a=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const t=ce(e.type),n=ce(e.tag);return t&&n&&t===n?t:""}(t),s=a?i[a]:null,c=a&&!s?l[a]:null,d="code_block"===t.type?null:r[t.type];if(s)return e.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(c)return function(t,n,o,r,i){const l=te(ve(fe(n.attrs??void 0,r.htmlPolicy??"safe",i))),a=Array.isArray(n.children)?Ee(n.children,r,`${String(o)}-html`,xf):n.content??null;return e.createElement(t,{...l,key:o},a)}(c,t,n,o,a);if(d)return e.createElement(d,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=Mm(t,{...r,...i},o.customHtmlTags),a=String(t.tag??"").trim().toLowerCase()||ne(t.content),s=l?.tag??a;if(s){const i=l?.component??r[s],a=l?.isWhitelisted??(o.customHtmlTags??[]).some(e=>e.toLowerCase()===s);if(a&&i){const r={...t,type:s,tag:s,content:ge(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&ye(c,s))return"html_inline"===t.type?bf(dc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):bf(Bm,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return bf(dc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return bf(dc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return bf(Bm,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return bf(vl,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return bf(kp,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return bf(kc,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return bf(xc,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return bf(af,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return bf(Xi,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return bf(al,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return bf(pl,t,n,{});case"footnote_anchor":return bf(rl,t,n,{});case"admonition":return bf(Ie,t,n,{ctx:o,renderNode:xf,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return bf(bl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return bf(bc,t,n,{ctx:o,renderNode:xf,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return bf(qa,t,n,{});case"inline_code":return bf(Us,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"code_block":return function(t,n,o,r){const i=function(e){const t=String(e?.language||"").trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}(t),l=zt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,zt(n),ke(n)]){const t=o&&e[o];if(t)return t}return null}(r,i);if("mermaid"===l){const i=function(e,t){const n={...t.mermaidProps||{}};return null==kd(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Cd(Sd(String(e?.code??"")),void 0,"none"===n.maxHeight?null:kd(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return wf(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(fm,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("infographic"===l){const i=function(e,t){const n={...t.infographicProps||{}};return null==Ua(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Ya(Xa(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Ua(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?wf(l,t,n,o,i):e.createElement(Rs,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?wf(i,t,n,o,o.d2Props||{}):e.createElement(Wi,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return vf(a,t,n,o);const s=r.code_block;if(s)return vf(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=gf(o.codeBlockProps).showLineNumbers,i=o.codeBlockOptions?.disableLineNumbers,l=o.codeBlockOptions?.overflow;return e.createElement(Tn,{key:n,node:t,style:l?{whiteSpace:"scroll"===l?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof r?r:"boolean"==typeof i&&!i})}return e.createElement(Rr,{key:n,node:t,loading:Boolean(t.loading)||!1===o.final,stream:o.codeBlockStream,themes:o.codeBlockThemes?.themes,darkTheme:o.codeBlockThemes?.darkTheme,lightTheme:o.codeBlockThemes?.lightTheme,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...gf(o.codeBlockProps),codeBlockOptions:o.codeBlockOptions})}(t,n,o,r);case"strong":return bf(Fm,t,n,{},Ee(t.children,o,`${String(n)}-strong`,xf));case"emphasis":return bf(el,t,n,{},Ee(t.children,o,`${String(n)}-em`,xf));case"strikethrough":return bf(_m,t,n,{},Ee(t.children,o,`${String(n)}-strike`,xf));case"highlight":return bf(kl,t,n,{},Ee(t.children,o,`${String(n)}-highlight`,xf));case"insert":return bf(Zs,t,n,{},Ee(t.children,o,`${String(n)}-insert`,xf));case"subscript":return bf(Om,t,n,{},Ee(t.children,o,`${String(n)}-sub`,xf));case"superscript":return bf(Km,t,n,{},Ee(t.children,o,`${String(n)}-sup`,xf));case"checkbox":case"checkbox_input":return bf(wt,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return bf(Gi,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(df);case"math_inline":return bf(xd,t,n,{});case"math_block":return bf(ad,t,n,{});case"reference":return bf(Dm,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?bf(ca,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):bf(Aa,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return bf(pf,t,n,{ctx:o,renderNode:xf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return bf(Cm,t,n,{})}}var kf=/* @__PURE__ */N(98),Sf=/* @__PURE__ */Symbol(kf),Cf=/* @__PURE__ */Symbol(kf+1),Mf=/* @__PURE__ */Symbol(kf+2),Nf=/* @__PURE__ */Symbol(kf+3),$f=/* @__PURE__ */Symbol(kf+4),Bf=/* @__PURE__ */Symbol(kf+5),Tf=/* @__PURE__ */Symbol(kf+6),Ef=/* @__PURE__ */Symbol(kf+7),Lf=/* @__PURE__ */Symbol(kf+8),Df=/* @__PURE__ */Symbol(kf+9),jf=/* @__PURE__ */Symbol(kf+10),Pf=/* @__PURE__ */Symbol(kf+11),_f=/* @__PURE__ */Symbol(kf+12),Rf=/* @__PURE__ */Symbol(kf+13),Af=/* @__PURE__ */Symbol(kf+14),Ff=/* @__PURE__ */Symbol(kf+15),If=/* @__PURE__ */Symbol(kf+16),Hf=/* @__PURE__ */Symbol(kf+17),Of=/* @__PURE__ */Symbol(kf+18),Wf=/* @__PURE__ */Symbol(kf+19),zf=/* @__PURE__ */Symbol(kf+20),Kf=/* @__PURE__ */Symbol(kf+21),Vf=/* @__PURE__ */Symbol(kf+22),qf=/* @__PURE__ */Symbol(kf+23),Uf=/* @__PURE__ */Symbol(kf+24),Xf=/* @__PURE__ */Symbol(kf+25),Yf=/* @__PURE__ */Symbol(kf+26),Zf=/* @__PURE__ */Symbol(kf+27),Gf=/* @__PURE__ */Symbol(kf+28),Jf=/* @__PURE__ */Symbol(kf+29),Qf=/* @__PURE__ */Symbol(kf+30),eh=/* @__PURE__ */Symbol(kf+31),th=/* @__PURE__ */Symbol(kf+32),nh=/* @__PURE__ */Symbol(kf+33),oh=/* @__PURE__ */Symbol(kf+34),rh=/* @__PURE__ */Symbol(kf+35),ih=/* @__PURE__ */Symbol(kf+36),lh=/* @__PURE__ */Symbol(kf+37),ah=/* @__PURE__ */Symbol(kf+38),sh=/* @__PURE__ */Symbol(kf+39),ch=/* @__PURE__ */Symbol(kf+40),dh=/* @__PURE__ */Symbol(kf+41),uh=/* @__PURE__ */Symbol(kf+42),mh=/* @__PURE__ */Symbol(kf+43),fh=/* @__PURE__ */Symbol(kf+44),hh=/* @__PURE__ */Symbol(kf+45),ph=/* @__PURE__ */Symbol(kf+46),yh=/* @__PURE__ */Symbol(kf+47),gh=/* @__PURE__ */Symbol(kf+48),bh=/* @__PURE__ */Symbol(kf+49),vh=/* @__PURE__ */Symbol(kf+50),wh=/* @__PURE__ */Symbol(kf+51),xh=/* @__PURE__ */Symbol(kf+52),kh=/* @__PURE__ */Symbol(kf+53),Sh=/* @__PURE__ */Symbol(kf+54),Ch=/* @__PURE__ */Symbol(kf+55),Mh=/* @__PURE__ */Symbol(kf+56),Nh=/* @__PURE__ */Symbol(kf+57),$h=/* @__PURE__ */Symbol(kf+58),Bh=/* @__PURE__ */Symbol(kf+59),Th=/* @__PURE__ */Symbol(kf+60),Eh=/* @__PURE__ */Symbol(kf+61),Lh=/* @__PURE__ */Symbol(kf+62),Dh=/* @__PURE__ */Symbol(kf+63),jh=/* @__PURE__ */Symbol(kf+64),Ph=/* @__PURE__ */Symbol(kf+65),_h=/* @__PURE__ */Symbol(kf+66),Rh=/* @__PURE__ */Symbol(kf+67),Ah=/* @__PURE__ */Symbol(kf+68),Fh=/* @__PURE__ */Symbol(kf+69),Ih=/* @__PURE__ */Symbol(kf+70),Hh=/* @__PURE__ */Symbol(kf+71),Oh=/* @__PURE__ */Symbol(kf+72),Wh=/* @__PURE__ */Symbol(kf+73),zh=/* @__PURE__ */Symbol(kf+74),Kh=/* @__PURE__ */Symbol(kf+75),Vh=/* @__PURE__ */Symbol(kf+76),qh=/* @__PURE__ */Symbol(kf+77),Uh=/* @__PURE__ */Symbol(kf+78),Xh=/* @__PURE__ */Symbol(kf+79),Yh=/* @__PURE__ */Symbol(kf+80),Zh=/* @__PURE__ */Symbol(kf+81),Gh=/* @__PURE__ */Symbol(kf+82),Jh=/* @__PURE__ */Symbol(kf+83),Qh=/* @__PURE__ */Symbol(kf+84),ep=/* @__PURE__ */Symbol(kf+85),tp=/* @__PURE__ */Symbol(kf+86),np=/* @__PURE__ */Symbol(kf+87),op=/* @__PURE__ */Symbol(kf+88),rp=/* @__PURE__ */Symbol(kf+89),ip=/* @__PURE__ */Symbol(kf+90),lp=/* @__PURE__ */Symbol(kf+91),ap=/* @__PURE__ */Symbol(kf+92),sp=/* @__PURE__ */Symbol(kf+93),cp=/* @__PURE__ */Symbol(kf+94),dp=/* @__PURE__ */Symbol(kf+95),up=/* @__PURE__ */Symbol(kf+96),mp=/* @__PURE__ */Symbol(kf+97),fp={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},hp=oe();function pp(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,o=t;return n.startLine===o.startLine&&n.endLine===o.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function yp(e){const t=X(()=>function(e){if(!e)return{};const t={};for(const[n,o]of Object.entries(e)){const e=ce(n);e&&(t[e]=o)}return t}(e),[e],Sf),n=Y(t,Cf);return function(e,t){const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}var gp=e.memo(({node:e,nodeKey:t,renderCtx:n})=>xf(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),bp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J(Mf,Ge,Mf),s="undefined"!=typeof window,c="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,d=Math.max(0,Math.trunc(e.renderBatchSize??80)),u=Math.max(0,Math.trunc(e.initialRenderBatchSize??(d||t.length))),m=!1!==e.batchRendering&&d>0&&s,f=Math.max(0,e.liveNodeBuffer??60),h=Math.max(1,e.maxLiveNodes??320),p=(e.maxLiveNodes??0)>0&&t.length>h,y=!1!==e.viewportPriority,g=m&&(e.maxLiveNodes??0)<=0,b=X(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&y,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,y,p],Nf),[v,w]=Z(()=>g?Math.min(t.length,u):t.length,$f),k=Y(v,Bf);q(()=>{k.current=v},[v],Tf);const M=g?v:t.length,[N,$]=Z(0,Ef),[B,T]=Z({start:0,end:t.length},Lf),L=Y(/* @__PURE__ */new Map,Df),[D,j]=Z(0,jf),P=Y({},Pf),_=Y(/* @__PURE__ */new Map,_f),R=Y(/* @__PURE__ */new Map,Rf),A=Y(/* @__PURE__ */new Map,Af),F=Y(/* @__PURE__ */new Map,Ff),I=Y(/* @__PURE__ */new Set,If),H=Y(v,Hf),O=Y(null,Of),W=Y(null,Wf),z=Y(null,zf),V=Y(!1,Kf),U=Y(null,Vf),G=Y(Math.max(1,d||1),qf),Q=Y(t.length,Uf),ee=Y({key:e.indexKey,total:t.length},Xf),te=Y({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:g},Yf),ne=b||p,oe=X(()=>{const e=L.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[D],Zf),re=X(()=>{if(!p)return t.map((e,t)=>({node:e,index:t}));const e=t.length,n=Math.max(0,Math.min(B.start,e)),o=Math.max(n,Math.min(B.end,e));return t.slice(n,o).map((e,t)=>({node:e,index:n+t}))},[t,B,p],Gf);Q.current=X(()=>{if(!p)return t.length;const e=Math.max(B.end+f,u),n=Math.min(t.length,e);return Math.max(v,n)},[t.length,p,B.end,f,u,v],Jf);const ie=K((e,t)=>{if(e>=t)return 0;const n=L.current;let o=0;for(let r=e;r<t;r++)o+=n.get(r)??oe;return o},[oe],Qf),le=p?ie(0,Math.min(B.start,t.length)):0,ae=p?ie(Math.min(B.end,t.length),t.length):0,se=K(()=>{null!=O.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(O.current),O.current=null),null!=W.current&&(window.clearTimeout(W.current),W.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),V.current=!1,U.current=null},[],eh),ce=K(t=>{if(!g)return;const n=Math.max(2,e.renderBatchBudgetMs??6),o=Math.max(1,d||1),r=Math.max(1,Math.floor(o/4));t>1.2*n?G.current=Math.max(r,Math.floor(.7*G.current)):t<.5*n&&G.current<o&&(G.current=Math.min(o,Math.ceil(1.2*G.current)))},[g,e.renderBatchBudgetMs,d],th),de=K((t,n={})=>{if(!g)return;const o=Q.current;if(k.current>=o)return;const r=Math.max(1,t),i=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();w(t=>{const n=Math.min(Q.current,t+Math.max(1,e));return k.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();ce(n-t)},l=()=>{const e=Math.max(1,Math.round(G.current));de(e)},a=t=>{O.current=null,W.current=null,z.current=null,V.current=!1;const n=U.current;if(U.current=null,i(null!=n?n:r),k.current>=Q.current)return;if(!t)return void l();const o=Math.max(2,e.renderBatchBudgetMs??6);for(;k.current<Q.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)i(Math.max(1,Math.round(G.current)));k.current<Q.current&&l()};if(!s||n.immediate)return void a();const d=Math.max(0,e.renderBatchDelay??16);if(U.current=null!=U.current?Math.max(U.current,r):r,!V.current){if(V.current=!0,c){const t=Math.max(0,e.renderBatchIdleTimeoutMs??120);return void(z.current=window.requestIdleCallback(e=>a(e),{timeout:t}))}"function"==typeof requestAnimationFrame?O.current=requestAnimationFrame(()=>{0!==d?W.current=window.setTimeout(()=>a(),d):a()}):W.current=window.setTimeout(()=>a(),d)}},[ce,c,g,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],nh);q(()=>{const n=e.indexKey,o=t.length,r=ee.current,i=void 0!==n?n!==r.key:o!==r.total;ee.current={key:n,total:o};const l=te.current,a=e.renderBatchDelay??16,c=l.batchSize!==d||l.initial!==u||l.delay!==a||l.enabled!==g;if(te.current={batchSize:d,initial:u,delay:a,enabled:g},(i||c||!g)&&se(),(i||c)&&(G.current=Math.max(1,d||1),I.current.clear()),!o)return k.current=0,void w(0);const m=Q.current;if(!g)return k.current=m,void w(m);if(i||c){const e=Math.min(m,u);return k.current=e,w(e),void(e<m&&de(Math.max(1,u),{immediate:!s}))}const f=Math.min(k.current,m);f!==k.current&&(k.current=f,w(f)),k.current<m&&de(Math.max(1,d||1))},[se,g,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],oh),q(()=>{if(!p)return void T({start:0,end:t.length});const e=t.length;if(!e)return void T({start:0,end:0});const n=Math.max(0,Math.min(N,e-1));let o=Math.max(0,n-f),r=Math.min(e,n+f+1);const i=r-o;if(i>h){const e=i-h;o+=Math.ceil(e/2),r-=Math.floor(e/2)}else if(i<h){const t=h-i;o=Math.max(0,o-Math.ceil(t/2)),r=Math.min(e,r+Math.floor(t/2))}T({start:o,end:r})},[N,f,h,t.length,p],rh),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],ih);const ue=K(e=>{for(const[t,n]of _.current.entries())t>=e&&(n.destroy(),_.current.delete(t),delete P.current[t],R.current.delete(t),A.current.delete(t),F.current.delete(t))},[],lh);q(()=>{ue(M)},[ue,M],ah),q(()=>{const e=t.length;let n=!1;for(const t of Array.from(L.current.keys()))t>=e&&(L.current.delete(t),n=!0);n&&j(e=>e+1);for(const t of Object.keys(P.current))Number(t)>=e&&delete P.current[t];for(const t of Array.from(I.current))t>=e&&I.current.delete(t)},[t.length],sh);const me=K((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],ch),fe=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],dh),he=K((e,t)=>{const n=R.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return fe(e),b&&!t&&delete P.current[e],void(t&&me(e,!0));if(e<u&&!p)return fe(e),void me(e,!0);fe(e);const o=a(t,{rootMargin:"400px"});_.current.set(e,o),o.isVisible()&&me(e,!0),o.whenVisible.then(()=>me(e,!0)).catch(()=>{})},[b,fe,me,a,u,ne,p],uh),pe=K(e=>{const t=A.current.get(e);if(t)return t;const n=t=>he(e,t);return A.current.set(e,n),n},[he],mh),ye=K((e,t)=>{if(!t)return void(L.current.has(e)&&(L.current.delete(e),j(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&L.current.get(e)!==n&&(L.current.set(e,n),j(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],fh),ge=K(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ye(e,t);return F.current.set(e,n),n},[ye],hh),be=K(e=>!(g&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,g,u],ph),ve=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],yh);q(()=>{for(const[e,t]of R.current.entries())t&&he(e,t)},[he],gh),q(()=>{p&&v>H.current&&$(v-1),H.current=v},[v,p],bh);const we=p?C(()=>x("div",{className:"node-spacer",style:{height:`${le}px`},"aria-hidden":"true"})):null,xe=p?C(()=>x("div",{className:"node-spacer",style:{height:`${ae}px`},"aria-hidden":"true"})):null;return C(()=>S("div",{ref:r,className:`markstream-octane markdown-renderer${e.isDark?" dark":""}${p?" virtualized":""}`,"data-custom-id":e.customId,onClick:e.onClick,onMouseOver:ve(e.onMouseOver),onMouseOut:ve(e.onMouseOut)},()=>E([we,re.map(({node:t,index:r})=>{const i=be(r),l=L.current.get(r)??oe,a=!1!==e.fade&&"code_block"!==t.type&&!I.current.has(r)&&i;return a&&I.current.add(r),S("div",{key:`${o}-${r}`,ref:pe(r),className:"node-slot","data-node-index":r,"data-node-type":t.type},()=>C(i?()=>S("div",{ref:ge(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>x(gp,{node:t,nodeKey:`${o}-${r}`,renderCtx:n}))):()=>x("div",{className:"node-placeholder",style:{height:`${l}px`}})))}),xe,i&&C(()=>x("span",{ref:l,className:"typewriter-cursor","aria-hidden":"true"}))])))},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,o=t.parsedNodes;if(n===o)return!0;if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==o[l])return!1;const r=e.props,i=t.props;return r.isDark===i.isDark&&r.typewriter===i.typewriter&&r.fade===i.fade&&r.batchRendering===i.batchRendering&&r.initialRenderBatchSize===i.initialRenderBatchSize&&r.renderBatchSize===i.renderBatchSize&&r.renderBatchDelay===i.renderBatchDelay&&r.renderBatchBudgetMs===i.renderBatchBudgetMs&&r.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&r.deferNodesUntilVisible===i.deferNodesUntilVisible&&r.maxLiveNodes===i.maxLiveNodes&&r.liveNodeBuffer===i.liveNodeBuffer&&r.viewportPriority===i.viewportPriority&&r.indexKey===i.indexKey&&r.onClick===i.onClick&&r.onMouseOver===i.onMouseOver&&r.onMouseOut===i.onMouseOut});function vp(t){const n={...fp,...t},o=Y(null,vh),r=Y(/* @__PURE__ */new Map,wh),i=Y(0,xh),l=Y(null,kh),a=J(Sh,mt,n.smoothStreamingOptions,Sh),s=e.useContext(He),c=Y(/* @__PURE__ */new Set,Ch),[d,u]=Z(()=>!0===n.smoothStreaming,Mh);q(()=>{u(!0)},[],Nh);const m=Array.isArray(n.nodes)&&n.nodes.length>0,f=X(()=>!1!==n.smoothStreaming&&!m&&(!0===n.smoothStreaming||!s)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[m,s,n.maxLiveNodes,n.smoothStreaming,n.typewriter],$h),h=d&&f,p=h?a.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Bh),g=n.content??"",b=m||a.source===g,v=X(()=>h&&null!=y?Boolean(y&&b&&a.caughtUp):y,[y,b,a.caughtUp,h],Th),w=Y(null,Eh),[k,M]=Z(!1,Lh),N=Y(void 0,Dh),$=Y(0,jh),B=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],Ph),T=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&B.has(t)},[B],_h),E=K(e=>{if(!e||"object"!=typeof e)return 0;const t=e,n=t.raw??t.content??t.code;if("string"==typeof n)return n.length;const o=t.children;if(Array.isArray(o))return o.reduce((e,t)=>e+E(t),0);const r=t.items;return Array.isArray(r)?r.reduce((e,t)=>e+E(t),0):0},[],Rh),L=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+E(t),0):(n.content??"").length,[n.nodes,n.content,E],Ah),D=K(()=>{N.current&&(clearTimeout(N.current),N.current=void 0)},[],Fh),j=K(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??"").trim())return NodeFilter.FILTER_REJECT;const t=e.parentElement;return t?t.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,o=t.nextNode();for(;o;)n=o,o=t.nextNode();return n},[],Ih),P=K(()=>{if("undefined"==typeof window||!k||!o.current||!w.current)return;const e=o.current,t=w.current,n=j(e),r=e.getBoundingClientRect();let i=0,l=0,a=20;if(n?.textContent){const t=document.createRange(),o=n.textContent.length;t.setStart(n,Math.max(0,o-1)),t.setEnd(n,o);const s="function"==typeof t.getClientRects?t.getClientRects():void 0,c=s?.[s.length-1]??n.parentElement?.getBoundingClientRect();c&&(i=c.right-r.left+e.scrollLeft,l=c.top-r.top+e.scrollTop,a=c.height||a),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,l)}px)`,t.style.height=`${a}px`},[k,o,j],Hh);q(()=>{k&&requestAnimationFrame(()=>{P()})},[k,P],Oh),q(()=>()=>{D()},[D],Wh);const _=m?n.nodes:p;l.current!==_&&(i.current+=1,l.current=_);const R=G(nt,ot,ot,zh),A=X(()=>it(n.customId),[n.customId,R],Kh),F=J(Vh,yp,n.streamingComponents,Vh),I=J(qh,yp,n.htmlComponents,qh);q(()=>{c.current},[I,F],Uh);const H=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],Xh),O=X(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return se(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(F))},[n.customId,n.customHtmlTags,n.parseOptions,R,F],Yh),W=X(()=>{const e=O;return e&&0!==e.length?oe(H,{customHtmlTags:e}):oe(H)},[H,O],Zh),z=X(()=>{const e=W;return n.customMarkdownIt?n.customMarkdownIt(e):e},[W,n.customMarkdownIt],Gh),V=X(()=>{const e=n.parseOptions??{},t=v,o=null!=t,r=O.length>0;return o||r?{...e,...o?{final:t}:{},...r?{customHtmlTags:O}:{}}:e},[O,v,n.parseOptions],Jh),U=X(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return m?o=n.nodes.map(e=>({...e})):p&&(o=de(p,z??hp,V)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:p.length}),o},[n.debugPerformance,p,m,n.nodes,V,z,n.customId,R,O],Qh),Q=K(()=>{const e=U[U.length-1];return!T(e)},[U,T],ep);q(()=>{if("undefined"==typeof window||m)return;if(v)return M(!1),void D();const e=L(),t=Q();return!1===n.typewriter||!t||e<=$.current?(!1!==n.typewriter&&t||M(!1),void($.current=e)):($.current=e,M(!0),D(),requestAnimationFrame(()=>{P()}),N.current=setTimeout(()=>{M(!1)},3e3),()=>{D()})},[p,n.nodes,n.typewriter,n.content,v,U.length,m,L,Q,D,P],tp);const ee=Y([],np),te=V?.postTransformNodes,ne=Y(te,op);ne.current!==te&&(ee.current=[],ne.current=te);const re=function(e,t){if(!t.length)return e;const n=new Array(e.length);let o=e.length===t.length;for(let r=0;r<e.length;r++){const i=r<t.length?t[r]:null;i&&pp(i,e[r])?n[r]=i:(n[r]=e[r],o=!1)}return o?t:n}(U,ee.current);ee.current=re,q(()=>{if(m)return void a.reset("");const e=n.content??"";if(!h)return a.reset(e),void(y&&a.finish({flush:!0}));const t=a.getSnapshot().source;e?e===t||(e.startsWith(t)?a.enqueue(e.slice(t.length)):a.reset(e)):a.reset(""),y&&a.finish()},[m,n.content,y,h],rp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!re.some(e=>"code_block"===e?.type&&"mermaid"!==zt(String(e?.language??""))))return;const e=window.requestIdleCallback??((e,t)=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),t?.timeout??600)),t=window.cancelIdleCallback??(e=>window.clearTimeout(e)),o=e(()=>{dn()},{timeout:900});return()=>t(o)},[re,n.renderCodeBlocksAsPre],ip);const ie=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],lp),le=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],ap),ae=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],sp),ce=X(()=>({...n.d2Props||{}}),[n.d2Props],cp),ue=X(()=>({...n.infographicProps||{}}),[n.infographicProps],dp),me=X(()=>({customId:n.customId,isDark:n.isDark,final:v,indexKey:ie,typewriter:n.typewriter,fade:n.fade,textStreamState:r.current,streamRenderVersion:i.current,customComponents:A,streamingComponents:F,htmlComponents:I,customHtmlTags:O,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockOptions:n.codeBlockOptions,codeBlockProps:le,mermaidProps:ae,d2Props:ce,infographicProps:ue,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,v,ie,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockOptions,O,le,ae,ce,ue,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,A,F,I],up);me.streamRenderVersion=i.current,me.textStreamState=r.current;const fe=Y(null,mp);return fe.current||(fe.current={textStreamState:r.current,getStreamRenderVersion:()=>i.current}),S(Oe.Provider,{value:fe.current},()=>S(He.Provider,{value:h},()=>S(Ze,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(bp,{props:n,parsedNodes:re,renderCtx:me,indexPrefix:ie,containerRef:o,showTypewriterCursor:k,typewriterCursorRef:w})))))}var wp=/* @__PURE__ */W('<blockquote class="blockquote-node" dir="auto"></blockquote>'),xp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(wp);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"cite",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function kp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(xp,{h0:t.cite,h1:i??(n&&o?C(()=>x(vp,{nodes:t.children||[],indexKey:`blockquote-${String(r??"blockquote")}`,customId:n.customId,isDark:n.isDark,typewriter:n.typewriter,viewportPriority:!0,codeBlockStream:n.codeBlockStream,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockOptions:n.codeBlockOptions,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}kp.$$singleRoot=!0;var Sp=/* @__PURE__ */N(5),Cp=/* @__PURE__ */Symbol(Sp),Mp=/* @__PURE__ */Symbol(Sp+1),Np=/* @__PURE__ */Symbol(Sp+2),$p=/* @__PURE__ */Symbol(Sp+3),Bp=/* @__PURE__ */Symbol(Sp+4);function Tp(e){const t=Y(null,Cp),[n,o]=Z(!1,Mp),[r,i]=Z({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},Np),l=X(()=>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],$p);return q(()=>{if(!e.visible)return void o(!1);if(!e.anchorEl||!t.current)return void o(!0);let n=null,r=!1;const l=async()=>{if(!e.anchorEl||!t.current)return;const{x:n,y:o}=await Ce(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[Ne(e.offset??8),Me(),$e({padding:8})],strategy:"fixed"});r||i({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(n)}px, ${Math.round(o)}px, 0)`})};return l().then(()=>{r||o(!0)}),n=Se(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],Bp),"undefined"==typeof document?null:e.visible&&n?k(C(()=>S("div",{id:e.id??void 0,ref:t,style:r,className:["markstream-octane ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",l?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip"},()=>e.content)),document.body):null}export{Ie as AdmonitionNode,kp as BlockquoteNode,wt as CheckboxNode,Rr as CodeBlockNode,Rr as OctaneCodeBlockNode,Wi as D2BlockNode,Xi as DefinitionListNode,Gi as EmojiNode,el as EmphasisNode,Cm as FallbackComponent,rl as FootnoteAnchorNode,al as FootnoteNode,pl as FootnoteReferenceNode,bl as HardBreakNode,vl as HeadingNode,kl as HighlightNode,ca as HtmlBlockNode,Aa as HtmlInlineNode,ln as HtmlPreviewFrame,qa as ImageNode,Rs as InfographicBlockNode,Us as InlineCodeNode,Zs as InsertNode,bc as LinkNode,xc as ListItemNode,kc as ListNode,Pd as MERMAID_WORKER_BUSY_CODE,ad as MathBlockNode,xd as MathInlineNode,fm as MermaidBlockNode,vp as NodeRenderer,vp as default,Bm as ParagraphNode,Tn as PreCodeNode,Dm as ReferenceNode,_m as StrikethroughNode,Fm as StrongNode,Om as SubscriptNode,Km as SuperscriptNode,af as TableNode,dc as TextNode,df as ThematicBreakNode,Tp as Tooltip,pf as VmrContainerNode,_c as WORKER_BUSY_CODE,Fd as canParseOffthread,at as clearGlobalCustomComponents,Fc as clearKaTeXCache,jc as clearKaTeXWorker,Rd as clearMermaidWorker,ut as defineHtmlComponents,dt as defineStreamingComponents,Kr as disableD2,zr as enableD2,Id as findPrefixOffthread,st as getCustomComponentDisplay,it as getCustomNodeComponents,zc as getKaTeXBackpressureDefaults,Xt as getLanguageIcon,jd as getMermaidWorkerLoad,Vr as isD2Enabled,Gt as isLikelyIncompleteLanguageIdentifier,Yt as languageMap,zt as normalizeLanguageIdentifier,qt as preloadExtendedLanguageIcons,lt as removeCustomComponents,Rc as renderKaTeXInWorker,Kc as renderKaTeXWithBackpressure,xf as renderNode,Kt as resolveLanguageId,rt as setCustomComponents,Wr as setD2Loader,kt as setDefaultI18nMap,Wc as setKaTeXBackpressureDefaults,Ac as setKaTeXCache,Ic as setKaTeXConcurrencyLimit,Dc as setKaTeXWorker,Pc as setKaTeXWorkerDebug,It as setLanguageIconResolver,_d as setMermaidWorker,Ld as setMermaidWorkerClientDebug,Dd as setMermaidWorkerMaxConcurrency,Ut as subscribeLanguageIconsRevision,Hd as terminateWorker,St as useSafeI18n,mt as useSmoothMarkdownStream,Hc as waitForKaTeXWorkerSlot,ct as withMarkstreamComponentDisplay};
|
|
2
|
+
import*as e from"octane";import{Fragment as t,__s as n,attachRef as o,bag0 as r,bag1 as i,bag10 as l,bag12 as a,bag13 as s,bag15 as c,bag3 as d,bag4 as u,bag5 as m,bag6 as f,bag7 as h,bag8 as p,bagOf as y,child as g,childTextHole as b,clone as v,createContext as w,createElement as x,createPortal as k,createScopedElement as S,createScopedValue as C,delegateEvents as N,hookSlots as M,htextSwap as $,mapSlot as B,markDangerouslySetInnerHTMLChildren as E,positionalChildren as T,queueRefAttach as L,queueRefDetach as D,setAriaAttribute as j,setAttribute as P,setCheckedCheckable as _,setClassAttr as R,setHostPropSources as A,setStyle as F,setText as I,sibling as H,snapshotSpread as O,template as W,textHole as z,useCallback as K,useContext as V,useEffect as q,useLayoutEffect as U,useMemo as X,useRef as Y,useState as Z,useSyncExternalStore as G,withSlot as J}from"octane";import{BLOCKED_HTML_TAGS as Q,NON_STRUCTURING_HTML_TAGS as ee,convertHtmlAttrsToProps as te,getHtmlTagFromContent as ne,getMarkdown as oe,hasCustomHtmlComponents as re,isCustomHtmlComponentTag as ie,isHtmlTagBlocked as le,isHtmlTagHardBlocked as ae,mergeCustomHtmlTags as se,normalizeCustomHtmlTagName as ce,parseMarkdownToStructure as de,sanitizeHtmlAttrs as ue,sanitizeHtmlContent as me,sanitizeHtmlTokenAttrs as fe,sanitizeImageSrc as he,shouldOpenLinkInNewTab as pe,shouldRenderUnknownHtmlTagAsText as ye,stripCustomHtmlWrapper as ge,toSafeSvgElement as be,tokenAttrsToRecord as ve,tokenizeHtml as we}from"stream-markdown-parser";import{createSmoothMarkdownStream as xe,normalizeShikiLanguage as ke}from"markstream-core";import{autoUpdate as Se,computePosition as Ce,flip as Ne,offset as Me,shift as $e}from"@floating-ui/dom";var Be=/* @__PURE__ */new Set(["table","code_block","html_block","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function Ee(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=n??!0,e):e,{})}function Te(t,n,o,r){if("function"!=typeof r)throw new TypeError("renderNodeChildren expected a function, received "+typeof r);if(!Array.isArray(t)||0===t.length)return null;const i=[];for(let l=0;l<t.length;l++){const a=t[l];if(a){if("label_open"===a.type){const s=[];for(l++;l<t.length;){const e=t[l];if("label_close"===e?.type)break;e&&s.push(e),l++}const c=`${o}-label-${l}`;i.push(e.createElement("label",{key:c,...Ee(a.attrs)},Te(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function Le(e,t,n,o){return Te(e,t,`${n}-inline`,o)}var De=/* @__PURE__ */W('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),je=/* @__PURE__ */M(3),Pe=/* @__PURE__ */Symbol(je),_e=/* @__PURE__ */Symbol(je+1),Re=/* @__PURE__ */Symbol(je+2),Ae=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r,i,l,a,s,c,d,u;const m=v(De);e=m,n=m;const f=g(m);r=f,i=f;const h=g(f);l=h;const p=H(h,1);a=p,s=f,c=H(p,1),d=m,u=H(f,1),o=y(t,m,{a:void 0,b:e,c:void 0,d:n,e:void 0,f:r,g:i,h:l,i:null,j:void 0,k:a,l:null,m:void 0,n:s,o:c,p:null,q:void 0,r:d,s:u,t:null,u:void 0})}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"data-index-key",t),o.c=t)}{const t=e.h2;o.e!==t&&(P(o.f,"id",t),o.e=t)}{const n=e.h3,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.j!==n){o.j=n;const e=o.i;null==e||r||null===n?o.i=z(t,1,o.g,n,o.h,!0):I(e,n)}}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.m!==n){const e=o.l;null==e||r||null===n?o.l=b(t,2,o.k,n,e):I(e,n),o.m=n}}{const n=e.h5,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){o.q=n;const e=o.p;null==e||r||null===n?o.p=z(t,3,o.n,n,o.o,!0):I(e,n)}}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.u!==n){o.u=n;const e=o.t;null==e||r||null===n?o.t=z(t,4,o.r,n,o.s,!0):I(e,n)}}}),Fe={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function Ie(e){const{node:t,ctx:n,renderNode:o,indexKey:r,isDark:i}=e,l=String(t.kind||"note"),a=X(()=>t.title&&String(t.title).trim().length?String(t.title):l.charAt(0).toUpperCase()+l.slice(1),[l,t.title],Pe),[s,c]=Z(()=>!!t.collapsible&&!(t.open??1),_e),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],Re);return x(Ae,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Fe[l]&&S("span",{className:"admonition-icon"},()=>Fe[l]),h4:a,h5:t.collapsible&&C(()=>S("button",{type:"button",className:"admonition-toggle","aria-expanded":!s,"aria-controls":`${d}-content`,title:s?"Expand":"Collapse",onClick:()=>c(e=>!e)},()=>S("span",{},()=>s?"▶":"▼"))),h6:!s&&C(()=>S("div",{id:`${d}-content`,className:"admonition-content","aria-labelledby":d},()=>n&&o?Te(t.children,n,String(r??d),o):null))})}Ie.$$singleRoot=!0;var He=w(!1),Oe=w(null);function We(){return V(Oe)}var ze=/* @__PURE__ */M(3),Ke=/* @__PURE__ */Symbol(ze),Ve=/* @__PURE__ */Symbol(ze+1),qe=/* @__PURE__ */Symbol(ze+2),Ue=w(null);function Xe(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,o=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,r=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null;let i=null,l=null;const a=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set;let c=null;const d=()=>{if(!a.size){try{i?.disconnect()}catch{}i=null,l=null,s.size||(()=>{if(null!=c){try{r?.(c)}catch{}c=null}})()}},u=e=>{const t=a.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{i?.unobserve(e)}catch{}a.delete(e),s.delete(e),d()}},m=()=>{o&&null==c&&s.size&&(c=o(()=>{c=null;const e=s.values().next().value;e&&(s.delete(e),u(e),s.size&&m())},{timeout:1200}))};return(o,r)=>{const c={current:!1};let f=!1;const{promise:h,resolve:p}=Promise.withResolvers(),y=()=>{f||(f=!0,p())},g=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g};const b=((t,o)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,o);if(i&&(c=r,(s=l)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return i;var s,c;if(i)try{i.disconnect()}catch{}i=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&u(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),l=r;for(const e of a.keys())i.observe(e);return i})(r?.rootMargin??"300px",r?.threshold??0);return b?(a.set(o,{resolve:y,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:g}):(c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Ye=Xe(()=>null,()=>!0);function Ze({getRoot:e,enabled:t=!0,children:n}){const o=Y(t,Ke);o.current=t;const r=Y(e,Ve);r.current=e;const i=X(()=>Xe(()=>r.current?.()??null,()=>o.current),[],qe);return S(Ue.Provider,{value:i},()=>n)}function Ge(){return V(Ue)??Ye}var Je="__global__",Qe="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",et=(()=>{const e=globalThis;if(e[Qe])return e[Qe];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[Qe]=t,t})();function tt(){et.revision++;for(const e of Array.from(et.listeners))try{e()}catch{}}function nt(e){return et.listeners.add(e),()=>{et.listeners.delete(e)}}function ot(){return et.revision}function rt(e,t){"string"==typeof e?et.scopedComponents[e]={...t||{}}:et.scopedComponents[Je]={...e},tt()}function it(e){const t=et.scopedComponents[Je]||{};if(!e)return t;const n=et.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function lt(e){if(e===Je)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete et.scopedComponents[e],tt()}function at(){delete et.scopedComponents[Je],tt()}function st(e){return e?.markstreamDisplay}function ct(e,t){return e.markstreamDisplay=t,e}function dt(e){return e}function ut(e){return e}function mt(e={}){const t=Y(null,ht);t.current||(t.current=xe(e));const n=t.current,[o,r]=Z(()=>n.getSnapshot(),pt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],yt),X(()=>({...o,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,o],gt)}var ft=/* @__PURE__ */M(4),ht=/* @__PURE__ */Symbol(ft),pt=/* @__PURE__ */Symbol(ft+1),yt=/* @__PURE__ */Symbol(ft+2),gt=/* @__PURE__ */Symbol(ft+3),bt=/* @__PURE__ */W('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),vt=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=v(bt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function wt(e){const{node:t}=e;return x(vt,{h0:Boolean(t.checked)})}wt.$$singleRoot=!0;var xt={"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 kt(e){Object.assign(xt,e)}function St(){return{t:e=>xt[e]??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)}}var Ct=null,Nt=null,Mt=null,$t=null,Bt=null,Et=null;function Tt(){$t&&(clearTimeout($t),$t=null),Bt&&(clearTimeout(Bt),Bt=null)}async function Lt(e){if(!Ct||!Nt)return;const{x:t,y:n}=await Ce(Nt,Ct,{placement:e,middleware:[Me(8),Ne(),$e({padding:8})],strategy:"fixed"});Ct.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Dt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Ct||"undefined"==typeof document||((Ct=document.createElement("div")).className="markstream-octane ms-tooltip",Ct.setAttribute("role","tooltip"),Ct.dataset.visible="false",Ct.style.position="fixed",Ct.style.left="0px",Ct.style.top="0px",Ct.style.transform="translate3d(0,0,0)",document.body.appendChild(Ct)),!Ct)return;Tt();const l=async()=>{if(Ct){Nt=e,Ct.textContent=t,Ct.dataset.placement=n,Ct.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",Ct.dataset.visible="false",Et=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Ct.id=Et;try{e.setAttribute("aria-describedby",Et)}catch{}await Lt(n),Ct.dataset.visible="true",Mt?.(),Mt=Se(e,Ct,()=>{Lt(n)})}};o?l():$t=setTimeout(l,80)}function jt(e=!1){if(!Ct)return;Tt();const t=()=>{if(Ct){if(Ct.dataset.visible="false",Nt&&Et)try{Nt.removeAttribute("aria-describedby")}catch{}Nt=null,Et=null,Mt&&(Mt(),Mt=null)}};e?t():Bt=setTimeout(t,120)}var Pt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n',_t=null,Rt=null,At=null,Ft=/* @__PURE__ */new Set;function It(e){_t=e??null}var Ht={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",d2lang:"d2",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"},Ot={"":Pt,plain:Pt,text:Pt,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'};function Wt(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}function zt(e){const t=Wt(e);return Ht[t]??t}function Kt(e){const t=zt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"shell":return"zsh";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}async function Vt(){return Rt||(At||(At=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Rt=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of Ft)try{e()}catch{}}(),Rt)).catch(()=>null)),At)}async function qt(){await Vt()}function Ut(e){return Ft.add(e),()=>{Ft.delete(e)}}function Xt(e){if(_t){const t=_t(e);if(null!=t&&""!==t)return t}const t=zt(e),n=Ot[t];if(n)return n;const o=Rt?.[t];return o||(Vt(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n')}var Yt={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",csharp:"C#",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"},Zt=Array.from(/* @__PURE__ */new Set([...Object.keys(Ht),...Object.values(Ht),...Object.keys(Ot),...Object.keys(Yt),"c","diff","go","java","php","ruby","rust","sql","yaml"]));function Gt(e){const t=Wt(e);return!!t&&!Zt.includes(t)&&Zt.some(e=>e.startsWith(t))}var Jt=/* @__PURE__ */M(4),Qt=/* @__PURE__ */Symbol(Jt),en=/* @__PURE__ */Symbol(Jt+1),tn=/* @__PURE__ */Symbol(Jt+2),nn=/* @__PURE__ */Symbol(Jt+3),on=void 0!==import.meta&&Boolean(!1),rn=null;function ln(e){const{t:t}=J(Qt,St,Qt),n=X(()=>{const t=e.code||"",n=t.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?t:`<!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: ${e.isDark?"#020617":"#ffffff"};\n color: ${e.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 ${t}\n </body>\n</html>`},[e.code,e.isDark],en),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!on||"undefined"==typeof console||rn===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(rn=e,console.warn("[markstream-octane] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(t),t):void 0!==t?"":!0===n?"allow-scripts":"";var t,n},[e.htmlPreviewAllowScripts,e.htmlPreviewSandbox],tn);return q(()=>{const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||e.onClose?.()};return"undefined"!=typeof window&&window.addEventListener("keydown",t),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",t)}},[e],nn),"undefined"==typeof document?null:k(C(()=>S("div",{className:"markstream-octane html-preview-frame__backdrop"+(e.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>e.onClose?.()},()=>C(()=>S("div",{className:"html-preview-frame"+(e.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation()},()=>T([S("div",{className:"html-preview-frame__header"},()=>T([S("div",{className:"html-preview-frame__title"},()=>T([x("span",{className:"html-preview-frame__dot"}),S("span",{className:"html-preview-frame__label"},()=>e.title||`HTML ${t("common.preview")}`)])),C(()=>x("button",{type:"button",className:"html-preview-frame__close"+(e.isDark?" html-preview-frame__close--dark":""),onClick:()=>e.onClose?.()},"\n ×\n "))])),C(()=>x("iframe",{className:"html-preview-frame__iframe",sandbox:o,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:n,title:e.title||"Preview"}))]))))),document.body)}var an=!1,sn=null,cn=!1;async function dn(){if(sn)return sn;if(cn)return null;try{if(!(sn=function(e){const t="function"==typeof e?.createCodeBlockRuntime||"function"==typeof e?.useMonaco?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return"function"!=typeof n?null:{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:t?.detectLanguage?.bind(t),preloadStreamDiffs:t?.preloadStreamDiffs?.bind(t)}}(await import("stream-diffs/markstream"))))throw new Error("Invalid stream-diffs runtime");return await async function(e){an||(an=!0,e?.preloadStreamDiffs&&await e.preloadStreamDiffs())}(sn),sn}catch{return cn=!0,null}}var un=/* @__PURE__ */W('<pre data-markstream-pre="1" tabindex="0"></pre>'),mn=/* @__PURE__ */M(6),fn=/* @__PURE__ */Symbol(mn),hn=/* @__PURE__ */Symbol(mn+1),pn=/* @__PURE__ */Symbol(mn+2),yn=/* @__PURE__ */Symbol(mn+3),gn=/* @__PURE__ */Symbol(mn+4),bn=/* @__PURE__ */Symbol(mn+5),vn=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r,i,l,a,s;const d=v(un);e=d,n=d,r=d,i=d,l=d,a=d,s=d,o=c(t,d,void 0,e,void 0,n,void 0,r,void 0,i,void 0,l,void 0,a,s,null,void 0)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(F(o.d,t,o.c),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-busy",t),o.e=t)}{const t=e.h3;o.g!==t&&(j(o.h,"aria-label",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"data-language",t),o.i=t)}{const t=e.h5;o.k!==t&&(P(o.l,"data-markstream-line-numbers",t),o.k=t)}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.o!==n){const e=o.n;null==e||r||null===n?o.n=b(t,1,o.m,n,e):I(e,n),o.o=n}}});function wn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function xn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function kn(e){return e.startsWith("-")&&!e.startsWith("---")}function Sn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Cn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function Nn(e,t,n,o,r={}){const i=0===String(e??"").trim().length;return{code:e,empty:i,kind:i&&"hunk"!==t&&!r.preserveBlankKind?"context":t,key:n,number:o}}function Mn(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?Nn(e,"hunk",`inline-hunk-${n}`,""):kn(e)?Nn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Sn(e)?Nn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):Nn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function $n(e,t){const n=xn(e),o=xn(t),r=function(e,t){const n=e.length,o=t.length;if((n+1)*(o+1)>15e5)return null;const r=o+1,i=new Uint16Array((n+1)*(o+1));for(let c=n-1;c>=0;c--)for(let n=o-1;n>=0;n--){const o=c*r+n;e[c]===t[n]?i[o]=i[(c+1)*r+n+1]+1:i[o]=Math.max(i[(c+1)*r+n],i[c*r+n+1])}const l=[];let a=0,s=0;for(;a<n&&s<o;)e[a]===t[s]?(l.push({originalIndex:a,modifiedIndex:s}),a++,s++):i[(a+1)*r+s]>=i[a*r+s+1]?a++:s++;return l}(n,o);if(r){const e=[];let t=0,i=0;for(const l of r){for(;t<l.originalIndex;)e.push(Nn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Cn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(Nn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Cn(o,i)})),i++;e.push(Nn(o[l.modifiedIndex],"context",`inline-context-source-${l.originalIndex}-${l.modifiedIndex}`,l.modifiedIndex+1)),t=l.originalIndex+1,i=l.modifiedIndex+1}for(;t<n.length;)e.push(Nn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Cn(n,t)})),t++;for(;i<o.length;)e.push(Nn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Cn(o,i)})),i++;return e}const i=[];let l=0,a=n.length-1,s=o.length-1;for(;l<=a&&l<=s&&n[l]===o[l];)i.push(Nn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(Nn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(Nn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Cn(n,d)}));for(let d=l;d<=s;d++)i.push(Nn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Cn(o,d)}));return i.concat(c)}function Bn(e,t=!1,n=wn(e?.language)){const o=(r=e?.code,String(r??"").split(/\r\n|\n|\r/));var r;if(!function(e,t,n){const o=e.some(e=>kn(e)),r=e.some(e=>Sn(e));return o&&r||function(e,t){if("diff"===t)return!0;const n=String(e?.raw??"").split(/\r?\n/,1)[0]?.trim()??"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(n)}(t,n)&&(o||r)}(o,e,n)&&function(e){return null!=e?.originalCode||null!=e?.updatedCode}(e)){if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:$n(e?.originalCode,e?.updatedCode)}];const n=xn(e?.originalCode),o=xn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>Nn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Cn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>Nn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Cn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Mn(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(Nn(d,"hunk",`original-hunk-${c}`,"")),l.push(Nn(d,"hunk",`modified-hunk-${c}`,""));else if(kn(d))i.push(Nn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Sn(d))l.push(Nn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(Nn(e,"context",`original-context-${c}`,a++)),l.push(Nn(e,"context",`modified-context-${c}`,s++))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:i},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:l}]}function En({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=X(()=>wn(e?.language),[e],fn),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=X(()=>c?Bn(e,!0===o,l):[],[o,c,e,l],hn),u=X(()=>function(e){if(!0===e?.diff)return String(e?.code??"");const t=String(e?.code??"");return!0===e?.loading?t:t.replace(/\r\n$|\n$|\r$/,"")}(e),[e],pn),m=X(()=>function(e){let t=1;for(let n=0;n<e.length;n++)"\n"===e[n]?t++:"\r"===e[n]&&(t++,"\n"===e[n+1]&&n++);return t}(u),[u],yn),f=X(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],gn),h=X(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(2,String(m).length)}ch`,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}},[m,c,r],bn);return x(vn,{h0:[a,n,r?"markstream-pre--line-numbers":"",c?"markstream-pre--diff-preview":"",c&&o?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),h1:h?{...i,...h}:i,h2:!0===e?.loading,h3:s,h4:l,h5:r?"1":void 0,h6:c?S("code",{translate:"no",className:"markstream-pre__diff-code"},()=>d.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-pane",e.className].join(" ")},()=>e.lines.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-line",`markstream-pre__diff-line--${e.kind}`,e.empty?"markstream-pre__diff-line--empty":""].filter(Boolean).join(" ")},()=>T([x("span",{className:"markstream-pre__diff-rail","aria-hidden":"true"}),S("span",{className:"markstream-pre__diff-number","aria-hidden":"true"},()=>e.number),S("span",{className:"markstream-pre__diff-content"},()=>S("span",{className:"markstream-pre__diff-content-inner"},()=>e.code))])))))):S(t,{},()=>T([r&&S("span",{className:"markstream-pre__line-numbers","aria-hidden":"true"},()=>S("span",{className:"markstream-pre__line-numbers-text"},()=>f)),S("code",{translate:"no",className:"markstream-pre__code"},()=>u)]))})}En.$$singleRoot=!0;var Tn=/* @__PURE__ */W('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),Ln=/* @__PURE__ */W('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Dn=["r","a","b"],jn=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,c,d,u;const m=v(Tn),f=g(m);{const l=e.h0;n=l,i=f,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=f,a=f,c=f;const h=H(f,1);d=h,u=h,r=s(t,m,n,i,void 0,l,void 0,a,void 0,c,void 0,d,u,null,void 0),t.refFields=Dn}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-hidden",t),r.g=t)}{const t=e.h4;r.i!==t&&(F(r.j,t,r.i),r.i=t)}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.m!==n){const e=r.l;null==e||o||null===n?r.l=b(t,1,r.k,n,e):I(e,n),r.m=n}}}),Pn=/* @__PURE__ */M(96),_n=/* @__PURE__ */Symbol(Pn),Rn=/* @__PURE__ */Symbol(Pn+1),An=/* @__PURE__ */Symbol(Pn+2),Fn=/* @__PURE__ */Symbol(Pn+3),In=/* @__PURE__ */Symbol(Pn+4),Hn=/* @__PURE__ */Symbol(Pn+5),On=/* @__PURE__ */Symbol(Pn+6),Wn=/* @__PURE__ */Symbol(Pn+7),zn=/* @__PURE__ */Symbol(Pn+8),Kn=/* @__PURE__ */Symbol(Pn+9),Vn=/* @__PURE__ */Symbol(Pn+10),qn=/* @__PURE__ */Symbol(Pn+11),Un=/* @__PURE__ */Symbol(Pn+12),Xn=/* @__PURE__ */Symbol(Pn+13),Yn=/* @__PURE__ */Symbol(Pn+14),Zn=/* @__PURE__ */Symbol(Pn+15),Gn=/* @__PURE__ */Symbol(Pn+16),Jn=/* @__PURE__ */Symbol(Pn+17),Qn=/* @__PURE__ */Symbol(Pn+18),eo=/* @__PURE__ */Symbol(Pn+19),to=/* @__PURE__ */Symbol(Pn+20),no=/* @__PURE__ */Symbol(Pn+21),oo=/* @__PURE__ */Symbol(Pn+22),ro=/* @__PURE__ */Symbol(Pn+23),io=/* @__PURE__ */Symbol(Pn+24),lo=/* @__PURE__ */Symbol(Pn+25),ao=/* @__PURE__ */Symbol(Pn+26),so=/* @__PURE__ */Symbol(Pn+27),co=/* @__PURE__ */Symbol(Pn+28),uo=/* @__PURE__ */Symbol(Pn+29),mo=/* @__PURE__ */Symbol(Pn+30),fo=/* @__PURE__ */Symbol(Pn+31),ho=/* @__PURE__ */Symbol(Pn+32),po=/* @__PURE__ */Symbol(Pn+33),yo=/* @__PURE__ */Symbol(Pn+34),go=/* @__PURE__ */Symbol(Pn+35),bo=/* @__PURE__ */Symbol(Pn+36),vo=/* @__PURE__ */Symbol(Pn+37),wo=/* @__PURE__ */Symbol(Pn+38),xo=/* @__PURE__ */Symbol(Pn+39),ko=/* @__PURE__ */Symbol(Pn+40),So=/* @__PURE__ */Symbol(Pn+41),Co=/* @__PURE__ */Symbol(Pn+42),No=/* @__PURE__ */Symbol(Pn+43),Mo=/* @__PURE__ */Symbol(Pn+44),$o=/* @__PURE__ */Symbol(Pn+45),Bo=/* @__PURE__ */Symbol(Pn+46),Eo=/* @__PURE__ */Symbol(Pn+47),To=/* @__PURE__ */Symbol(Pn+48),Lo=/* @__PURE__ */Symbol(Pn+49),Do=/* @__PURE__ */Symbol(Pn+50),jo=/* @__PURE__ */Symbol(Pn+51),Po=/* @__PURE__ */Symbol(Pn+52),_o=/* @__PURE__ */Symbol(Pn+53),Ro=/* @__PURE__ */Symbol(Pn+54),Ao=/* @__PURE__ */Symbol(Pn+55),Fo=/* @__PURE__ */Symbol(Pn+56),Io=/* @__PURE__ */Symbol(Pn+57),Ho=/* @__PURE__ */Symbol(Pn+58),Oo=/* @__PURE__ */Symbol(Pn+59),Wo=/* @__PURE__ */Symbol(Pn+60),zo=/* @__PURE__ */Symbol(Pn+61),Ko=/* @__PURE__ */Symbol(Pn+62),Vo=/* @__PURE__ */Symbol(Pn+63),qo=/* @__PURE__ */Symbol(Pn+64),Uo=/* @__PURE__ */Symbol(Pn+65),Xo=/* @__PURE__ */Symbol(Pn+66),Yo=/* @__PURE__ */Symbol(Pn+67),Zo=/* @__PURE__ */Symbol(Pn+68),Go=/* @__PURE__ */Symbol(Pn+69),Jo=/* @__PURE__ */Symbol(Pn+70),Qo=/* @__PURE__ */Symbol(Pn+71),er=/* @__PURE__ */Symbol(Pn+72),tr=/* @__PURE__ */Symbol(Pn+73),nr=/* @__PURE__ */Symbol(Pn+74),or=/* @__PURE__ */Symbol(Pn+75),rr=/* @__PURE__ */Symbol(Pn+76),ir=/* @__PURE__ */Symbol(Pn+77),lr=/* @__PURE__ */Symbol(Pn+78),ar=/* @__PURE__ */Symbol(Pn+79),sr=/* @__PURE__ */Symbol(Pn+80),cr=/* @__PURE__ */Symbol(Pn+81),dr=/* @__PURE__ */Symbol(Pn+82),ur=/* @__PURE__ */Symbol(Pn+83),mr=/* @__PURE__ */Symbol(Pn+84),fr=/* @__PURE__ */Symbol(Pn+85),hr=/* @__PURE__ */Symbol(Pn+86),pr=/* @__PURE__ */Symbol(Pn+87),yr=/* @__PURE__ */Symbol(Pn+88),gr=/* @__PURE__ */Symbol(Pn+89),br=/* @__PURE__ */Symbol(Pn+90),vr=/* @__PURE__ */Symbol(Pn+91),wr=/* @__PURE__ */Symbol(Pn+92),xr=/* @__PURE__ */Symbol(Pn+93),kr=/* @__PURE__ */Symbol(Pn+94),Sr=/* @__PURE__ */Symbol(Pn+95),Cr=["r","a","b"],Nr=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s,c,d,u,m,f,h,p,b,w;const x=v(Ln);{const l=e.h0;n=l,i=x,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=x,a=x;const k=H(g(x),1);s=k,c=x,d=g(x),u=k;const S=g(k);m=S,f=k,h=H(S,1),p=x;const C=H(k,1);b=C,w=H(C,1),r=y(t,x,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:null,l:void 0,m:u,n:m,o:null,p:void 0,q:f,r:h,s:null,t:void 0,u:p,v:b,w:null,x:void 0,y:w,z:null,A:void 0}),t.refFields=Cr}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h4;r.g!==t&&(R(r.h,t),r.g=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,1,r.i,n,r.j,!0):I(e,n)}}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,2,r.m,n,r.n,!0):I(e,n)}}{const n=e.h6,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,3,r.q,n,r.r,!0):I(e,n)}}{const n=e.h7,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.x!==n){r.x=n;const e=r.w;null==e||o||null===n?r.w=z(t,4,r.u,n,r.v,!0):I(e,n)}}{const n=e.h8,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.A!==n){const e=r.z;null==e||o||null===n?r.z=b(t,5,r.y,n,e):I(e,n),r.A=n}}}),Mr="undefined"!=typeof window?U:q,$r={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Br=12;function Er({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return x(jn,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(En,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Tr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Lr(e,t){return"number"!=typeof e||!Number.isFinite(e)||e<0?{top:t,bottom:t}:{top:e,bottom:e}}function Dr(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const o=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},r={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...r,...n,parseDiffOptions:{...r.parseDiffOptions,...o}}}function jr(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}function Pr(e){const t=String(e??"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,o,r]=t.slice(0,3).map(Number);return.2126*n+.7152*o+.0722*r}function _r(e){const t=String(e??"").trim().toLowerCase();if(!t||"transparent"===t)return!0;const n=t.match(/^#([0-9a-f]{8})$/);if(n)return 0===Number.parseInt(n[1].slice(6),16);const o=t.match(/^#([0-9a-f]{4})$/);if(o)return 0===Number.parseInt(o[1][3]+o[1][3],16);const r=t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1]?.split(/[\s,/]+/).filter(Boolean);return 4===r?.length&&0===Number(r[3])}function Rr(e){const n={...$r,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,codeBlockOptions:u,themes:m,minWidth:f,maxWidth:h,showHeader:p,showCopyButton:y,showExpandButton:g,showPreviewButton:b,showCollapseButton:v,showFontSizeButtons:w,showLineNumbers:k,showTooltips:N}=n,M=Y(null,_n),$=Y(null,Rn),B=Y(null,An),E=Y(null,Fn),L=Y(null,In),D=Y(null,Hn),j=Y(null,On),P=Y(0,Wn),_=Y(null,zn),R=Y(null,Kn),A=J(Vn,Ge,Vn),F=Y(null,qn),I=Y(null,Un),H=Y(u,Xn),O=Y(null,Yn),W=Y([],Zn),z=Y(null,Gn),V=Y(null,Jn),U=Y(!1,Qn),G=Y(void 0,eo),[Q,ee]=Z(!1,to),[te,ne]=Z(()=>"undefined"==typeof window,no),[oe,re]=Z(!1,oo),[ie,le]=Z(!1,ro),[ae,se]=Z(!1,io),[ce,de]=Z(()=>o.language||"plaintext",lo),[ue,me]=Z(()=>zt(o.language),ao),[fe,he]=Z(!1,so),[pe,ye]=Z(!1,co),[ge,be]=Z(!1,uo),[ve,we]=Z(!1,mo),[xe,ke]=Z(0,fo),{t:Se}=J(ho,St,ho);q(()=>{U.current=pe},[pe],po);const Ce=X(()=>Dr(Boolean(o.diff),u),[u,o.diff],yo),[Ne,Me]=Z(()=>{const e=Number(Dr(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:Br},go),[$e,Be]=Z(Ne,bo),Ee=X(()=>!1!==N,[N],vo),Te="boolean"==typeof k?k:!0!==Ce.disableLineNumbers,Le=Y(Te,wo),De=Number(H.current?.fontSize),je=Number(u?.fontSize),Pe=H.current!==u&&Number.isFinite(De)&&De>0&&(!Number.isFinite(je)||je<=0),_e=K(()=>{const e=Ce.maxHeight??500;return"number"==typeof e&&Number.isFinite(e)?e:500},[Ce.maxHeight],xo);J(ko,Mr,()=>{const e=Number(Ce.fontSize),t=Number.isFinite(e)&&e>0?e:Br;Me(t),Be(t)},[Ce.fontSize],ko);const Re=K(e=>{if(Q)return;const t=M.current,n=B.current;if(!t||!n)return;const o="diff"===D.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=_e(),i="diff"===D.current,l=i?"important":"";e?(t.style.minHeight="0px",t.style.setProperty("max-height","none",l),t.style.overflow="visible"):(t.style.minHeight="0px",t.style.setProperty("max-height",`${Math.ceil(r)}px`,l),t.style.overflow=i?"hidden":"auto");try{const n=()=>{if(i){const e=function(e){if("undefined"==typeof window)return null;try{const t=e.getBoundingClientRect();if(t.width<=0)return null;const n=[".stream-diffs-shell",".stream-diffs-shell .diffs-container",".stream-diffs-shell .diff-line",".stream-diffs-shell .diff-hunk"];let o=0;for(const r of Array.from(e.querySelectorAll(n.join(",")))){if(!(r instanceof HTMLElement))continue;const e=window.getComputedStyle(r);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=r.getBoundingClientRect();n.height<=0||n.bottom<=t.top||(o=Math.max(o,n.bottom-t.top))}return o>0?Math.ceil(o+4):null}catch{return null}}(t);if(null!=e)return e}if("function"==typeof o.getContentHeight)return o.getContentHeight();if(i&&"function"==typeof o.getModifiedEditor){const e=o.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}},a=Number(n());if(Number.isFinite(a)&&a>0){const n=e?a:Math.min(a,r);t.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,l)}o.layout?.()}catch{}},[_e,Q],So),Ae=K(e=>{if(Re(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Re(e),window.requestAnimationFrame(()=>{Re(e);const t=M.current;t&&null!=V.current&&(t.style.minHeight="0px",V.current=null)})});return window.setTimeout(()=>Re(e),180),()=>window.cancelAnimationFrame(t)},[Re],Co),Fe=K(()=>{const e=M.current,t=$.current?.querySelector(".code-editor-fallback-surface");if(!e||!t)return;const n=t.getBoundingClientRect().height;!Number.isFinite(n)||n<=0||(V.current=n,e.style.minHeight=`${Math.ceil(n)}px`)},[],No),Ie=K(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],Mo),He=K(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],z.current?.disconnect(),z.current=null},[],$o),Oe=K(()=>{He();const e=B.current,t=M.current;if(!e||!t||"diff"!==D.current)return;const n=()=>Ae(U.current),o=(e,t)=>{try{const o=e?.[t];if("function"!=typeof o)return;const r=o.call(e,n);r&&W.current.push(r)}catch{}},r=e.getDiffEditorView?.(),i=r?.getOriginalEditor?.(),l=r?.getModifiedEditor?.();if(o(r,"onDidUpdateDiff"),o(i,"onDidContentSizeChange"),o(l,"onDidContentSizeChange"),o(i,"onDidLayoutChange"),o(l,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),z.current=e}},[He,Ae],Bo);q(()=>Ut(()=>{ke(e=>e+1)}),[],Eo),q(()=>{me(zt(o.language))},[o.language],To);const We=Y(o,Lo);We.current=o;const ze=K(()=>{P.current+=1;try{E.current?.()}catch{}He(),L.current=null,D.current=null,j.current=null,V.current=null,se(!1),le(!1)},[He],Do),Ke=K(()=>{const e=M.current,t=$.current;if(!e||!t)return;t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),t.style.removeProperty("--vscode-editor-selectionBackground");const n=Tr(Ce.tabSize)??4,r=Lr(Ce.padding,o.diff?0:8);if(e.style.setProperty("--diffs-tab-size",String(n)),"number"==typeof Ce.padding&&Number.isFinite(Ce.padding)&&Ce.padding>=0?e.style.setProperty("--diffs-gap-block",`${r.top}px`):e.style.removeProperty("--diffs-gap-block"),o.diff)return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");const i=e.querySelector(".stream-diffs-shell")??e;try{const n="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(i):null,r=String(n?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(n?.color??"").trim(),l=String(n?.getPropertyValue("--vscode-editor-background")??"").trim(),a=String(n?.backgroundColor??"").trim(),s=_r(l)?_r(a)?"":a:l,c=String(n?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=Pr(e),i=Pr(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(s,r,"plaintext"===Kt(String(o.language||ue||ce||"plaintext")),t.classList.contains("is-dark")))return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");r?e.style.setProperty("--vscode-editor-foreground",r):e.style.removeProperty("--vscode-editor-foreground"),s?e.style.setProperty("--vscode-editor-background",s):e.style.removeProperty("--vscode-editor-background"),c?e.style.setProperty("--vscode-editor-selectionBackground",c):e.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ue,ce,o.diff,o.language,Ce],jo),Ve=X(()=>r?c??m?.[0]??"vitesse-dark":d??m?.[1]??"vitesse-light",[c,r,d,m],Po),qe=K(()=>Ve,[Ve],_o),Ue=X(()=>qe(),[qe],Ro),Xe=X(()=>function(e,t){const n=(function(e){return"string"==typeof e?e:null}(e)??"").toLowerCase();return n?["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=>n.includes(e))&&!["light","latte","dawn","lotus"].some(e=>n.includes(e)):t}(Ue,Boolean(r)),[r,Ue],Ao),Ye=X(()=>o.diff?r?"dark":"light":Xe?"dark":"light",[r,o.diff,Xe],Fo),Ze=X(()=>o.diff?"dark"===Ye:Xe,[Ye,o.diff,Xe],Io),Je=X(()=>o.diff?"dark"===Ye:Boolean(r),[Ye,r,o.diff],Ho),Qe=X(()=>{const e=Ce,t=Tr(e?.fontSize)??(Pe?Br:$e)??Br,n=Tr(e?.lineHeight)??(t===Br?18:Math.max(12,Math.round(1.5*t))),r="string"==typeof e?.fontFamily&&e.fontFamily.trim()?e.fontFamily.trim():'Menlo, Monaco, "Courier New", monospace',i=Lr(e?.padding,o.diff?0:8),l=Tr(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Pe,$e,o.diff,Ce],Oo),et=X(()=>!!o.diff&&"unified"===Ce.diffStyle,[o.diff,Ce],Wo),tt=X(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Qe.lineHeight}px`,"--markstream-pre-line-number-top":`${Qe.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Qe.fontSize}px`,lineHeight:`${Qe.lineHeight}px`,maxHeight:`${_e()}px`,overflow:"auto",paddingBottom:`${Qe.paddingBottom}px`,paddingTop:`${Qe.paddingTop}px`,tabSize:Qe.tabSize,whiteSpace:"scroll"===Ce.overflow?"pre":"pre-wrap","--markstream-code-font-family":Qe.fontFamily,fontFamily:Qe.fontFamily}),[_e,Qe,Ce.overflow],zo),nt=K(()=>{const e=Ce.maxHeight,t={...Ce||{},...null==e?{}:{MAX_HEIGHT:e},themes:m?[...m]:void 0,stream:!1,disableFileHeader:!0,theme:Ue,disableLineNumbers:!Te,fontSize:Qe.fontSize,lineHeight:Qe.lineHeight,fontFamily:Qe.fontFamily,onThemeChange(){Ke()},themeType:r?"dark":"light"};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }","string"==typeof t.unsafeCSS?t.unsafeCSS:""].filter(Boolean).join("\n"),t},[r,Qe,Ue,Ce,Te,Ke,m],Ko),ot=K(()=>{const e=nt(),t=F.current;if(!t)return F.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[nt],Vo),rt=K(e=>{const t=e(ot());return B.current=t,E.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[ot],qo),it=X(()=>JSON.stringify({diffStyle:Ce.diffStyle,expandUnchanged:Ce.expandUnchanged,collapsedContextThreshold:Ce.collapsedContextThreshold,hunkSeparators:Ce.hunkSeparators,lineDiffType:Ce.lineDiffType,maxLineDiffLength:Ce.maxLineDiffLength,expansionLineCount:Ce.expansionLineCount,context:Ce.parseDiffOptions?.context}),[Ce],Uo);q(()=>{ot()},[Ce,ot],Xo),q(()=>()=>{P.current+=1,E.current?.(),He(),E.current=null,L.current=null,D.current=null,j.current=null,B.current=null,I.current=null,_.current=null,R.current?.destroy?.(),R.current=null},[He],Yo),q(()=>{if("undefined"==typeof window)return;if(te)return;const e=$.current;if(!e)return;R.current?.destroy?.();const t=A(e,{rootMargin:"400px"});return R.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),R.current===t&&(R.current=null)}},[A,te],Zo),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(ot(),()=>{e=!1}):((async()=>{try{const t=await dn();if(!e)return;if(!t)return void ee(!0);const n=t.createCodeBlockRuntime,o=t.detectLanguage;if("function"==typeof o&&(_.current=o),"function"!=typeof n)return void ee(!0);I.current=n,rt(n),re(!0)}catch{e&&ee(!0)}})(),()=>{e=!1})},[rt,ot],Go),q(()=>{if(!o.language&&!ue&&_.current)try{const e=_.current(String(o.code??""));e&&de(e)}catch{}},[ue,o.code,o.language],Jo);const lt=X(()=>String(o.language||ue||ce||"plaintext"),[ue,ce,o.language],Qo),at=X(()=>zt(lt),[lt],er),st=X(()=>!!i&&Gt(lt),[i,lt],tr),ct=X(()=>st?"plaintext":Kt(at),[at,st],nr),dt=X(()=>"plaintext"===ct,[ct],or),ut=X(()=>Xt(at),[at,xe],rr),mt=X(()=>!!a&&("html"===at||"svg"===at),[at,a],ir),ft=X(()=>{const e=at;return e?Yt[e]||e.charAt(0).toUpperCase()+e.slice(1):Yt[""]||"Plain Text"},[at],lr),ht=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],ar),pt=X(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(f),r=e(h);return n&&(t.minWidth=n),r&&(t.maxWidth=r),o.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--markstream-code-fallback-fg, var(--code-fg))",t.backgroundColor="var(--markstream-code-fallback-bg, var(--code-bg, #fff))",t.borderColor=Je?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[h,f,o.diff,Je],sr),yt=X(()=>{if(!o.diff)return{color:"var(--markstream-code-fallback-fg, var(--code-fg))",backgroundColor:"var(--markstream-code-fallback-bg, var(--code-bg, #fff))"}},[o.diff],cr),gt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],dr),bt=!1===l&&i||!1!==l&&i&&!gt;q(()=>{if(Q)return;if(!oe)return;if(!ie||!te)return;const e=B.current;ot();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),Ke(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null)&&Ae(pe)};e?.setTheme&&Ue?Promise.resolve(e.setTheme(Ue)).then(t).catch(()=>{}):t()},[ge,ie,Ye,pe,oe,o.diff,Ue,Ae,Ke,ot,Q,te],ur);const vt=K(async()=>{if(Q)return null;if(!te)return null;if(ge)return null;if(bt)return null;const e=B.current,t=M.current;if(!e||!t||!e.createEditor)return null;ot();const n=We.current,o=n.diff?"diff":"single",r=j.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(D.current===o&&r===t&&i)return null;if(L.current)return L.current;P.current+=1;const l=P.current;le(!0);const a=(async()=>{try{E.current?.(),D.current=null,j.current=null,se(!1);const o=ct;if(n.diff?"function"==typeof e.createDiffEditor?(D.current="diff",await e.createDiffEditor(t,jr(n.originalCode),jr(n.updatedCode),o)):(D.current="single",await e.createEditor(t,jr(n.updatedCode??n.code),o)):(D.current="single",await e.createEditor(t,jr(n.code),o)),j.current=t,P.current!==l)return;const r=Number(Ce.fontSize),i=Number.isFinite(r)&&r>0?r:Br;if(Number.isFinite(i)&&i>0){Me(i),Be(i);try{const t="diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.(),n=Tr(Ce.lineHeight)??(i===Br?18:Math.max(12,Math.round(1.5*i)));t?.updateOptions?.({fontSize:i,lineHeight:n})}catch{}}if(Oe(),Ke(),Fe(),Re(pe),await Ie(),P.current!==l)return;Re(pe),se(!0),Ae(pe)}catch{P.current===l&&(G.current=ct,ee(!0))}})().finally(()=>{L.current===a&&(L.current=null)});return L.current=a,a},[Re,Oe,He,ge,pe,ct,Fe,Ce.fontSize,Ae,bt,Ke,ot,Q,te,Ie],mr);q(()=>{ot();const e=H.current!==u;H.current=u;const t=Le.current!==Te;Le.current=Te;const n=O.current;if(O.current=it,Q)return;if(!oe)return;let r=!1;if(e||t){const e=I.current;if(e){ze(),B.current=null,E.current=null;try{rt(e),r=!0}catch{return void ee(!0)}}}const i=Boolean(o.diff&&n!==it);if(!r&&!i)return;if(!te||!ie&&!r)return;if(ge||bt)return;let l=!1;return(async()=>{if(r||ze(),!l)try{await vt()}catch{}})(),()=>{l=!0}},[ge,u,ie,Te,vt,rt,oe,it,o.diff,ze,bt,ot,Q,te],fr),q(()=>{if(Q){const e=G.current;if(void 0===e||e===ct)return;return G.current=void 0,ze(),void ee(!1)}oe&&te&&(ge||bt?ze():vt())},[ge,vt,ct,oe,ze,bt,Q,te],hr),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;const e=B.current;if(!e)return;const t=jr(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=zt(o.language)||ue;if(!n&&_.current)try{n=zt(_.current(t)),n&&me(n)}catch{}const r=st?"plaintext":Kt(n||at);if(e.createEditor&&M.current){try{await Promise.resolve(vt())}catch{}const e=L.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(jr(o.originalCode),jr(o.updatedCode),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}Ae(pe)})()},[at,ue,ge,ie,vt,pe,oe,o.code,o.diff,o.language,o.originalCode,o.updatedCode,Ae,st,bt,Q,te],pr),q(()=>{if(i)return;if(!oe||!te||ge||Q)return;const e=B.current;e&&(async()=>{try{o.diff&&e.finalizeDiff?await Promise.resolve(e.finalizeDiff()):e.finalizeCode&&await Promise.resolve(e.finalizeCode())}catch{}Ae(pe)})()},[ge,pe,i,o.diff,oe,Ae,Q,te],yr),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;if(!pe&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null;return null==e&&Ae(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,pe,i,oe,Ae,bt,Q,te],gr),q(()=>{if(!s)return;if(Q)return;const e=B.current;if(e){try{("diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:$e})}catch{}Ae(pe)}},[s,pe,$e,o.diff,Ae,Q],br),q(()=>{Ee||jt(!0)},[Ee],vr);const wt=K((e,t)=>{if(!Ee)return;const n=e.currentTarget;n&&!n.disabled&&Dt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ze)},[Ze,Ee],wr),xt=K(()=>{Ee&&jt()},[Ee],xr),kt=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(ht)),he(!0),n.onCopy?.(String(ht)),setTimeout(()=>he(!1),1e3)}catch{}},[n,ht],kr),Ct=K(()=>{if(!mt)return;const e="html"===at?"text/html":"image/svg+xml",t="html"===at?Se("artifacts.htmlPreviewTitle")||"HTML Preview":Se("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===at&&we(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${at}-${Date.now()}`})},[at,mt,o,n,Se],Sr);return x(Nr,{h0:$,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Je?"border-gray-700/30":"border-gray-200",i?"is-rendering":"",Je?"is-dark":"",o.diff?"is-diff":"",dt?"is-plain-text":""].join(" "),h2:pt,h3:p&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:yt},()=>T([S("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden"},()=>T([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:ut}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>ft)])),S("div",{className:"flex items-center space-x-2"},()=>T([v&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":ge,onClick:()=>be(e=>!e),onMouseEnter:e=>wt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onFocus:e=>wt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onMouseLeave:xt,onBlur:xt},()=>C(()=>x("svg",{style:{rotate:ge?"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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),w&&s&&S(t,{},()=>T([C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e<=10,onClick:()=>Be(e=>Math.max(10,e-1)),onMouseEnter:e=>wt(e,Se("common.decrease")||"Decrease"),onFocus:e=>wt(e,Se("common.decrease")||"Decrease"),onMouseLeave:xt,onBlur:xt},x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e===Ne,onClick:()=>Be(Ne),onMouseEnter:e=>wt(e,Se("common.reset")||"Reset"),onFocus:e=>wt(e,Se("common.reset")||"Reset"),onMouseLeave:xt,onBlur:xt},x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),x("path",{d:"M3 3v5h5"}))))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e>=36,onClick:()=>Be(e=>Math.min(36,e+1)),onMouseEnter:e=>wt(e,Se("common.increase")||"Increase"),onFocus:e=>wt(e,Se("common.increase")||"Increase"),onMouseLeave:xt,onBlur:xt},x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),y&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy",onClick:kt,onMouseEnter:e=>wt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onFocus:e=>wt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onMouseLeave:xt,onBlur:xt},()=>x("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"},fe?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),g&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":pe,onClick:e=>{ye(e=>!e),wt(e,pe?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse")},onMouseEnter:e=>wt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onFocus:e=>wt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onMouseLeave:xt,onBlur:xt},()=>x("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"},x("path",pe?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})))),mt&&b&&C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Se("common.preview")||"Preview",onClick:Ct,onMouseEnter:e=>wt(e,Se("common.preview")||"Preview"),onFocus:e=>wt(e,Se("common.preview")||"Preview"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},x("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"},x("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"}),x("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"})))))]))]))),h4:`code-block-body${ge?" code-block-body--collapsed":""}${pe?" code-block-body--expanded":""}`,h5:!ge&&(!!l||!i)&&C(Q?()=>x(En,{className:"code-fallback-plain m-0",diffInline:et,node:o,showLineNumbers:Te,style:tt}):()=>x(Er,{editorHostRef:M,editorReady:ae,node:o,preFallbackDiffInline:et,preFallbackStyle:tt,showLineNumbers:Te,stream:l})),h6:!l&&i&&x("div",{className:"code-loading-placeholder"},x("div",{className:"loading-skeleton"},x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line short"}))),h7:ve&&!n.onPreviewCode&&mt&&"html"===at&&C(()=>x(ln,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>we(!1)})),h8:fe?Se("common.copied")||"Copied":""})}function Ar(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Ar(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Fr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ar(e))&&(o&&(o+=" "),o+=t);return o}Er.$$singleRoot=!0,Rr.$$singleRoot=!0;var Ir=()=>import("@terrastruct/d2"),Hr=null,Or=Ir;function Wr(e){Or=e,Hr=null}function zr(e){Wr(e??Ir)}function Kr(){Wr(null)}function Vr(){return"function"==typeof Or}var qr=/* @__PURE__ */W("<div><!><!></div>"),Ur=/* @__PURE__ */M(41),Xr=/* @__PURE__ */Symbol(Ur),Yr=/* @__PURE__ */Symbol(Ur+1),Zr=/* @__PURE__ */Symbol(Ur+2),Gr=/* @__PURE__ */Symbol(Ur+3),Jr=/* @__PURE__ */Symbol(Ur+4),Qr=/* @__PURE__ */Symbol(Ur+5),ei=/* @__PURE__ */Symbol(Ur+6),ti=/* @__PURE__ */Symbol(Ur+7),ni=/* @__PURE__ */Symbol(Ur+8),oi=/* @__PURE__ */Symbol(Ur+9),ri=/* @__PURE__ */Symbol(Ur+10),ii=/* @__PURE__ */Symbol(Ur+11),li=/* @__PURE__ */Symbol(Ur+12),ai=/* @__PURE__ */Symbol(Ur+13),si=/* @__PURE__ */Symbol(Ur+14),ci=/* @__PURE__ */Symbol(Ur+15),di=/* @__PURE__ */Symbol(Ur+16),ui=/* @__PURE__ */Symbol(Ur+17),mi=/* @__PURE__ */Symbol(Ur+18),fi=/* @__PURE__ */Symbol(Ur+19),hi=/* @__PURE__ */Symbol(Ur+20),pi=/* @__PURE__ */Symbol(Ur+21),yi=/* @__PURE__ */Symbol(Ur+22),gi=/* @__PURE__ */Symbol(Ur+23),bi=/* @__PURE__ */Symbol(Ur+24),vi=/* @__PURE__ */Symbol(Ur+25),wi=/* @__PURE__ */Symbol(Ur+26),xi=/* @__PURE__ */Symbol(Ur+27),ki=/* @__PURE__ */Symbol(Ur+28),Si=/* @__PURE__ */Symbol(Ur+29),Ci=/* @__PURE__ */Symbol(Ur+30),Ni=/* @__PURE__ */Symbol(Ur+31),Mi=/* @__PURE__ */Symbol(Ur+32),$i=/* @__PURE__ */Symbol(Ur+33),Bi=/* @__PURE__ */Symbol(Ur+34),Ei=/* @__PURE__ */Symbol(Ur+35),Ti=/* @__PURE__ */Symbol(Ur+36),Li=/* @__PURE__ */Symbol(Ur+37),Di=/* @__PURE__ */Symbol(Ur+38),ji=/* @__PURE__ */Symbol(Ur+39),Pi=/* @__PURE__ */Symbol(Ur+40),_i=["r","a","b"],Ri=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,s,c,d,u;const m=v(qr);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=m,s=m;const f=g(m);c=f,d=m,u=H(f,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=_i}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const n=e.h2,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.h!==n){r.h=n;const e=r.g;null==e||o||null===n?r.g=z(t,1,r.e,n,r.f,!0):I(e,n)}}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,2,r.i,n,r.j,!0):I(e,n)}}}),Ai={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Fi={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"},Ii=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Hi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Oi(e){if(!e)return"";const t=e.trim();return Hi.test(t)?t:""}function Wi(e){const n={...Ai,...e},{t:o}=J(Xr,St,Xr),[r,i]=Z(!1,Yr),[l,a]=Z(!1,Zr),[s,c]=Z(!1,Gr),[d,u]=Z(!1,Jr),[m,f]=Z(null,Qr),[h,p]=Z("",ei),[y,g]=Z(null,ti),[b,v]=Z(!1,ni),[w,k]=Z(()=>"undefined"==typeof window,oi),N=Y(0,ri),M=Y(null,ii),$=Y(!1,li),B=Y(!1,ai),E=Y(0,si),L=Y(null,ci),D=Y(!1,di),j=Y(null,ui),P=Y(null,mi),_=Y(null,fi),R=Y(null,hi),A=Y(!1,pi),F=Y(()=>{},yi),I=J(gi,Ge,gi),H=n.node?.code??"",O=s||!d||!h,W=!!h,z=X(()=>{if(n.maxHeight)return{maxHeight:"number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight)}},[n.maxHeight],bi),V=X(()=>{if(O&&y)return{minHeight:`${y}px`}},[y,O],vi);q(()=>{A.current=b},[b],wi),q(()=>{const e=j.current;if(!e)return;const t=I(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),P.current=null}},[I],xi);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&g(e=>e!==t?t:e)},[],ki),G=K((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!w)return;if(A.current)return void(D.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-E.current;if(!e&&o<t)return D.current=!0,void(null==L.current&&(L.current=window.setTimeout(()=>{L.current=null,D.current&&(D.current=!1,G(!0))},Math.max(0,t-o))));$.current=!0;const r=()=>{$.current=!1,E.current=Date.now(),F.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[n.progressiveIntervalMs,w],Si),Q=K(async()=>{if(M.current)return M.current;const e=await async function(){if(Hr)return Hr;const e=Or;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Ir)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Hr=function(e){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 t=e.default??e;return"function"==typeof t?t:t?.D2&&"function"==typeof t.D2?t.D2:t}(t),Hr):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?M.current=t:"function"==typeof e.compile&&(M.current=e),M.current}return e?.D2&&"function"==typeof e.D2?(M.current=new e.D2,M.current):("function"==typeof e.compile&&(M.current=e),M.current)},[],Ci),ee=K(async()=>{if("undefined"==typeof window||B.current)return;if(!w)return;if(n.loading&&!n.progressiveRender)return;if(!H)return p(""),void f(null);const e=++N.current;v(!0),f(null);try{const t=await Q();if(!t)return u(!1),c(!0),p(""),void f("D2 is not available.");if("function"!=typeof t.compile||"function"!=typeof t.render)throw new Error("D2 instance is missing compile/render methods.");u(!0);const o=await t.compile(H);if(e!==N.current)return;const r=o?.diagram??o,i=o?.renderOptions??o?.options??{},l=n.themeId??i.themeID,a=n.darkThemeId??i.darkThemeID,s={...i};if(s.themeID=n.isDark&&null!=a?a:l,s.darkThemeID=null,s.darkThemeOverrides=null,n.isDark){const e=i.themeOverrides&&"object"==typeof i.themeOverrides?i.themeOverrides:null;s.themeOverrides={...Fi,...e||{}}}const d=await t.render(r,s);if(e!==N.current)return;const m=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(d);if(!m)throw new Error("D2 render returned empty output.");const h=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 o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ii.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Oi(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(m);p(h||""),n.loading&&c(!1),f(null)}catch(t){if(e!==N.current)return;const o=t?.message?String(t.message):"D2 render failed.";n.loading||f(o),o.includes("@terrastruct/d2")&&(u(!1),c(!0))}finally{e===N.current&&(v(!1),D.current&&(D.current=!1,G()))}},[H,Q,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,G,w],Ni);q(()=>{F.current=ee},[ee],Mi);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(H),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[H],$i),ne=K(()=>{if(h)try{const e=new Blob([h],{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)}},[h],Bi),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Dt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Ei),re=K(()=>{jt()},[],Ti);return q(()=>{G()},[H,n.loading,n.isDark,G],Li),q(()=>{n.loading||G(!0)},[n.loading,G],Di),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[O,h,H,U],ji),q(()=>{B.current=!1,G();const e=requestAnimationFrame(()=>U());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{U()});R.current=e,_.current&&e.observe(_.current)}return()=>{B.current=!0,null!=L.current&&(clearTimeout(L.current),L.current=null),R.current?.disconnect(),R.current=null,cancelAnimationFrame(e)}},[G,U],Pi),x(Ri,{h0:j,h1:Fr("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),h2:n.showHeader&&C(()=>S("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)"}},()=>T([x("div",{className:"flex items-center gap-x-2"},x("span",{className:"text-sm font-medium font-mono"},"D2")),S("div",{className:"flex items-center gap-x-2"},()=>T([n.showModeToggle&&C(()=>S("div",{className:Fr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{type:"button",className:Fr("mode-btn px-2 py-1 text-xs rounded",!s&&"is-active"),onClick:()=>c(!1),onMouseEnter:e=>oe(e,o("common.preview")||"Preview"),onFocus:e=>oe(e,o("common.preview")||"Preview"),onMouseLeave:re,onBlur:re},()=>o("common.preview")||"Preview")),C(()=>S("button",{type:"button",className:Fr("mode-btn px-2 py-1 text-xs rounded",s&&"is-active"),onClick:()=>c(!0),onMouseEnter:e=>oe(e,o("common.source")||"Source"),onFocus:e=>oe(e,o("common.source")||"Source"),onMouseLeave:re,onBlur:re},()=>o("common.source")||"Source"))]))),n.showCopyButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":r?o("common.copied")||"Copied":o("common.copy")||"Copy",onClick:te,onMouseEnter:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onFocus:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onMouseLeave:re,onBlur:re},()=>x("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"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":o("common.export")||"Export",onClick:ne,onMouseEnter:e=>oe(e,o("common.export")||"Export"),onFocus:e=>oe(e,o("common.export")||"Export"),onMouseLeave:re,onBlur:re},x("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"},x("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"})))),n.showCollapseButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":l,onClick:()=>a(e=>!e),onMouseEnter:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onFocus:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re},()=>C(()=>x("svg",{style:{transform:`rotate(${l?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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})))))]))]))),h3:!l&&C(()=>S("div",{ref:_,className:"d2-block-body",style:V},()=>n.loading&&!W?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>T([O?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):C(()=>S("div",{className:"d2-render",style:z},()=>T([C(()=>x("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:h}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}Wi.$$singleRoot=!0;var zi=/* @__PURE__ */W('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),Ki=/* @__PURE__ */W('<dl class="definition-list"><!></dl>'),Vi=(e,t)=>`${String(indexKey??"definition")}-${t}`;function qi(e,t,n){const o=t.block,[r,i,l]=n,a=o.itemIndex;let s=t.slots[0];if(void 0===s){let e,n;const o=v(zi),r=g(o);e=r,n=H(r,1),s=f(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?Le(e.term,r,`${String(i??"definition")}-term-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.c!==n){const e=s.b;null==e||o||null===n?s.b=b(t,1,s.a,n,e):I(e,n),s.c=n}}{const n=r&&l?Le(e.definition,r,`${String(i??"definition")}-desc-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.f!==n){const e=s.e;null==e||o||null===n?s.e=b(t,2,s.d,n,e):I(e,n),s.f=n}}}var Ui=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=v(Ki);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(P(o.b,"data-index-key",t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,Vi,qi,18,[e.h4,e.h5,e.h6],o.d,1)});function Xi(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(Ui,{h0:r,h1:i,h2:i.map,h3:(e,t)=>S("div",{key:`${String(r??"definition")}-${t}`,className:"mb-4"},()=>T([S("dt",{className:"definition-term font-semibold"},()=>n&&o?Le(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?Le(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}Xi.$$singleRoot=!0;var Yi=/* @__PURE__ */W('<span class="emoji-node"></span>'),Zi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Yi);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Gi(e){const{node:t}=e;return x(Zi,{h0:t.name??t.markup})}Gi.$$singleRoot=!0;var Ji=/* @__PURE__ */W('<em class="emphasis-node"></em>'),Qi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Ji);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function el(e){return x(Qi,{h0:e.children})}el.$$singleRoot=!0,N(["click"]);var tl=/* @__PURE__ */W('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),nl=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),ol=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=v(tl);n=l,r=l,i=l,l.$$click=e.h2,o=m(t,l,void 0,n,void 0,r,i)}else o.e.$$click=e.h2;{const t=e.h0;o.a!==t&&(P(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"title",t),o.c=t)}});function rl(e){const{node:t}=e,n=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=document.getElementById(`fnref-${String(t.id??"")}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],nl);return x(ol,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}rl.$$singleRoot=!0;var il=/* @__PURE__ */W('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),ll=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(il);e=r,n=g(r),o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function al(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return x(ll,{h0:`fnref--${t.id}`,h1:n&&o?Te(t.children,n,String(r??`footnote-${t.id}`),o):null})}al.$$singleRoot=!0,N(["click"]);var sl=/* @__PURE__ */W('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),cl=/* @__PURE__ */M(3),dl=/* @__PURE__ */Symbol(cl),ul=/* @__PURE__ */Symbol(cl+1),ml=/* @__PURE__ */Symbol(cl+2),fl=["s","h","g"],hl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,s,c,d,u,m;const f=v(sl);n=f,r=f,f.$$click=e.h1;const h=g(f);i=O(e.h2),l=e.h3,s="footnote-link cursor-pointer",c=h,d=A(h,[[!0,i],[!1,"title",l],[!1,"className",s]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.h;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.g)}),E(h),u=h,m=H(g(h),1),o=a(t,f,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=fl}else{o.c.$$click=e.h1,o.d=O(e.h2);{const t=e.h3;o.e!==t&&(o.e=t)}{const e="footnote-link cursor-pointer";o.f!==e&&(o.f=e)}o.h=A(o.g,[[!0,o.d],[!1,"title",o.e],[!1,"className",o.f]],o.h,t,!0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.l!==n){o.l=n;const e=o.k;null==e||r||null===n?o.k=z(t,1,o.i,n,o.j,!0):I(e,n)}}});function pl(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],dl),o=X(()=>({href:n}),[n],ul),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(n);t&&t.scrollIntoView({behavior:"smooth"})},[n],ml);return x(hl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}pl.$$singleRoot=!0;var yl=/* @__PURE__ */W('<br class="hard-break"/>'),gl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,v(yl)))});function bl(e){return x(gl,{})}function vl(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e,l=Math.min(6,Math.max(1,Number(t.level)||1)),a=`h${l}`,{class:s,className:c,style:d,...u}=t?.attrs??{};return S(a,{dir:"auto",className:Fr("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?Te(t.children,n,String(r??`heading-${l}`),o):null))}bl.$$singleRoot=!0;var wl=/* @__PURE__ */W('<mark class="highlight-node"></mark>'),xl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(wl);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function kl(e){return x(xl,{h0:e.children})}function Sl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Cl(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 o of t.split(";")){const e=o.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const r=Sl(e.slice(0,t).trim()),i=e.slice(t+1).trim();r&&(n[r]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}kl.$$singleRoot=!0;var Nl=we,Ml=ue;function $l(e,t){return ie(e,t)}function Bl(e,t){return re(e,t)}function El(e,t,n=!1){const o=Object.entries(t??{}),r=o.length>0?o.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${r} />`:`<${e}${r}>`}function Tl(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Ll(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Dl(t){if(null==t||"boolean"==typeof t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return t.map(Dl).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Dl(n.props.children);const o=Object.entries(n.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${n.type}${o}>${Dl(n.props.children)}</${n.type}>`}function jl(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Pl(e){const t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||Boolean(t?.loading));return{loading:n,autoClosed:n||Boolean(t?.autoClosed)}}function _l(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Rl(t,n,o,r,i,l,a,s=Pl(i)){const c=ce(t),d=l??function(e){return e.map(Dl).join("")}(o),u={type:c,tag:c,attrs:jl(n),content:d,raw:a??`${El(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Ll(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Al=/* @__PURE__ */W("<div></div>"),Fl=/* @__PURE__ */M(22),Il=/* @__PURE__ */Symbol(Fl),Hl=/* @__PURE__ */Symbol(Fl+1),Ol=/* @__PURE__ */Symbol(Fl+2),Wl=/* @__PURE__ */Symbol(Fl+3),zl=/* @__PURE__ */Symbol(Fl+4),Kl=/* @__PURE__ */Symbol(Fl+5),Vl=/* @__PURE__ */Symbol(Fl+6),ql=/* @__PURE__ */Symbol(Fl+7),Ul=/* @__PURE__ */Symbol(Fl+8),Xl=/* @__PURE__ */Symbol(Fl+9),Yl=/* @__PURE__ */Symbol(Fl+10),Zl=/* @__PURE__ */Symbol(Fl+11),Gl=/* @__PURE__ */Symbol(Fl+12),Jl=/* @__PURE__ */Symbol(Fl+13),Ql=/* @__PURE__ */Symbol(Fl+14),ea=/* @__PURE__ */Symbol(Fl+15),ta=/* @__PURE__ */Symbol(Fl+16),na=/* @__PURE__ */Symbol(Fl+17),oa=/* @__PURE__ */Symbol(Fl+18),ra=/* @__PURE__ */Symbol(Fl+19),ia=/* @__PURE__ */Symbol(Fl+20),la=/* @__PURE__ */Symbol(Fl+21),aa=["s","e","d"],sa=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s;const c=v(Al);n=e.h0,r="html-block-node",i=O(e.h1),l=c,a=A(c,[[!1,"ref",n],[!1,"className",r],[!0,i]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.e;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.d)}),s=c,o=p(t,c,n,r,i,l,a,s,null,void 0),t.refFields=aa}else{{const t=e.h0;o.a!==t&&(o.a=t)}{const e="html-block-node";o.b!==e&&(o.b=e)}o.c=O(e.h1),o.e=A(o.d,[[!1,"ref",o.a],[!1,"className",o.b],[!0,o.c]],o.e,t,!0)}{const n=e.h2;o.g=b(t,1,o.f,n,o.g),o.h=n}});function ca(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(Il,Ge,Il),[s,c]=Z(null,Hl),d=Y(null,Ol),[u,m]=Z(()=>"undefined"==typeof window,Wl),[f,h]=Z(o.content,zl),p=Boolean(o.loading),y=G(nt,ot,ot,Kl),g=X(()=>({...n.customComponents??n.ctx?.customComponents??it(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,y],Vl),b=X(()=>({...g,...n.ctx?.streamingComponents??{}}),[g,n.ctx?.streamingComponents],ql);q(()=>{if("undefined"==typeof window)return void m(!0);if(d.current?.destroy(),d.current=null,!p)return m(!0),void h(o.content);if(!s)return void m(!1);const e=a(s,{rootMargin:"400px"});return d.current=e,e.isVisible()&&m(!0),e.whenVisible.then(()=>m(!0)).catch(()=>{}),()=>{e.destroy(),d.current=null}},[s,p,o.content,a],Ul),q(()=>()=>{d.current?.destroy(),d.current=null},[],Xl),q(()=>{p&&!u||h(o.content)},[p,o.content,u],Yl);const v=X(()=>{const e=Ee(fe(o.attrs??void 0,l));return e?Cl(e):void 0},[l,o.attrs],Zl),w=X(()=>String(o.tag??"").trim(),[o.tag],Gl),k=X(()=>ce(w),[w],Jl),N=X(()=>{const e=Ee(fe(o.attrs??void 0,l,w));return e?Cl(e):void 0},[l,o.attrs,w],Ql),M=X(()=>te(ve(fe(o.attrs??void 0,l,k))),[l,o.attrs,k],ea),$=X(()=>Array.isArray(o.children)?o.children:[],[o.children],ta),B=$.length>0&&!!w&&!ee.has(w.toLowerCase())&&!le(w,l)&&!!n.ctx&&!!n.renderNode,E=X(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(N),[N],na),L=X(()=>"escape"!==l&&Bl(o.content??"",b),[b,l,o.content],oa),D=X(()=>L&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Nl(t);let l=0;const a=r.keyPrefix??"ms-html",s=[],c=[];for(const t of i){if("text"===t.type){if(s.length>0&&s[s.length-1].hardBlocked)continue;(s.length>0?s[s.length-1].children:c).push(t.content??""),s.length>0&&s[s.length-1].sourceParts.push(t.content??"");continue}const i=t.tagName;if(void 0===i)return null;if("self_closing"===t.type){const d=t.attrs||{},u=El(i,d,!0),m=$l(i,n),f=Boolean(Ll(i,r));if(Q.has(i.toLowerCase())||!m&&!f&&ae(i,o))continue;if(!m&&!f&&le(i,o)){(s.length>0?s[s.length-1].children:c).push(u),s.length>0&&s[s.length-1].sourceParts.push(u);continue}const h=Ml(d,o,i),p=h.key,y=null!=p&&""!==p?p:`${a}-${l++}`,g=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(f)b.push(Rl(i,d,[],y,r,"",u,{loading:!1,autoClosed:!1}));else if(g){const t=_l(i,h,r);b.push(e.createElement(g,{...t,key:y}))}else b.push(e.createElement(i,{...Cl(h),key:y,suppressHydrationWarning:!0}));s.length>0&&s[s.length-1].sourceParts.push(u);continue}if("tag_open"===t.type){const e=s.length>0&&s[s.length-1].hardBlocked,l=$l(i,n),a=Boolean(Ll(i,r));s.push({tagName:i,children:[],attrs:t.attrs,sourceParts:[],customComponent:l||a,hardBlocked:e||Q.has(i.toLowerCase())||!l&&!a&&ae(i,o),softBlocked:!e&&!l&&!a&&le(i,o)});continue}const d=i.toLowerCase();let u=-1;for(let e=s.length-1;e>=0;e--)if(s[e].tagName.toLowerCase()===d){u=e;break}if(-1!==u)for(;s.length>u;){const t=s.pop();if(!t)continue;const i=t.sourceParts.join(""),u=`${El(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[El(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=Ml(t.attrs||{},o,t.tagName),c=s.key,f=null!=c&&""!==c?c:`${a}-${l++}`,h=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;if(Boolean(Ll(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Pl(r);m=Rl(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{..._l(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{...Cl(s),key:f,suppressHydrationWarning:!0},...t.children)}s.length>0?Tl(s[s.length-1].children,m):Tl(c,m),s.length>0&&!t.hardBlocked&&s[s.length-1].sourceParts.push(u)}}for(;s.length>0;){const t=s.pop();if(!t||t.hardBlocked)continue;const i=t.sourceParts.join(""),d=`${El(t.tagName,t.attrs)}${i}`;if(t.softBlocked){Tl(c,[El(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=Ml(t.attrs||{},o,t.tagName),m=u.key,f=null!=m&&""!==m?m:`${a}-${l++}`,h=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;let p;p=Boolean(Ll(t.tagName,r))?Rl(t.tagName,t.attrs||{},t.children,f,r,i,d,Pl(r)):h?e.createElement(h,{..._l(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{...Cl(u),key:f,suppressHydrationWarning:!0},...t.children),c.push(p),s.length>0&&s[s.length-1].sourceParts.push(d)}return c}catch{return null}}(o.content,g,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[g,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,L],ra),j=X(()=>me(f??"",l),[l,f],ia),P=X(()=>B&&n.ctx&&n.renderNode?Te($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],la),_=k?n.ctx?.htmlComponents?.[k]:void 0,R=S("div",{className:"html-block-node__placeholder"},()=>r??T([x("span",{className:"html-block-node__placeholder-bar"}),x("span",{className:"html-block-node__placeholder-bar w-4/5"}),x("span",{className:"html-block-node__placeholder-bar w-2/3"})]));return B&&_?e.createElement(_,M,P)??null:B?e.createElement(w,{...E,ref:c},u?P:R)??null:x(sa,{h0:c,h1:v,h2:u?L&&D?S(t,{},()=>T([D])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:j}})):R})}var da=/* @__PURE__ */W('<span class="html-inline-node"></span>'),ua=/* @__PURE__ */M(13),ma=/* @__PURE__ */Symbol(ua),fa=/* @__PURE__ */Symbol(ua+1),ha=/* @__PURE__ */Symbol(ua+2),pa=/* @__PURE__ */Symbol(ua+3),ya=/* @__PURE__ */Symbol(ua+4),ga=/* @__PURE__ */Symbol(ua+5),ba=/* @__PURE__ */Symbol(ua+6),va=/* @__PURE__ */Symbol(ua+7),wa=/* @__PURE__ */Symbol(ua+8),xa=/* @__PURE__ */Symbol(ua+9),ka=/* @__PURE__ */Symbol(ua+10),Sa=/* @__PURE__ */Symbol(ua+11),Ca=/* @__PURE__ */Symbol(ua+12),Na=["r","a","b"],Ma=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=v(da);{const l=e.h0;n=l,i=a,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=a,r=u(t,a,n,i,void 0,l),t.refFields=Na}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(F(r.d,t,r.c),r.c=t)}}),$a=(()=>{try{return Boolean(!1)}catch{}return!1})();function Ba(e){$a&&console.warn(e)}function Ea(e,t,n=!1){const o=Object.entries(t??{}),r=o.length>0?o.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${r} />`:`<${e}${r}>`}function Ta(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function La(e,t){for(const n of Nl(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if($l(e,t)&&"block"===st(t[e]||t[e.toLowerCase()]))return!0}return!1}function Da(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function ja(t){if(null==t||"boolean"==typeof t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return t.map(ja).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return ja(n.props.children);const o=Object.entries(n.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${n.type}${o}>${ja(n.props.children)}</${n.type}>`}function Pa(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function _a(e){const t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||Boolean(t?.loading));return{loading:n,autoClosed:n||Boolean(t?.autoClosed)}}function Ra(t,n,o,r,i,l,a,s,c,d){const u=$l(t,r),m=Boolean(Da(t,a));if(Q.has(t.toLowerCase())||!u&&!m&&ae(t,l))return null;if(!u&&!m&&le(t,l))return[Ea(t,n),...o,`</${t}>`];const f=Ml(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=_a(i)){const c=ce(t),d=l??function(e){return e.map(ja).join("")}(o),u={type:c,tag:c,attrs:Pa(n),content:d,raw:a??`${Ea(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Da(t,i);return m?e.createElement(m,{key:r,node:u}):null}(t,n,o,String(p),a,s,c,d);if(u){const n=r[t]||r[t.toLowerCase()],i=te(f);return e.createElement(n,{...i,key:p},...o)}return e.createElement(t,{...Cl(f),key:p},...o)}function Aa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Y(null,ma),[a,s]=Z(!1,fa);q(()=>{s(!0)},[],ha);const c=e.useMemo(()=>({...n.ctx?.customComponents??it(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],pa),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],ya),u=e.useMemo(()=>me(o.content??"",i),[i,o.content],ga),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],ba),f=e.useMemo(()=>ce(m),[m],va),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],wa),p=e.useMemo(()=>te(ve(fe(o.attrs??void 0,i,f))),[i,o.attrs,f],xa),y=f?n.ctx?.htmlComponents?.[f]:void 0,g=h.length>0&&!!m&&"escape"!==i&&!le(m,i)&&!!n.ctx&&!!n.renderNode&&!!y,b=e.useMemo(()=>g&&n.ctx&&n.renderNode?Te(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[g,n.ctx,n.indexKey,n.renderNode,h],ka),v=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Bl(e,d))return{mode:"html",content:e};const t=function(e,t,n="safe",o={}){if(!e)return[];try{return function(e,t,n="safe",o={}){let r=0;const i=o.keyPrefix??"ms-html",l=[],a=[];for(const s of e)if("text"===s.type){if(l.length>0&&l[l.length-1].hardBlocked)continue;(l.length>0?l[l.length-1].children:a).push(s.content),l.length>0&&l[l.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},c=Ea(s.tagName,e,!0),d=$l(s.tagName,t),u=Boolean(Da(s.tagName,o));if(Q.has(s.tagName.toLowerCase())||!d&&!u&&ae(s.tagName,n))continue;if(!d&&!u&&le(s.tagName,n)){(l.length>0?l[l.length-1].children:a).push(c),l.length>0&&l[l.length-1].sourceParts.push(c);continue}const m=Ra(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});Ta(l.length>0?l[l.length-1].children:a,m),l.length>0&&l[l.length-1].sourceParts.push(c)}else if("tag_open"===s.type){const e=l.length>0&&l[l.length-1].hardBlocked,r=$l(s.tagName,t),i=Boolean(Da(s.tagName,o));l.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:r||i,hardBlocked:e||Q.has(s.tagName.toLowerCase())||!r&&!i&&ae(s.tagName,n),softBlocked:!e&&!r&&!i&&le(s.tagName,n)})}else if("tag_close"===s.type){const e=s.tagName.toLowerCase();let c=-1;for(let t=l.length-1;t>=0;t--)if(l[t].tagName.toLowerCase()===e){c=t;break}if(-1!==c)for(;l.length>c;){const s=l.pop(),d=s.sourceParts.join(""),u=`${Ea(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Ea(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:_a(o);m=Ra(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?Ta(l[l.length-1].children,m):Ta(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Ba(`Auto-closing unclosed tag: <${s.tagName}>`)}else Ba(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${Ea(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[Ea(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ra(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,_a(o)),Ta(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Ba(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Nl(e),t,n,o)}catch(i){return r=i,$a&&console.error("Failed to parse HTML to Octane nodes:",r),null}var r}(e,c,i,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-inline"),nodeComponents:n.ctx?.streamingComponents,renderNode:n.renderNode,sourceNode:o});return null===t?{mode:"html",content:e}:{mode:"dynamic",block:La(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],Sa);return q(()=>{if(!a||!l.current||"html"!==v.mode)return;const e=l.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=u,e.appendChild(t.content.cloneNode(!0))},[v.mode,a,u],Ca),!o.loading||o.autoClosed||g||"dynamic"===v.mode?g?e.createElement(y,p,b)??null:"dynamic"===v.mode?v.block?S(t,{},()=>T([v.nodes])):C(()=>S("span",{className:"html-inline-node",style:{display:"inline"}},()=>v.nodes)):x(Ma,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var Fa=/* @__PURE__ */M(5),Ia=/* @__PURE__ */Symbol(Fa),Ha=/* @__PURE__ */Symbol(Fa+1),Oa=/* @__PURE__ */Symbol(Fa+2),Wa=/* @__PURE__ */Symbol(Fa+3),za=/* @__PURE__ */Symbol(Fa+4),Ka={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Va(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function qa(e){const t={...Ka,...e},n=he(t.node.src),o=he(t.fallbackSrc),r=Va(n,o,t.node.loading),[i,l]=Z(!1,Ia),[a,s]=Z(!1,Ha),[c,d]=Z(r.src,Oa),[u,m]=Z(r.stage,Wa),f=c;q(()=>{const e=Va(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],za);const h=()=>{if("primary"===u&&o&&o!==c)return d(o),m("fallback"),l(!1),void s(!1);m("failed"),s(!0),t.onError?.(c)},p=()=>{l(!0),s(!1),t.onLoad?.(f)},y=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,f])};return!t.node.loading&&"failed"!==u&&f?C(()=>x("img",{key:"image",src:f,alt:String(t.node.alt??t.node.title??""),title:String(t.node.title??t.node.alt??""),className:"image-node__img"+(i?" is-loaded":""),loading:t.lazy?"lazy":"eager",decoding:"async",tabIndex:i?0:-1,"aria-label":t.node.alt??"Preview image",onError:h,onLoad:p,onClick:y})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?T([x("span",{className:"image-node__spinner","aria-hidden":"true"}),x("span",{className:"image-node__placeholder-text"},"Loading image...")]):S("span",{className:"image-node__placeholder-text"},()=>t.node.raw??"Loading image…")):t.node.loading||"failed"!==u?null:x("span",{className:"image-node__error"},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true"},x("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"})),x("span",{className:"image-node__placeholder-text"},"Image failed to load"))}function Ua(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Xa(e){const t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+60*t:360}function Ya(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var Za=null,Ga=null,Ja=/* @__PURE__ */M(37),Qa=/* @__PURE__ */Symbol(Ja),es=/* @__PURE__ */Symbol(Ja+1),ts=/* @__PURE__ */Symbol(Ja+2),ns=/* @__PURE__ */Symbol(Ja+3),os=/* @__PURE__ */Symbol(Ja+4),rs=/* @__PURE__ */Symbol(Ja+5),is=/* @__PURE__ */Symbol(Ja+6),ls=/* @__PURE__ */Symbol(Ja+7),as=/* @__PURE__ */Symbol(Ja+8),ss=/* @__PURE__ */Symbol(Ja+9),cs=/* @__PURE__ */Symbol(Ja+10),ds=/* @__PURE__ */Symbol(Ja+11),us=/* @__PURE__ */Symbol(Ja+12),ms=/* @__PURE__ */Symbol(Ja+13),fs=/* @__PURE__ */Symbol(Ja+14),hs=/* @__PURE__ */Symbol(Ja+15),ps=/* @__PURE__ */Symbol(Ja+16),ys=/* @__PURE__ */Symbol(Ja+17),gs=/* @__PURE__ */Symbol(Ja+18),bs=/* @__PURE__ */Symbol(Ja+19),vs=/* @__PURE__ */Symbol(Ja+20),ws=/* @__PURE__ */Symbol(Ja+21),xs=/* @__PURE__ */Symbol(Ja+22),ks=/* @__PURE__ */Symbol(Ja+23),Ss=/* @__PURE__ */Symbol(Ja+24),Cs=/* @__PURE__ */Symbol(Ja+25),Ns=/* @__PURE__ */Symbol(Ja+26),Ms=/* @__PURE__ */Symbol(Ja+27),$s=/* @__PURE__ */Symbol(Ja+28),Bs=/* @__PURE__ */Symbol(Ja+29),Es=/* @__PURE__ */Symbol(Ja+30),Ts=/* @__PURE__ */Symbol(Ja+31),Ls=/* @__PURE__ */Symbol(Ja+32),Ds=/* @__PURE__ */Symbol(Ja+33),js=/* @__PURE__ */Symbol(Ja+34),Ps=/* @__PURE__ */Symbol(Ja+35),_s=/* @__PURE__ */Symbol(Ja+36),Rs=x("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"},x("g",{},x("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"}),x("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"}),x("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"}),x("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"}),x("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"}))),As={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Fs(e){const n={...As,...e},{t:o}=J(Qa,St,Qa),[r,i]=Z(!1,es),[l,a]=Z(!1,ts),[s,c]=Z(!1,ns),[d,u]=Z(!1,os),[m,f]=Z(()=>"undefined"==typeof window,rs),h=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?Ua(n.maxHeight):null,[n.maxHeight],is),y=X(()=>Ya(Ua(n.estimatedPreviewHeightPx)??Xa(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],ls),[g,b]=Z(`${y}px`,as),[v,w]=Z(!1,ss),[N,M]=Z(!1,cs),[$,B]=Z(1,ds),[E,L]=Z({x:0,y:0},us),[D,j]=Z(!1,ms),P=Y(null,fs),_=Y(null,hs),R=Y(null,ps),A=Y(null,ys),F=Y(null,gs),I=Y({x:0,y:0},bs),H=Y(null,vs),O=Y(0,ws),W=J(xs,Ge,xs),z=K(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,y)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),y)}px`:`${Math.max(e,y)}px`},[y,n.maxHeight],ks),V=K(()=>{const e=P.current;if(!e)return;const t=e.scrollHeight;t>0&&b(z(t))},[z],Ss);q(()=>{s||l||b(e=>{const t=Ua(e);return null!=t&&t>=y?e:`${y}px`})},[y,l,s],Cs);const U=K(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],Ns),G=K(async()=>{if(!m)return;if(!P.current)return;const e=P.current,t=h,o=!1===n.loading,r=++O.current;let i=null,l=null;try{const n=await async function(){return Ga||Za||(Za=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),Ga=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Za)}();if(r!==O.current||e!==P.current)return;if(!n)throw new Error("Infographic library failed to load.");l=Array.from(e.childNodes),i=new n({container:e,width:"100%",height:"100%"});let o="",a=!1;if(i.on?.("error",e=>{o=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?e.message??"":e??"")).filter(Boolean).join("; ")}),i.on?.("rendered",()=>{a=!0}),i.render(t),o)throw new Error(o);const s=Array.from(e.childNodes),c=s.length>0&&(s.length!==l.length||s.some((e,t)=>e!==l?.[t]));if(!a&&!c)throw new Error("Infographic render returned empty output.");H.current?.destroy?.(),H.current=i,i=null,w(!0),M(!1),setTimeout(()=>{V()},0)}catch(a){if(r!==O.current||e!==P.current)return;i?.destroy?.(),i=null,o&&!1===n.loading&&t===h?(console.error("Failed to render infographic:",a),H.current?.destroy?.(),H.current=null,w(!1),M(!0),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${a instanceof Error?a.message:"Unknown error"}</div>`):l&&e.replaceChildren(...l)}finally{i?.destroy?.()}},[h,n.loading,V,m],Ms);q(()=>{const e=_.current;if(!e)return;const t=W(e,{rootMargin:"160px"});return R.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),R.current=null}},[W],$s),q(()=>{!m||s||l||G()},[h,l,G,s,m],Bs),q(()=>()=>{O.current+=1,H.current&&(H.current.destroy?.(),H.current=null)},[],Es);const Q=K(()=>{u(!1),A.current&&(A.current.innerHTML=""),F.current=null,document.body.style.overflow=""},[],Ts),ee=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Ls);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&Q()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,Q],Ds),q(()=>{d&&setTimeout(()=>{if(P.current&&A.current){A.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=P.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),A.current.appendChild(e),F.current=e,e.style.transform=`translate(${E.x}px, ${E.y}px) scale(${$})`}},0)},[d],js),q(()=>{d&&F.current&&(F.current.style.transform=`translate(${E.x}px, ${E.y}px) scale(${$})`)},[d,E,$],Ps);const te=K(()=>{const e=P.current?.querySelector("svg");if(!e)return;const t=(new XMLSerializer).serializeToString(e),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=`infographic-${Date.now()}.svg`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)},[],_s),ne=e=>{j(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;I.current={x:t-E.x,y:n-E.y}},oe=e=>{if(!D)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;L({x:t-I.current.x,y:n-I.current.y})},re=()=>j(!1),ie=n.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",le=s||l;return S(t,{},()=>T([C(()=>S("div",{ref:_,"data-markstream-infographic":"1","data-markstream-mode":s?"source":N?"error":v?"preview":"pending",className:Fr("my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":n.loading})},()=>T([n.showHeader&&C(()=>S("div",{className:Fr("flex justify-between items-center px-4 py-2.5 border-b",n.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200")},()=>T([S("div",{className:"flex items-center gap-x-2 overflow-hidden"},()=>T([Rs,C(()=>x("span",{className:Fr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:Fr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{className:Fr("px-2.5 py-1 text-xs rounded transition-colors",s?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>c(!1),onMouseEnter:e=>Dt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("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"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview")||"Preview")])))),C(()=>S("button",{className:Fr("px-2.5 py-1 text-xs rounded transition-colors",s?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>c(!0),onMouseEnter:e=>Dt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source")||"Source")]))))]))),S("div",{className:"flex items-center gap-x-1"},()=>T([n.showCollapseButton&&C(()=>S("button",{className:ie,onClick:()=>a(!l),onMouseEnter:e=>Dt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>C(()=>x("svg",{style:{rotate:l?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),n.showCopyButton&&C(()=>S("button",{className:ie,onClick:U,onMouseEnter:e=>Dt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&C(()=>x("button",{className:Fr(ie,le&&"opacity-50 cursor-not-allowed"),disabled:le,onClick:te,onMouseEnter:e=>Dt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>jt()},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&C(()=>S("button",{className:Fr(ie,le&&"opacity-50 cursor-not-allowed"),disabled:le,onClick:ee,onMouseEnter:e=>Dt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>jt()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},x("path",d?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),!l&&S("div",{},()=>s?C(()=>S("div",{className:Fr("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:Fr("text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)))):S("div",{className:"relative"},()=>T([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>T([C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"\n +\n ")),C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"\n -\n ")),C(()=>S("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),L({x:0,y:0})}},()=>T([Math.round(100*$),"\n %\n "])))]))),C(()=>S("div",{className:Fr("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:g,maxHeight:n.maxHeight??void 0},onMouseDown:ne,onMouseMove:oe,onMouseUp:re,onMouseLeave:re,onTouchStart:ne,onTouchMove:oe,onTouchEnd:re},()=>T([!v&&!N&&C(()=>S("pre",{className:Fr("absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)),C(()=>S("div",{className:Fr("absolute inset-0 cursor-grab",D&&"cursor-grabbing"),style:{transform:`translate(${E.x}px, ${E.y}px) scale(${$})`}},()=>C(()=>x("div",{ref:P,className:"w-full text-center flex items-center justify-center min-h-full"}))))])))])))]))),d&&"undefined"!=typeof document&&k(C(()=>S("div",{className:"markstream-octane fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:Q,role:"dialog","aria-modal":"true"},()=>C(()=>S("div",{className:Fr("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",n.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation()},()=>T([S("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2"},()=>T([C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"+")),C(()=>x("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"-")),C(()=>S("button",{className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),L({x:0,y:0})}},()=>T([Math.round(100*$),"\n %\n "]))),C(()=>x("button",{className:Fr("inline-flex items-center justify-center p-2 rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:Q},"X"))])),C(()=>x("div",{ref:A,className:Fr("w-full h-full flex items-center justify-center p-4 overflow-hidden",!D&&"cursor-grab",D&&"cursor-grabbing"),onMouseDown:ne,onMouseMove:oe,onMouseUp:re,onMouseLeave:re,onTouchStart:ne,onTouchMove:oe,onTouchEnd:re}))]))))),document.body)]))}var Is=/* @__PURE__ */W('<code class="inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full"></code>'),Hs=/* @__PURE__ */M(6),Os=/* @__PURE__ */Symbol(Hs),Ws=/* @__PURE__ */Symbol(Hs+1),zs=/* @__PURE__ */Symbol(Hs+2),Ks=/* @__PURE__ */Symbol(Hs+3),Vs=/* @__PURE__ */Symbol(Hs+4),qs=/* @__PURE__ */Symbol(Hs+5),Us=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Is);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Xs(e,t){return e.reduce((e,n)=>{const o=null==t||n.id===t?{...n,fading:!1}:n,r=e[e.length-1];return!r||r.fading||o.fading?e.push(o):e[e.length-1]={...r,content:r.content+o.content},e},[])}function Ys(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.code??""),a=i??o?.fade??!0,s=null==r||""===r?"":String(r),[c,d]=Z(l?[{id:0,content:l,fading:!1}]:[],Os),u=J(Ws,We,Ws),m=Y(l,zs),f=Y(1,Ks),h=Y(void 0,Vs);return q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==h.current;if(null!=n)return m.current="",d([]),void(h.current=e);const r=u?.textStreamState??o?.textStreamState,i=s?r?.get(s):void 0;let c=m.current;const p=Boolean(c===l&&i&&l.startsWith(i)&&l.length>i.length);if(p&&void 0!==i&&(c=i),a)if(l!==c)if(c&&l.startsWith(c)){const e=l.slice(c.length);d(t=>{if(p)return[{id:f.current++,content:c,fading:!1},{id:f.current++,content:e,fading:!0}];const n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:f.current++,content:e,fading:!0}]})}else d(l?[{id:f.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?Xs(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:f.current++,content:l,fading:!1}]:[]:e);m.current=l,h.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],qs),x(Us,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void d(e=>e.some(e=>e.id===t&&e.fading)?Xs(e,t):e);var t}:void 0},()=>e.content))})}Ys.$$singleRoot=!0;var Zs=/* @__PURE__ */W('<ins class="insert-node"></ins>'),Gs=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Zs);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Js(e){return x(Gs,{h0:e.children})}Js.$$singleRoot=!0,N(["animationend"]);var Qs=/* @__PURE__ */W("<span></span>"),ec=/* @__PURE__ */W("<span><!></span>"),tc=/* @__PURE__ */M(6),nc=/* @__PURE__ */Symbol(tc),oc=/* @__PURE__ */Symbol(tc+1),rc=/* @__PURE__ */Symbol(tc+2),ic=/* @__PURE__ */Symbol(tc+3),lc=/* @__PURE__ */Symbol(tc+4),ac=/* @__PURE__ */Symbol(tc+5),sc=e=>e.id;function cc(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=v(Qs);n=a,i=a,a.$$animationend=e.fading?()=>o(e.id):void 0,l=a,r=f(t,a,void 0,n,i,l,null,void 0)}else r.c.$$animationend=e.fading?()=>o(e.id):void 0;{const t=e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0;r.a!==t&&(R(r.b,t),r.a=t)}{const n=e.content,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.f!==n){const e=r.e;null==e||o||null===n?r.e=b(t,1,r.d,n,e):I(e,n),r.f=n}}}var dc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=v(ec);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,sc,cc,30,[e.h4],o.d,1)});function uc(e,t){return e.reduce((e,n)=>{const o=null==t||n.id===t?{...n,fading:!1}:n,r=e[e.length-1];return!r||r.fading||o.fading?e.push(o):e[e.length-1]={...r,content:r.content+o.content},e},[])}function mc(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.content??""),a=i??o?.fade??!0,s=null==r||""===r?"":String(r),[c,d]=Z(l?[{id:0,content:l,fading:!1}]:[],nc),u=J(oc,We,oc),m=Y(l,rc),f=Y(1,ic),h=Y(void 0,lc);q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==h.current;if(null!=n)return m.current="",d([]),void(h.current=e);const r=u?.textStreamState??o?.textStreamState,i=s?r?.get(s):void 0;let c=m.current;const p=Boolean(c===l&&i&&l.startsWith(i)&&l.length>i.length);if(p&&void 0!==i&&(c=i),a)if(l!==c)if(c&&l.startsWith(c)){const e=l.slice(c.length);d(t=>{if(p)return[{id:f.current++,content:c,fading:!1},{id:f.current++,content:e,fading:!0}];const n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:f.current++,content:e,fading:!0}]})}else d(l?[{id:f.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?uc(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:f.current++,content:l,fading:!1}]:[]:e);m.current=l,h.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],ac);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?uc(t,e):t)};return null!=n?C(()=>S("span",{className:Fr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):x(dc,{h0:Fr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center"),h1:c,h2:c.map,h3:e=>S("span",{key:e.id,className:e.fading?Fr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>p(e.id):void 0},()=>e.content),h4:p})}N(["mouseenter","mouseleave"]);var fc=/* @__PURE__ */W('<a class="link-node"></a>',3),hc=/* @__PURE__ */M(4),pc=/* @__PURE__ */Symbol(hc),yc=/* @__PURE__ */Symbol(hc+1),gc=/* @__PURE__ */Symbol(hc+2),bc=/* @__PURE__ */Symbol(hc+3),vc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s,c,d,u;const m=v(fc);n=m,r=m,i=m,l=m,a=m,s=m,c=m,m.$$mouseenter=e.h6,d=m,m.$$mouseleave=e.h7,u=m,o=y(t,m,{a:void 0,b:n,c:void 0,d:r,e:void 0,f:i,g:void 0,h:l,i:void 0,j:a,k:void 0,l:s,m:c,n:d,o:u,p:null,q:void 0})}else o.m.$$mouseenter=e.h6,o.n.$$mouseleave=e.h7;{const t=e.h0;o.a!==t&&(P(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"title",t),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-label",t),o.e=t)}{const t=e.h3;o.g!==t&&(P(o.h,"target",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"rel",t),o.i=t)}{const t=e.h5;o.k!==t&&(F(o.l,t,o.k),o.k=t)}{const n=e.h8,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){const e=o.p;null==e||r||null===n?o.p=b(t,1,o.o,n,e):I(e,n),o.q=n}}});function wc(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=!1!==e.showTooltip,l=e.isDark??n?.isDark,a=X(()=>{const t=void 0!==e.underlineBottom?"number"==typeof e.underlineBottom?`${e.underlineBottom}px`:String(e.underlineBottom):"-3px",n=e.animationOpacity??.35,o=Math.max(.12,Math.min(.5*n,n));return{"--link-color":e.color??"#0366d6","--underline-height":`${e.underlineHeight??2}px`,"--underline-bottom":t,"--underline-opacity":String(n),"--underline-rest-opacity":String(o),"--underline-duration":`${e.animationDuration??1.6}s`,"--underline-timing":e.animationTiming??"ease-in-out","--underline-iteration":"number"==typeof e.animationIteration?String(e.animationIteration):e.animationIteration??"infinite"}},[e.animationDuration,e.animationIteration,e.animationOpacity,e.animationTiming,e.color,e.underlineBottom,e.underlineHeight],pc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],yc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&Dt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],gc),m=K(()=>{i&&jt()},[i],bc);return t.loading?C(()=>S("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:a},()=>S("span",{className:"link-text-wrapper relative inline-flex"},()=>T([S("span",{className:"leading-[normal] link-text"},()=>C(()=>x(mc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-loading`,typewriter:e.typewriter}))),x("span",{className:"link-loading-indicator","aria-hidden":"true"})])))):x(vc,{h0:s||void 0,h1:i?"":c,h2:`Link: ${c}`,h3:d?"_blank":void 0,h4:d?"noopener noreferrer":void 0,h5:a,h6:u,h7:m,h8:n&&o?Te(t.children,n,String(r??"link"),o):C(()=>x(mc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var xc=/* @__PURE__ */W('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),kc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(xc);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"value",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function Sc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(kc,{h0:null==r?void 0:r,h1:l??(n&&o?Te(t.children,n,String(i??"list-item"),o):null)})}function Cc(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=t.ordered?"ol":"ul",l=t.ordered&&t.start?t.start:void 0,a=n&&it(n.customId).list_item||Sc;return S(i,{className:Fr("list-node my-5 pl-[calc(13/8*1em)]",t.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:l},()=>t.items?.map((e,i)=>x(a,{key:`${String(r??"list")}-${i}`,node:e,value:t.ordered?(t.start??1)+i:void 0,ctx:n,renderNode:o,indexKey:`${String(r??"list")}-${i}`,customId:n?.customId,isDark:n?.isDark,typewriter:n?.typewriter})))}function Nc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}Sc.$$singleRoot=!0;var Mc=null,$c=null,Bc=!1,Ec=/* @__PURE__ */new Map,Tc=/* @__PURE__ */new Map,Lc=5,Dc=/* @__PURE__ */new Set;function jc(){if(Ec.size<Lc&&Dc.size){const e=Array.from(Dc);Dc.clear();for(const t of e)try{t()}catch{}}}function Pc(e){$c=null,(Mc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=Ec.get(t);if(r)if(Ec.delete(t),clearTimeout(r.timeoutId),jc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Tc.set(e,n),Tc.size>200){const e=Tc.keys().next();e.done||Tc.delete(e.value)}}r.resolve(n)}},Mc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Ec.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Ec.clear(),jc()}}function _c(){Mc&&Mc.terminate?.(),Mc=null,$c=null}function Rc(e){Bc=!!e,Mc&&Mc.postMessage({type:"init",debug:Bc})}var Ac="WORKER_BUSY";async function Fc(e,t=!0,n=2e3,o){performance.now();const r=Nc(e);if($c)return Promise.reject($c);const i=`${t?"d":"i"}:${r}`,l=Tc.get(i);if(l)return Promise.resolve(l);const a=Mc||(($c=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",$c.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject($c);if(Ec.size>=Lc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Ac,e.busy=!0,e.inFlight=Ec.size,e.max=Lc,Promise.reject(e)}return new Promise((e,i)=>{if(o?.aborted){const e=/* @__PURE__ */new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),s=setTimeout(()=>{Ec.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),jc()},n),c=()=>{},d=()=>{Ec.delete(l),clearTimeout(s),Dc.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),jc()};o&&o.addEventListener("abort",d,{once:!0}),Ec.set(l,{resolve:t=>{o&&o.removeEventListener("abort",d),e(t)},reject:e=>{o&&o.removeEventListener("abort",d),i(e)},timeoutId:s});try{a.postMessage({id:l,content:r,displayMode:t,debug:Bc})}catch(u){Ec.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),jc()}})}function Ic(e,t,n){const o=`${t?"d":"i"}:${Nc(e)}`;if(Tc.set(o,n),Tc.size>200){const e=Tc.keys().next();e.done||Tc.delete(e.value)}}function Hc(){Tc.clear()}function Oc(e){Lc=Math.max(1,Math.floor(e)),jc()}function Wc(e=1500,t){return Ec.size<Lc?Promise.resolve():new Promise((n,o)=>{if(t?.aborted){const e=/* @__PURE__ */new Error("Aborted");return e.name="AbortError",void o(e)}let r=null;function i(){Dc.delete(l),null!=r&&clearTimeout(r),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",o(e)}r=e>0?setTimeout(()=>{i(),o(/* @__PURE__ */new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),Dc.add(l)})}var zc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Kc(e){null!=e.timeout&&(zc.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(zc.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(zc.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(zc.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Vc(){return{...zc}}async function qc(e,t=!0,n={}){const o=n.timeout??zc.timeout,r=n.waitTimeout??zc.waitTimeout,i=n.backoffMs??zc.backoffMs,l=n.maxRetries??zc.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):zc.maxRetries,s=n.signal;let c=0;for(;;){if(s?.aborted){const e=/* @__PURE__ */new Error("Aborted");throw e.name="AbortError",e}try{return await Fc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await Wc(r,s).catch(()=>{}),s?.aborted){const e=/* @__PURE__ */new Error("Aborted");throw e.name="AbortError",e}i>0&&await new Promise(e=>setTimeout(e,i*c))}}}var Uc=null,Xc=!1;async function Yc(){if(Uc)return Uc;if(Xc)return null;try{return Uc=await import("katex"),await import("katex/contrib/mhchem"),Uc}catch{return Xc=!0,null}}var Zc=/* @__PURE__ */W('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),Gc=/* @__PURE__ */M(9),Jc=/* @__PURE__ */Symbol(Gc),Qc=/* @__PURE__ */Symbol(Gc+1),ed=/* @__PURE__ */Symbol(Gc+2),td=/* @__PURE__ */Symbol(Gc+3),nd=/* @__PURE__ */Symbol(Gc+4),od=/* @__PURE__ */Symbol(Gc+5),rd=/* @__PURE__ */Symbol(Gc+6),id=/* @__PURE__ */Symbol(Gc+7),ld=/* @__PURE__ */Symbol(Gc+8),ad=["r","a","b","r","c","d"],sd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=v(Zc);{const l=e.h0;n=l,i=c,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const d=c.firstChild;{const n=e.h1;l=n,a=d,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}s=d,r=f(t,c,n,i,l,a,void 0,s),t.refFields=ad}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function cd({node:e}){const t=Y(null,Jc),n=Y(null,Qc),o=Y(null,ed),r=J(td,Ge,td),[i,l]=Z(!0,nd),[a,s]=Z(()=>"undefined"==typeof window,od),c=Y(0,rd);return q(()=>{const e=t.current;if(!e)return;const n=r(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&s(!0),n.whenVisible.then(()=>s(!0)),()=>{n.destroy(),o.current=null}},[r],id),q(()=>{const t=Nc(e.content??"");if(!t)return n.current&&(n.current.innerHTML=""),void l(!1);if(!a)return void l(!0);let o=!1;const r=new AbortController,i=++c.current;return qc(t,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:r.signal}).then(e=>{o||i!==c.current||(n.current&&(n.current.innerHTML=e),l(!1))}).catch(async r=>{if(o||i!==c.current)return;if(!n.current)return;const a=r?.code||r?.name;if("WORKER_INIT_ERROR"===a||r?.fallbackToRenderer||"WORKER_BUSY"===a||"WORKER_TIMEOUT"===a){const r=await Yc();if(r)try{const a=r.renderToString(t,{throwOnError:e.loading,displayMode:!0});return void(!o&&i===c.current&&n.current&&(n.current.innerHTML=a,l(!1),Ic(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],ld),x(sd,{h0:t,h1:n,h2:i?"math-rendering":void 0})}cd.$$singleRoot=!0;var dd=/* @__PURE__ */W('<span class="math-inline-wrapper"><span></span><!></span>'),ud=/* @__PURE__ */M(9),md=/* @__PURE__ */Symbol(ud),fd=/* @__PURE__ */Symbol(ud+1),hd=/* @__PURE__ */Symbol(ud+2),pd=/* @__PURE__ */Symbol(ud+3),yd=/* @__PURE__ */Symbol(ud+4),gd=/* @__PURE__ */Symbol(ud+5),bd=/* @__PURE__ */Symbol(ud+6),vd=/* @__PURE__ */Symbol(ud+7),wd=/* @__PURE__ */Symbol(ud+8),xd=["r","a","b","r","c","d"],kd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,a,s,c,d,u;const m=v(dd);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const f=g(m);{const n=e.h1;a=n,s=f,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}c=f,d=m,u=H(f,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=xd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.j!==n){r.j=n;const e=r.i;null==e||o||null===n?r.i=z(t,1,r.g,n,r.h,!0):I(e,n)}}});function Sd({node:e}){const t=Y(null,md),n=Y(null,fd),o=Y(null,hd),r=J(pd,Ge,pd),[i,l]=Z(!0,yd),[a,s]=Z(()=>"undefined"==typeof window,gd),c=Y(0,bd);return q(()=>{const e=t.current;if(!e)return;const n=r(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&s(!0),n.whenVisible.then(()=>s(!0)),()=>{n.destroy(),o.current=null}},[r],vd),q(()=>{const t=Nc(e.content??"");if(!t)return n.current&&(n.current.innerHTML=""),void l(!1);if(!a)return void l(!0);let o=!1;const r=new AbortController,i=++c.current,s="$$"===e.markup;return qc(t,s,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{o||i!==c.current||n.current&&(n.current.innerHTML=e,l(!1))}).catch(async r=>{if(o||i!==c.current)return;if(!n.current)return;const a=r?.code||r?.name;if("WORKER_INIT_ERROR"===a||r?.fallbackToRenderer||"WORKER_BUSY"===a||"WORKER_TIMEOUT"===a){const r=await Yc();if(r)try{const a=r.renderToString(t,{throwOnError:e.loading,displayMode:s});return void(!o&&i===c.current&&n.current&&(n.current.innerHTML=a,l(!1),Ic(t,s,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,e.markup,a],wd),x(kd,{h0:t,h1:n,h2:"math-inline"+(i?" math-inline--hidden":""),h3:i&&x("span",{className:"math-inline__loading",role:"status","aria-live":"polite"},x("span",{className:"math-inline__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}function Cd(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Nd(e){const t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),n=Math.max(1,t.length),o=function(e){for(const t of e.split(/\r?\n/)){const e=t.trim();if(e&&!e.startsWith("%%"))return e.match(/^([A-Z][\w-]*)\b/i)?.[1]?.toLowerCase()||""}return""}(e);return"gantt"===o?220+28*n:"sequencediagram"===o?180+26*n:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*n:"flowchart"===o||"graph"===o?170+28*n:200+22*n}function Md(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function $d(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}Sd.$$singleRoot=!0;var Bd=null,Ed=null,Td=/* @__PURE__ */new Map,Ld=5,Dd=!1;function jd(e){Dd=!!e}function Pd(e){Number.isFinite(e)&&e>0&&(Ld=Math.floor(e))}function _d(){return{inFlight:Td.size,max:Ld}}var Rd="WORKER_BUSY";function Ad(e){Ed=null;const t=e;(Bd=e).onmessage=e=>{if(Bd!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Td.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Bd.onerror=e=>{if(Bd===t)if(0!==Td.size){try{Dd?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Td.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Td.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Bd.onmessageerror=e=>{if(Bd===t)if(0!==Td.size){try{Dd?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Td.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Td.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Fd(){if(Bd)try{for(const[e,t]of Td.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Td.clear(),Bd.terminate?.()}catch{}Bd=null,Ed=null}function Id(e,t,n=1400){if(Ed)return Promise.reject(Ed);const o=Bd||((Ed=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",Ed.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Ed);if(Td.size>=Ld){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Rd,e.inFlight=Td.size,e.max=Ld,Promise.reject(e)}return new Promise((r,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,s=null;const c=()=>{a||(a=!0,null!=s&&clearTimeout(s),Td.delete(l))};Td.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Td.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Td.get(l)?.reject(e)},n)})}async function Hd(e,t,n=1400){return Id("canParse",{code:e,theme:t},n)}async function Od(e,t,n=2400){return Id("findPrefix",{code:e,theme:t},n)}function Wd(){Bd?.terminate?.(),Bd=null,Ed=null,Td.clear()}var zd=null,Kd=!1,Vd=null,qd=null;function Ud(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(Vd!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),Vd=n}catch{}}var Xd=/* @__PURE__ */M(68),Yd=/* @__PURE__ */Symbol(Xd),Zd=/* @__PURE__ */Symbol(Xd+1),Gd=/* @__PURE__ */Symbol(Xd+2),Jd=/* @__PURE__ */Symbol(Xd+3),Qd=/* @__PURE__ */Symbol(Xd+4),eu=/* @__PURE__ */Symbol(Xd+5),tu=/* @__PURE__ */Symbol(Xd+6),nu=/* @__PURE__ */Symbol(Xd+7),ou=/* @__PURE__ */Symbol(Xd+8),ru=/* @__PURE__ */Symbol(Xd+9),iu=/* @__PURE__ */Symbol(Xd+10),lu=/* @__PURE__ */Symbol(Xd+11),au=/* @__PURE__ */Symbol(Xd+12),su=/* @__PURE__ */Symbol(Xd+13),cu=/* @__PURE__ */Symbol(Xd+14),du=/* @__PURE__ */Symbol(Xd+15),uu=/* @__PURE__ */Symbol(Xd+16),mu=/* @__PURE__ */Symbol(Xd+17),fu=/* @__PURE__ */Symbol(Xd+18),hu=/* @__PURE__ */Symbol(Xd+19),pu=/* @__PURE__ */Symbol(Xd+20),yu=/* @__PURE__ */Symbol(Xd+21),gu=/* @__PURE__ */Symbol(Xd+22),bu=/* @__PURE__ */Symbol(Xd+23),vu=/* @__PURE__ */Symbol(Xd+24),wu=/* @__PURE__ */Symbol(Xd+25),xu=/* @__PURE__ */Symbol(Xd+26),ku=/* @__PURE__ */Symbol(Xd+27),Su=/* @__PURE__ */Symbol(Xd+28),Cu=/* @__PURE__ */Symbol(Xd+29),Nu=/* @__PURE__ */Symbol(Xd+30),Mu=/* @__PURE__ */Symbol(Xd+31),$u=/* @__PURE__ */Symbol(Xd+32),Bu=/* @__PURE__ */Symbol(Xd+33),Eu=/* @__PURE__ */Symbol(Xd+34),Tu=/* @__PURE__ */Symbol(Xd+35),Lu=/* @__PURE__ */Symbol(Xd+36),Du=/* @__PURE__ */Symbol(Xd+37),ju=/* @__PURE__ */Symbol(Xd+38),Pu=/* @__PURE__ */Symbol(Xd+39),_u=/* @__PURE__ */Symbol(Xd+40),Ru=/* @__PURE__ */Symbol(Xd+41),Au=/* @__PURE__ */Symbol(Xd+42),Fu=/* @__PURE__ */Symbol(Xd+43),Iu=/* @__PURE__ */Symbol(Xd+44),Hu=/* @__PURE__ */Symbol(Xd+45),Ou=/* @__PURE__ */Symbol(Xd+46),Wu=/* @__PURE__ */Symbol(Xd+47),zu=/* @__PURE__ */Symbol(Xd+48),Ku=/* @__PURE__ */Symbol(Xd+49),Vu=/* @__PURE__ */Symbol(Xd+50),qu=/* @__PURE__ */Symbol(Xd+51),Uu=/* @__PURE__ */Symbol(Xd+52),Xu=/* @__PURE__ */Symbol(Xd+53),Yu=/* @__PURE__ */Symbol(Xd+54),Zu=/* @__PURE__ */Symbol(Xd+55),Gu=/* @__PURE__ */Symbol(Xd+56),Ju=/* @__PURE__ */Symbol(Xd+57),Qu=/* @__PURE__ */Symbol(Xd+58),em=/* @__PURE__ */Symbol(Xd+59),tm=/* @__PURE__ */Symbol(Xd+60),nm=/* @__PURE__ */Symbol(Xd+61),om=/* @__PURE__ */Symbol(Xd+62),rm=/* @__PURE__ */Symbol(Xd+63),im=/* @__PURE__ */Symbol(Xd+64),lm=/* @__PURE__ */Symbol(Xd+65),am=/* @__PURE__ */Symbol(Xd+66),sm=/* @__PURE__ */Symbol(Xd+67),cm="undefined"!=typeof window?U:q,dm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function um(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function mm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(um(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||um(e),o}function fm(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var hm={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:!0,enableMermaidInteractions:!1};function pm(e){const n={...hm,...e},{t:o}=J(Yd,St,Yd),r=X(()=>Xt("mermaid"),[],Zd),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],Gd),a=n.workerTimeoutMs??hm.workerTimeoutMs,s=n.parseTimeoutMs??hm.parseTimeoutMs,c=n.renderTimeoutMs??hm.renderTimeoutMs,d=n.fullRenderTimeoutMs??hm.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??hm.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?Cd(n.maxHeight):null,[n.maxHeight],Jd),f=X(()=>Md(Cd(n.estimatedPreviewHeightPx)??Nd(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],Qd),[h,p]=Z(!1,eu),[y,g]=Z(!1,tu),[b,v]=Z(!1,nu),[w,N]=Z(!1,ou),[M,$]=Z(1,ru),[B,E]=Z({x:0,y:0},iu),[L,D]=Z(!1,lu),[j,P]=Z(!1,au),[_,R]=Z(!1,su),[A,F]=Z(null,cu),[I,H]=Z(!1,du),[O,W]=Z(`${f}px`,uu),[z,V]=Z("undefined"==typeof window,mu),G=Y(null,fu),Q=Y(null,hu),ee=Y(null,pu),te=Y(null,yu),ne=Y(null,gu),oe=Y(null,bu),re=Y(null,vu),ie=Y({x:0,y:0},wu),le=Y(0,xu),ae=Y({},ku),se=Y(null,Su),ce=Y("",Cu),de=Y(!1,Nu),ue=Y(null,Mu),me=Y(!1,$u),fe=Y({zoom:1,translateX:0,translateY:0,containerHeight:O||"360px"},Bu),he=J(Eu,Ge,Eu),pe=Boolean(n.node?.loading??n.loading),ye=n.isDark?"dark":"light",ge=Boolean(n.isStrict),be=!0===n.enableMermaidInteractions,ve=X(()=>ge?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:dm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ge],Tu);q(()=>{me.current=_},[_],Lu),q(()=>{y||b||W(e=>{const t=Cd(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,y],Du),q(()=>{ae.current={}},[ye,l,ge],ju),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(zd)return Ud(zd,e),zd;if(qd){const t=await qd;return t&&Ud(t,e),t}if(Kd)return null;try{Kd=!0,qd=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(zd=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return Ud(zd,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),zd}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{qd=null}})();const t=await qd;return t&&Ud(t,e),t}catch{return null}}(ve);e||(G.current=t,p(Boolean(t)),de.current||g(!t))})(),()=>{e=!0}},[ve],Pu),q(()=>{const e=Q.current;if(!e)return;const t=he(e,{rootMargin:"400px"});return ue.current=t,t.isVisible()&&V(!0),t.whenVisible.then(()=>V(!0)),()=>{t.destroy(),ue.current=null}},[he],_u),q(()=>{if("undefined"==typeof document)return;if(!I)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[I],Ru);const we=K(()=>m,[m],Au),xe=K(e=>{const t=Q.current,o=te.current;if(!t||!o)return;const r=o.querySelector("svg");if(!r)return;let i=0,l=0;const a=r.getAttribute("viewBox");if(a){const e=a.split(" ");4===e.length&&(i=Number.parseFloat(e[2]),l=Number.parseFloat(e[3]))}if(i&&l||!r.hasAttribute("width")||!r.hasAttribute("height")||(i=Number.parseFloat(r.getAttribute("width")||"0"),l=Number.parseFloat(r.getAttribute("height")||"0")),!i||!l||Number.isNaN(i)||Number.isNaN(l))try{const e=r.getBBox();i=e.width,l=e.height}catch{return}if(!(i>0&&l>0))return;const s=(e??t.clientWidth)*(l/i),c=Number.isFinite(s)&&s>0?s:l,d=we(),u=null==d?c:Math.min(c,d);W(`${"none"===n.maxHeight?u:Math.max(u,f)}px`)},[f,n.maxHeight,we],Fu);q(()=>{if(!Q.current||"undefined"==typeof ResizeObserver)return;if(y||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;$d(()=>xe(t))});return e.observe(Q.current),()=>e.disconnect()},[b,y,xe],Iu),q(()=>{y||b||xe()},[b,n.maxHeight,y,xe],Hu),q(()=>()=>{Wd()},[],Ou),U(()=>{const e=ae.current[ye];!y&&te.current&&e?.svg&&(mm(te.current,e.svg)&&(se.current=e.bindFunctions??null,fm(te.current,e.bindFunctions,be)),$d(()=>xe()))},[be,y,ye,xe],Wu);const ke=K(async(e,t,o)=>{if(!G.current||!te.current)return!1;P(!0);try{const n=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=bm(e,t),i=await km(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=mm(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,fm(te.current,i.bindFunctions,be),xe(),ae.current[t]={svg:l,bindFunctions:i.bindFunctions},R(!0),F(null),!0)}catch(r){if(!pe){if("function"==typeof n.onRenderError&&te.current&&!0===n.onRenderError(r,l,te.current))return!1;F(r instanceof Error?r.message:String(r))}return!1}finally{P(!1)}},[be,d,pe,xe],zu),Se=K(async(e,t,n)=>{if(G.current&&te.current){P(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=bm(xm(e)||e,t),i=await km(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=mm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,fm(te.current,i.bindFunctions,be)),e&&xe()}}catch{}finally{P(!1)}}},[be,c,pe,xe],Ku),Ce=K(async(e,t)=>{if(!e.trim())return um(te.current),R(!1),void(ce.current="");const n=e.replace(/\s+/g,"");if(n===ce.current&&me.current)return;const o=++le.current;if("gantt"===vm(e)){const i=xm(e);if(!i.trim())return;try{if(await gm(i,ye,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;i===e?await ke(e,ye,t)&&(ce.current=n):await Se(i,ye,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await gm(e,ye,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;return void(await ke(e,ye,t)&&(ce.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await Od(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return xm(e)}(e,ye,{workerTimeout:a,signal:t});if(!n||t?.aborted||le.current!==o)return;await Se(n,ye,t)}catch{}},[s,ke,Se,ye,a],Vu),Ne=K(()=>z&&!y&&!b,[b,y,z],qu);q(()=>{if(!Ne())return;if(!G.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Ne()&&Ce(l,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[l,Ne,h,Ce,u],Uu);const Me=K((e,t)=>{e.clientX,e.clientY,Dt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],Xu),$e=K(async()=>{try{await(navigator.clipboard?.writeText(l)),N(!0),n.onCopy?.(l),setTimeout(()=>N(!1),1e3)}catch{}},[l,n],Yu),Be=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=Sm(e),o={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:t};n.onExport?.(o),o.defaultPrevented||function(e,t){const n=t??Sm(e),o=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}(e,t)},[n],Zu),Ee=K(()=>{re.current=null,um(oe.current)},[],Gu),Te=K(()=>{H(!1),Ee()},[Ee],Ju),Le=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?Sm(e):null};n.onOpenModal?.(t),t.defaultPrevented||H(!0)},[n],Qu);q(()=>{if(!I)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Te()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Te,I],em),J(tm,cm,()=>{if(!I)return;const e=oe.current,t=Q.current;if(!e||!t)return;const n=`translate(${B.x}px, ${B.y}px) scale(${M})`,o=t.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="100%",o.style.maxHeight="100%";const r=o.querySelector("[data-mermaid-wrapper]");r&&(re.current=r,r.style.transform=n),um(e),e.appendChild(o),fm(e,se.current??ae.current[ye]?.bindFunctions,be)},[be,I,ye],tm),q(()=>{I&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${M})`)},[I,B.x,B.y,M],nm);const De=y||j||b,je=X(()=>n.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",[n.isDark],om),Pe=K(e=>{const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(n.onToggleMode?.(e,t),!t.defaultPrevented)if(de.current=!0,"preview"===e){g(!1);const e=fe.current;$(e.zoom),E({x:e.translateX,y:e.translateY}),W(e.containerHeight)}else fe.current={zoom:M,translateX:B.x,translateY:B.y,containerHeight:O},g(!0)},[l,O,Ce,n,ye,B.x,B.y,xe,M],rm),_e=K(e=>{if(!1===n.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=Q.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-B.x,i=e.clientY-o.top-B.y,l=.01*-e.deltaY,a=ym(M+l,.5,3);if(a===M)return;const s=a/M;E({x:B.x-r*(s-1),y:B.y-i*(s-1)}),$(a)},[B,M],im),Re=K((e,t)=>{D(!0),ie.current={x:e-B.x,y:t-B.y}},[B.x,B.y],lm),Ae=K((e,t)=>{L&&E({x:e-ie.current.x,y:t-ie.current.y})},[L],am),Fe=K(()=>{D(!1)},[],sm),Ie=S("div",{className:"relative"},()=>T([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>T([C(()=>x("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Me(e,o("common.zoomIn")),onMouseLeave:()=>jt(),onClick:()=>$(ym(M+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Me(e,o("common.zoomOut")),onMouseLeave:()=>jt(),onClick:()=>$(ym(M-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:Fr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Me(e,o("common.resetZoom")),onMouseLeave:()=>jt(),onClick:()=>{$(1),E({x:0,y:0})}},()=>T([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:Fr("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:O,maxHeight:n.maxHeight??void 0},onWheel:_e,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Re(e.clientX,e.clientY))},onMouseMove:e=>Ae(e.clientX,e.clientY),onMouseUp:Fe,onMouseLeave:Fe,onTouchStart:e=>{const t=e.touches[0];t&&Re(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Ae(t.clientX,t.clientY)},onTouchEnd:Fe},()=>T([C(()=>S("div",{ref:ee,"data-mermaid-wrapper":!0,className:Fr("absolute inset-0 cursor-grab",{"cursor-grabbing":L}),style:{transform:`translate(${B.x}px, ${B.y}px) scale(${M})`}},()=>C(()=>x("div",{ref:te,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})))),(j||pe)&&x("div",{className:"mermaid-loading"},x("span",{className:"mermaid-spinner"}),x("span",{},"Rendering diagram…"))])))])),He=n.showHeader&&C(()=>S("div",{className:Fr("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",n.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200")},()=>T([S("div",{className:"flex items-center space-x-2 overflow-hidden"},()=>T([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:r}})),C(()=>x("span",{className:Fr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"\n Mermaid\n "))])),n.showModeToggle&&h&&C(()=>S("div",{className:Fr("flex items-center space-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{type:"button",className:Fr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Pe("preview"),onMouseEnter:e=>Me(e,o("common.preview")),onFocus:e=>Me(e,o("common.preview")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("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"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview"))])))),C(()=>S("button",{type:"button",className:Fr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Pe("source"),onMouseEnter:e=>Me(e,o("common.source")),onFocus:e=>Me(e,o("common.source")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([x("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"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source"))]))))]))),S("div",{className:"flex items-center space-x-1"},()=>T([n.showCollapseButton&&C(()=>S("button",{type:"button",className:je,"aria-pressed":b,onClick:()=>v(e=>!e),onMouseEnter:e=>Me(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Me(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>C(()=>x("svg",{style:{rotate:b?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),n.showCopyButton&&C(()=>S("button",{type:"button",className:je,onClick:$e,onMouseEnter:e=>Me(e,o(w?"common.copied":"common.copy")),onFocus:e=>Me(e,o(w?"common.copied":"common.copy")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>x("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"},w?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:Fr(je,De?"opacity-50 cursor-not-allowed":""),disabled:De,onClick:Be,onMouseEnter:e=>Me(e,o("common.export")),onFocus:e=>Me(e,o("common.export")),onMouseLeave:()=>jt(),onBlur:()=>jt()},x("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"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&h&&C(()=>S("button",{type:"button",className:Fr(je,De?"opacity-50 cursor-not-allowed":""),disabled:De,onClick:I?Te:Le,onMouseEnter:e=>Me(e,o(I?"common.minimize":"common.open")),onFocus:e=>Me(e,o(I?"common.minimize":"common.open")),onMouseLeave:()=>jt(),onBlur:()=>jt()},()=>x("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"},x("path",I?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),Oe=S("div",{},()=>T([y?C(()=>S("div",{className:Fr("p-4",n.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700")},()=>S("pre",{className:"text-sm font-mono whitespace-pre-wrap"},()=>l))):Ie,A&&S("div",{className:"mermaid-error"},()=>A)]));return S(t,{},()=>T([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":y?"source":_?"preview":"pending",className:Fr("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":pe})},()=>T([He,C(()=>S("div",{ref:ne,style:{display:b?"none":""}},()=>Oe))]))),I&&"undefined"!=typeof document&&k(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Te()},()=>C(()=>S("div",{className:Fr("mermaid-modal-panel",{"is-dark":n.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},()=>T([S("div",{className:"mermaid-modal-header"},()=>T([S("span",{className:"mermaid-modal-title"},()=>`Mermaid ${o("common.preview")}`),C(()=>S("button",{type:"button",className:"mermaid-modal-close",onClick:Te},()=>o("common.close")))])),S("div",{className:"mermaid-modal-body"},()=>C(()=>x("div",{ref:oe,className:"mermaid-modal-content"})))])))),document.body)]))}function ym(e,t,n){return Math.min(Math.max(e,t),n)}async function gm(e,t,n){try{if(await Hd(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===l?.name)throw l}if(!n.mermaid)throw new Error("Mermaid not available");const o=bm(e,t),r=n.mermaid;if("function"==typeof r.parse)return await km(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await km(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function bm(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function vm(e){for(const t of e.split(/\r?\n/)){const e=t.trim();if(e&&!e.startsWith("%%"))return e.match(/^([A-Z][\w-]*)\b/i)?.[1]?.toLowerCase()||""}return""}function wm(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function xm(e){if("gantt"===vm(e))return function(e){const t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){const e=t[t.length-1]?.trim();if(e&&!e.startsWith("%%")){if(wm(e))break;t.pop()}else t.pop()}return t.some(wm)?t.join("\n"):""}(e);const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function km(e,t={}){const{timeoutMs:n,signal:o}=t;return o?.aborted?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,r)=>{let i=!1,l=null;function a(){i||(i=!0,s(),r(new DOMException("Aborted","AbortError")))}function s(){null!=l&&clearTimeout(l),o&&o.removeEventListener("abort",a)}o&&o.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,s(),r(/* @__PURE__ */new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,s(),t(e))}).catch(e=>{i||(i=!0,s(),r(e))})})}function Sm(e){return(new XMLSerializer).serializeToString(e)}var Cm=/* @__PURE__ */W('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),Nm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l;const a=v(Cm),s=H(g(a),1);i=a,l=H(s,1);{const t=e.h0;n=$(s,t),r=t}o=f(t,a,n,r,i,l,null,void 0)}else{const t=e.h0;o.b!==t&&(I(o.a,t),o.b=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.f!==n){o.f=n;const e=o.e;null==e||r||null===n?o.e=z(t,1,o.c,n,o.d,!0):I(e,n)}}});function Mm(e){const{node:t}=e;return x(Nm,{h0:" ",h1:String(t?.type)})}function $m(e,t,n){const o=ce(e.type),r=(n??[]).map(e=>ce(e)).filter(Boolean),i="html_inline"===o||"html_block"===o;if(!i&&!r.includes(o))return null;const l=i?ce(e.tag)||ne(e.content):ce(e.tag)||o;if(!l)return null;const a=r.includes(l),s=t[l]??t[o]??null,c=a||i?s:null;return{tag:l,isWhitelisted:a,component:c,display:st(c)}}function Bm(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function Em(e,t,n,o){const r=e.filter(e=>!Bm(e)),i=r.length>0&&r.every(e=>"image"===e.type||function(e){const t=function(e){return"link"===e?.type&&Array.isArray(e?.children)?e.children.filter(e=>!Bm(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return Te(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Bm(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Bm(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Bm(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Tm(t){const{node:n,ctx:o,renderNode:r,indexKey:i,children:l}=t;if(!o||!r)return e.createElement("p",{dir:"auto",className:"paragraph-node"},l);const a=n.children??[],s={...o.customComponents??it(o.customId),...o.htmlComponents??{},...o.streamingComponents??{}},c=[],d=[],u=()=>{if(!d.length)return;const t=c.length;c.push(e.createElement("p",{key:`${String(i??"paragraph")}-inline-${t}`,dir:"auto",className:"paragraph-node"},Em(d.slice(),r,o,`${String(i??"paragraph")}-${t}`))),d.length=0};return a.forEach((e,t)=>{const n="escape"!==(o.htmlPolicy??"safe")||"html_inline"!==e.type&&"html_block"!==e.type;Be.has(e.type)||n&&function(e,t,n){return"block"===$m(e,t,n)?.display}(e,s,o.customHtmlTags)?(u(),c.push(r(e,`${String(i??"paragraph")}-block-${t}`,o))):d.push(e)}),u(),c.length?e.createElement(e.Fragment,{},c):e.createElement("p",{dir:"auto",className:"paragraph-node"},Em(a,r,o,String(i??"paragraph")))}Mm.$$singleRoot=!0,N(["click","keydown","mouseenter","mouseleave"]);var Lm=/* @__PURE__ */W('<span class="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"></span>'),Dm=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),jm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=v(Lm);n=s,s.$$click=e.h0,r=s,s.$$mouseenter=e.h1,i=s,s.$$mouseleave=e.h2,l=s,s.$$keydown=e.h3,a=s,o=h(t,s,n,r,i,l,a,null,void 0)}else o.a.$$click=e.h0,o.b.$$mouseenter=e.h1,o.c.$$mouseleave=e.h2,o.d.$$keydown=e.h3;{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.g!==n){const e=o.f;null==e||r||null===n?o.f=b(t,1,o.e,n,e):I(e,n),o.g=n}}});function Pm(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],Dm);return x(jm,{h0:n,h1:n=>{e.onMouseEnter?.(n,t.id,e.messageId,e.threadId)},h2:n=>{e.onMouseLeave?.(n,t.id,e.messageId,e.threadId)},h3:e=>{"Enter"!==e.key&&" "!==e.key||n(e)},h4:t.id})}Pm.$$singleRoot=!0;var _m=/* @__PURE__ */W('<s class="strikethrough-node"></s>'),Rm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(_m);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Am(e){return x(Rm,{h0:e.children})}Am.$$singleRoot=!0;var Fm=/* @__PURE__ */W('<strong class="strong-node"></strong>'),Im=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Fm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Hm(e){return x(Im,{h0:e.children})}Hm.$$singleRoot=!0;var Om=/* @__PURE__ */W('<sub class="subscript-node"></sub>'),Wm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Om);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function zm(e){return x(Wm,{h0:e.children})}zm.$$singleRoot=!0;var Km=/* @__PURE__ */W('<sup class="superscript-node"></sup>'),Vm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=v(Km);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function qm(e){return x(Vm,{h0:e.children})}qm.$$singleRoot=!0;var Um=/* @__PURE__ */W('<th dir="auto"><!><!></th>'),Xm=/* @__PURE__ */W("<tr></tr>"),Ym=/* @__PURE__ */W('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),Zm=/* @__PURE__ */M(5),Gm=/* @__PURE__ */Symbol(Zm),Jm=/* @__PURE__ */Symbol(Zm+1),Qm=/* @__PURE__ */Symbol(Zm+2),ef=/* @__PURE__ */Symbol(Zm+3),tf=/* @__PURE__ */Symbol(Zm+4),nf=(e,t)=>`header-${t}`;function of(e,t,n){const o=t.block,[r,i,a,s,c,d]=n,u=o.itemIndex;let m=t.slots[0];if(void 0===m){let e,n,o,r,i;const a=v(Um);e=a,n=a;const s=g(a);o=s,r=a,i=H(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=Fr("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?Le(e.children,i,`${String(s??"table")}-th-${u}`,c):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||m.f!==n){m.f=n;const e=m.e;null==e||o||null===n?m.e=z(t,1,m.c,n,m.d,!0):I(e,n)}}{const e=u<a.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${u+1} and ${u+2}`,onPointerDown:e=>d(u,e)})),n=null!==e&&("object"==typeof e||"function"==typeof e);if(n||m.j!==e){m.j=e;const o=m.i;null==o||n||null===e?m.i=z(t,2,m.g,e,m.h,!0):I(o,e)}}}var rf=(e,t)=>`row-${t}`;function lf(e,t,n){const o=t.block,[r,i,l,a,s]=n,c=o.itemIndex;let d=t.slots[0];if(void 0===d){let e,n;const o=v(Xm);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=Fr("border-[var(--table-border,#cbd5e1)]",c<r.length-1&&"border-b");d.a!==e&&(R(d.b,e),d.a=e)}{const n=e.cells?.map((e,t)=>S("td",{key:`cell-${c}-${t}`,className:Fr("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?Le(e.children,i,`${String(a??"table")}-row-${c}-${t}`,s):null)),o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||d.e!==n){const e=d.d;null==e||o||null===n?d.d=b(t,1,d.c,n,e):I(e,n),d.e=n}}}var af=["r","c","d"],sf=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s,c,d,u,m,f,h,p,b;const w=v(Ym);n=w;const x=g(w);{const n=e.h1;i=n,l=x,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}a=x,s=x;const k=H(g(x),1),S=g(k);c=S,d=g(S);const C=H(k,1);u=C,m=g(C),f=x,h=g(x),p=w,b=H(x,1),r=y(t,w,{a:void 0,b:n,c:i,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:u,l:m,m:f,n:h,o:null,p:void 0,q:p,r:b,s:null,t:void 0}),t.refFields=af}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}{const t=e.h0;r.a!==t&&(P(r.b,"data-index-key",t),r.a=t)}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-busy",t),r.g=t)}B(t,1,r.i,e.h5,e.h6,e.h7,nf,of,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,rf,lf,18,[e.h12,e.h13,e.h14,e.h15,e.h16],r.l,1);{const n=e.h4,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,3,r.m,n,r.n,!0):I(e,n)}}{const n=e.h17,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,4,r.q,n,r.r,!0):I(e,n)}}});function cf(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=Array.isArray(n?.header?.cells)?n.header.cells:[],a=Boolean(n?.loading),s=Array.isArray(n?.rows)?n.rows:[],c=e.useRef(null,Gm),d=e.useRef(null,Jm),u=e.useRef(null,Qm),[m,f]=e.useState([],ef),h=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",p=()=>{const e=u.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),u.current=null),d.current=null},y=(e,t)=>{if(0!==t.button)return;const n=(()=>{const e=c.current?.querySelectorAll("thead th");return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))})(),o=n[e],r=n[e+1];if(!o||!r)return;t.preventDefault(),p(),d.current={index:e,startX:t.clientX,startWidth:o,nextStartWidth:r,widths:n},f(n);const i=e=>{const t=d.current;if(!t)return;e.preventDefault();const n=t.startWidth+t.nextStartWidth,o=Math.min(48,Math.floor(n/2)),r=Math.max(o,Math.min(n-o,Math.round(t.startWidth+e.clientX-t.startX))),i=[...t.widths];i[t.index]=r,i[t.index+1]=n-r,f(i)},l=()=>{p()};u.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)};return e.useEffect(()=>(p(),f([]),p),[l.length],tf),x(sf,{h0:i,h1:c,h2:Fr("my-8 text-sm table-node",a&&"table-node--loading"),h3:a,h4:m.length>0&&S("colgroup",{},()=>l.map((e,t)=>x("col",{key:`col-${t}`,style:m[t]>0?{width:`${m[t]}px`}:void 0}))),h5:l,h6:l.map,h7:(e,t)=>S("th",{key:`header-${t}`,className:Fr("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>T([o&&r?Le(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>y(t,e)}))])),h8:[h,o,l,i,r,y],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:Fr("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:Fr("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?Le(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&x("div",{className:"table-node__loading",role:"status","aria-live":"polite"},x("span",{className:"table-node__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}cf.$$singleRoot=!0;var df=/* @__PURE__ */W('<hr class="hr-node thematic-break"/>'),uf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,v(df)))});function mf(){return x(uf,{})}mf.$$singleRoot=!0;var ff=/* @__PURE__ */W("<div></div>"),hf=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),pf=["s","d","c"],yf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=v(ff);n=e.h0,r=O(e.h1),i=s,l=A(s,[[!1,"className",n],[!0,r]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.d;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.c)}),a=s,o=h(t,s,n,r,i,l,a,null,void 0),t.refFields=pf}else{{const t=e.h0;o.a!==t&&(o.a=t)}o.b=O(e.h1),o.d=A(o.c,[[!1,"className",o.a],[!0,o.b]],o.d,t,!0)}{const n=e.h2;o.f=b(t,1,o.e,n,o.f),o.g=n}});function gf(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=`vmr-container vmr-container-${n.name}`,a=X(()=>{if(n.attrs)return Array.isArray(n.attrs)?Ee(n.attrs):n.attrs},[n.attrs],hf);return x(yf,{h0:l,h1:a,h2:o&&r&&Array.isArray(n.children)?n.children.map((t,n)=>S(e.Fragment,{key:`${String(i??"vmr-container")}-${n}`},()=>r(t,`${String(i??"vmr-container")}-${n}`,o))):null})}gf.$$singleRoot=!0;var bf=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function vf(e,t={}){const n={},o=new Set(t.omit??[]);if(!e||"object"!=typeof e)return n;const r=Object.getOwnPropertyDescriptors(e);for(const[i,l]of Object.entries(r))bf.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function wf(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function xf(t,n,o,r,i={}){const l=vf(r.codeBlockProps),a=r.events.onHandleArtifactClick?e=>{const t="image/svg+xml"===e.type?"image/svg+xml":"text/html";r.events.onHandleArtifactClick?.({node:null==e.content?n:{...n,code:e.content},artifactType:t,artifactTitle:e.title||("image/svg+xml"===t?"SVG Preview":"HTML Preview"),id:String(o)})}:void 0;return e.createElement(t,{key:o,node:n,loading:Boolean(n.loading)||!1===r.final,stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,codeBlockOptions:r.codeBlockOptions,...i,ctx:r,renderNode:Sf,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function kf(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function Sf(t,n,o){const r=o.customComponents??it(o.customId),i=o.streamingComponents??{},l=o.htmlComponents??{},a=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const t=ce(e.type),n=ce(e.tag);return t&&n&&t===n?t:""}(t),s=a?i[a]:null,c=a&&!s?l[a]:null,d="code_block"===t.type?null:r[t.type];if(s)return e.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(c)return function(t,n,o,r,i){const l=te(ve(fe(n.attrs??void 0,r.htmlPolicy??"safe",i))),a=Array.isArray(n.children)?Te(n.children,r,`${String(o)}-html`,Sf):n.content??null;return e.createElement(t,{...l,key:o},a)}(c,t,n,o,a);if(d)return e.createElement(d,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=$m(t,{...r,...i},o.customHtmlTags),a=String(t.tag??"").trim().toLowerCase()||ne(t.content),s=l?.tag??a;if(s){const i=l?.component??r[s],a=l?.isWhitelisted??(o.customHtmlTags??[]).some(e=>e.toLowerCase()===s);if(a&&i){const r={...t,type:s,tag:s,content:ge(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&ye(c,s))return"html_inline"===t.type?wf(mc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):wf(Tm,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return wf(mc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return wf(mc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return wf(Tm,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return wf(vl,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return wf(Cp,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return wf(Cc,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return wf(Sc,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return wf(cf,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return wf(Xi,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return wf(al,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return wf(pl,t,n,{});case"footnote_anchor":return wf(rl,t,n,{});case"admonition":return wf(Ie,t,n,{ctx:o,renderNode:Sf,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return wf(bl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return wf(wc,t,n,{ctx:o,renderNode:Sf,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return wf(qa,t,n,{});case"inline_code":return wf(Ys,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"code_block":return function(t,n,o,r){const i=function(e){const t=String(e?.language||"").trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}(t),l=zt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,zt(n),ke(n)]){const t=o&&e[o];if(t)return t}return null}(r,i);if("mermaid"===l){const i=function(e,t){const n={...t.mermaidProps||{}};return null==Cd(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Md(Nd(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Cd(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return kf(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(pm,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("infographic"===l){const i=function(e,t){const n={...t.infographicProps||{}};return null==Ua(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Ya(Xa(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Ua(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?kf(l,t,n,o,i):e.createElement(Fs,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?kf(i,t,n,o,o.d2Props||{}):e.createElement(Wi,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return xf(a,t,n,o);const s=r.code_block;if(s)return xf(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=vf(o.codeBlockProps).showLineNumbers,i=o.codeBlockOptions?.disableLineNumbers,l=o.codeBlockOptions?.overflow;return e.createElement(En,{key:n,node:t,style:l?{whiteSpace:"scroll"===l?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof r?r:"boolean"==typeof i&&!i})}return e.createElement(Rr,{key:n,node:t,loading:Boolean(t.loading)||!1===o.final,stream:o.codeBlockStream,themes:o.codeBlockThemes?.themes,darkTheme:o.codeBlockThemes?.darkTheme,lightTheme:o.codeBlockThemes?.lightTheme,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...vf(o.codeBlockProps),codeBlockOptions:o.codeBlockOptions})}(t,n,o,r);case"strong":return wf(Hm,t,n,{},Te(t.children,o,`${String(n)}-strong`,Sf));case"emphasis":return wf(el,t,n,{},Te(t.children,o,`${String(n)}-em`,Sf));case"strikethrough":return wf(Am,t,n,{},Te(t.children,o,`${String(n)}-strike`,Sf));case"highlight":return wf(kl,t,n,{},Te(t.children,o,`${String(n)}-highlight`,Sf));case"insert":return wf(Js,t,n,{},Te(t.children,o,`${String(n)}-insert`,Sf));case"subscript":return wf(zm,t,n,{},Te(t.children,o,`${String(n)}-sub`,Sf));case"superscript":return wf(qm,t,n,{},Te(t.children,o,`${String(n)}-sup`,Sf));case"checkbox":case"checkbox_input":return wf(wt,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return wf(Gi,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(mf);case"math_inline":return wf(Sd,t,n,{});case"math_block":return wf(cd,t,n,{});case"reference":return wf(Pm,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?wf(ca,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):wf(Aa,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return wf(gf,t,n,{ctx:o,renderNode:Sf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return wf(Mm,t,n,{})}}var Cf=/* @__PURE__ */M(98),Nf=/* @__PURE__ */Symbol(Cf),Mf=/* @__PURE__ */Symbol(Cf+1),$f=/* @__PURE__ */Symbol(Cf+2),Bf=/* @__PURE__ */Symbol(Cf+3),Ef=/* @__PURE__ */Symbol(Cf+4),Tf=/* @__PURE__ */Symbol(Cf+5),Lf=/* @__PURE__ */Symbol(Cf+6),Df=/* @__PURE__ */Symbol(Cf+7),jf=/* @__PURE__ */Symbol(Cf+8),Pf=/* @__PURE__ */Symbol(Cf+9),_f=/* @__PURE__ */Symbol(Cf+10),Rf=/* @__PURE__ */Symbol(Cf+11),Af=/* @__PURE__ */Symbol(Cf+12),Ff=/* @__PURE__ */Symbol(Cf+13),If=/* @__PURE__ */Symbol(Cf+14),Hf=/* @__PURE__ */Symbol(Cf+15),Of=/* @__PURE__ */Symbol(Cf+16),Wf=/* @__PURE__ */Symbol(Cf+17),zf=/* @__PURE__ */Symbol(Cf+18),Kf=/* @__PURE__ */Symbol(Cf+19),Vf=/* @__PURE__ */Symbol(Cf+20),qf=/* @__PURE__ */Symbol(Cf+21),Uf=/* @__PURE__ */Symbol(Cf+22),Xf=/* @__PURE__ */Symbol(Cf+23),Yf=/* @__PURE__ */Symbol(Cf+24),Zf=/* @__PURE__ */Symbol(Cf+25),Gf=/* @__PURE__ */Symbol(Cf+26),Jf=/* @__PURE__ */Symbol(Cf+27),Qf=/* @__PURE__ */Symbol(Cf+28),eh=/* @__PURE__ */Symbol(Cf+29),th=/* @__PURE__ */Symbol(Cf+30),nh=/* @__PURE__ */Symbol(Cf+31),oh=/* @__PURE__ */Symbol(Cf+32),rh=/* @__PURE__ */Symbol(Cf+33),ih=/* @__PURE__ */Symbol(Cf+34),lh=/* @__PURE__ */Symbol(Cf+35),ah=/* @__PURE__ */Symbol(Cf+36),sh=/* @__PURE__ */Symbol(Cf+37),ch=/* @__PURE__ */Symbol(Cf+38),dh=/* @__PURE__ */Symbol(Cf+39),uh=/* @__PURE__ */Symbol(Cf+40),mh=/* @__PURE__ */Symbol(Cf+41),fh=/* @__PURE__ */Symbol(Cf+42),hh=/* @__PURE__ */Symbol(Cf+43),ph=/* @__PURE__ */Symbol(Cf+44),yh=/* @__PURE__ */Symbol(Cf+45),gh=/* @__PURE__ */Symbol(Cf+46),bh=/* @__PURE__ */Symbol(Cf+47),vh=/* @__PURE__ */Symbol(Cf+48),wh=/* @__PURE__ */Symbol(Cf+49),xh=/* @__PURE__ */Symbol(Cf+50),kh=/* @__PURE__ */Symbol(Cf+51),Sh=/* @__PURE__ */Symbol(Cf+52),Ch=/* @__PURE__ */Symbol(Cf+53),Nh=/* @__PURE__ */Symbol(Cf+54),Mh=/* @__PURE__ */Symbol(Cf+55),$h=/* @__PURE__ */Symbol(Cf+56),Bh=/* @__PURE__ */Symbol(Cf+57),Eh=/* @__PURE__ */Symbol(Cf+58),Th=/* @__PURE__ */Symbol(Cf+59),Lh=/* @__PURE__ */Symbol(Cf+60),Dh=/* @__PURE__ */Symbol(Cf+61),jh=/* @__PURE__ */Symbol(Cf+62),Ph=/* @__PURE__ */Symbol(Cf+63),_h=/* @__PURE__ */Symbol(Cf+64),Rh=/* @__PURE__ */Symbol(Cf+65),Ah=/* @__PURE__ */Symbol(Cf+66),Fh=/* @__PURE__ */Symbol(Cf+67),Ih=/* @__PURE__ */Symbol(Cf+68),Hh=/* @__PURE__ */Symbol(Cf+69),Oh=/* @__PURE__ */Symbol(Cf+70),Wh=/* @__PURE__ */Symbol(Cf+71),zh=/* @__PURE__ */Symbol(Cf+72),Kh=/* @__PURE__ */Symbol(Cf+73),Vh=/* @__PURE__ */Symbol(Cf+74),qh=/* @__PURE__ */Symbol(Cf+75),Uh=/* @__PURE__ */Symbol(Cf+76),Xh=/* @__PURE__ */Symbol(Cf+77),Yh=/* @__PURE__ */Symbol(Cf+78),Zh=/* @__PURE__ */Symbol(Cf+79),Gh=/* @__PURE__ */Symbol(Cf+80),Jh=/* @__PURE__ */Symbol(Cf+81),Qh=/* @__PURE__ */Symbol(Cf+82),ep=/* @__PURE__ */Symbol(Cf+83),tp=/* @__PURE__ */Symbol(Cf+84),np=/* @__PURE__ */Symbol(Cf+85),op=/* @__PURE__ */Symbol(Cf+86),rp=/* @__PURE__ */Symbol(Cf+87),ip=/* @__PURE__ */Symbol(Cf+88),lp=/* @__PURE__ */Symbol(Cf+89),ap=/* @__PURE__ */Symbol(Cf+90),sp=/* @__PURE__ */Symbol(Cf+91),cp=/* @__PURE__ */Symbol(Cf+92),dp=/* @__PURE__ */Symbol(Cf+93),up=/* @__PURE__ */Symbol(Cf+94),mp=/* @__PURE__ */Symbol(Cf+95),fp=/* @__PURE__ */Symbol(Cf+96),hp=/* @__PURE__ */Symbol(Cf+97),pp={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},yp=oe();function gp(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,o=t;return n.startLine===o.startLine&&n.endLine===o.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function bp(e){const t=X(()=>function(e){if(!e)return{};const t={};for(const[n,o]of Object.entries(e)){const e=ce(n);e&&(t[e]=o)}return t}(e),[e],Nf),n=Y(t,Mf);return function(e,t){const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}var vp=e.memo(({node:e,nodeKey:t,renderCtx:n})=>Sf(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),wp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J($f,Ge,$f),s="undefined"!=typeof window,c="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,d=Math.max(0,Math.trunc(e.renderBatchSize??80)),u=Math.max(0,Math.trunc(e.initialRenderBatchSize??(d||t.length))),m=!1!==e.batchRendering&&d>0&&s,f=Math.max(0,e.liveNodeBuffer??60),h=Math.max(1,e.maxLiveNodes??320),p=(e.maxLiveNodes??0)>0&&t.length>h,y=!1!==e.viewportPriority,g=m&&(e.maxLiveNodes??0)<=0,b=X(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&y,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,y,p],Bf),[v,w]=Z(()=>g?Math.min(t.length,u):t.length,Ef),k=Y(v,Tf);q(()=>{k.current=v},[v],Lf);const N=g?v:t.length,[M,$]=Z(0,Df),[B,E]=Z({start:0,end:t.length},jf),L=Y(/* @__PURE__ */new Map,Pf),[D,j]=Z(0,_f),P=Y({},Rf),_=Y(/* @__PURE__ */new Map,Af),R=Y(/* @__PURE__ */new Map,Ff),A=Y(/* @__PURE__ */new Map,If),F=Y(/* @__PURE__ */new Map,Hf),I=Y(/* @__PURE__ */new Set,Of),H=Y(v,Wf),O=Y(null,zf),W=Y(null,Kf),z=Y(null,Vf),V=Y(!1,qf),U=Y(null,Uf),G=Y(Math.max(1,d||1),Xf),Q=Y(t.length,Yf),ee=Y({key:e.indexKey,total:t.length},Zf),te=Y({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:g},Gf),ne=b||p,oe=X(()=>{const e=L.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[D],Jf),re=X(()=>{if(!p)return t.map((e,t)=>({node:e,index:t}));const e=t.length,n=Math.max(0,Math.min(B.start,e)),o=Math.max(n,Math.min(B.end,e));return t.slice(n,o).map((e,t)=>({node:e,index:n+t}))},[t,B,p],Qf);Q.current=X(()=>{if(!p)return t.length;const e=Math.max(B.end+f,u),n=Math.min(t.length,e);return Math.max(v,n)},[t.length,p,B.end,f,u,v],eh);const ie=K((e,t)=>{if(e>=t)return 0;const n=L.current;let o=0;for(let r=e;r<t;r++)o+=n.get(r)??oe;return o},[oe],th),le=p?ie(0,Math.min(B.start,t.length)):0,ae=p?ie(Math.min(B.end,t.length),t.length):0,se=K(()=>{null!=O.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(O.current),O.current=null),null!=W.current&&(window.clearTimeout(W.current),W.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),V.current=!1,U.current=null},[],nh),ce=K(t=>{if(!g)return;const n=Math.max(2,e.renderBatchBudgetMs??6),o=Math.max(1,d||1),r=Math.max(1,Math.floor(o/4));t>1.2*n?G.current=Math.max(r,Math.floor(.7*G.current)):t<.5*n&&G.current<o&&(G.current=Math.min(o,Math.ceil(1.2*G.current)))},[g,e.renderBatchBudgetMs,d],oh),de=K((t,n={})=>{if(!g)return;const o=Q.current;if(k.current>=o)return;const r=Math.max(1,t),i=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();w(t=>{const n=Math.min(Q.current,t+Math.max(1,e));return k.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();ce(n-t)},l=()=>{const e=Math.max(1,Math.round(G.current));de(e)},a=t=>{O.current=null,W.current=null,z.current=null,V.current=!1;const n=U.current;if(U.current=null,i(null!=n?n:r),k.current>=Q.current)return;if(!t)return void l();const o=Math.max(2,e.renderBatchBudgetMs??6);for(;k.current<Q.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)i(Math.max(1,Math.round(G.current)));k.current<Q.current&&l()};if(!s||n.immediate)return void a();const d=Math.max(0,e.renderBatchDelay??16);if(U.current=null!=U.current?Math.max(U.current,r):r,!V.current){if(V.current=!0,c){const t=Math.max(0,e.renderBatchIdleTimeoutMs??120);return void(z.current=window.requestIdleCallback(e=>a(e),{timeout:t}))}"function"==typeof requestAnimationFrame?O.current=requestAnimationFrame(()=>{0!==d?W.current=window.setTimeout(()=>a(),d):a()}):W.current=window.setTimeout(()=>a(),d)}},[ce,c,g,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],rh);q(()=>{const n=e.indexKey,o=t.length,r=ee.current,i=void 0!==n?n!==r.key:o!==r.total;ee.current={key:n,total:o};const l=te.current,a=e.renderBatchDelay??16,c=l.batchSize!==d||l.initial!==u||l.delay!==a||l.enabled!==g;if(te.current={batchSize:d,initial:u,delay:a,enabled:g},(i||c||!g)&&se(),(i||c)&&(G.current=Math.max(1,d||1),I.current.clear()),!o)return k.current=0,void w(0);const m=Q.current;if(!g)return k.current=m,void w(m);if(i||c){const e=Math.min(m,u);return k.current=e,w(e),void(e<m&&de(Math.max(1,u),{immediate:!s}))}const f=Math.min(k.current,m);f!==k.current&&(k.current=f,w(f)),k.current<m&&de(Math.max(1,d||1))},[se,g,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],ih),q(()=>{if(!p)return void E({start:0,end:t.length});const e=t.length;if(!e)return void E({start:0,end:0});const n=Math.max(0,Math.min(M,e-1));let o=Math.max(0,n-f),r=Math.min(e,n+f+1);const i=r-o;if(i>h){const e=i-h;o+=Math.ceil(e/2),r-=Math.floor(e/2)}else if(i<h){const t=h-i;o=Math.max(0,o-Math.ceil(t/2)),r=Math.min(e,r+Math.floor(t/2))}E({start:o,end:r})},[M,f,h,t.length,p],lh),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],ah);const ue=K(e=>{for(const[t,n]of _.current.entries())t>=e&&(n.destroy(),_.current.delete(t),delete P.current[t],R.current.delete(t),A.current.delete(t),F.current.delete(t))},[],sh);q(()=>{ue(N)},[ue,N],ch),q(()=>{const e=t.length;let n=!1;for(const t of Array.from(L.current.keys()))t>=e&&(L.current.delete(t),n=!0);n&&j(e=>e+1);for(const t of Object.keys(P.current))Number(t)>=e&&delete P.current[t];for(const t of Array.from(I.current))t>=e&&I.current.delete(t)},[t.length],dh);const me=K((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],uh),fe=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],mh),he=K((e,t)=>{const n=R.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return fe(e),b&&!t&&delete P.current[e],void(t&&me(e,!0));if(e<u&&!p)return fe(e),void me(e,!0);fe(e);const o=a(t,{rootMargin:"400px"});_.current.set(e,o),o.isVisible()&&me(e,!0),o.whenVisible.then(()=>me(e,!0)).catch(()=>{})},[b,fe,me,a,u,ne,p],fh),pe=K(e=>{const t=A.current.get(e);if(t)return t;const n=t=>he(e,t);return A.current.set(e,n),n},[he],hh),ye=K((e,t)=>{if(!t)return void(L.current.has(e)&&(L.current.delete(e),j(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&L.current.get(e)!==n&&(L.current.set(e,n),j(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],ph),ge=K(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ye(e,t);return F.current.set(e,n),n},[ye],yh),be=K(e=>!(g&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,g,u],gh),ve=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],bh);q(()=>{for(const[e,t]of R.current.entries())t&&he(e,t)},[he],vh),q(()=>{p&&v>H.current&&$(v-1),H.current=v},[v,p],wh);const we=p?C(()=>x("div",{className:"node-spacer",style:{height:`${le}px`},"aria-hidden":"true"})):null,xe=p?C(()=>x("div",{className:"node-spacer",style:{height:`${ae}px`},"aria-hidden":"true"})):null;return C(()=>S("div",{ref:r,className:`markstream-octane markdown-renderer${e.isDark?" dark":""}${p?" virtualized":""}`,"data-custom-id":e.customId,onClick:e.onClick,onMouseOver:ve(e.onMouseOver),onMouseOut:ve(e.onMouseOut)},()=>T([we,re.map(({node:t,index:r})=>{const i=be(r),l=L.current.get(r)??oe,a=!1!==e.fade&&"code_block"!==t.type&&!I.current.has(r)&&i;return a&&I.current.add(r),S("div",{key:`${o}-${r}`,ref:pe(r),className:"node-slot","data-node-index":r,"data-node-type":t.type},()=>C(i?()=>S("div",{ref:ge(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>x(vp,{node:t,nodeKey:`${o}-${r}`,renderCtx:n}))):()=>x("div",{className:"node-placeholder",style:{height:`${l}px`}})))}),xe,i&&C(()=>x("span",{ref:l,className:"typewriter-cursor","aria-hidden":"true"}))])))},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,o=t.parsedNodes;if(n===o)return!0;if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==o[l])return!1;const r=e.props,i=t.props;return r.isDark===i.isDark&&r.typewriter===i.typewriter&&r.fade===i.fade&&r.batchRendering===i.batchRendering&&r.initialRenderBatchSize===i.initialRenderBatchSize&&r.renderBatchSize===i.renderBatchSize&&r.renderBatchDelay===i.renderBatchDelay&&r.renderBatchBudgetMs===i.renderBatchBudgetMs&&r.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&r.deferNodesUntilVisible===i.deferNodesUntilVisible&&r.maxLiveNodes===i.maxLiveNodes&&r.liveNodeBuffer===i.liveNodeBuffer&&r.viewportPriority===i.viewportPriority&&r.indexKey===i.indexKey&&r.onClick===i.onClick&&r.onMouseOver===i.onMouseOver&&r.onMouseOut===i.onMouseOut});function xp(t){const n={...pp,...t},o=Y(null,xh),r=Y(/* @__PURE__ */new Map,kh),i=Y(0,Sh),l=Y(null,Ch),a=J(Nh,mt,n.smoothStreamingOptions,Nh),s=e.useContext(He),c=Y(/* @__PURE__ */new Set,Mh),[d,u]=Z(()=>!0===n.smoothStreaming,$h);q(()=>{u(!0)},[],Bh);const m=Array.isArray(n.nodes)&&n.nodes.length>0,f=X(()=>!1!==n.smoothStreaming&&!m&&(!0===n.smoothStreaming||!s)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[m,s,n.maxLiveNodes,n.smoothStreaming,n.typewriter],Eh),h=d&&f,p=h?a.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Th),g=n.content??"",b=m||a.source===g,v=X(()=>h&&null!=y?Boolean(y&&b&&a.caughtUp):y,[y,b,a.caughtUp,h],Lh),w=Y(null,Dh),[k,N]=Z(!1,jh),M=Y(void 0,Ph),$=Y(0,_h),B=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],Rh),E=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&B.has(t)},[B],Ah),T=K(e=>{if(!e||"object"!=typeof e)return 0;const t=e,n=t.raw??t.content??t.code;if("string"==typeof n)return n.length;const o=t.children;if(Array.isArray(o))return o.reduce((e,t)=>e+T(t),0);const r=t.items;return Array.isArray(r)?r.reduce((e,t)=>e+T(t),0):0},[],Fh),L=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+T(t),0):(n.content??"").length,[n.nodes,n.content,T],Ih),D=K(()=>{M.current&&(clearTimeout(M.current),M.current=void 0)},[],Hh),j=K(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??"").trim())return NodeFilter.FILTER_REJECT;const t=e.parentElement;return t?t.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,o=t.nextNode();for(;o;)n=o,o=t.nextNode();return n},[],Oh),P=K(()=>{if("undefined"==typeof window||!k||!o.current||!w.current)return;const e=o.current,t=w.current,n=j(e),r=e.getBoundingClientRect();let i=0,l=0,a=20;if(n?.textContent){const t=document.createRange(),o=n.textContent.length;t.setStart(n,Math.max(0,o-1)),t.setEnd(n,o);const s="function"==typeof t.getClientRects?t.getClientRects():void 0,c=s?.[s.length-1]??n.parentElement?.getBoundingClientRect();c&&(i=c.right-r.left+e.scrollLeft,l=c.top-r.top+e.scrollTop,a=c.height||a),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,l)}px)`,t.style.height=`${a}px`},[k,o,j],Wh);q(()=>{k&&requestAnimationFrame(()=>{P()})},[k,P],zh),q(()=>()=>{D()},[D],Kh);const _=m?n.nodes:p;l.current!==_&&(i.current+=1,l.current=_);const R=G(nt,ot,ot,Vh),A=X(()=>it(n.customId),[n.customId,R],qh),F=J(Uh,bp,n.streamingComponents,Uh),I=J(Xh,bp,n.htmlComponents,Xh);q(()=>{c.current},[I,F],Yh);const H=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],Zh),O=X(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return se(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(F))},[n.customId,n.customHtmlTags,n.parseOptions,R,F],Gh),W=X(()=>{const e=O;return e&&0!==e.length?oe(H,{customHtmlTags:e}):oe(H)},[H,O],Jh),z=X(()=>{const e=W;return n.customMarkdownIt?n.customMarkdownIt(e):e},[W,n.customMarkdownIt],Qh),V=X(()=>{const e=n.parseOptions??{},t=v,o=null!=t,r=O.length>0;return o||r?{...e,...o?{final:t}:{},...r?{customHtmlTags:O}:{}}:e},[O,v,n.parseOptions],ep),U=X(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return m?o=n.nodes.map(e=>({...e})):p&&(o=de(p,z??yp,V)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:p.length}),o},[n.debugPerformance,p,m,n.nodes,V,z,n.customId,R,O],tp),Q=K(()=>{const e=U[U.length-1];return!E(e)},[U,E],np);q(()=>{if("undefined"==typeof window||m)return;if(v)return N(!1),void D();const e=L(),t=Q();return!1===n.typewriter||!t||e<=$.current?(!1!==n.typewriter&&t||N(!1),void($.current=e)):($.current=e,N(!0),D(),requestAnimationFrame(()=>{P()}),M.current=setTimeout(()=>{N(!1)},3e3),()=>{D()})},[p,n.nodes,n.typewriter,n.content,v,U.length,m,L,Q,D,P],op);const ee=Y([],rp),te=V?.postTransformNodes,ne=Y(te,ip);ne.current!==te&&(ee.current=[],ne.current=te);const re=function(e,t){if(!t.length)return e;const n=new Array(e.length);let o=e.length===t.length;for(let r=0;r<e.length;r++){const i=r<t.length?t[r]:null;i&&gp(i,e[r])?n[r]=i:(n[r]=e[r],o=!1)}return o?t:n}(U,ee.current);ee.current=re,q(()=>{if(m)return void a.reset("");const e=n.content??"";if(!h)return a.reset(e),void(y&&a.finish({flush:!0}));const t=a.getSnapshot().source;e?e===t||(e.startsWith(t)?a.enqueue(e.slice(t.length)):a.reset(e)):a.reset(""),y&&a.finish()},[m,n.content,y,h],lp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!re.some(e=>"code_block"===e?.type&&"mermaid"!==zt(String(e?.language??""))))return;const e=window.requestIdleCallback??((e,t)=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),t?.timeout??600)),t=window.cancelIdleCallback??(e=>window.clearTimeout(e)),o=e(()=>{dn()},{timeout:900});return()=>t(o)},[re,n.renderCodeBlocksAsPre],ap);const ie=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],sp),le=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],cp),ae=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],dp),ce=X(()=>({...n.d2Props||{}}),[n.d2Props],up),ue=X(()=>({...n.infographicProps||{}}),[n.infographicProps],mp),me=X(()=>({customId:n.customId,isDark:n.isDark,final:v,indexKey:ie,typewriter:n.typewriter,fade:n.fade,textStreamState:r.current,streamRenderVersion:i.current,customComponents:A,streamingComponents:F,htmlComponents:I,customHtmlTags:O,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockOptions:n.codeBlockOptions,codeBlockProps:le,mermaidProps:ae,d2Props:ce,infographicProps:ue,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,v,ie,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockOptions,O,le,ae,ce,ue,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,A,F,I],fp);me.streamRenderVersion=i.current,me.textStreamState=r.current;const fe=Y(null,hp);return fe.current||(fe.current={textStreamState:r.current,getStreamRenderVersion:()=>i.current}),S(Oe.Provider,{value:fe.current},()=>S(He.Provider,{value:h},()=>S(Ze,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(wp,{props:n,parsedNodes:re,renderCtx:me,indexPrefix:ie,containerRef:o,showTypewriterCursor:k,typewriterCursorRef:w})))))}var kp=/* @__PURE__ */W('<blockquote class="blockquote-node" dir="auto"></blockquote>'),Sp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=v(kp);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"cite",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function Cp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(Sp,{h0:t.cite,h1:i??(n&&o?C(()=>x(xp,{nodes:t.children||[],indexKey:`blockquote-${String(r??"blockquote")}`,customId:n.customId,isDark:n.isDark,typewriter:n.typewriter,viewportPriority:!0,codeBlockStream:n.codeBlockStream,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockOptions:n.codeBlockOptions,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}Cp.$$singleRoot=!0;var Np=/* @__PURE__ */M(5),Mp=/* @__PURE__ */Symbol(Np),$p=/* @__PURE__ */Symbol(Np+1),Bp=/* @__PURE__ */Symbol(Np+2),Ep=/* @__PURE__ */Symbol(Np+3),Tp=/* @__PURE__ */Symbol(Np+4);function Lp(e){const t=Y(null,Mp),[n,o]=Z(!1,$p),[r,i]=Z({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},Bp),l=X(()=>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],Ep);return q(()=>{if(!e.visible)return void o(!1);if(!e.anchorEl||!t.current)return void o(!0);let n=null,r=!1;const l=async()=>{if(!e.anchorEl||!t.current)return;const{x:n,y:o}=await Ce(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[Me(e.offset??8),Ne(),$e({padding:8})],strategy:"fixed"});r||i({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(n)}px, ${Math.round(o)}px, 0)`})};return l().then(()=>{r||o(!0)}),n=Se(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],Tp),"undefined"==typeof document?null:e.visible&&n?k(C(()=>S("div",{id:e.id??void 0,ref:t,style:r,className:["markstream-octane ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",l?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip"},()=>e.content)),document.body):null}export{Ie as AdmonitionNode,Cp as BlockquoteNode,wt as CheckboxNode,Rr as CodeBlockNode,Rr as OctaneCodeBlockNode,Wi as D2BlockNode,Xi as DefinitionListNode,Gi as EmojiNode,el as EmphasisNode,Mm as FallbackComponent,rl as FootnoteAnchorNode,al as FootnoteNode,pl as FootnoteReferenceNode,bl as HardBreakNode,vl as HeadingNode,kl as HighlightNode,ca as HtmlBlockNode,Aa as HtmlInlineNode,ln as HtmlPreviewFrame,qa as ImageNode,Fs as InfographicBlockNode,Ys as InlineCodeNode,Js as InsertNode,wc as LinkNode,Sc as ListItemNode,Cc as ListNode,Rd as MERMAID_WORKER_BUSY_CODE,cd as MathBlockNode,Sd as MathInlineNode,pm as MermaidBlockNode,xp as NodeRenderer,xp as default,Tm as ParagraphNode,En as PreCodeNode,Pm as ReferenceNode,Am as StrikethroughNode,Hm as StrongNode,zm as SubscriptNode,qm as SuperscriptNode,cf as TableNode,mc as TextNode,mf as ThematicBreakNode,Lp as Tooltip,gf as VmrContainerNode,Ac as WORKER_BUSY_CODE,Hd as canParseOffthread,at as clearGlobalCustomComponents,Hc as clearKaTeXCache,_c as clearKaTeXWorker,Fd as clearMermaidWorker,ut as defineHtmlComponents,dt as defineStreamingComponents,Kr as disableD2,zr as enableD2,Od as findPrefixOffthread,st as getCustomComponentDisplay,it as getCustomNodeComponents,Vc as getKaTeXBackpressureDefaults,Xt as getLanguageIcon,_d as getMermaidWorkerLoad,Vr as isD2Enabled,Gt as isLikelyIncompleteLanguageIdentifier,Yt as languageMap,zt as normalizeLanguageIdentifier,qt as preloadExtendedLanguageIcons,lt as removeCustomComponents,Fc as renderKaTeXInWorker,qc as renderKaTeXWithBackpressure,Sf as renderNode,Kt as resolveLanguageId,rt as setCustomComponents,Wr as setD2Loader,kt as setDefaultI18nMap,Kc as setKaTeXBackpressureDefaults,Ic as setKaTeXCache,Oc as setKaTeXConcurrencyLimit,Pc as setKaTeXWorker,Rc as setKaTeXWorkerDebug,It as setLanguageIconResolver,Ad as setMermaidWorker,jd as setMermaidWorkerClientDebug,Pd as setMermaidWorkerMaxConcurrency,Ut as subscribeLanguageIconsRevision,Wd as terminateWorker,St as useSafeI18n,mt as useSmoothMarkdownStream,Wc as waitForKaTeXWorkerSlot,ct as withMarkstreamComponentDisplay};
|