markstream-octane 0.0.56-beta.2 → 0.0.56-beta.4

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.
@@ -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 h,bag7 as f,bag8 as p,bagOf as g,child as y,childTextHole as b,clone as w,createContext as v,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 L,queueRefAttach as E,queueRefDetach as j,setAriaAttribute as D,setAttribute as P,setCheckedCheckable as _,setClassAttr as R,setHostPropSources as A,setStyle as F,setText as H,sibling as W,snapshotSpread as I,template as O,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 he,sanitizeImageSrc as fe,shouldOpenLinkInNewTab as pe,shouldRenderUnknownHtmlTagAsText as ge,stripCustomHtmlWrapper as ye,toSafeSvgElement as be,tokenAttrsToRecord as we,tokenizeHtml as ve}from"stream-markdown-parser";import{createSmoothMarkdownStream as xe,getHighlightRegistrationKey as ke,getRuntimeShikiRegistrationConfig as Se,normalizeShikiLanguage as Ce,registerHighlightOnce as Me}from"markstream-core";import{autoUpdate as Ne,computePosition as $e,flip as Be,offset as Te,shift as Le}from"@floating-ui/dom";var Ee=/* @__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 je(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 De(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,...je(a.attrs)},De(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function Pe(e,t,n,o){return De(e,t,`${n}-inline`,o)}var _e=/* @__PURE__ */O('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),Re=/* @__PURE__ */N(3),Ae=/* @__PURE__ */Symbol(Re),Fe=/* @__PURE__ */Symbol(Re+1),He=/* @__PURE__ */Symbol(Re+2),We=/* @__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=w(_e);e=m,n=m;const h=y(m);r=h,i=h;const f=y(h);l=f;const p=W(f,1);a=p,s=h,c=W(p,1),d=m,u=W(h,1),o=g(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):H(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):H(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):H(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):H(e,n)}}}),Ie={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function Oe(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],Ae),[s,c]=Z(()=>!!t.collapsible&&!(t.open??1),Fe),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],He);return x(We,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Ie[l]&&S("span",{className:"admonition-icon"},()=>Ie[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?De(t.children,n,String(r??d),o):null))})}Oe.$$singleRoot=!0;var ze=v(!1),Ke=v(null);function Ve(){return V(Ke)}var qe=/* @__PURE__ */N(3),Ue=/* @__PURE__ */Symbol(qe),Xe=/* @__PURE__ */Symbol(qe+1),Ye=/* @__PURE__ */Symbol(qe+2),Ze=v(null);function Ge(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 h=!1;const{promise:f,resolve:p}=Promise.withResolvers(),g=()=>{h||(h=!0,p())},y=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,g(),{isVisible:()=>!0,whenVisible:f,destroy:y};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:g,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:f,destroy:y}):(c.current=!0,g(),{isVisible:()=>!0,whenVisible:f,destroy:y})}}var Je=Ge(()=>null,()=>!0);function Qe({getRoot:e,enabled:t=!0,children:n}){const o=Y(t,Ue);o.current=t;const r=Y(e,Xe);r.current=e;const i=X(()=>Ge(()=>r.current?.()??null,()=>o.current),[],Ye);return S(Ze.Provider,{value:i},()=>n)}function et(){return V(Ze)??Je}function tt(){const e=!1;return e}var nt="__global__",ot="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",rt=(()=>{const e=globalThis;if(e[ot])return e[ot];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[ot]=t,t})();function it(){rt.revision++;for(const e of Array.from(rt.listeners))try{e()}catch{}}function lt(e){return rt.listeners.add(e),()=>{rt.listeners.delete(e)}}function at(){return rt.revision}function st(e,t){"string"==typeof e?rt.scopedComponents[e]={...t||{}}:rt.scopedComponents[nt]={...e},it()}function ct(e){const t=rt.scopedComponents[nt]||{};if(!e)return t;const n=rt.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function dt(e){if(e===nt)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete rt.scopedComponents[e],it()}function ut(){delete rt.scopedComponents[nt],it()}function mt(e){return e?.markstreamDisplay}function ht(e,t){return e.markstreamDisplay=t,e}function ft(e){return e}function pt(e){return e}function gt(e={}){const t=Y(null,bt);t.current||(t.current=xe(e));const n=t.current,[o,r]=Z(()=>n.getSnapshot(),wt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],vt),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],xt)}var yt=/* @__PURE__ */N(4),bt=/* @__PURE__ */Symbol(yt),wt=/* @__PURE__ */Symbol(yt+1),vt=/* @__PURE__ */Symbol(yt+2),xt=/* @__PURE__ */Symbol(yt+3),kt=/* @__PURE__ */O('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),St=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=w(kt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function Ct(e){const{node:t}=e;return x(St,{h0:Boolean(t.checked)})}Ct.$$singleRoot=!0;var Mt={"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 Nt(e){Object.assign(Mt,e)}function $t(){return{t:e=>Mt[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 Bt=null,Tt=null,Lt=null,Et=null,jt=null,Dt=null;function Pt(){Et&&(clearTimeout(Et),Et=null),jt&&(clearTimeout(jt),jt=null)}async function _t(e){if(!Bt||!Tt)return;const{x:t,y:n}=await $e(Tt,Bt,{placement:e,middleware:[Te(8),Be(),Le({padding:8})],strategy:"fixed"});Bt.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Rt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Bt||"undefined"==typeof document||((Bt=document.createElement("div")).className="markstream-octane ms-tooltip",Bt.setAttribute("role","tooltip"),Bt.dataset.visible="false",Bt.style.position="fixed",Bt.style.left="0px",Bt.style.top="0px",Bt.style.transform="translate3d(0,0,0)",document.body.appendChild(Bt)),!Bt)return;Pt();const l=async()=>{if(Bt){Tt=e,Bt.textContent=t,Bt.dataset.placement=n,Bt.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",Bt.dataset.visible="false",Dt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bt.id=Dt;try{e.setAttribute("aria-describedby",Dt)}catch{}await _t(n),Bt.dataset.visible="true",Lt?.(),Lt=Ne(e,Bt,()=>{_t(n)})}};o?l():Et=setTimeout(l,80)}function At(e=!1){if(!Bt)return;Pt();const t=()=>{if(Bt){if(Bt.dataset.visible="false",Tt&&Dt)try{Tt.removeAttribute("aria-describedby")}catch{}Tt=null,Dt=null,Lt&&(Lt(),Lt=null)}};e?t():jt=setTimeout(t,120)}var Ft='<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',Ht=null,Wt=null,It=null,Ot=/* @__PURE__ */new Set;function zt(e){Ht=e??null}var Kt={"":"",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"},Vt={"":Ft,plain:Ft,text:Ft,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 qt(e){const t=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}(e);return Kt[t]??t}function Ut(e){const t=qt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}async function Xt(){return Wt||(It||(It=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Wt=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of Ot)try{e()}catch{}}(),Wt)).catch(()=>null)),It)}async function Yt(){await Xt()}function Zt(e){return Ot.add(e),()=>{Ot.delete(e)}}function Gt(e){if(Ht){const t=Ht(e);if(null!=t&&""!==t)return t}const t=qt(e),n=Vt[t];if(n)return n;const o=Wt?.[t];return o||(Xt(),'<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 Jt={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"},Qt=/* @__PURE__ */N(4),en=/* @__PURE__ */Symbol(Qt),tn=/* @__PURE__ */Symbol(Qt+1),nn=/* @__PURE__ */Symbol(Qt+2),on=/* @__PURE__ */Symbol(Qt+3),rn=void 0!==import.meta&&Boolean(!1),ln=null;function an(e){const{t:t}=J(en,$t,en),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],tn),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!rn||"undefined"==typeof console||ln===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")&&(ln=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],nn);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],on),"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()},()=>L([S("div",{className:"html-preview-frame__header"},()=>L([S("div",{className:"html-preview-frame__title"},()=>L([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 sn=!1,cn=null,dn=!1;async function un(){if(cn)return cn;if(dn)return null;try{return cn=await import("stream-monaco"),await async function(e){if(sn)return;sn=!0;const t=globalThis?.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&e?.preloadMonacoWorkers&&await e.preloadMonacoWorkers()}(cn),cn}catch{return dn=!0,null}}var mn=null,hn=!1,fn=null,pn=null,gn=null,yn=null,bn=null,wn=/* @__PURE__ */new WeakMap,vn=0;function xn(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=wn.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return wn.set(e,t),t}catch{}const n="__theme_"+ ++vn;return wn.set(e,n),n}return String(e)}(e);return n?(mn!==t&&(mn=t),hn||bn!==n?!fn||yn!==n&&pn!==n?(gn=e,yn=n,fn||(hn=!0,fn=(async()=>{for(;null!=gn&&null!=yn;){const e=gn,t=yn;if(gn=null,yn=null,bn===t)continue;const n=mn;if(!n)break;try{pn=t,await Promise.resolve(n(e)),bn=t}catch{}}})().finally(()=>{hn=!1,fn=null,pn=null}))):fn:Promise.resolve()):Promise.resolve()}var kn=null,Sn=null,Cn=null,Mn=/* @__PURE__ */new Set,Nn=/* @__PURE__ */new WeakMap,$n=0;function Bn(){for(const e of Array.from(Mn))try{e()}catch{}}var Tn=/* @__PURE__ */O('<pre data-markstream-pre="1" tabindex="0"></pre>'),Ln=/* @__PURE__ */N(3),En=/* @__PURE__ */Symbol(Ln),jn=/* @__PURE__ */Symbol(Ln+1),Dn=/* @__PURE__ */Symbol(Ln+2),Pn=/* @__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=w(Tn);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&&(D(o.f,"aria-busy",t),o.e=t)}{const t=e.h3;o.g!==t&&(D(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):H(e,n),o.o=n}}});function _n(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function Rn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function An(e){return e.startsWith("-")&&!e.startsWith("---")}function Fn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Hn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function Wn(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 In(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?Wn(e,"hunk",`inline-hunk-${n}`,""):An(e)?Wn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Fn(e)?Wn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):Wn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function On(e,t){const n=Rn(e),o=Rn(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(Wn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Hn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(Wn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Hn(o,i)})),i++;e.push(Wn(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(Wn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Hn(n,t)})),t++;for(;i<o.length;)e.push(Wn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Hn(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(Wn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(Wn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(Wn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Hn(n,d)}));for(let d=l;d<=s;d++)i.push(Wn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Hn(o,d)}));return i.concat(c)}function zn(e,t=!1,n=_n(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=>An(e)),r=e.some(e=>Fn(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:On(e?.originalCode,e?.updatedCode)}];const n=Rn(e?.originalCode),o=Rn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>Wn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Hn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>Wn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Hn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:In(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(Wn(d,"hunk",`original-hunk-${c}`,"")),l.push(Wn(d,"hunk",`modified-hunk-${c}`,""));else if(An(d))i.push(Wn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Fn(d))l.push(Wn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(Wn(e,"context",`original-context-${c}`,a++)),l.push(Wn(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 Kn({node:e,className:t,diffInline:n,showLineNumbers:o,style:r}){const i=X(()=>_n(e?.language),[e],En),l=`language-${i}`,a=i?`Code block: ${i}`:"Code block",s=!0===o&&!0===e?.diff,c=X(()=>s?zn(e,!0===n,i):[],[n,s,e,i],jn),d=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],Dn);return x(Pn,{h0:[l,t,o?"markstream-pre--line-numbers":"",s?"markstream-pre--diff-preview":"",s&&n?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),h1:r,h2:!0===e?.loading,h3:a,h4:i,h5:o?"1":void 0,h6:s?S("code",{translate:"no",className:"markstream-pre__diff-code"},()=>c.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(" ")},()=>L([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("code",{translate:"no"},()=>d)})}Kn.$$singleRoot=!0;var Vn=/* @__PURE__ */O('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),qn=/* @__PURE__ */O('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Un=["r","a","b"],Xn=/* @__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=w(Vn),h=y(m);{const l=e.h0;n=l,i=h,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=h,a=h,c=h;const f=W(h,1);d=f,u=f,r=s(t,m,n,i,void 0,l,void 0,a,void 0,c,void 0,d,u,null,void 0),t.refFields=Un}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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&&(D(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):H(e,n),r.m=n}}}),Yn=/* @__PURE__ */N(88),Zn=/* @__PURE__ */Symbol(Yn),Gn=/* @__PURE__ */Symbol(Yn+1),Jn=/* @__PURE__ */Symbol(Yn+2),Qn=/* @__PURE__ */Symbol(Yn+3),eo=/* @__PURE__ */Symbol(Yn+4),to=/* @__PURE__ */Symbol(Yn+5),no=/* @__PURE__ */Symbol(Yn+6),oo=/* @__PURE__ */Symbol(Yn+7),ro=/* @__PURE__ */Symbol(Yn+8),io=/* @__PURE__ */Symbol(Yn+9),lo=/* @__PURE__ */Symbol(Yn+10),ao=/* @__PURE__ */Symbol(Yn+11),so=/* @__PURE__ */Symbol(Yn+12),co=/* @__PURE__ */Symbol(Yn+13),uo=/* @__PURE__ */Symbol(Yn+14),mo=/* @__PURE__ */Symbol(Yn+15),ho=/* @__PURE__ */Symbol(Yn+16),fo=/* @__PURE__ */Symbol(Yn+17),po=/* @__PURE__ */Symbol(Yn+18),go=/* @__PURE__ */Symbol(Yn+19),yo=/* @__PURE__ */Symbol(Yn+20),bo=/* @__PURE__ */Symbol(Yn+21),wo=/* @__PURE__ */Symbol(Yn+22),vo=/* @__PURE__ */Symbol(Yn+23),xo=/* @__PURE__ */Symbol(Yn+24),ko=/* @__PURE__ */Symbol(Yn+25),So=/* @__PURE__ */Symbol(Yn+26),Co=/* @__PURE__ */Symbol(Yn+27),Mo=/* @__PURE__ */Symbol(Yn+28),No=/* @__PURE__ */Symbol(Yn+29),$o=/* @__PURE__ */Symbol(Yn+30),Bo=/* @__PURE__ */Symbol(Yn+31),To=/* @__PURE__ */Symbol(Yn+32),Lo=/* @__PURE__ */Symbol(Yn+33),Eo=/* @__PURE__ */Symbol(Yn+34),jo=/* @__PURE__ */Symbol(Yn+35),Do=/* @__PURE__ */Symbol(Yn+36),Po=/* @__PURE__ */Symbol(Yn+37),_o=/* @__PURE__ */Symbol(Yn+38),Ro=/* @__PURE__ */Symbol(Yn+39),Ao=/* @__PURE__ */Symbol(Yn+40),Fo=/* @__PURE__ */Symbol(Yn+41),Ho=/* @__PURE__ */Symbol(Yn+42),Wo=/* @__PURE__ */Symbol(Yn+43),Io=/* @__PURE__ */Symbol(Yn+44),Oo=/* @__PURE__ */Symbol(Yn+45),zo=/* @__PURE__ */Symbol(Yn+46),Ko=/* @__PURE__ */Symbol(Yn+47),Vo=/* @__PURE__ */Symbol(Yn+48),qo=/* @__PURE__ */Symbol(Yn+49),Uo=/* @__PURE__ */Symbol(Yn+50),Xo=/* @__PURE__ */Symbol(Yn+51),Yo=/* @__PURE__ */Symbol(Yn+52),Zo=/* @__PURE__ */Symbol(Yn+53),Go=/* @__PURE__ */Symbol(Yn+54),Jo=/* @__PURE__ */Symbol(Yn+55),Qo=/* @__PURE__ */Symbol(Yn+56),er=/* @__PURE__ */Symbol(Yn+57),tr=/* @__PURE__ */Symbol(Yn+58),nr=/* @__PURE__ */Symbol(Yn+59),or=/* @__PURE__ */Symbol(Yn+60),rr=/* @__PURE__ */Symbol(Yn+61),ir=/* @__PURE__ */Symbol(Yn+62),lr=/* @__PURE__ */Symbol(Yn+63),ar=/* @__PURE__ */Symbol(Yn+64),sr=/* @__PURE__ */Symbol(Yn+65),cr=/* @__PURE__ */Symbol(Yn+66),dr=/* @__PURE__ */Symbol(Yn+67),ur=/* @__PURE__ */Symbol(Yn+68),mr=/* @__PURE__ */Symbol(Yn+69),hr=/* @__PURE__ */Symbol(Yn+70),fr=/* @__PURE__ */Symbol(Yn+71),pr=/* @__PURE__ */Symbol(Yn+72),gr=/* @__PURE__ */Symbol(Yn+73),yr=/* @__PURE__ */Symbol(Yn+74),br=/* @__PURE__ */Symbol(Yn+75),wr=/* @__PURE__ */Symbol(Yn+76),vr=/* @__PURE__ */Symbol(Yn+77),xr=/* @__PURE__ */Symbol(Yn+78),kr=/* @__PURE__ */Symbol(Yn+79),Sr=/* @__PURE__ */Symbol(Yn+80),Cr=/* @__PURE__ */Symbol(Yn+81),Mr=/* @__PURE__ */Symbol(Yn+82),Nr=/* @__PURE__ */Symbol(Yn+83),$r=/* @__PURE__ */Symbol(Yn+84),Br=/* @__PURE__ */Symbol(Yn+85),Tr=/* @__PURE__ */Symbol(Yn+86),Lr=/* @__PURE__ */Symbol(Yn+87),Er=["r","a","b"],jr=/* @__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,h,f,p,b,v;const x=w(qn);{const l=e.h0;n=l,i=x,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=x,a=x;const k=W(y(x),1);s=k,c=x,d=y(x),u=k;const S=y(k);m=S,h=k,f=W(S,1),p=x;const C=W(k,1);b=C,v=W(C,1),r=g(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:h,r:f,s:null,t:void 0,u:p,v:b,w:null,x:void 0,y:v,z:null,A:void 0}),t.refFields=Er}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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):H(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):H(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):H(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):H(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):H(e,n),r.A=n}}}),Dr={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Pr=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function _r({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,stream:i}){return x(Xn,{h0:e,h1:"code-editor-container"+(i?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(Kn,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:Boolean(n.diff),style:r})})}function Rr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Ar(e){if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return{...Pr,...t,enabled:t.enabled??!0}}return{...Pr}}function Fr(e,t){const n=t?{...t}:{};if(!e)return n;const o=void 0===n.diffHideUnchangedRegions?{...Pr}:Ar(n.diffHideUnchangedRegions),r=void 0===n.hideUnchangedRegions?void 0:Ar(n.hideUnchangedRegions),i=n.diffUnchangedRegionStyle??"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffHideUnchangedRegions:o,useInlineViewWhenSpaceIsLimited:n.useInlineViewWhenSpaceIsLimited??!1,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:i,diffHunkActionsOnHover:!1,diffHunkHoverHideDelayMs:160,...n,...void 0===r?{}:{hideUnchangedRegions:r},diffHideUnchangedRegions:o}}function Hr(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Wr(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 Ir(e){const n={...Dr,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,monacoOptions:u,themes:m,minWidth:h,maxWidth:f,showHeader:p,showCopyButton:g,showExpandButton:y,showPreviewButton:b,showCollapseButton:w,showFontSizeButtons:v,showTooltips:k}=n,M=Y(null,Zn),N=Y(null,Gn),$=Y(null,Jn),B=Y(null,Qn),T=Y(null,eo),E=Y(null,to),j=Y(null,no),D=Y(0,oo),P=Y(null,ro),_=Y(null,io),R=J(lo,et,lo),A=Y(u,ao),F=Y(null,so),H=Y(null,co),W=Y([],uo),I=Y(null,mo),O=Y(!1,ho),z=Y(void 0,fo),[V,U]=Z(!1,po),[G,Q]=Z(()=>"undefined"==typeof window,go),[ee,te]=Z(!1,yo),[ne,oe]=Z(!1,bo),[re,ie]=Z(!1,wo),[le,ae]=Z(()=>o.language||"plaintext",vo),[se,ce]=Z(()=>qt(o.language),xo),[de,ue]=Z(!1,ko),[me,he]=Z(!1,So),[fe,pe]=Z(!1,Co),[ge,ye]=Z(!1,Mo),[be,we]=Z(0,No),{t:ve}=J($o,$t,$o);q(()=>{O.current=me},[me],Bo);const xe=X(()=>Fr(Boolean(o.diff),u),[u,o.diff],To),[ke,Se]=Z(()=>{const e=Number(Fr(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:12},Lo),[Ce,Me]=Z(ke,Eo),Ne=X(()=>!1!==k,[k],jo),$e=K(()=>{const e=A.current?.MAX_HEIGHT??500;if("number"==typeof e&&Number.isFinite(e))return Math.max(80,e);const t=String(e).match(/^(\d+(?:\.\d+)?)/),n=t?Number.parseFloat(t[1]):500;return Number.isFinite(n)?Math.max(80,n):500},[],Do),Be=K(e=>{if(V)return;const t=M.current,n=$.current;if(!t||!n)return;const o="diff"===E.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=$e();try{o.updateOptions?.({automaticLayout:e})}catch{}const i="diff"===E.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=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .margin-view-overlays .line-numbers",".editor.modified .margin-view-overlays .line-numbers",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];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,V],Po),Te=K(e=>{if(Be(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Be(e),window.requestAnimationFrame(()=>Be(e))});return window.setTimeout(()=>Be(e),180),()=>window.cancelAnimationFrame(t)},[Be],_o),Le=K(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],I.current?.disconnect(),I.current=null},[],Ro),Ee=K(()=>{Le();const e=$.current,t=M.current;if(!e||!t||"diff"!==E.current)return;const n=()=>Te(O.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"]}),I.current=e}},[Le,Te],Ao);q(()=>Zt(()=>{we(e=>e+1)}),[],Fo),q(()=>{ce(qt(o.language))},[o.language],Ho);const je=Y(o,Wo);je.current=o;const De=K(()=>{D.current+=1;try{B.current?.()}catch{}Le(),T.current=null,E.current=null,j.current=null,ie(!1),oe(!1)},[Le],Io),Pe=K(()=>{const e=M.current,t=N.current;if(!e||!t)return;if(o.diff)return t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),void t.style.removeProperty("--vscode-editor-selectionBackground");const n=e.querySelector(".monaco-editor")??e;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(n):null,r=String(e?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(e?.color??"").trim(),i=String(e?.getPropertyValue("--vscode-editor-background")??"").trim()||String(e?.backgroundColor??"").trim(),l=String(e?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=Wr(e),i=Wr(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(i,r,"plaintext"===Ut(String(o.language||se||le||"plaintext")),t.classList.contains("is-dark")))return t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),void t.style.removeProperty("--vscode-editor-selectionBackground");r&&t.style.setProperty("--vscode-editor-foreground",r),i&&t.style.setProperty("--vscode-editor-background",i),l&&t.style.setProperty("--vscode-editor-selectionBackground",l)}catch{}},[se,le,o.diff,o.language],Oo),_e=X(()=>r?c:d,[c,r,d],zo),Re=K(()=>{const e=xe?.theme,t=_e??e??kn,n=Array.isArray(m)?m:[];if(!n.length||null==t)return t;const o=Hr(t),r=n.map(e=>Hr(e)).filter(e=>!!e);if(!o||r.includes(o))return t;const i=Hr(e);return null!=e&&i&&r.includes(i)?e:n[0]},[_e,xe,m],Ko),Ae=X(()=>Re(),[Re],Vo),Fe=X(()=>function(e,t){const n=(Hr(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}(Ae,Boolean(r)),[r,Ae],qo),He=X(()=>{if(!o.diff)return Fe?"dark":"light";const e=xe?.diffAppearance;return"light"===e||"dark"===e?e:r?"dark":"light"},[r,o.diff,Fe,xe],Uo),We=X(()=>o.diff?"dark"===He:Fe,[He,o.diff,Fe],Xo),Ie=X(()=>{const e=xe,t=Rr(e?.fontSize)??Ce??12,n=Rr(e?.lineHeight)??(12===t?18:Math.max(12,Math.round(1.5*t))),o="string"==typeof e?.fontFamily&&e.fontFamily.trim()?e.fontFamily.trim():void 0,r=function(e){if(!e||"object"!=typeof e)return{top:0,bottom:0};const t=e;return{top:Rr(t.top)??0,bottom:Rr(t.bottom)??0}}(e?.padding),i=Rr(e?.tabSize)??4;return{fontFamily:o,fontSize:t,lineHeight:n,paddingBottom:r.bottom,paddingTop:r.top,tabSize:i}},[Ce,xe],Yo),Oe=X(()=>!!o.diff&&!1===xe?.renderSideBySide,[o.diff,xe],Zo),ze=X(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Ie.lineHeight}px`,"--markstream-pre-line-number-top":`${Ie.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Ie.fontSize}px`,lineHeight:`${Ie.lineHeight}px`,paddingBottom:`${Ie.paddingBottom}px`,paddingTop:`${Ie.paddingTop}px`,tabSize:Ie.tabSize};return Ie.fontFamily&&(e.fontFamily=Ie.fontFamily),e},[Ie],Go),Ke=K(()=>{const e={wordWrap:"on",wrappingIndent:"same",themes:m,...xe||{},theme:Ae,...o.diff?{diffAppearance:He}:{},onThemeChange(){Pe()}};return o.diff&&(e.fontSize??=Ie.fontSize,e.lineHeight??=Ie.lineHeight,e.padding??={top:Ie.paddingTop,bottom:Ie.paddingBottom},e.tabSize??=Ie.tabSize,Ie.fontFamily&&(e.fontFamily??=Ie.fontFamily)),e},[He,o.diff,Ie,Ae,xe,Pe,m],Jo),Ve=K(()=>{const e=Ke(),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},[Ke],Qo),qe=X(()=>JSON.stringify({diffLineStyle:xe?.diffLineStyle??"background",diffUnchangedRegionStyle:xe?.diffUnchangedRegionStyle??"line-info",diffHideUnchangedRegions:xe?.diffHideUnchangedRegions??!0,renderSideBySide:xe?.renderSideBySide??!0,enableSplitViewResizing:xe?.enableSplitViewResizing??!0,ignoreTrimWhitespace:xe?.ignoreTrimWhitespace??!0,originalEditable:xe?.originalEditable??!1}),[xe],er);q(()=>{A.current=xe,Ve()},[xe,Ve],tr),q(()=>()=>{D.current+=1,B.current?.(),Le(),B.current=null,T.current=null,E.current=null,j.current=null,P.current=null,_.current?.destroy?.(),_.current=null},[Le],nr),q(()=>{if("undefined"==typeof window)return;if(G)return;const e=N.current;if(!e)return;_.current?.destroy?.();const t=R(e,{rootMargin:"400px"});return _.current=t,t.isVisible()&&Q(!0),t.whenVisible.then(()=>Q(!0)),()=>{t.destroy(),_.current===t&&(_.current=null)}},[R,G],or),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:$.current?(Ve(),()=>{e=!1}):((async()=>{try{const n=await un();if(!e)return;if(!n)return void U(!0);const o=n.useMonaco,r=n.detectLanguage;if("function"==typeof r&&(P.current=r),"function"!=typeof o)return void U(!0);const i=Ve(),l=J(ir,o,i,ir);$.current=l,"function"==typeof(t=l.setTheme)&&(Cn=t,null!=kn&&null!=Sn&&xn(kn,Cn).then(()=>Bn()).catch(()=>{})),B.current="function"==typeof l.safeClean?()=>l.safeClean():"function"==typeof l.cleanupEditor?()=>l.cleanupEditor():null,te(!0)}catch{e&&U(!0)}var t})(),()=>{e=!1})},[Ve],rr),q(()=>{if(!o.language&&!se&&P.current)try{const e=P.current(String(o.code??""));e&&ae(e)}catch{}},[se,o.code,o.language],lr);const Ue=X(()=>String(o.language||se||le||"plaintext"),[se,le,o.language],ar),Xe=X(()=>qt(Ue),[Ue],sr),Ye=X(()=>Ut(Xe),[Xe],cr),Ze=X(()=>"plaintext"===Ye,[Ye],dr),Ge=X(()=>Gt(Xe),[Xe,be],ur),Je=X(()=>!!a&&("html"===Xe||"svg"===Xe),[Xe,a],mr),Qe=X(()=>{const e=Xe;return e?Jt[e]||e.charAt(0).toUpperCase()+e.slice(1):Jt[""]||"Plain Text"},[Xe],hr),tt=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],fr),nt=X(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(h),r=e(f);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(--vscode-editor-foreground, ${We?"#e5e7eb":"#111827"})`,t.backgroundColor=`var(--vscode-editor-background, ${We?"#111827":"#ffffff"})`,t.borderColor=We?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[f,h,o.diff,We],pr),ot=X(()=>{if(!o.diff)return{color:`var(--vscode-editor-foreground, ${We?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${We?"#111827":"#ffffff"})`}},[o.diff,We],gr),rt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],yr),it=!1===l&&i||!1!==l&&i&&!rt;q(()=>{if(V)return;if(!ee)return;if(!ne||!G)return;const e=$.current;Ve();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),Pe(),fe||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Te(me)):null)&&Te(me)};e?.setTheme&&Ae?xn(Ae,e.setTheme).then(t).catch(()=>{}):t()},[fe,ne,He,me,ee,o.diff,Ae,Te,Pe,Ve,V,G],br),q(()=>{var e;if("undefined"!=typeof window)return e=()=>{Pe()},Mn.add(e),()=>{Mn.delete(e)}},[Pe],wr);const lt=K(async()=>{if(V)return null;if(!G)return null;if(fe)return null;if(it)return null;const e=$.current,t=M.current;if(!e||!t||!e.createEditor)return null;Ve();const n=je.current,o=n.diff?"diff":"single",r=j.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(E.current===o&&r===t&&i)return null;if(T.current)return T.current;D.current+=1;const l=D.current;oe(!0);const a=(async()=>{try{B.current?.(),E.current=null,j.current=null,ie(!1);const o=Ye;if(n.diff?"function"==typeof e.createDiffEditor?(E.current="diff",await e.createDiffEditor(t,String(n.originalCode??""),String(n.updatedCode??""),o)):(E.current="single",await e.createEditor(t,String(n.updatedCode??n.code??""),o)):(E.current="single",await e.createEditor(t,String(n.code??""),o)),j.current=t,D.current!==l)return;const r=Number(A.current?.fontSize);if(Number.isFinite(r)&&r>0){Se(r),Me(r);try{("diff"===E.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:r,automaticLayout:!1})}catch{}}Ee(),Pe(),me||fe||Te(!1),ie(!0)}catch{D.current===l&&(z.current=Ye,U(!0))}})().finally(()=>{T.current===a&&(T.current=null)});return T.current=a,a},[Ee,Le,fe,me,Ye,Te,it,Pe,Ve,V,G],vr);q(()=>{Ve();const e=H.current;if(H.current=qe,!o.diff)return;if(V)return;if(!ee||!G||!ne)return;if(fe||it)return;if(e===qe)return;let t=!1;return(async()=>{if(De(),!t)try{await lt()}catch{}})(),()=>{t=!0}},[fe,ne,lt,ee,qe,o.diff,De,it,Ve,V,G],xr),q(()=>{if(V){const e=z.current;if(void 0===e||e===Ye)return;return z.current=void 0,De(),void U(!1)}ee&&G&&(fe||it?De():lt())},[fe,lt,Ye,ee,De,it,V,G],kr),q(()=>{if(V)return;if(!ee)return;if(!G)return;if(fe)return;if(it)return;const e=$.current;if(!e)return;const t=String(o.code??"");(async()=>{let n=se;if(!n&&P.current)try{n=qt(P.current(t)),n&&ce(n)}catch{}const r=Ut(n||Xe);if(e.createEditor&&M.current){try{await Promise.resolve(lt())}catch{}const e=T.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(String(o.originalCode??""),String(o.updatedCode??""),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}Te(me)})()},[Xe,se,fe,ne,lt,me,ee,o.code,o.diff,o.originalCode,o.updatedCode,Te,it,V,G],Sr),q(()=>{if(V)return;if(!ee)return;if(!G)return;if(fe)return;if(it)return;if(!me&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Te(me)):null;return null==e&&Te(me),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[fe,me,i,ee,Te,it,V,G],Cr),q(()=>{if(!s)return;if(V)return;const e=$.current;if(e){try{("diff"===E.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:Ce})}catch{}Te(me)}},[s,me,Ce,o.diff,Te,V],Mr),q(()=>{Ne||At(!0)},[Ne],Nr);const at=K((e,t)=>{if(!Ne)return;const n=e.currentTarget;n&&!n.disabled&&Rt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),We)},[We,Ne],$r),st=K(()=>{Ne&&At()},[Ne],Br),ct=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(tt)),ue(!0),n.onCopy?.(String(tt)),setTimeout(()=>ue(!1),1e3)}catch{}},[n,tt],Tr),dt=K(()=>{if(!Je)return;const e="html"===Xe?"text/html":"image/svg+xml",t="html"===Xe?ve("artifacts.htmlPreviewTitle")||"HTML Preview":ve("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===Xe&&ye(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${Xe}-${Date.now()}`})},[Xe,Je,o,n,ve],Lr);return x(jr,{h0:N,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",We?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",i?"is-rendering":"",We?"is-dark":"",o.diff?"is-diff":"",Ze?"is-plain-text":""].join(" "),h2:nt,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:ot},()=>L([S("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden"},()=>L([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:Ge}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>Qe)])),S("div",{className:"flex items-center space-x-2"},()=>L([w&&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":fe,onClick:()=>pe(e=>!e),onMouseEnter:e=>at(e,fe?ve("common.expand")||"Expand":ve("common.collapse")||"Collapse"),onFocus:e=>at(e,fe?ve("common.expand")||"Expand":ve("common.collapse")||"Collapse"),onMouseLeave:st,onBlur:st},()=>C(()=>x("svg",{style:{rotate:fe?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),v&&s&&S(t,{},()=>L([C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ce<=10,onClick:()=>Me(e=>Math.max(10,e-1)),onMouseEnter:e=>at(e,ve("common.decrease")||"Decrease"),onFocus:e=>at(e,ve("common.decrease")||"Decrease"),onMouseLeave:st,onBlur:st},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:Ce===ke,onClick:()=>Me(ke),onMouseEnter:e=>at(e,ve("common.reset")||"Reset"),onFocus:e=>at(e,ve("common.reset")||"Reset"),onMouseLeave:st,onBlur:st},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:Ce>=36,onClick:()=>Me(e=>Math.min(36,e+1)),onMouseEnter:e=>at(e,ve("common.increase")||"Increase"),onFocus:e=>at(e,ve("common.increase")||"Increase"),onMouseLeave:st,onBlur:st},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"}))))])),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-label":de?ve("common.copied")||"Copied":ve("common.copy")||"Copy",onClick:ct,onMouseEnter:e=>at(e,de?ve("common.copied")||"Copied":ve("common.copy")||"Copy"),onFocus:e=>at(e,de?ve("common.copied")||"Copied":ve("common.copy")||"Copy"),onMouseLeave:st,onBlur:st},()=>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"},de?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"}))))),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-pressed":me,onClick:e=>{he(e=>!e),at(e,me?ve("common.expand")||"Expand":ve("common.collapse")||"Collapse")},onMouseEnter:e=>at(e,me?ve("common.collapse")||"Collapse":ve("common.expand")||"Expand"),onFocus:e=>at(e,me?ve("common.collapse")||"Collapse":ve("common.expand")||"Expand"),onMouseLeave:st,onBlur:st},()=>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",me?{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"})))),Je&&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":ve("common.preview")||"Preview",onClick:dt,onMouseEnter:e=>at(e,ve("common.preview")||"Preview"),onFocus:e=>at(e,ve("common.preview")||"Preview"),onMouseLeave:st,onBlur:st},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${fe?" code-block-body--collapsed":""}${me?" code-block-body--expanded":""}`,h5:!fe&&(!!l||!i)&&C(V?()=>x(Kn,{className:"code-fallback-plain m-0",diffInline:Oe,node:o,showLineNumbers:Boolean(o.diff),style:ze}):()=>x(_r,{editorHostRef:M,editorReady:re,node:o,preFallbackDiffInline:Oe,preFallbackStyle:ze,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:ge&&!n.onPreviewCode&&Je&&"html"===Xe&&C(()=>x(an,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>ye(!1)})),h8:de?ve("common.copied")||"Copied":""})}function Or(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=Or(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function zr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Or(e))&&(o&&(o+=" "),o+=t);return o}_r.$$singleRoot=!0,Ir.$$singleRoot=!0;var Kr=()=>import("@terrastruct/d2"),Vr=null,qr=Kr;function Ur(e){qr=e,Vr=null}function Xr(e){Ur(e??Kr)}function Yr(){Ur(null)}function Zr(){return"function"==typeof qr}var Gr=/* @__PURE__ */O("<div><!><!></div>"),Jr=/* @__PURE__ */N(41),Qr=/* @__PURE__ */Symbol(Jr),ei=/* @__PURE__ */Symbol(Jr+1),ti=/* @__PURE__ */Symbol(Jr+2),ni=/* @__PURE__ */Symbol(Jr+3),oi=/* @__PURE__ */Symbol(Jr+4),ri=/* @__PURE__ */Symbol(Jr+5),ii=/* @__PURE__ */Symbol(Jr+6),li=/* @__PURE__ */Symbol(Jr+7),ai=/* @__PURE__ */Symbol(Jr+8),si=/* @__PURE__ */Symbol(Jr+9),ci=/* @__PURE__ */Symbol(Jr+10),di=/* @__PURE__ */Symbol(Jr+11),ui=/* @__PURE__ */Symbol(Jr+12),mi=/* @__PURE__ */Symbol(Jr+13),hi=/* @__PURE__ */Symbol(Jr+14),fi=/* @__PURE__ */Symbol(Jr+15),pi=/* @__PURE__ */Symbol(Jr+16),gi=/* @__PURE__ */Symbol(Jr+17),yi=/* @__PURE__ */Symbol(Jr+18),bi=/* @__PURE__ */Symbol(Jr+19),wi=/* @__PURE__ */Symbol(Jr+20),vi=/* @__PURE__ */Symbol(Jr+21),xi=/* @__PURE__ */Symbol(Jr+22),ki=/* @__PURE__ */Symbol(Jr+23),Si=/* @__PURE__ */Symbol(Jr+24),Ci=/* @__PURE__ */Symbol(Jr+25),Mi=/* @__PURE__ */Symbol(Jr+26),Ni=/* @__PURE__ */Symbol(Jr+27),$i=/* @__PURE__ */Symbol(Jr+28),Bi=/* @__PURE__ */Symbol(Jr+29),Ti=/* @__PURE__ */Symbol(Jr+30),Li=/* @__PURE__ */Symbol(Jr+31),Ei=/* @__PURE__ */Symbol(Jr+32),ji=/* @__PURE__ */Symbol(Jr+33),Di=/* @__PURE__ */Symbol(Jr+34),Pi=/* @__PURE__ */Symbol(Jr+35),_i=/* @__PURE__ */Symbol(Jr+36),Ri=/* @__PURE__ */Symbol(Jr+37),Ai=/* @__PURE__ */Symbol(Jr+38),Fi=/* @__PURE__ */Symbol(Jr+39),Hi=/* @__PURE__ */Symbol(Jr+40),Wi=["r","a","b"],Ii=/* @__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=w(Gr);{const l=e.h0;n=l,i=m,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=m,s=m;const h=y(m);c=h,d=m,u=W(h,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=Wi}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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):H(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):H(e,n)}}}),Oi={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},zi={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"},Ki=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Vi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function qi(e){if(!e)return"";const t=e.trim();return Vi.test(t)?t:""}function Ui(e){const n={...Oi,...e},{t:o}=J(Qr,$t,Qr),[r,i]=Z(!1,ei),[l,a]=Z(!1,ti),[s,c]=Z(!1,ni),[d,u]=Z(!1,oi),[m,h]=Z(null,ri),[f,p]=Z("",ii),[g,y]=Z(null,li),[b,w]=Z(!1,ai),[v,k]=Z(()=>"undefined"==typeof window,si),M=Y(0,ci),N=Y(null,di),$=Y(!1,ui),B=Y(!1,mi),T=Y(0,hi),E=Y(null,fi),j=Y(!1,pi),D=Y(null,gi),P=Y(null,yi),_=Y(null,bi),R=Y(null,wi),A=Y(!1,vi),F=Y(()=>{},xi),H=J(ki,et,ki),W=n.node?.code??"",I=s||!d||!f,O=!!f,z=X(()=>{if(n.maxHeight)return{maxHeight:"number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight)}},[n.maxHeight],Si),V=X(()=>{if(I&&g)return{minHeight:`${g}px`}},[g,I],Ci);q(()=>{A.current=b},[b],Mi),q(()=>{const e=D.current;if(!e)return;const t=H(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),P.current=null}},[H],Ni);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&y(e=>e!==t?t:e)},[],$i),G=K((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!v)return;if(A.current)return void(j.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-T.current;if(!e&&o<t)return j.current=!0,void(null==E.current&&(E.current=window.setTimeout(()=>{E.current=null,j.current&&(j.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,v],Bi),Q=K(async()=>{if(N.current)return N.current;const e=await async function(){if(Vr)return Vr;const e=qr;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Kr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Vr=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),Vr):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)},[],Ti),ee=K(async()=>{if("undefined"==typeof window||B.current)return;if(!v)return;if(n.loading&&!n.progressiveRender)return;if(!W)return p(""),void h(null);const e=++M.current;w(!0),h(null);try{const t=await Q();if(!t)return u(!1),c(!0),p(""),void h("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(W);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={...zi,...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 f=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const 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(Ki.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=qi(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(f||""),n.loading&&c(!1),h(null)}catch(t){if(e!==M.current)return;const o=t?.message?String(t.message):"D2 render failed.";n.loading||h(o),o.includes("@terrastruct/d2")&&(u(!1),c(!0))}finally{e===M.current&&(w(!1),j.current&&(j.current=!1,G()))}},[W,Q,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,G,v],Li);q(()=>{F.current=ee},[ee],Ei);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(W),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[W],ji),ne=K(()=>{if(f)try{const e=new Blob([f],{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)}},[f],Di),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Rt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Pi),re=K(()=>{At()},[],_i);return q(()=>{G()},[W,n.loading,n.isDark,G],Ri),q(()=>{n.loading||G(!0)},[n.loading,G],Ai),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[I,f,W,U],Fi),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!=E.current&&(clearTimeout(E.current),E.current=null),R.current?.disconnect(),R.current=null,cancelAnimationFrame(e)}},[G,U],Hi),x(Ii,{h0:D,h1:zr("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)"}},()=>L([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"},()=>L([n.showModeToggle&&C(()=>S("div",{className:zr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>L([C(()=>S("button",{type:"button",className:zr("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:zr("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&&f&&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&&!O?S("div",{className:"d2-source px-4 py-4"},()=>L([S("pre",{className:"d2-code"},()=>S("code",{},()=>W)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>L([I?S("div",{className:"d2-source px-4 py-4"},()=>L([S("pre",{className:"d2-code"},()=>S("code",{},()=>W)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):C(()=>S("div",{className:"d2-render",style:z},()=>L([C(()=>x("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:f}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}Ui.$$singleRoot=!0;var Xi=/* @__PURE__ */O('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),Yi=/* @__PURE__ */O('<dl class="definition-list"><!></dl>'),Zi=(e,t)=>`${String(indexKey??"definition")}-${t}`;function Gi(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=w(Xi),r=y(o);e=r,n=W(r,1),s=h(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?Pe(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):H(e,n),s.c=n}}{const n=r&&l?Pe(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):H(e,n),s.f=n}}}var Ji=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(Yi);e=i,n=i,r=y(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,Zi,Gi,18,[e.h4,e.h5,e.h6],o.d,1)});function Qi(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(Ji,{h0:r,h1:i,h2:i.map,h3:(e,t)=>S("div",{key:`${String(r??"definition")}-${t}`,className:"mb-4"},()=>L([S("dt",{className:"definition-term font-semibold"},()=>n&&o?Pe(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?Pe(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}Qi.$$singleRoot=!0;var el=/* @__PURE__ */O('<span class="emoji-node"></span>'),tl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(el);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):H(e,n),o.c=n}}});function nl(e){const{node:t}=e;return x(tl,{h0:t.name??t.markup})}nl.$$singleRoot=!0;var ol=/* @__PURE__ */O('<em class="emphasis-node"></em>'),rl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(ol);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):H(e,n),o.c=n}}});function il(e){return x(rl,{h0:e.children})}il.$$singleRoot=!0,M(["click"]);var ll=/* @__PURE__ */O('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),al=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),sl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=w(ll);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 cl(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],al);return x(sl,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}cl.$$singleRoot=!0;var dl=/* @__PURE__ */O('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),ul=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(dl);e=r,n=y(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):H(e,n),o.e=n}}});function ml(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return x(ul,{h0:`fnref--${t.id}`,h1:n&&o?De(t.children,n,String(r??`footnote-${t.id}`),o):null})}ml.$$singleRoot=!0,M(["click"]);var hl=/* @__PURE__ */O('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),fl=/* @__PURE__ */N(3),pl=/* @__PURE__ */Symbol(fl),gl=/* @__PURE__ */Symbol(fl+1),yl=/* @__PURE__ */Symbol(fl+2),bl=["s","h","g"],wl=/* @__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 h=w(hl);n=h,r=h,h.$$click=e.h1;const f=y(h);i=I(e.h2),l=e.h3,s="footnote-link cursor-pointer",c=f,d=A(f,[[!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&&j(e.ref,o.g)}),T(f),u=f,m=W(y(f),1),o=a(t,h,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=bl}else{o.c.$$click=e.h1,o.d=I(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):H(e,n)}}});function vl(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],pl),o=X(()=>({href:n}),[n],gl),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(n);t&&t.scrollIntoView({behavior:"smooth"})},[n],yl);return x(wl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}vl.$$singleRoot=!0;var xl=/* @__PURE__ */O('<br class="hard-break"/>'),kl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(xl)))});function Sl(e){return x(kl,{})}function Cl(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:zr("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?De(t.children,n,String(r??`heading-${l}`),o):null))}Sl.$$singleRoot=!0;var Ml=/* @__PURE__ */O('<mark class="highlight-node"></mark>'),Nl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Ml);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):H(e,n),o.c=n}}});function $l(e){return x(Nl,{h0:e.children})}function Bl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Tl(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=Bl(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}$l.$$singleRoot=!0;var Ll=ve,El=ue;function jl(e,t){return ie(e,t)}function Dl(e,t){return re(e,t)}function Pl(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 _l(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Rl(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Al(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(Al).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Al(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}>${Al(n.props.children)}</${n.type}>`}function Fl(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Hl(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 Wl(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Il(t,n,o,r,i,l,a,s=Hl(i)){const c=ce(t),d=l??function(e){return e.map(Al).join("")}(o),u={type:c,tag:c,attrs:Fl(n),content:d,raw:a??`${Pl(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Rl(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Ol=/* @__PURE__ */O("<div></div>"),zl=/* @__PURE__ */N(22),Kl=/* @__PURE__ */Symbol(zl),Vl=/* @__PURE__ */Symbol(zl+1),ql=/* @__PURE__ */Symbol(zl+2),Ul=/* @__PURE__ */Symbol(zl+3),Xl=/* @__PURE__ */Symbol(zl+4),Yl=/* @__PURE__ */Symbol(zl+5),Zl=/* @__PURE__ */Symbol(zl+6),Gl=/* @__PURE__ */Symbol(zl+7),Jl=/* @__PURE__ */Symbol(zl+8),Ql=/* @__PURE__ */Symbol(zl+9),ea=/* @__PURE__ */Symbol(zl+10),ta=/* @__PURE__ */Symbol(zl+11),na=/* @__PURE__ */Symbol(zl+12),oa=/* @__PURE__ */Symbol(zl+13),ra=/* @__PURE__ */Symbol(zl+14),ia=/* @__PURE__ */Symbol(zl+15),la=/* @__PURE__ */Symbol(zl+16),aa=/* @__PURE__ */Symbol(zl+17),sa=/* @__PURE__ */Symbol(zl+18),ca=/* @__PURE__ */Symbol(zl+19),da=/* @__PURE__ */Symbol(zl+20),ua=/* @__PURE__ */Symbol(zl+21),ma=["s","e","d"],ha=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s;const c=w(Ol);n=e.h0,r="html-block-node",i=I(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&&j(e.ref,o.d)}),s=c,o=p(t,c,n,r,i,l,a,s,null,void 0),t.refFields=ma}else{{const t=e.h0;o.a!==t&&(o.a=t)}{const e="html-block-node";o.b!==e&&(o.b=e)}o.c=I(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 fa(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(Kl,et,Kl),[s,c]=Z(null,Vl),d=Y(null,ql),[u,m]=Z(()=>"undefined"==typeof window,Ul),[h,f]=Z(o.content,Xl),p=Boolean(o.loading),g=G(lt,at,at,Yl),y=X(()=>({...n.customComponents??n.ctx?.customComponents??ct(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,g],Zl),b=X(()=>({...y,...n.ctx?.streamingComponents??{}}),[y,n.ctx?.streamingComponents],Gl);q(()=>{if("undefined"==typeof window)return void m(!0);if(d.current?.destroy(),d.current=null,!p)return m(!0),void f(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],Jl),q(()=>()=>{d.current?.destroy(),d.current=null},[],Ql),q(()=>{p&&!u||f(o.content)},[p,o.content,u],ea);const w=X(()=>{const e=je(he(o.attrs??void 0,l));return e?Tl(e):void 0},[l,o.attrs],ta),v=X(()=>String(o.tag??"").trim(),[o.tag],na),k=X(()=>ce(v),[v],oa),M=X(()=>{const e=je(he(o.attrs??void 0,l,v));return e?Tl(e):void 0},[l,o.attrs,v],ra),N=X(()=>te(we(he(o.attrs??void 0,l,k))),[l,o.attrs,k],ia),$=X(()=>Array.isArray(o.children)?o.children:[],[o.children],la),B=$.length>0&&!!v&&!ee.has(v.toLowerCase())&&!le(v,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],aa),E=X(()=>"escape"!==l&&Dl(o.content??"",b),[b,l,o.content],sa),j=X(()=>E&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Ll(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=Pl(i,d,!0),m=jl(i,n),h=Boolean(Rl(i,r));if(Q.has(i.toLowerCase())||!m&&!h&&ae(i,o))continue;if(!m&&!h&&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 f=El(d,o,i),p=f.key,g=null!=p&&""!==p?p:`${a}-${l++}`,y=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(h)b.push(Il(i,d,[],g,r,"",u,{loading:!1,autoClosed:!1}));else if(y){const t=Wl(i,f,r);b.push(e.createElement(y,{...t,key:g}))}else b.push(e.createElement(i,{...Tl(f),key:g,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=jl(i,n),a=Boolean(Rl(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=`${Pl(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[Pl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=El(t.attrs||{},o,t.tagName),c=s.key,h=null!=c&&""!==c?c:`${a}-${l++}`,f=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;if(Boolean(Rl(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Hl(r);m=Il(t.tagName,t.attrs||{},t.children,h,r,i,u,e)}else m=f?e.createElement(f,{...Wl(t.tagName,s,r),key:h},...t.children):e.createElement(t.tagName,{...Tl(s),key:h,suppressHydrationWarning:!0},...t.children)}s.length>0?_l(s[s.length-1].children,m):_l(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=`${Pl(t.tagName,t.attrs)}${i}`;if(t.softBlocked){_l(c,[Pl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=El(t.attrs||{},o,t.tagName),m=u.key,h=null!=m&&""!==m?m:`${a}-${l++}`,f=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;let p;p=Boolean(Rl(t.tagName,r))?Il(t.tagName,t.attrs||{},t.children,h,r,i,d,Hl(r)):f?e.createElement(f,{...Wl(t.tagName,u,r),key:h},...t.children):e.createElement(t.tagName,{...Tl(u),key:h,suppressHydrationWarning:!0},...t.children),c.push(p),s.length>0&&s[s.length-1].sourceParts.push(d)}return c}catch{return null}}(o.content,y,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[y,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,E],ca),D=X(()=>me(h??"",l),[l,h],da),P=X(()=>B&&n.ctx&&n.renderNode?De($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],ua),_=k?n.ctx?.htmlComponents?.[k]:void 0,R=S("div",{className:"html-block-node__placeholder"},()=>r??L([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(v,{...T,ref:c},u?P:R)??null:x(ha,{h0:c,h1:w,h2:u?E&&j?S(t,{},()=>L([j])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:D}})):R})}var pa=/* @__PURE__ */O('<span class="html-inline-node"></span>'),ga=/* @__PURE__ */N(13),ya=/* @__PURE__ */Symbol(ga),ba=/* @__PURE__ */Symbol(ga+1),wa=/* @__PURE__ */Symbol(ga+2),va=/* @__PURE__ */Symbol(ga+3),xa=/* @__PURE__ */Symbol(ga+4),ka=/* @__PURE__ */Symbol(ga+5),Sa=/* @__PURE__ */Symbol(ga+6),Ca=/* @__PURE__ */Symbol(ga+7),Ma=/* @__PURE__ */Symbol(ga+8),Na=/* @__PURE__ */Symbol(ga+9),$a=/* @__PURE__ */Symbol(ga+10),Ba=/* @__PURE__ */Symbol(ga+11),Ta=/* @__PURE__ */Symbol(ga+12),La=["r","a","b"],Ea=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(pa);{const l=e.h0;n=l,i=a,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=a,r=u(t,a,n,i,void 0,l),t.refFields=La}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(F(r.d,t,r.c),r.c=t)}}),ja=(()=>{try{return Boolean(!1)}catch{}return!1})();function Da(e){ja&&console.warn(e)}function Pa(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 _a(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Ra(e,t){for(const n of Ll(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if(jl(e,t)&&"block"===mt(t[e]||t[e.toLowerCase()]))return!0}return!1}function Aa(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Fa(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(Fa).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Fa(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}>${Fa(n.props.children)}</${n.type}>`}function Ha(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Wa(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 Ia(t,n,o,r,i,l,a,s,c,d){const u=jl(t,r),m=Boolean(Aa(t,a));if(Q.has(t.toLowerCase())||!u&&!m&&ae(t,l))return null;if(!u&&!m&&le(t,l))return[Pa(t,n),...o,`</${t}>`];const h=El(n,l,t),f=h.key,p=null!=f&&""!==f?f:i;if(m)return function(t,n,o,r,i,l,a,s=Wa(i)){const c=ce(t),d=l??function(e){return e.map(Fa).join("")}(o),u={type:c,tag:c,attrs:Ha(n),content:d,raw:a??`${Pa(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Aa(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(h);return e.createElement(n,{...i,key:p},...o)}return e.createElement(t,{...Tl(h),key:p},...o)}function Oa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Y(null,ya),[a,s]=Z(!1,ba);q(()=>{s(!0)},[],wa);const c=e.useMemo(()=>({...n.ctx?.customComponents??ct(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],va),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],xa),u=e.useMemo(()=>me(o.content??"",i),[i,o.content],ka),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],Sa),h=e.useMemo(()=>ce(m),[m],Ca),f=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],Ma),p=e.useMemo(()=>te(we(he(o.attrs??void 0,i,h))),[i,o.attrs,h],Na),g=h?n.ctx?.htmlComponents?.[h]:void 0,y=f.length>0&&!!m&&"escape"!==i&&!le(m,i)&&!!n.ctx&&!!n.renderNode&&!!g,b=e.useMemo(()=>y&&n.ctx&&n.renderNode?De(f,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[y,n.ctx,n.indexKey,n.renderNode,f],$a),w=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Dl(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=Pa(s.tagName,e,!0),d=jl(s.tagName,t),u=Boolean(Aa(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=Ia(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});_a(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=jl(s.tagName,t),i=Boolean(Aa(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=`${Pa(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Pa(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Wa(o);m=Ia(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?_a(l[l.length-1].children,m):_a(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Da(`Auto-closing unclosed tag: <${s.tagName}>`)}else Da(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${Pa(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[Pa(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ia(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,Wa(o)),_a(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Da(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Ll(e),t,n,o)}catch(i){return r=i,ja&&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:Ra(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],Ba);return q(()=>{if(!a||!l.current||"html"!==w.mode)return;const e=l.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=u,e.appendChild(t.content.cloneNode(!0))},[w.mode,a,u],Ta),!o.loading||o.autoClosed||y||"dynamic"===w.mode?y?e.createElement(g,p,b)??null:"dynamic"===w.mode?w.block?S(t,{},()=>L([w.nodes])):C(()=>S("span",{className:"html-inline-node",style:{display:"inline"}},()=>w.nodes)):x(Ea,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var za=/* @__PURE__ */N(5),Ka=/* @__PURE__ */Symbol(za),Va=/* @__PURE__ */Symbol(za+1),qa=/* @__PURE__ */Symbol(za+2),Ua=/* @__PURE__ */Symbol(za+3),Xa=/* @__PURE__ */Symbol(za+4),Ya={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Za(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function Ga(e){const t={...Ya,...e},n=fe(t.node.src),o=fe(t.fallbackSrc),r=Za(n,o,t.node.loading),[i,l]=Z(!1,Ka),[a,s]=Z(!1,Va),[c,d]=Z(r.src,qa),[u,m]=Z(r.stage,Ua),h=c;q(()=>{const e=Za(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],Xa);const f=()=>{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?.(h)},g=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,h])};return!t.node.loading&&"failed"!==u&&h?C(()=>x("img",{key:"image",src:h,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:f,onLoad:p,onClick:g})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?L([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 Ja(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Qa(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 es(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var ts=null,ns=null,os=/* @__PURE__ */N(35),rs=/* @__PURE__ */Symbol(os),is=/* @__PURE__ */Symbol(os+1),ls=/* @__PURE__ */Symbol(os+2),as=/* @__PURE__ */Symbol(os+3),ss=/* @__PURE__ */Symbol(os+4),cs=/* @__PURE__ */Symbol(os+5),ds=/* @__PURE__ */Symbol(os+6),us=/* @__PURE__ */Symbol(os+7),ms=/* @__PURE__ */Symbol(os+8),hs=/* @__PURE__ */Symbol(os+9),fs=/* @__PURE__ */Symbol(os+10),ps=/* @__PURE__ */Symbol(os+11),gs=/* @__PURE__ */Symbol(os+12),ys=/* @__PURE__ */Symbol(os+13),bs=/* @__PURE__ */Symbol(os+14),ws=/* @__PURE__ */Symbol(os+15),vs=/* @__PURE__ */Symbol(os+16),xs=/* @__PURE__ */Symbol(os+17),ks=/* @__PURE__ */Symbol(os+18),Ss=/* @__PURE__ */Symbol(os+19),Cs=/* @__PURE__ */Symbol(os+20),Ms=/* @__PURE__ */Symbol(os+21),Ns=/* @__PURE__ */Symbol(os+22),$s=/* @__PURE__ */Symbol(os+23),Bs=/* @__PURE__ */Symbol(os+24),Ts=/* @__PURE__ */Symbol(os+25),Ls=/* @__PURE__ */Symbol(os+26),Es=/* @__PURE__ */Symbol(os+27),js=/* @__PURE__ */Symbol(os+28),Ds=/* @__PURE__ */Symbol(os+29),Ps=/* @__PURE__ */Symbol(os+30),_s=/* @__PURE__ */Symbol(os+31),Rs=/* @__PURE__ */Symbol(os+32),As=/* @__PURE__ */Symbol(os+33),Fs=/* @__PURE__ */Symbol(os+34),Hs=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"}))),Ws={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Is(e){const n={...Ws,...e},{t:o}=J(rs,$t,rs),[r,i]=Z(!1,is),[l,a]=Z(!1,ls),[s,c]=Z(!1,as),[d,u]=Z(!1,ss),[m,h]=Z(()=>"undefined"==typeof window,cs),f=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?Ja(n.maxHeight):null,[n.maxHeight],ds),g=X(()=>es(Ja(n.estimatedPreviewHeightPx)??Qa(f),void 0,p),[f,p,n.estimatedPreviewHeightPx],us),[y,b]=Z(`${g}px`,ms),[w,v]=Z(!1,hs),[M,N]=Z(1,fs),[$,B]=Z({x:0,y:0},ps),[T,E]=Z(!1,gs),j=Y(null,ys),D=Y(null,bs),P=Y(null,ws),_=Y(null,vs),R=Y(null,xs),A=Y({x:0,y:0},ks),F=Y(null,Ss),H=J(Cs,et,Cs),W=K(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,g)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),g)}px`:`${Math.max(e,g)}px`},[g,n.maxHeight],Ms),I=K(()=>{const e=j.current;if(!e)return;const t=e.scrollHeight;t>0&&b(W(t))},[W],Ns);q(()=>{s||l||b(e=>{const t=Ja(e);return null!=t&&t>=g?e:`${g}px`})},[g,l,s],$s);const O=K(async()=>{try{await(navigator.clipboard?.writeText(f)),i(!0),n.onCopy?.(f),setTimeout(()=>i(!1),1e3)}catch{}},[f,n],Bs),z=K(async()=>{if(!m)return;if(!j.current)return;const e=j.current;try{const t=await async function(){return ns||ts||(ts=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),ns=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),ts)}();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(f),v(!0),setTimeout(()=>{I()},0)}catch(t){console.error("Failed to render infographic:",t),v(!1),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`}},[f,I,m],Ts);q(()=>{const e=D.current;if(!e)return;const t=H(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&h(!0),t.whenVisible.then(()=>h(!0)),()=>{t.destroy(),P.current=null}},[H],Ls),q(()=>{!m||s||l||z()},[f,l,z,s,m],Es),q(()=>()=>{F.current&&(F.current.destroy?.(),F.current=null)},[],js);const V=K(()=>{u(!1),_.current&&(_.current.innerHTML=""),R.current=null,document.body.style.overflow=""},[],Ds),U=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Ps);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&V()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,V],_s),q(()=>{d&&setTimeout(()=>{if(j.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=j.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],Rs),q(()=>{d&&R.current&&(R.current.style.transform=`translate(${$.x}px, ${$.y}px) scale(${M})`)},[d,$,M],As);const G=K(()=>{const e=j.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)},[],Fs),Q=e=>{E(!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=()=>E(!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,{},()=>L([C(()=>S("div",{ref:D,"data-markstream-infographic":"1","data-markstream-mode":s?"source":w?"preview":"pending",className:zr("my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":n.loading})},()=>L([n.showHeader&&C(()=>S("div",{className:zr("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")},()=>L([S("div",{className:"flex items-center gap-x-2 overflow-hidden"},()=>L([Hs,C(()=>x("span",{className:zr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:zr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>L([C(()=>S("button",{className:zr("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=>Rt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>S("div",{className:"flex items-center gap-x-1"},()=>L([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:zr("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=>Rt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>S("div",{className:"flex items-center gap-x-1"},()=>L([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"},()=>L([n.showCollapseButton&&C(()=>S("button",{className:ne,onClick:()=>a(!l),onMouseEnter:e=>Rt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>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:O,onMouseEnter:e=>Rt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>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:zr(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:G,onMouseEnter:e=>Rt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>At()},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:zr(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:U,onMouseEnter:e=>Rt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>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:zr("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:zr("text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>f)))):S("div",{className:"relative"},()=>L([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"},()=>L([C(()=>x("button",{className:zr("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:zr("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:zr("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})}},()=>L([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{className:zr("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:y,maxHeight:n.maxHeight??void 0},onMouseDown:Q,onMouseMove:ee,onMouseUp:te,onMouseLeave:te,onTouchStart:Q,onTouchMove:ee,onTouchEnd:te},()=>C(()=>S("div",{className:zr("absolute inset-0 cursor-grab",T&&"cursor-grabbing"),style:{transform:`translate(${$.x}px, ${$.y}px) scale(${M})`}},()=>C(()=>x("div",{ref:j,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:zr("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()},()=>L([S("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2"},()=>L([C(()=>x("button",{className:zr("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:zr("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:zr("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})}},()=>L([Math.round(100*M),"\n %\n "]))),C(()=>x("button",{className:zr("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:zr("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 Os=/* @__PURE__ */O('<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>'),zs=/* @__PURE__ */N(6),Ks=/* @__PURE__ */Symbol(zs),Vs=/* @__PURE__ */Symbol(zs+1),qs=/* @__PURE__ */Symbol(zs+2),Us=/* @__PURE__ */Symbol(zs+3),Xs=/* @__PURE__ */Symbol(zs+4),Ys=/* @__PURE__ */Symbol(zs+5),Zs=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Os);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):H(e,n),o.c=n}}});function Gs(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 Js(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}]:[],Ks),u=J(Vs,Ve,Vs),m=Y(l,qs),h=Y(1,Us),f=Y(void 0,Xs);return q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==f.current;if(null!=n)return m.current="",d([]),void(f.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:h.current++,content:c,fading:!1},{id:h.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:h.current++,content:e,fading:!0}]})}else d(l?[{id:h.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?Gs(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:h.current++,content:l,fading:!1}]:[]:e);m.current=l,f.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],Ys),x(Zs,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?zr("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)?Gs(e,t):e);var t}:void 0},()=>e.content))})}Js.$$singleRoot=!0;var Qs=/* @__PURE__ */O('<ins class="insert-node"></ins>'),ec=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Qs);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):H(e,n),o.c=n}}});function tc(e){return x(ec,{h0:e.children})}tc.$$singleRoot=!0,M(["animationend"]);var nc=/* @__PURE__ */O("<span></span>"),oc=/* @__PURE__ */O("<span><!></span>"),rc=/* @__PURE__ */N(6),ic=/* @__PURE__ */Symbol(rc),lc=/* @__PURE__ */Symbol(rc+1),ac=/* @__PURE__ */Symbol(rc+2),sc=/* @__PURE__ */Symbol(rc+3),cc=/* @__PURE__ */Symbol(rc+4),dc=/* @__PURE__ */Symbol(rc+5),uc=e=>e.id;function mc(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(nc);n=a,i=a,a.$$animationend=e.fading?()=>o(e.id):void 0,l=a,r=h(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?zr("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):H(e,n),r.f=n}}}var hc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(oc);e=i,n=i,r=y(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,uc,mc,30,[e.h4],o.d,1)});function fc(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 pc(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}]:[],ic),u=J(lc,Ve,lc),m=Y(l,ac),h=Y(1,sc),f=Y(void 0,cc);q(()=>{const e=u?.getStreamRenderVersion()??o?.streamRenderVersion,t=e!==f.current;if(null!=n)return m.current="",d([]),void(f.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:h.current++,content:c,fading:!1},{id:h.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:h.current++,content:e,fading:!0}]})}else d(l?[{id:h.current++,content:l,fading:!1}]:[]);else t&&d(e=>e.some(e=>e.fading)?fc(e):e);else d(e=>1!==e.length||e[0]?.fading||e[0].content!==l?l?[{id:h.current++,content:l,fading:!1}]:[]:e);m.current=l,f.current=e,s&&r?.set(s,l)},[n,l,u,o?.textStreamState,o?.streamRenderVersion,s,a],dc);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?fc(t,e):t)};return null!=n?C(()=>S("span",{className:zr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):x(hc,{h0:zr("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?zr("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 gc=/* @__PURE__ */O('<a class="link-node"></a>',3),yc=/* @__PURE__ */N(4),bc=/* @__PURE__ */Symbol(yc),wc=/* @__PURE__ */Symbol(yc+1),vc=/* @__PURE__ */Symbol(yc+2),xc=/* @__PURE__ */Symbol(yc+3),kc=/* @__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=w(gc);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=g(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&&(D(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):H(e,n),o.q=n}}});function Sc(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],bc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],wc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&Rt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],vc),m=K(()=>{i&&At()},[i],xc);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"},()=>L([S("span",{className:"leading-[normal] link-text"},()=>C(()=>x(pc,{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(kc,{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?De(t.children,n,String(r??"link"),o):C(()=>x(pc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var Cc=/* @__PURE__ */O('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),Mc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(Cc);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):H(e,n),o.e=n}}});function Nc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(Mc,{h0:null==r?void 0:r,h1:l??(n&&o?De(t.children,n,String(i??"list-item"),o):null)})}function $c(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&&ct(n.customId).list_item||Nc;return S(i,{className:zr("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 Bc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}Nc.$$singleRoot=!0;var Tc=null,Lc=null,Ec=!1,jc=/* @__PURE__ */new Map,Dc=/* @__PURE__ */new Map,Pc=5,_c=/* @__PURE__ */new Set;function Rc(){if(jc.size<Pc&&_c.size){const e=Array.from(_c);_c.clear();for(const t of e)try{t()}catch{}}}function Ac(e){Lc=null,(Tc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=jc.get(t);if(r)if(jc.delete(t),clearTimeout(r.timeoutId),Rc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Dc.set(e,n),Dc.size>200){const e=Dc.keys().next();e.done||Dc.delete(e.value)}}r.resolve(n)}},Tc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of jc.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));jc.clear(),Rc()}}function Fc(){Tc&&Tc.terminate?.(),Tc=null,Lc=null}function Hc(e){Ec=!!e,Tc&&Tc.postMessage({type:"init",debug:Ec})}var Wc="WORKER_BUSY";async function Ic(e,t=!0,n=2e3,o){performance.now();const r=Bc(e);if(Lc)return Promise.reject(Lc);const i=`${t?"d":"i"}:${r}`,l=Dc.get(i);if(l)return Promise.resolve(l);const a=Tc||((Lc=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Lc.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Lc);if(jc.size>=Pc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Wc,e.busy=!0,e.inFlight=jc.size,e.max=Pc,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(()=>{jc.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Rc()},n),c=()=>{},d=()=>{jc.delete(l),clearTimeout(s),_c.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),Rc()};o&&o.addEventListener("abort",d,{once:!0}),jc.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:Ec})}catch(u){jc.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),Rc()}})}function Oc(e,t,n){const o=`${t?"d":"i"}:${Bc(e)}`;if(Dc.set(o,n),Dc.size>200){const e=Dc.keys().next();e.done||Dc.delete(e.value)}}function zc(){Dc.clear()}function Kc(e){Pc=Math.max(1,Math.floor(e)),Rc()}function Vc(e=1500,t){return jc.size<Pc?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(){_c.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}),_c.add(l)})}var qc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Uc(e){null!=e.timeout&&(qc.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(qc.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(qc.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(qc.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Xc(){return{...qc}}async function Yc(e,t=!0,n={}){const o=n.timeout??qc.timeout,r=n.waitTimeout??qc.waitTimeout,i=n.backoffMs??qc.backoffMs,l=n.maxRetries??qc.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):qc.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 Ic(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await Vc(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 Zc=null,Gc=!1;async function Jc(){if(Zc)return Zc;if(Gc)return null;try{return Zc=await import("katex"),await import("katex/contrib/mhchem"),Zc}catch{return Gc=!0,null}}var Qc=/* @__PURE__ */O('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),ed=/* @__PURE__ */N(9),td=/* @__PURE__ */Symbol(ed),nd=/* @__PURE__ */Symbol(ed+1),od=/* @__PURE__ */Symbol(ed+2),rd=/* @__PURE__ */Symbol(ed+3),id=/* @__PURE__ */Symbol(ed+4),ld=/* @__PURE__ */Symbol(ed+5),ad=/* @__PURE__ */Symbol(ed+6),sd=/* @__PURE__ */Symbol(ed+7),cd=/* @__PURE__ */Symbol(ed+8),dd=["r","a","b","r","c","d"],ud=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=w(Qc);{const l=e.h0;n=l,i=c,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}const d=c.firstChild;{const n=e.h1;l=n,a=d,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}s=d,r=h(t,c,n,i,l,a,void 0,s),t.refFields=dd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function md({node:e}){const t=Y(null,td),n=Y(null,nd),o=Y(null,od),r=J(rd,et,rd),[i,l]=Z(!0,id),[a,s]=Z(()=>"undefined"==typeof window,ld),c=Y(0,ad);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],sd),q(()=>{const t=Bc(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 Yc(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 Jc();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),Oc(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],cd),x(ud,{h0:t,h1:n,h2:i?"math-rendering":void 0})}md.$$singleRoot=!0;var hd=/* @__PURE__ */O('<span class="math-inline-wrapper"><span></span><!></span>'),fd=/* @__PURE__ */N(9),pd=/* @__PURE__ */Symbol(fd),gd=/* @__PURE__ */Symbol(fd+1),yd=/* @__PURE__ */Symbol(fd+2),bd=/* @__PURE__ */Symbol(fd+3),wd=/* @__PURE__ */Symbol(fd+4),vd=/* @__PURE__ */Symbol(fd+5),xd=/* @__PURE__ */Symbol(fd+6),kd=/* @__PURE__ */Symbol(fd+7),Sd=/* @__PURE__ */Symbol(fd+8),Cd=["r","a","b","r","c","d"],Md=/* @__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=w(hd);{const l=e.h0;n=l,i=m,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}const h=y(m);{const n=e.h1;a=n,s=h,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}c=h,d=m,u=W(h,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=Cd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(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):H(e,n)}}});function Nd({node:e}){const t=Y(null,pd),n=Y(null,gd),o=Y(null,yd),r=J(bd,et,bd),[i,l]=Z(!0,wd),[a,s]=Z(()=>"undefined"==typeof window,vd),c=Y(0,xd);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],kd),q(()=>{const t=Bc(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 Yc(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 Jc();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),Oc(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],Sd),x(Md,{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 $d(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Bd(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 Td(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Ld(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}Nd.$$singleRoot=!0;var Ed=null,jd=null,Dd=/* @__PURE__ */new Map,Pd=5,_d=!1;function Rd(e){_d=!!e}function Ad(e){Number.isFinite(e)&&e>0&&(Pd=Math.floor(e))}function Fd(){return{inFlight:Dd.size,max:Pd}}var Hd="WORKER_BUSY";function Wd(e){jd=null;const t=e;(Ed=e).onmessage=e=>{if(Ed!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Dd.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Ed.onerror=e=>{if(Ed===t)if(0!==Dd.size){try{_d?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Dd.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Dd.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Ed.onmessageerror=e=>{if(Ed===t)if(0!==Dd.size){try{_d?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Dd.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Dd.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Id(){if(Ed)try{for(const[e,t]of Dd.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Dd.clear(),Ed.terminate?.()}catch{}Ed=null,jd=null}function Od(e,t,n=1400){if(jd)return Promise.reject(jd);const o=Ed||((jd=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",jd.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(jd);if(Dd.size>=Pd){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Hd,e.inFlight=Dd.size,e.max=Pd,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),Dd.delete(l))};Dd.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Dd.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Dd.get(l)?.reject(e)},n)})}async function zd(e,t,n=1400){return Od("canParse",{code:e,theme:t},n)}async function Kd(e,t,n=2400){return Od("findPrefix",{code:e,theme:t},n)}function Vd(){Ed?.terminate?.(),Ed=null,jd=null,Dd.clear()}var qd=null,Ud=!1,Xd=null,Yd=null;function Zd(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(Xd!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),Xd=n}catch{}}var Gd=/* @__PURE__ */N(68),Jd=/* @__PURE__ */Symbol(Gd),Qd=/* @__PURE__ */Symbol(Gd+1),eu=/* @__PURE__ */Symbol(Gd+2),tu=/* @__PURE__ */Symbol(Gd+3),nu=/* @__PURE__ */Symbol(Gd+4),ou=/* @__PURE__ */Symbol(Gd+5),ru=/* @__PURE__ */Symbol(Gd+6),iu=/* @__PURE__ */Symbol(Gd+7),lu=/* @__PURE__ */Symbol(Gd+8),au=/* @__PURE__ */Symbol(Gd+9),su=/* @__PURE__ */Symbol(Gd+10),cu=/* @__PURE__ */Symbol(Gd+11),du=/* @__PURE__ */Symbol(Gd+12),uu=/* @__PURE__ */Symbol(Gd+13),mu=/* @__PURE__ */Symbol(Gd+14),hu=/* @__PURE__ */Symbol(Gd+15),fu=/* @__PURE__ */Symbol(Gd+16),pu=/* @__PURE__ */Symbol(Gd+17),gu=/* @__PURE__ */Symbol(Gd+18),yu=/* @__PURE__ */Symbol(Gd+19),bu=/* @__PURE__ */Symbol(Gd+20),wu=/* @__PURE__ */Symbol(Gd+21),vu=/* @__PURE__ */Symbol(Gd+22),xu=/* @__PURE__ */Symbol(Gd+23),ku=/* @__PURE__ */Symbol(Gd+24),Su=/* @__PURE__ */Symbol(Gd+25),Cu=/* @__PURE__ */Symbol(Gd+26),Mu=/* @__PURE__ */Symbol(Gd+27),Nu=/* @__PURE__ */Symbol(Gd+28),$u=/* @__PURE__ */Symbol(Gd+29),Bu=/* @__PURE__ */Symbol(Gd+30),Tu=/* @__PURE__ */Symbol(Gd+31),Lu=/* @__PURE__ */Symbol(Gd+32),Eu=/* @__PURE__ */Symbol(Gd+33),ju=/* @__PURE__ */Symbol(Gd+34),Du=/* @__PURE__ */Symbol(Gd+35),Pu=/* @__PURE__ */Symbol(Gd+36),_u=/* @__PURE__ */Symbol(Gd+37),Ru=/* @__PURE__ */Symbol(Gd+38),Au=/* @__PURE__ */Symbol(Gd+39),Fu=/* @__PURE__ */Symbol(Gd+40),Hu=/* @__PURE__ */Symbol(Gd+41),Wu=/* @__PURE__ */Symbol(Gd+42),Iu=/* @__PURE__ */Symbol(Gd+43),Ou=/* @__PURE__ */Symbol(Gd+44),zu=/* @__PURE__ */Symbol(Gd+45),Ku=/* @__PURE__ */Symbol(Gd+46),Vu=/* @__PURE__ */Symbol(Gd+47),qu=/* @__PURE__ */Symbol(Gd+48),Uu=/* @__PURE__ */Symbol(Gd+49),Xu=/* @__PURE__ */Symbol(Gd+50),Yu=/* @__PURE__ */Symbol(Gd+51),Zu=/* @__PURE__ */Symbol(Gd+52),Gu=/* @__PURE__ */Symbol(Gd+53),Ju=/* @__PURE__ */Symbol(Gd+54),Qu=/* @__PURE__ */Symbol(Gd+55),em=/* @__PURE__ */Symbol(Gd+56),tm=/* @__PURE__ */Symbol(Gd+57),nm=/* @__PURE__ */Symbol(Gd+58),om=/* @__PURE__ */Symbol(Gd+59),rm=/* @__PURE__ */Symbol(Gd+60),im=/* @__PURE__ */Symbol(Gd+61),lm=/* @__PURE__ */Symbol(Gd+62),am=/* @__PURE__ */Symbol(Gd+63),sm=/* @__PURE__ */Symbol(Gd+64),cm=/* @__PURE__ */Symbol(Gd+65),dm=/* @__PURE__ */Symbol(Gd+66),um=/* @__PURE__ */Symbol(Gd+67),mm="undefined"!=typeof window?U:q,hm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function fm(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function pm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(fm(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||fm(e),o}function gm(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var ym={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 bm(e){const n={...ym,...e},{t:o}=J(Jd,$t,Jd),r=X(()=>Gt("mermaid"),[],Qd),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],eu),a=n.workerTimeoutMs??ym.workerTimeoutMs,s=n.parseTimeoutMs??ym.parseTimeoutMs,c=n.renderTimeoutMs??ym.renderTimeoutMs,d=n.fullRenderTimeoutMs??ym.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??ym.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?$d(n.maxHeight):null,[n.maxHeight],tu),h=X(()=>Td($d(n.estimatedPreviewHeightPx)??Bd(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],nu),[f,p]=Z(!1,ou),[g,y]=Z(!1,ru),[b,w]=Z(!1,iu),[v,M]=Z(!1,lu),[N,$]=Z(1,au),[B,T]=Z({x:0,y:0},su),[E,j]=Z(!1,cu),[D,P]=Z(!1,du),[_,R]=Z(!1,uu),[A,F]=Z(null,mu),[H,W]=Z(!1,hu),[I,O]=Z(`${h}px`,fu),[z,V]=Z("undefined"==typeof window,pu),G=Y(null,gu),Q=Y(null,yu),ee=Y(null,bu),te=Y(null,wu),ne=Y(null,vu),oe=Y(null,xu),re=Y(null,ku),ie=Y({x:0,y:0},Su),le=Y(0,Cu),ae=Y({},Mu),se=Y(null,Nu),ce=Y("",$u),de=Y(!1,Bu),ue=Y(null,Tu),me=Y(!1,Lu),he=Y({zoom:1,translateX:0,translateY:0,containerHeight:I||"360px"},Eu),fe=J(ju,et,ju),pe=Boolean(n.node?.loading??n.loading),ge=n.isDark?"dark":"light",ye=Boolean(n.isStrict),be=!0===n.enableMermaidInteractions,we=X(()=>ye?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:hm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ye],Du);q(()=>{me.current=_},[_],Pu),q(()=>{g||b||O(e=>{const t=$d(e);return null!=t&&t>=h?e:`${h}px`})},[h,b,g],_u),q(()=>{ae.current={}},[ge,l,ye],Ru),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(qd)return Zd(qd,e),qd;if(Yd){const t=await Yd;return t&&Zd(t,e),t}if(Ud)return null;try{Ud=!0,Yd=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(qd=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return Zd(qd,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),qd}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{Yd=null}})();const t=await Yd;return t&&Zd(t,e),t}catch{return null}}(we);e||(G.current=t,p(Boolean(t)),de.current||y(!t))})(),()=>{e=!0}},[we],Au),q(()=>{const e=Q.current;if(!e)return;const t=fe(e,{rootMargin:"400px"});return ue.current=t,t.isVisible()&&V(!0),t.whenVisible.then(()=>V(!0)),()=>{t.destroy(),ue.current=null}},[fe],Fu),q(()=>{if("undefined"==typeof document)return;if(!H)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[H],Hu);const ve=K(()=>m,[m],Wu),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=ve(),u=null==d?c:Math.min(c,d);O(`${"none"===n.maxHeight?u:Math.max(u,h)}px`)},[h,n.maxHeight,ve],Iu);q(()=>{if(!Q.current||"undefined"==typeof ResizeObserver)return;if(g||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Ld(()=>xe(t))});return e.observe(Q.current),()=>e.disconnect()},[b,g,xe],Ou),q(()=>{g||b||xe()},[b,n.maxHeight,g,xe],zu),q(()=>()=>{Vd()},[],Ku),U(()=>{const e=ae.current[ge];!g&&te.current&&e?.svg&&(pm(te.current,e.svg)&&(se.current=e.bindFunctions??null,gm(te.current,e.bindFunctions,be)),Ld(()=>xe()))},[be,g,ge,xe],Vu);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=xm(e,t),i=await Mm(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=pm(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,gm(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],qu),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=xm(Cm(e)||e,t),i=await Mm(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=pm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,gm(te.current,i.bindFunctions,be)),e&&xe()}}catch{}finally{P(!1)}}},[be,c,pe,xe],Uu),Ce=K(async(e,t)=>{if(!e.trim())return fm(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"===km(e)){const i=Cm(e);if(!i.trim())return;try{if(await vm(i,ge,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;i===e?await ke(e,ge,t)&&(ce.current=n):await Se(i,ge,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await vm(e,ge,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;return void(await ke(e,ge,t)&&(ce.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await Kd(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return Cm(e)}(e,ge,{workerTimeout:a,signal:t});if(!n||t?.aborted||le.current!==o)return;await Se(n,ge,t)}catch{}},[s,ke,Se,ge,a],Xu),Me=K(()=>z&&!g&&!b,[b,g,z],Yu);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,f,Ce,u],Zu);const Ne=K((e,t)=>{e.clientX,e.clientY,Rt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],Gu),$e=K(async()=>{try{await(navigator.clipboard?.writeText(l)),M(!0),n.onCopy?.(l),setTimeout(()=>M(!1),1e3)}catch{}},[l,n],Ju),Be=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=Nm(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??Nm(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],Qu),Te=K(()=>{re.current=null,fm(oe.current)},[],em),Le=K(()=>{W(!1),Te()},[Te],tm),Ee=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?Nm(e):null};n.onOpenModal?.(t),t.defaultPrevented||W(!0)},[n],nm);q(()=>{if(!H)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Le()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Le,H],om),J(rm,mm,()=>{if(!H)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),fm(e),e.appendChild(o),gm(e,se.current??ae.current[ge]?.bindFunctions,be)},[be,H,ge],rm),q(()=>{H&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${N})`)},[H,B.x,B.y,N],im);const je=g||D||b,De=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],lm),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){y(!1);const e=he.current;$(e.zoom),T({x:e.translateX,y:e.translateY}),O(e.containerHeight)}else he.current={zoom:N,translateX:B.x,translateY:B.y,containerHeight:I},y(!0)},[l,I,Ce,n,ge,B.x,B.y,xe,N],am),_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=wm(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],sm),Re=K((e,t)=>{j(!0),ie.current={x:e-B.x,y:t-B.y}},[B.x,B.y],cm),Ae=K((e,t)=>{E&&T({x:e-ie.current.x,y:t-ie.current.y})},[E],dm),Fe=K(()=>{j(!1)},[],um),He=S("div",{className:"relative"},()=>L([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"},()=>L([C(()=>x("button",{type:"button",className:zr("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:()=>At(),onClick:()=>$(wm(N+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:zr("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:()=>At(),onClick:()=>$(wm(N-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:zr("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:()=>At(),onClick:()=>{$(1),T({x:0,y:0})}},()=>L([Math.round(100*N),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:zr("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:I,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},()=>L([C(()=>S("div",{ref:ee,"data-mermaid-wrapper":!0,className:zr("absolute inset-0 cursor-grab",{"cursor-grabbing":E}),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"})))),(D||pe)&&x("div",{className:"mermaid-loading"},x("span",{className:"mermaid-spinner"}),x("span",{},"Rendering diagram…"))])))])),We=n.showHeader&&C(()=>S("div",{className:zr("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")},()=>L([S("div",{className:"flex items-center space-x-2 overflow-hidden"},()=>L([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:r}})),C(()=>x("span",{className:zr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"\n Mermaid\n "))])),n.showModeToggle&&f&&C(()=>S("div",{className:zr("flex items-center space-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>L([C(()=>S("button",{type:"button",className:zr("px-2.5 py-1 text-xs rounded transition-colors",g?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:()=>At(),onBlur:()=>At()},()=>S("div",{className:"flex items-center space-x-1"},()=>L([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:zr("px-2.5 py-1 text-xs rounded transition-colors",g?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:()=>At(),onBlur:()=>At()},()=>S("div",{className:"flex items-center space-x-1"},()=>L([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"},()=>L([n.showCollapseButton&&C(()=>S("button",{type:"button",className:De,"aria-pressed":b,onClick:()=>w(e=>!e),onMouseEnter:e=>Ne(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Ne(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>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:De,onClick:$e,onMouseEnter:e=>Ne(e,o(v?"common.copied":"common.copy")),onFocus:e=>Ne(e,o(v?"common.copied":"common.copy")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>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"},v?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&&f&&C(()=>x("button",{type:"button",className:zr(De,je?"opacity-50 cursor-not-allowed":""),disabled:je,onClick:Be,onMouseEnter:e=>Ne(e,o("common.export")),onFocus:e=>Ne(e,o("common.export")),onMouseLeave:()=>At(),onBlur:()=>At()},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&&f&&C(()=>S("button",{type:"button",className:zr(De,je?"opacity-50 cursor-not-allowed":""),disabled:je,onClick:H?Le:Ee,onMouseEnter:e=>Ne(e,o(H?"common.minimize":"common.open")),onFocus:e=>Ne(e,o(H?"common.minimize":"common.open")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>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",H?{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"}))))]))]))),Ie=S("div",{},()=>L([g?C(()=>S("div",{className:zr("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))):He,A&&S("div",{className:"mermaid-error"},()=>A)]));return S(t,{},()=>L([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":g?"source":_?"preview":"pending",className:zr("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":pe})},()=>L([We,C(()=>S("div",{ref:ne,style:{display:b?"none":""}},()=>Ie))]))),H&&"undefined"!=typeof document&&k(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Le()},()=>C(()=>S("div",{className:zr("mermaid-modal-panel",{"is-dark":n.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},()=>L([S("div",{className:"mermaid-modal-header"},()=>L([S("span",{className:"mermaid-modal-title"},()=>`Mermaid ${o("common.preview")}`),C(()=>S("button",{type:"button",className:"mermaid-modal-close",onClick:Le},()=>o("common.close")))])),S("div",{className:"mermaid-modal-body"},()=>C(()=>x("div",{ref:oe,className:"mermaid-modal-content"})))])))),document.body)]))}function wm(e,t,n){return Math.min(Math.max(e,t),n)}async function vm(e,t,n){try{if(await zd(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=xm(e,t),r=n.mermaid;if("function"==typeof r.parse)return await Mm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Mm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function xm(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function km(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 Sm(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 Cm(e){if("gantt"===km(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(Sm(e))break;t.pop()}else t.pop()}return t.some(Sm)?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 Mm(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 Nm(e){return(new XMLSerializer).serializeToString(e)}var $m=/* @__PURE__ */O('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),Bm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l;const a=w($m),s=W(y(a),1);i=a,l=W(s,1);{const t=e.h0;n=$(s,t),r=t}o=h(t,a,n,r,i,l,null,void 0)}else{const t=e.h0;o.b!==t&&(H(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):H(e,n)}}});function Tm(e){const{node:t}=e;return x(Bm,{h0:" ",h1:String(t?.type)})}function Lm(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:mt(c)}}function Em(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function jm(e,t,n,o){const r=e.filter(e=>!Em(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=>!Em(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return De(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Em(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Em(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Em(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Dm(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??ct(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"},jm(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;Ee.has(e.type)||n&&function(e,t,n){return"block"===Lm(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"},jm(a,r,o,String(i??"paragraph")))}Tm.$$singleRoot=!0,M(["click","keydown","mouseenter","mouseleave"]);var Pm=/* @__PURE__ */O('<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>'),_m=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),Rm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Pm);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=f(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):H(e,n),o.g=n}}});function Am(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],_m);return x(Rm,{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})}Am.$$singleRoot=!0;var Fm=/* @__PURE__ */O('<s class="strikethrough-node"></s>'),Hm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(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):H(e,n),o.c=n}}});function Wm(e){return x(Hm,{h0:e.children})}Wm.$$singleRoot=!0;var Im=/* @__PURE__ */O('<strong class="strong-node"></strong>'),Om=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(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):H(e,n),o.c=n}}});function zm(e){return x(Om,{h0:e.children})}zm.$$singleRoot=!0;var Km=/* @__PURE__ */O('<sub class="subscript-node"></sub>'),Vm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(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):H(e,n),o.c=n}}});function qm(e){return x(Vm,{h0:e.children})}qm.$$singleRoot=!0;var Um=/* @__PURE__ */O('<sup class="superscript-node"></sup>'),Xm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Um);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):H(e,n),o.c=n}}});function Ym(e){return x(Xm,{h0:e.children})}Ym.$$singleRoot=!0;var Zm=/* @__PURE__ */O('<th dir="auto"><!><!></th>'),Gm=/* @__PURE__ */O("<tr></tr>"),Jm=/* @__PURE__ */O('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),Qm=/* @__PURE__ */N(5),eh=/* @__PURE__ */Symbol(Qm),th=/* @__PURE__ */Symbol(Qm+1),nh=/* @__PURE__ */Symbol(Qm+2),oh=/* @__PURE__ */Symbol(Qm+3),rh=/* @__PURE__ */Symbol(Qm+4),ih=(e,t)=>`header-${t}`;function lh(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=w(Zm);e=a,n=a;const s=y(a);o=s,r=a,i=W(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=zr("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?Pe(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):H(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):H(o,e)}}}var ah=(e,t)=>`row-${t}`;function sh(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=w(Gm);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=zr("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:zr("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?Pe(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):H(e,n),d.e=n}}}var ch=["r","c","d"],dh=/* @__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,h,f,p,b;const v=w(Jm);n=v;const x=y(v);{const n=e.h1;i=n,l=x,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}a=x,s=x;const k=W(y(x),1),S=y(k);c=S,d=y(S);const C=W(k,1);u=C,m=y(C),h=x,f=y(x),p=v,b=W(x,1),r=g(t,v,{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:h,n:f,o:null,p:void 0,q:p,r:b,s:null,t:void 0}),t.refFields=ch}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(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&&(D(r.h,"aria-busy",t),r.g=t)}B(t,1,r.i,e.h5,e.h6,e.h7,ih,lh,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,ah,sh,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):H(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):H(e,n)}}});function uh(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,eh),d=e.useRef(null,th),u=e.useRef(null,nh),[m,h]=e.useState([],oh),f=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},g=(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},h(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,h(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(),h([]),p),[l.length],rh),x(dh,{h0:i,h1:c,h2:zr("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:zr("font-semibold p-[calc(4/7*1em)]",f(e.align)),dir:"auto"},()=>L([o&&r?Pe(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=>g(t,e)}))])),h8:[f,o,l,i,r,g],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:zr("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:zr("p-[calc(4/7*1em)]",f(e.align)),dir:"auto"},()=>o&&r?Pe(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:f,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"))})}uh.$$singleRoot=!0;var mh=/* @__PURE__ */O('<hr class="hr-node thematic-break"/>'),hh=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(mh)))});function fh(){return x(hh,{})}fh.$$singleRoot=!0;var ph=/* @__PURE__ */O("<div></div>"),gh=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),yh=["s","d","c"],bh=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(ph);n=e.h0,r=I(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&&j(e.ref,o.c)}),a=s,o=f(t,s,n,r,i,l,a,null,void 0),t.refFields=yh}else{{const t=e.h0;o.a!==t&&(o.a=t)}o.b=I(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 wh(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)?je(n.attrs):n.attrs},[n.attrs],gh);return x(bh,{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})}wh.$$singleRoot=!0;var vh=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function xh(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))vh.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function kh(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function Sh(t,n,o,r,i={}){const l=xh(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),stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,langs:r.codeBlockThemes?.langs,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,...i,ctx:r,renderNode:Mh,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function Ch(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function Mh(t,n,o){const r=o.customComponents??ct(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:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(c)return function(t,n,o,r,i){const l=te(we(he(n.attrs??void 0,r.htmlPolicy??"safe",i))),a=Array.isArray(n.children)?De(n.children,r,`${String(o)}-html`,Mh):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:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=Lm(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:ye(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&ge(c,s))return"html_inline"===t.type?kh(pc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):kh(Dm,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return kh(pc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return kh(pc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return kh(Dm,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return kh(Cl,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return kh(Tp,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return kh($c,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return kh(Nc,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return kh(uh,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return kh(Qi,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return kh(ml,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return kh(vl,t,n,{});case"footnote_anchor":return kh(cl,t,n,{});case"admonition":return kh(Oe,t,n,{ctx:o,renderNode:Mh,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return kh(Sl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return kh(Sc,t,n,{ctx:o,renderNode:Mh,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return kh(Ga,t,n,{});case"inline_code":return kh(Js,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=qt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,qt(n),Ce(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==$d(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Td(Bd(String(e?.code??"")),void 0,"none"===n.maxHeight?null:$d(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return Ch(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(bm,{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==Ja(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=es(Qa(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Ja(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?Ch(l,t,n,o,i):e.createElement(Is,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?Ch(i,t,n,o,o.d2Props||{}):e.createElement(Ui,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return Sh(a,t,n,o);const s=r.code_block;return s?Sh(s,t,n,o):o.renderCodeBlocksAsPre||"mermaid"===l?e.createElement(Kn,{key:n,node:t}):e.createElement(Ir,{key:n,node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:o.codeBlockThemes?.monacoOptions,themes:o.codeBlockThemes?.themes,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...xh(o.codeBlockProps,{omit:["langs"]})})}(t,n,o,r);case"strong":return kh(zm,t,n,{},De(t.children,o,`${String(n)}-strong`,Mh));case"emphasis":return kh(il,t,n,{},De(t.children,o,`${String(n)}-em`,Mh));case"strikethrough":return kh(Wm,t,n,{},De(t.children,o,`${String(n)}-strike`,Mh));case"highlight":return kh($l,t,n,{},De(t.children,o,`${String(n)}-highlight`,Mh));case"insert":return kh(tc,t,n,{},De(t.children,o,`${String(n)}-insert`,Mh));case"subscript":return kh(qm,t,n,{},De(t.children,o,`${String(n)}-sub`,Mh));case"superscript":return kh(Ym,t,n,{},De(t.children,o,`${String(n)}-sup`,Mh));case"checkbox":case"checkbox_input":return kh(Ct,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return kh(nl,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(fh);case"math_inline":return kh(Nd,t,n,{});case"math_block":return kh(md,t,n,{});case"reference":return kh(Am,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?kh(fa,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):kh(Oa,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return kh(wh,t,n,{ctx:o,renderNode:Mh,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return kh(Tm,t,n,{})}}var Nh=/* @__PURE__ */N(100),$h=/* @__PURE__ */Symbol(Nh),Bh=/* @__PURE__ */Symbol(Nh+1),Th=/* @__PURE__ */Symbol(Nh+2),Lh=/* @__PURE__ */Symbol(Nh+3),Eh=/* @__PURE__ */Symbol(Nh+4),jh=/* @__PURE__ */Symbol(Nh+5),Dh=/* @__PURE__ */Symbol(Nh+6),Ph=/* @__PURE__ */Symbol(Nh+7),_h=/* @__PURE__ */Symbol(Nh+8),Rh=/* @__PURE__ */Symbol(Nh+9),Ah=/* @__PURE__ */Symbol(Nh+10),Fh=/* @__PURE__ */Symbol(Nh+11),Hh=/* @__PURE__ */Symbol(Nh+12),Wh=/* @__PURE__ */Symbol(Nh+13),Ih=/* @__PURE__ */Symbol(Nh+14),Oh=/* @__PURE__ */Symbol(Nh+15),zh=/* @__PURE__ */Symbol(Nh+16),Kh=/* @__PURE__ */Symbol(Nh+17),Vh=/* @__PURE__ */Symbol(Nh+18),qh=/* @__PURE__ */Symbol(Nh+19),Uh=/* @__PURE__ */Symbol(Nh+20),Xh=/* @__PURE__ */Symbol(Nh+21),Yh=/* @__PURE__ */Symbol(Nh+22),Zh=/* @__PURE__ */Symbol(Nh+23),Gh=/* @__PURE__ */Symbol(Nh+24),Jh=/* @__PURE__ */Symbol(Nh+25),Qh=/* @__PURE__ */Symbol(Nh+26),ef=/* @__PURE__ */Symbol(Nh+27),tf=/* @__PURE__ */Symbol(Nh+28),nf=/* @__PURE__ */Symbol(Nh+29),of=/* @__PURE__ */Symbol(Nh+30),rf=/* @__PURE__ */Symbol(Nh+31),lf=/* @__PURE__ */Symbol(Nh+32),af=/* @__PURE__ */Symbol(Nh+33),sf=/* @__PURE__ */Symbol(Nh+34),cf=/* @__PURE__ */Symbol(Nh+35),df=/* @__PURE__ */Symbol(Nh+36),uf=/* @__PURE__ */Symbol(Nh+37),mf=/* @__PURE__ */Symbol(Nh+38),hf=/* @__PURE__ */Symbol(Nh+39),ff=/* @__PURE__ */Symbol(Nh+40),pf=/* @__PURE__ */Symbol(Nh+41),gf=/* @__PURE__ */Symbol(Nh+42),yf=/* @__PURE__ */Symbol(Nh+43),bf=/* @__PURE__ */Symbol(Nh+44),wf=/* @__PURE__ */Symbol(Nh+45),vf=/* @__PURE__ */Symbol(Nh+46),xf=/* @__PURE__ */Symbol(Nh+47),kf=/* @__PURE__ */Symbol(Nh+48),Sf=/* @__PURE__ */Symbol(Nh+49),Cf=/* @__PURE__ */Symbol(Nh+50),Mf=/* @__PURE__ */Symbol(Nh+51),Nf=/* @__PURE__ */Symbol(Nh+52),$f=/* @__PURE__ */Symbol(Nh+53),Bf=/* @__PURE__ */Symbol(Nh+54),Tf=/* @__PURE__ */Symbol(Nh+55),Lf=/* @__PURE__ */Symbol(Nh+56),Ef=/* @__PURE__ */Symbol(Nh+57),jf=/* @__PURE__ */Symbol(Nh+58),Df=/* @__PURE__ */Symbol(Nh+59),Pf=/* @__PURE__ */Symbol(Nh+60),_f=/* @__PURE__ */Symbol(Nh+61),Rf=/* @__PURE__ */Symbol(Nh+62),Af=/* @__PURE__ */Symbol(Nh+63),Ff=/* @__PURE__ */Symbol(Nh+64),Hf=/* @__PURE__ */Symbol(Nh+65),Wf=/* @__PURE__ */Symbol(Nh+66),If=/* @__PURE__ */Symbol(Nh+67),Of=/* @__PURE__ */Symbol(Nh+68),zf=/* @__PURE__ */Symbol(Nh+69),Kf=/* @__PURE__ */Symbol(Nh+70),Vf=/* @__PURE__ */Symbol(Nh+71),qf=/* @__PURE__ */Symbol(Nh+72),Uf=/* @__PURE__ */Symbol(Nh+73),Xf=/* @__PURE__ */Symbol(Nh+74),Yf=/* @__PURE__ */Symbol(Nh+75),Zf=/* @__PURE__ */Symbol(Nh+76),Gf=/* @__PURE__ */Symbol(Nh+77),Jf=/* @__PURE__ */Symbol(Nh+78),Qf=/* @__PURE__ */Symbol(Nh+79),ep=/* @__PURE__ */Symbol(Nh+80),tp=/* @__PURE__ */Symbol(Nh+81),np=/* @__PURE__ */Symbol(Nh+82),op=/* @__PURE__ */Symbol(Nh+83),rp=/* @__PURE__ */Symbol(Nh+84),ip=/* @__PURE__ */Symbol(Nh+85),lp=/* @__PURE__ */Symbol(Nh+86),ap=/* @__PURE__ */Symbol(Nh+87),sp=/* @__PURE__ */Symbol(Nh+88),cp=/* @__PURE__ */Symbol(Nh+89),dp=/* @__PURE__ */Symbol(Nh+90),up=/* @__PURE__ */Symbol(Nh+91),mp=/* @__PURE__ */Symbol(Nh+92),hp=/* @__PURE__ */Symbol(Nh+93),fp=/* @__PURE__ */Symbol(Nh+94),pp=/* @__PURE__ */Symbol(Nh+95),gp=/* @__PURE__ */Symbol(Nh+96),yp=/* @__PURE__ */Symbol(Nh+97),bp=/* @__PURE__ */Symbol(Nh+98),wp=/* @__PURE__ */Symbol(Nh+99),vp={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},xp=oe();function kp(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 Sp(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],$h),n=Y(t,Bh);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 Cp=e.memo(({node:e,nodeKey:t,renderCtx:n})=>Mh(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Mp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J(Th,et,Th),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,h=Math.max(0,e.liveNodeBuffer??60),f=Math.max(1,e.maxLiveNodes??320),p=(e.maxLiveNodes??0)>0&&t.length>f,g=!1!==e.viewportPriority,y=m&&(e.maxLiveNodes??0)<=0,b=X(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&g,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,g,p],Lh),[w,v]=Z(()=>y?Math.min(t.length,u):t.length,Eh),k=Y(w,jh);q(()=>{k.current=w},[w],Dh);const M=y?w:t.length,[N,$]=Z(0,Ph),[B,T]=Z({start:0,end:t.length},_h),E=Y(/* @__PURE__ */new Map,Rh),[j,D]=Z(0,Ah),P=Y({},Fh),_=Y(/* @__PURE__ */new Map,Hh),R=Y(/* @__PURE__ */new Map,Wh),A=Y(/* @__PURE__ */new Map,Ih),F=Y(/* @__PURE__ */new Map,Oh),H=Y(/* @__PURE__ */new Set,zh),W=Y(w,Kh),I=Y(null,Vh),O=Y(null,qh),z=Y(null,Uh),V=Y(!1,Xh),U=Y(null,Yh),G=Y(Math.max(1,d||1),Zh),Q=Y(t.length,Gh),ee=Y({key:e.indexKey,total:t.length},Jh),te=Y({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:y},Qh),ne=b||p,oe=X(()=>{const e=E.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[j],ef),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],tf);Q.current=X(()=>{if(!p)return t.length;const e=Math.max(B.end+h,u),n=Math.min(t.length,e);return Math.max(w,n)},[t.length,p,B.end,h,u,w],nf);const ie=K((e,t)=>{if(e>=t)return 0;const n=E.current;let o=0;for(let r=e;r<t;r++)o+=n.get(r)??oe;return o},[oe],of),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!=I.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(I.current),I.current=null),null!=O.current&&(window.clearTimeout(O.current),O.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),V.current=!1,U.current=null},[],rf),ce=K(t=>{if(!y)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)))},[y,e.renderBatchBudgetMs,d],lf),de=K((t,n={})=>{if(!y)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();v(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=>{I.current=null,O.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?I.current=requestAnimationFrame(()=>{0!==d?O.current=window.setTimeout(()=>a(),d):a()}):O.current=window.setTimeout(()=>a(),d)}},[ce,c,y,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],af);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!==y;if(te.current={batchSize:d,initial:u,delay:a,enabled:y},(i||c||!y)&&se(),(i||c)&&(G.current=Math.max(1,d||1),H.current.clear()),!o)return k.current=0,void v(0);const m=Q.current;if(!y)return k.current=m,void v(m);if(i||c){const e=Math.min(m,u);return k.current=e,v(e),void(e<m&&de(Math.max(1,u),{immediate:!s}))}const h=Math.min(k.current,m);h!==k.current&&(k.current=h,v(h)),k.current<m&&de(Math.max(1,d||1))},[se,y,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],sf),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-h),r=Math.min(e,n+h+1);const i=r-o;if(i>f){const e=i-f;o+=Math.ceil(e/2),r-=Math.floor(e/2)}else if(i<f){const t=f-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,h,f,t.length,p],cf),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],df);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))},[],uf);q(()=>{ue(M)},[ue,M],mf),q(()=>{const e=t.length;let n=!1;for(const t of Array.from(E.current.keys()))t>=e&&(E.current.delete(t),n=!0);n&&D(e=>e+1);for(const t of Object.keys(P.current))Number(t)>=e&&delete P.current[t];for(const t of Array.from(H.current))t>=e&&H.current.delete(t)},[t.length],hf);const me=K((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],ff),he=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],pf),fe=K((e,t)=>{const n=R.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return he(e),b&&!t&&delete P.current[e],void(t&&me(e,!0));if(e<u&&!p)return he(e),void me(e,!0);he(e);const o=a(t,{rootMargin:"400px"});_.current.set(e,o),o.isVisible()&&me(e,!0),o.whenVisible.then(()=>me(e,!0)).catch(()=>{})},[b,he,me,a,u,ne,p],gf),pe=K(e=>{const t=A.current.get(e);if(t)return t;const n=t=>fe(e,t);return A.current.set(e,n),n},[fe],yf),ge=K((e,t)=>{if(!t)return void(E.current.has(e)&&(E.current.delete(e),D(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&E.current.get(e)!==n&&(E.current.set(e,n),D(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],bf),ye=K(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ge(e,t);return F.current.set(e,n),n},[ge],wf),be=K(e=>!(y&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,y,u],vf),we=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],xf);q(()=>{for(const[e,t]of R.current.entries())t&&fe(e,t)},[fe],kf),q(()=>{p&&w>W.current&&$(w-1),W.current=w},[w,p],Sf);const ve=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:we(e.onMouseOver),onMouseOut:we(e.onMouseOut)},()=>L([ve,re.map(({node:t,index:r})=>{const i=be(r),l=E.current.get(r)??oe,a=!1!==e.fade&&"code_block"!==t.type&&!H.current.has(r)&&i;return a&&H.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:ye(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>x(Cp,{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 Np(t){const n={...vp,...t},o=Y(null,Cf),r=Y(null,Mf),i=Y(/* @__PURE__ */new Map,Nf),l=Y(0,$f),a=Y(null,Bf),s=J(Tf,gt,n.smoothStreamingOptions,Tf),c=e.useContext(ze),d=Y(/* @__PURE__ */new Set,Lf),[u,m]=Z(()=>!0===n.smoothStreaming,Ef);q(()=>{m(!0)},[],jf);const h=Array.isArray(n.nodes)&&n.nodes.length>0,f=X(()=>!1!==n.smoothStreaming&&!h&&(!0===n.smoothStreaming||!c)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[h,c,n.maxLiveNodes,n.smoothStreaming,n.typewriter],Df),p=u&&f,g=p?s.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Pf),b=n.content??"",w=h||s.source===b,v=X(()=>p&&null!=y?Boolean(y&&w&&s.caughtUp):y,[y,w,s.caughtUp,p],_f),k=Y(null,Rf),[M,N]=Z(!1,Af),$=Y(void 0,Ff),B=Y(0,Hf),T=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],Wf),L=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&T.has(t)},[T],If),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},[],Of),j=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+E(t),0):(n.content??"").length,[n.nodes,n.content,E],zf),D=K(()=>{$.current&&(clearTimeout($.current),$.current=void 0)},[],Kf),P=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},[],Vf),_=K(()=>{if("undefined"==typeof window||!M||!o.current||!k.current)return;const e=o.current,t=k.current,n=P(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`},[M,o,P],qf);q(()=>{M&&requestAnimationFrame(()=>{_()})},[M,_],Uf),q(()=>()=>{D()},[D],Xf);const R=h?n.nodes:g;a.current!==R&&(l.current+=1,a.current=R);const A=G(lt,at,at,Yf),F=X(()=>ct(n.customId),[n.customId,A],Zf),H=J(Gf,Sp,n.streamingComponents,Gf),W=J(Jf,Sp,n.htmlComponents,Jf);q(()=>{!function(e,t,n){if(tt())for(const o of Object.keys(e))t[o]&&!n.has(o)&&(n.add(o),console.warn(`[markstream-octane] "${o}" was provided in both streamingComponents and htmlComponents. The streamingComponents entry will be used for parser-backed rendering.`))}(H,W,d.current)},[W,H],Qf);const I=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],ep),O=X(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return se(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(H))},[n.customId,n.customHtmlTags,n.parseOptions,A,H],tp),z=X(()=>{const e=O;return e&&0!==e.length?oe(I,{customHtmlTags:e}):oe(I)},[I,O],np),V=X(()=>{const e=z;return n.customMarkdownIt?n.customMarkdownIt(e):e},[z,n.customMarkdownIt],op),U=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],rp),Q=X(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return h?o=n.nodes.map(e=>({...e})):g&&(o=de(g,V??xp,U)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:g.length}),o},[n.debugPerformance,g,h,n.nodes,U,V,n.customId,A,O],ip),ee=K(()=>{const e=Q[Q.length-1];return!L(e)},[Q,L],lp);q(()=>{if("undefined"==typeof window||h)return;if(v)return N(!1),void D();const e=j(),t=ee();return!1===n.typewriter||!t||e<=B.current?(!1!==n.typewriter&&t||N(!1),void(B.current=e)):(B.current=e,N(!0),D(),requestAnimationFrame(()=>{_()}),$.current=setTimeout(()=>{N(!1)},3e3),()=>{D()})},[g,n.nodes,n.typewriter,n.content,v,Q.length,h,j,ee,D,_],ap);const te=Y([],sp),ne=U?.postTransformNodes,re=Y(ne,cp);re.current!==ne&&(te.current=[],re.current=ne);const ie=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&&kp(i,e[r])?n[r]=i:(n[r]=e[r],o=!1)}return o?t:n}(Q,te.current);te.current=ie,q(()=>{if(h)return void s.reset("");const e=n.content??"";if(!p)return s.reset(e),void(y&&s.finish({flush:!0}));const t=s.getSnapshot().source;e?e===t||(e.startsWith(t)?s.enqueue(e.slice(t.length)):s.reset(e)):s.reset(""),y&&s.finish()},[h,n.content,y,p],dp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!ie.some(e=>"code_block"===e?.type&&"mermaid"!==qt(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(()=>{un()},{timeout:900});return()=>t(o)},[ie,n.renderCodeBlocksAsPre],up),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&r.current!==t&&(r.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Nn.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Nn.set(e,t),t}catch{}const n="__theme_"+ ++$n;return Nn.set(e,n),n}return String(e)}(e);t&&Sn!==t&&(kn=e,Sn=t,Cn&&xn(kn,Cn).then(()=>Bn()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre],mp);const le=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],hp),ae=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],fp),ce=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],pp),ue=X(()=>({...n.d2Props||{}}),[n.d2Props],gp),me=X(()=>({...n.infographicProps||{}}),[n.infographicProps],yp),he=X(()=>({customId:n.customId,isDark:n.isDark,final:v,indexKey:le,typewriter:n.typewriter,fade:n.fade,textStreamState:i.current,streamRenderVersion:l.current,customComponents:F,streamingComponents:H,htmlComponents:W,customHtmlTags:O,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:ae,mermaidProps:ce,d2Props:ue,infographicProps:me,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,langs:n.langs,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,v,le,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,O,ae,ce,ue,me,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.langs,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,F,H,W],bp);he.streamRenderVersion=l.current,he.textStreamState=i.current;const fe=Y(null,wp);return fe.current||(fe.current={textStreamState:i.current,getStreamRenderVersion:()=>l.current}),S(Ke.Provider,{value:fe.current},()=>S(ze.Provider,{value:p},()=>S(Qe,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(Mp,{props:n,parsedNodes:ie,renderCtx:he,indexPrefix:le,containerRef:o,showTypewriterCursor:M,typewriterCursorRef:k})))))}var $p=/* @__PURE__ */O('<blockquote class="blockquote-node" dir="auto"></blockquote>'),Bp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w($p);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):H(e,n),o.e=n}}});function Tp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(Bp,{h0:t.cite,h1:i??(n&&o?C(()=>x(Np,{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,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMonacoOptions:n.codeBlockThemes?.monacoOptions,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}Tp.$$singleRoot=!0;var Lp=/* @__PURE__ */O('<div><!><!><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Ep=/* @__PURE__ */N(72),jp=/* @__PURE__ */Symbol(Ep),Dp=/* @__PURE__ */Symbol(Ep+1),Pp=/* @__PURE__ */Symbol(Ep+2),_p=/* @__PURE__ */Symbol(Ep+3),Rp=/* @__PURE__ */Symbol(Ep+4),Ap=/* @__PURE__ */Symbol(Ep+5),Fp=/* @__PURE__ */Symbol(Ep+6),Hp=/* @__PURE__ */Symbol(Ep+7),Wp=/* @__PURE__ */Symbol(Ep+8),Ip=/* @__PURE__ */Symbol(Ep+9),Op=/* @__PURE__ */Symbol(Ep+10),zp=/* @__PURE__ */Symbol(Ep+11),Kp=/* @__PURE__ */Symbol(Ep+12),Vp=/* @__PURE__ */Symbol(Ep+13),qp=/* @__PURE__ */Symbol(Ep+14),Up=/* @__PURE__ */Symbol(Ep+15),Xp=/* @__PURE__ */Symbol(Ep+16),Yp=/* @__PURE__ */Symbol(Ep+17),Zp=/* @__PURE__ */Symbol(Ep+18),Gp=/* @__PURE__ */Symbol(Ep+19),Jp=/* @__PURE__ */Symbol(Ep+20),Qp=/* @__PURE__ */Symbol(Ep+21),eg=/* @__PURE__ */Symbol(Ep+22),tg=/* @__PURE__ */Symbol(Ep+23),ng=/* @__PURE__ */Symbol(Ep+24),og=/* @__PURE__ */Symbol(Ep+25),rg=/* @__PURE__ */Symbol(Ep+26),ig=/* @__PURE__ */Symbol(Ep+27),lg=/* @__PURE__ */Symbol(Ep+28),ag=/* @__PURE__ */Symbol(Ep+29),sg=/* @__PURE__ */Symbol(Ep+30),cg=/* @__PURE__ */Symbol(Ep+31),dg=/* @__PURE__ */Symbol(Ep+32),ug=/* @__PURE__ */Symbol(Ep+33),mg=/* @__PURE__ */Symbol(Ep+34),hg=/* @__PURE__ */Symbol(Ep+35),fg=/* @__PURE__ */Symbol(Ep+36),pg=/* @__PURE__ */Symbol(Ep+37),gg=/* @__PURE__ */Symbol(Ep+38),yg=/* @__PURE__ */Symbol(Ep+39),bg=/* @__PURE__ */Symbol(Ep+40),wg=/* @__PURE__ */Symbol(Ep+41),vg=/* @__PURE__ */Symbol(Ep+42),xg=/* @__PURE__ */Symbol(Ep+43),kg=/* @__PURE__ */Symbol(Ep+44),Sg=/* @__PURE__ */Symbol(Ep+45),Cg=/* @__PURE__ */Symbol(Ep+46),Mg=/* @__PURE__ */Symbol(Ep+47),Ng=/* @__PURE__ */Symbol(Ep+48),$g=/* @__PURE__ */Symbol(Ep+49),Bg=/* @__PURE__ */Symbol(Ep+50),Tg=/* @__PURE__ */Symbol(Ep+51),Lg=/* @__PURE__ */Symbol(Ep+52),Eg=/* @__PURE__ */Symbol(Ep+53),jg=/* @__PURE__ */Symbol(Ep+54),Dg=/* @__PURE__ */Symbol(Ep+55),Pg=/* @__PURE__ */Symbol(Ep+56),_g=/* @__PURE__ */Symbol(Ep+57),Rg=/* @__PURE__ */Symbol(Ep+58),Ag=/* @__PURE__ */Symbol(Ep+59),Fg=/* @__PURE__ */Symbol(Ep+60),Hg=/* @__PURE__ */Symbol(Ep+61),Wg=/* @__PURE__ */Symbol(Ep+62),Ig=/* @__PURE__ */Symbol(Ep+63),Og=/* @__PURE__ */Symbol(Ep+64),zg=/* @__PURE__ */Symbol(Ep+65),Kg=/* @__PURE__ */Symbol(Ep+66),Vg=/* @__PURE__ */Symbol(Ep+67),qg=/* @__PURE__ */Symbol(Ep+68),Ug=/* @__PURE__ */Symbol(Ep+69),Xg=/* @__PURE__ */Symbol(Ep+70),Yg=/* @__PURE__ */Symbol(Ep+71),Zg=["r","a","b"],Gg=/* @__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,h,f;const p=w(Lp);{const l=e.h0;n=l,i=p,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=p,a=p,s=p;const b=y(p);c=b,d=p;const v=W(b,1);u=v,m=p;const x=W(v,1);h=x,f=W(x,1),r=g(t,p,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:s,h:c,i:null,j:void 0,k:d,l:u,m:null,n:void 0,o:m,p:h,q:null,r:void 0,s:f,t:null,u:void 0}),t.refFields=Zg}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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 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):H(e,n)}}{const n=e.h4,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.n!==n){r.n=n;const e=r.m;null==e||o||null===n?r.m=z(t,2,r.k,n,r.l,!0):H(e,n)}}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.r!==n){r.r=n;const e=r.q;null==e||o||null===n?r.q=z(t,3,r.o,n,r.p,!0):H(e,n)}}{const n=e.h6,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.u!==n){const e=r.t;null==e||o||null===n?r.t=b(t,4,r.s,n,e):H(e,n),r.u=n}}}),Jg=tt();function Qg(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(String.fromCharCode(34),"&quot;").replaceAll(String.fromCharCode(39),"&#39;")}function ey(e){const n={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0,...e},o=X(()=>String(n.node.language??""),[n.node.language],jp),r=X(()=>qt(o),[o],Dp),[i,l]=Z(0,Pp);q(()=>Zt(()=>{l(e=>e+1)}),[],_p);const a=X(()=>{const e=Jt[r]||r;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[r],Rp),s=X(()=>Gt(r),[r,i],Ap),{t:c}=J(Fp,$t,Fp),d=X(()=>!!n.isShowPreview&&("html"===r||"svg"===r),[r,n.isShowPreview],Hp),u=X(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=t(n.minWidth),r=t(n.maxWidth);return o&&(e.minWidth=o),r&&(e.maxWidth=r),e},[n.maxWidth,n.minWidth],Wp),[m,h]=Z(!1,Ip),[f,p]=Z(!1,Op),[g,y]=Z(!1,zp),[b,w]=Z(()=>n.node.code?`<pre class="shiki shiki-fallback"><code>${Qg(n.node.code)}</code></pre>`:"",Kp),[v,k]=Z(!1,Vp),[M,N]=Z(14,qp),[$,B]=Z(M,Up),T=X(()=>!1!==n.showTooltips,[n.showTooltips],Xp),E=ke(n.themes,n.langs),j=Y(null,Yp);j.current&&j.current.key===E||(j.current={key:E,themes:n.themes,langs:n.langs});const D=Y(null,Zp),P=Y(null,Gp),_=Y(null,Jp),R=Y(null,Qp),A=Y(null,eg),F=Y("",tg),H=Y("",ng),W=Y(0,og),I=Y(null,rg),O=Y(null,ig),z=Y(null,lg),V=Y(!1,ag),U=Y(!1,sg),G=Y(null,cg),Q=Y(!1,dg),ee=Y(/* @__PURE__ */new Set,ug),te=Y(/* @__PURE__ */new Set,mg),ne=Y("",hg),oe=Y(0,fg),re=Y(E,pg),ie=Y(0,gg),le=Y(!0,yg),ae=Y(null,bg),se=J(wg,et,wg),[ce,de]=Z(()=>"undefined"==typeof window,vg),ue=K(()=>n.isDark?n.darkTheme:n.lightTheme,[n.darkTheme,n.isDark,n.lightTheme],xg),me=K(e=>{e?.disconnect(),e&&R.current!==e||(R.current=null)},[],kg),he=K(()=>{_.current&&(_.current.innerHTML="")},[],Sg),fe=K(e=>{if(I.current=null,me(),!e)return he(),H.current="",w(""),void k(!1);w(`<pre class="shiki shiki-fallback"><code>${Qg(e)}</code></pre>`),k(!1)},[he,me],Cg),pe=K(()=>{me(),w(""),k(!0)},[me],Mg),ge=K(e=>{H.current=e,pe()},[pe],Ng),ye=K(()=>{const e=_.current;return!!e&&(e.childNodes.length>0||Boolean(e.textContent?.trim().length))},[],$g),be=K((e=!0)=>{const t=A.current;me(),A.current=null,F.current="",H.current="",I.current=null,ee.current.clear();try{t?.dispose()}catch(n){Jg&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to dispose Shiki renderer.",n)}finally{he(),e&&k(!1)}},[he,me],Bg),we=K(()=>(ie.current+=1,ie.current),[],Tg),ve=K(e=>le.current&&ie.current===e,[],Lg),xe=K((e,t)=>{me();const n=_.current;if(!n||"undefined"==typeof MutationObserver)return;I.current=null;const o=new MutationObserver(()=>{W.current+=1;const n=I.current;if(n)return ve(e)?void(W.current!==t&&ye()&&(I.current=null,me(o),ge(n))):(I.current=null,void me(o))});R.current=o,o.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0})},[me,ye,ve,ge],Eg),Ne=K(async(e,t,n,o)=>{if(I.current=n,await Promise.resolve(),!ve(e))return;const r=ye(),i=W.current!==t,l=void 0!==o&&_.current?.innerHTML!==o;r&&(!H.current||i||l||H.current===n)&&(I.current=null,me(),ge(n))},[me,ye,ve,ge],jg),$e=K(async()=>{if(!O.current&&!V.current)return z.current||(z.current=(async()=>{try{const e=await import("stream-markdown"),t=e.createShikiStreamRenderer;if("function"!=typeof t)throw new TypeError("stream-markdown.createShikiStreamRenderer is not available");O.current=t;const n=e.registerHighlight;G.current="function"==typeof n?n:null,V.current=!1,U.current=!1}catch(e){V.current=!0,Jg&&!U.current&&"undefined"!=typeof console&&(U.current=!0,console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e))}finally{z.current=null}})()),z.current},[],Dg),Be=K(async e=>{const t=e.key;if(re.current!==t)return"stale";if(!G.current)return"ready";if(ne.current===t)return"ready";const n=++oe.current;try{await Me(G.current,e.registerOptions,t)}catch{return n!==oe.current||re.current!==t?"stale":"failed"}return n!==oe.current||re.current!==t?"stale":(ne.current=t,"ready")},[],Pg),Te=K(async e=>{const t=await Be(e);return"failed"!==t?t:re.current!==e.key?"stale":Be(e)},[Be],_g),Le=K(e=>{const t={hasRegisterHighlight:Boolean(G.current),hasCreateRenderer:Boolean(O.current)},n=Se(e?.themes,e?.langs,t),o=n.rendererOptions.langs?.length&&te.current.has(n.key)?Se(e?.themes,void 0,t):n;return n.ignoredLangs&&Jg&&!Q.current&&"undefined"!=typeof console&&(Q.current=!0,console.warn("[MarkdownCodeBlockNode] `langs` requires stream-markdown >=0.0.15 with registerHighlight(); ignoring `langs` and using stream-markdown default language preload.")),{key:o.key,registerOptions:o.registerOptions,rendererOptions:o.rendererOptions}},[],Rg),Ee=K(async(e,t,n)=>{const o=A.current;if(!o||!ve(n))return;const r=function(e){return Ce(e)||"plaintext"}(t),i=async t=>{const o=A.current;if(o&&ve(n)){t&&"plaintext"!==r&&ee.current.add(r);try{return await o.updateCode(e,"plaintext"),ve(n)?"plaintext":void 0}catch{return}}};if("plaintext"!==r&&ee.current.has(r))return i();try{return await o.updateCode(e,r),ve(n)?r:void 0}catch(l){if(!ve(n)||"plaintext"===r)return;return i(l)}},[ve],Ag),je=K(async()=>{const e=we(),t=n.node.code,o=n.node.language,r=j.current;if(!ce)return void fe(t);if(await $e(),!ve(e))return;let i=Le(r),l=i.key;re.current=l;let a=Boolean(A.current&&F.current!==l);a&&fe(t);let s=await Te(i);if("failed"===s&&i.rendererOptions.langs?.length&&(te.current.add(i.key),Jg&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to register configured Shiki languages; retrying without `langs`.",{langs:i.rendererOptions.langs}),i=Le({themes:r?.themes,langs:void 0}),l=i.key,re.current=l,s=await Te(i)),!ve(e)||"stale"===s)return;if(a=Boolean(A.current&&F.current!==l),"failed"===s)return void(a&&A.current&&ye()?pe():fe(t));if(a&&be(),!P.current||!_.current)return void fe(t);if(!A.current&&O.current&&(A.current=O.current(_.current,{theme:ue(),themes:i.rendererOptions.themes,langs:i.rendererOptions.langs}),F.current=l,k(!0)),!A.current)return void fe(t);if(!1===n.stream&&n.loading)return void fe(t);fe(t);const c=W.current,d=_.current?.innerHTML;xe(e,c);const u=await Ee(t,o,e);ve(e)&&(u?await Ne(e,c,function(e,t,n){return`${e??""}\0${t}\0${n}`}(l,u,t),d):(I.current=null,me()))},[we,n.node.code,n.node.language,n.stream,n.loading,E,ce,$e,Le,Te,be,pe,ue,ye,fe,xe,Ee,Ne,me,ve],Fg);q(()=>{const e=D.current;if(!e)return;let t=!0;const n=se(e,{rootMargin:"400px"});return ae.current=n,n.isVisible()&&de(!0),n.whenVisible.then(()=>{t&&de(!0)}),()=>{t=!1,n.destroy(),ae.current=null}},[se],Hg),q(()=>{je().catch(()=>{le.current&&_.current&&fe(n.node.code)})},[je,n.node.code,fe],Wg),q(()=>(le.current=!0,()=>{le.current=!1,ie.current+=1,be(!1)}),[be],Ig),q(()=>{A.current&&ce&&A.current.setTheme(ue())},[ue,ce],Og),q(()=>{T||At(!0)},[T],zg);const De=K((e,t)=>{if(!T)return;const o=e.currentTarget;o&&!o.disabled&&Rt(o,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),n.isDark)},[n.isDark,T],Kg),Pe=K(()=>{T&&At()},[T],Vg),_e=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(n.node.code),h(!0),n.onCopy?.(n.node.code),setTimeout(()=>h(!1),1e3)}catch{}},[n],qg),Re=K(()=>{if(!d)return;const e="html"===r?"text/html":"image/svg+xml",t="html"===r?"HTML Preview":"SVG Preview";n.onPreviewCode?.({type:e,content:n.node.code,title:t})},[r,d,n],Ug),Ae=X(()=>({fontSize:`${$}px`}),[$],Xg),Fe=()=>B(e=>Math.max(10,e-1)),He=()=>B(e=>Math.min(36,e+1)),We=()=>B(M);return q(()=>{N(14),B(14)},[],Yg),x(Gg,{h0:D,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),h2:u,h3:n.showHeader&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"}},()=>L([S("div",{className:"flex items-center space-x-2"},()=>L([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:s}})),S("span",{className:"text-sm font-medium font-mono"},()=>a)])),S("div",{className:"flex items-center space-x-2"},()=>L([n.showCollapseButton&&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":g,onClick:()=>y(e=>!e),onMouseEnter:e=>De(e,g?c("common.expand")||"Expand":c("common.collapse")||"Collapse"),onFocus:e=>De(e,g?c("common.expand")||"Expand":c("common.collapse")||"Collapse"),onMouseLeave:Pe,onBlur:Pe},()=>C(()=>x("svg",{style:{rotate:g?"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.showFontSizeButtons&&n.enableFontSizeControl&&S(t,{},()=>L([C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$<=10,onClick:Fe,onMouseEnter:e=>De(e,c("common.decrease")||"Decrease"),onFocus:e=>De(e,c("common.decrease")||"Decrease"),onMouseLeave:Pe,onBlur:Pe},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:$===M,onClick:We,onMouseEnter:e=>De(e,c("common.reset")||"Reset"),onFocus:e=>De(e,c("common.reset")||"Reset"),onMouseLeave:Pe,onBlur:Pe},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:$>=36,onClick:He,onMouseEnter:e=>De(e,c("common.increase")||"Increase"),onFocus:e=>De(e,c("common.increase")||"Increase"),onMouseLeave:Pe,onBlur:Pe},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"}))))])),n.showCopyButton&&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":m?c("common.copied")||"Copied":c("common.copy")||"Copy",onClick:_e,onMouseEnter:e=>De(e,m?c("common.copied")||"Copied":c("common.copy")||"Copy"),onFocus:e=>De(e,m?c("common.copied")||"Copied":c("common.copy")||"Copy"),onMouseLeave:Pe,onBlur:Pe},()=>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"},m?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.showExpandButton&&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":f,onClick:e=>{p(e=>!e),De(e,f?c("common.expand")||"Expand":c("common.collapse")||"Collapse")},onMouseEnter:e=>De(e,f?c("common.collapse")||"Collapse":c("common.expand")||"Expand"),onFocus:e=>De(e,f?c("common.collapse")||"Collapse":c("common.expand")||"Expand"),onMouseLeave:Pe,onBlur:Pe},()=>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",f?{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"})))),d&&n.showPreviewButton&&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":c("common.preview")||"Preview",onClick:Re,onMouseEnter:e=>De(e,c("common.preview")||"Preview"),onFocus:e=>De(e,c("common.preview")||"Preview"),onMouseLeave:Pe,onBlur:Pe},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"})))))]))]))),h4:!g&&(!!n.stream||!n.loading)&&C(()=>S("div",{ref:P,className:"code-block-content",style:{...Ae,maxHeight:f?"none":"500px",overflowY:f?"visible":"auto",overflowX:"auto"}},()=>L([C(()=>x("div",{ref:_,className:"code-block-render"})),!v&&b&&C(()=>x("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:b}}))]))),h5:!n.stream&&n.loading&&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"}))),h6:m?c("common.copied")||"Copied":""})}ey.$$singleRoot=!0;var ty=/* @__PURE__ */N(5),ny=/* @__PURE__ */Symbol(ty),oy=/* @__PURE__ */Symbol(ty+1),ry=/* @__PURE__ */Symbol(ty+2),iy=/* @__PURE__ */Symbol(ty+3),ly=/* @__PURE__ */Symbol(ty+4);function ay(e){const t=Y(null,ny),[n,o]=Z(!1,oy),[r,i]=Z({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},ry),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],iy);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 $e(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[Te(e.offset??8),Be(),Le({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=Ne(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],ly),"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{Oe as AdmonitionNode,Tp as BlockquoteNode,Ct as CheckboxNode,Ir as CodeBlockNode,Ir as OctaneCodeBlockNode,Ui as D2BlockNode,Qi as DefinitionListNode,nl as EmojiNode,il as EmphasisNode,Tm as FallbackComponent,cl as FootnoteAnchorNode,ml as FootnoteNode,vl as FootnoteReferenceNode,Sl as HardBreakNode,Cl as HeadingNode,$l as HighlightNode,fa as HtmlBlockNode,Oa as HtmlInlineNode,an as HtmlPreviewFrame,Ga as ImageNode,Is as InfographicBlockNode,Js as InlineCodeNode,tc as InsertNode,Sc as LinkNode,Nc as ListItemNode,$c as ListNode,Hd as MERMAID_WORKER_BUSY_CODE,ey as MarkdownCodeBlockNode,md as MathBlockNode,Nd as MathInlineNode,bm as MermaidBlockNode,Np as NodeRenderer,Np as default,Dm as ParagraphNode,Kn as PreCodeNode,Am as ReferenceNode,Wm as StrikethroughNode,zm as StrongNode,qm as SubscriptNode,Ym as SuperscriptNode,uh as TableNode,pc as TextNode,fh as ThematicBreakNode,ay as Tooltip,wh as VmrContainerNode,Wc as WORKER_BUSY_CODE,zd as canParseOffthread,ut as clearGlobalCustomComponents,zc as clearKaTeXCache,Fc as clearKaTeXWorker,Id as clearMermaidWorker,pt as defineHtmlComponents,ft as defineStreamingComponents,Yr as disableD2,Xr as enableD2,Kd as findPrefixOffthread,mt as getCustomComponentDisplay,ct as getCustomNodeComponents,Xc as getKaTeXBackpressureDefaults,Gt as getLanguageIcon,Fd as getMermaidWorkerLoad,Zr as isD2Enabled,Jt as languageMap,qt as normalizeLanguageIdentifier,Yt as preloadExtendedLanguageIcons,dt as removeCustomComponents,Ic as renderKaTeXInWorker,Yc as renderKaTeXWithBackpressure,Mh as renderNode,Ut as resolveMonacoLanguageId,st as setCustomComponents,Ur as setD2Loader,Nt as setDefaultI18nMap,Uc as setKaTeXBackpressureDefaults,Oc as setKaTeXCache,Kc as setKaTeXConcurrencyLimit,Ac as setKaTeXWorker,Hc as setKaTeXWorkerDebug,zt as setLanguageIconResolver,Wd as setMermaidWorker,Rd as setMermaidWorkerClientDebug,Ad as setMermaidWorkerMaxConcurrency,Zt as subscribeLanguageIconsRevision,Vd as terminateWorker,$t as useSafeI18n,gt as useSmoothMarkdownStream,Vc as waitForKaTeXWorkerSlot,ht 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 g,child as y,childTextHole as b,clone as w,createContext as v,createElement as k,createPortal as x,createScopedElement as S,createScopedValue as C,delegateEvents as M,hookSlots as N,htextSwap as $,mapSlot as B,markDangerouslySetInnerHTMLChildren as L,positionalChildren as T,queueRefAttach as E,queueRefDetach as j,setAriaAttribute as P,setAttribute as D,setCheckedCheckable as _,setClassAttr as R,setHostPropSources as A,setStyle as F,setText as H,sibling as W,snapshotSpread as I,template as O,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 ge,stripCustomHtmlWrapper as ye,toSafeSvgElement as be,tokenAttrsToRecord as we,tokenizeHtml as ve}from"stream-markdown-parser";import{createSmoothMarkdownStream as ke,getHighlightRegistrationKey as xe,getRuntimeShikiRegistrationConfig as Se,normalizeShikiLanguage as Ce,registerHighlightOnce as Me}from"markstream-core";import{autoUpdate as Ne,computePosition as $e,flip as Be,offset as Le,shift as Te}from"@floating-ui/dom";var Ee=/* @__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 je(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 Pe(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,...je(a.attrs)},Pe(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function De(e,t,n,o){return Pe(e,t,`${n}-inline`,o)}var _e=/* @__PURE__ */O('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),Re=/* @__PURE__ */N(3),Ae=/* @__PURE__ */Symbol(Re),Fe=/* @__PURE__ */Symbol(Re+1),He=/* @__PURE__ */Symbol(Re+2),We=/* @__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=w(_e);e=m,n=m;const f=y(m);r=f,i=f;const h=y(f);l=h;const p=W(h,1);a=p,s=f,c=W(p,1),d=m,u=W(f,1),o=g(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&&(D(o.d,"data-index-key",t),o.c=t)}{const t=e.h2;o.e!==t&&(D(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):H(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):H(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):H(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):H(e,n)}}}),Ie={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function Oe(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],Ae),[s,c]=Z(()=>!!t.collapsible&&!(t.open??1),Fe),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],He);return k(We,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Ie[l]&&S("span",{className:"admonition-icon"},()=>Ie[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?Pe(t.children,n,String(r??d),o):null))})}Oe.$$singleRoot=!0;var ze=v(!1),Ke=v(null);function Ve(){return V(Ke)}var qe=/* @__PURE__ */N(3),Ue=/* @__PURE__ */Symbol(qe),Xe=/* @__PURE__ */Symbol(qe+1),Ye=/* @__PURE__ */Symbol(qe+2),Ze=v(null);function Ge(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(),g=()=>{f||(f=!0,p())},y=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,g(),{isVisible:()=>!0,whenVisible:h,destroy:y};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:g,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:y}):(c.current=!0,g(),{isVisible:()=>!0,whenVisible:h,destroy:y})}}var Je=Ge(()=>null,()=>!0);function Qe({getRoot:e,enabled:t=!0,children:n}){const o=Y(t,Ue);o.current=t;const r=Y(e,Xe);r.current=e;const i=X(()=>Ge(()=>r.current?.()??null,()=>o.current),[],Ye);return S(Ze.Provider,{value:i},()=>n)}function et(){return V(Ze)??Je}function tt(){const e=!1;return e}var nt="__global__",ot="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",rt=(()=>{const e=globalThis;if(e[ot])return e[ot];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[ot]=t,t})();function it(){rt.revision++;for(const e of Array.from(rt.listeners))try{e()}catch{}}function lt(e){return rt.listeners.add(e),()=>{rt.listeners.delete(e)}}function at(){return rt.revision}function st(e,t){"string"==typeof e?rt.scopedComponents[e]={...t||{}}:rt.scopedComponents[nt]={...e},it()}function ct(e){const t=rt.scopedComponents[nt]||{};if(!e)return t;const n=rt.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function dt(e){if(e===nt)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete rt.scopedComponents[e],it()}function ut(){delete rt.scopedComponents[nt],it()}function mt(e){return e?.markstreamDisplay}function ft(e,t){return e.markstreamDisplay=t,e}function ht(e){return e}function pt(e){return e}function gt(e={}){const t=Y(null,bt);t.current||(t.current=ke(e));const n=t.current,[o,r]=Z(()=>n.getSnapshot(),wt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],vt),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],kt)}var yt=/* @__PURE__ */N(4),bt=/* @__PURE__ */Symbol(yt),wt=/* @__PURE__ */Symbol(yt+1),vt=/* @__PURE__ */Symbol(yt+2),kt=/* @__PURE__ */Symbol(yt+3),xt=/* @__PURE__ */O('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),St=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=w(xt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function Ct(e){const{node:t}=e;return k(St,{h0:Boolean(t.checked)})}Ct.$$singleRoot=!0;var Mt={"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 Nt(e){Object.assign(Mt,e)}function $t(){return{t:e=>Mt[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 Bt=null,Lt=null,Tt=null,Et=null,jt=null,Pt=null;function Dt(){Et&&(clearTimeout(Et),Et=null),jt&&(clearTimeout(jt),jt=null)}async function _t(e){if(!Bt||!Lt)return;const{x:t,y:n}=await $e(Lt,Bt,{placement:e,middleware:[Le(8),Be(),Te({padding:8})],strategy:"fixed"});Bt.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Rt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Bt||"undefined"==typeof document||((Bt=document.createElement("div")).className="markstream-octane ms-tooltip",Bt.setAttribute("role","tooltip"),Bt.dataset.visible="false",Bt.style.position="fixed",Bt.style.left="0px",Bt.style.top="0px",Bt.style.transform="translate3d(0,0,0)",document.body.appendChild(Bt)),!Bt)return;Dt();const l=async()=>{if(Bt){Lt=e,Bt.textContent=t,Bt.dataset.placement=n,Bt.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",Bt.dataset.visible="false",Pt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bt.id=Pt;try{e.setAttribute("aria-describedby",Pt)}catch{}await _t(n),Bt.dataset.visible="true",Tt?.(),Tt=Ne(e,Bt,()=>{_t(n)})}};o?l():Et=setTimeout(l,80)}function At(e=!1){if(!Bt)return;Dt();const t=()=>{if(Bt){if(Bt.dataset.visible="false",Lt&&Pt)try{Lt.removeAttribute("aria-describedby")}catch{}Lt=null,Pt=null,Tt&&(Tt(),Tt=null)}};e?t():jt=setTimeout(t,120)}var Ft='<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',Ht=null,Wt=null,It=null,Ot=/* @__PURE__ */new Set;function zt(e){Ht=e??null}var Kt={"":"",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"},Vt={"":Ft,plain:Ft,text:Ft,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 qt(e){const t=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}(e);return Kt[t]??t}function Ut(e){const t=qt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}async function Xt(){return Wt||(It||(It=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Wt=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of Ot)try{e()}catch{}}(),Wt)).catch(()=>null)),It)}async function Yt(){await Xt()}function Zt(e){return Ot.add(e),()=>{Ot.delete(e)}}function Gt(e){if(Ht){const t=Ht(e);if(null!=t&&""!==t)return t}const t=qt(e),n=Vt[t];if(n)return n;const o=Wt?.[t];return o||(Xt(),'<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 Jt={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"},Qt=/* @__PURE__ */N(4),en=/* @__PURE__ */Symbol(Qt),tn=/* @__PURE__ */Symbol(Qt+1),nn=/* @__PURE__ */Symbol(Qt+2),on=/* @__PURE__ */Symbol(Qt+3),rn=void 0!==import.meta&&Boolean(!1),ln=null;function an(e){const{t:t}=J(en,$t,en),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],tn),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!rn||"undefined"==typeof console||ln===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")&&(ln=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],nn);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],on),"undefined"==typeof document?null:x(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([k("span",{className:"html-preview-frame__dot"}),S("span",{className:"html-preview-frame__label"},()=>e.title||`HTML ${t("common.preview")}`)])),C(()=>k("button",{type:"button",className:"html-preview-frame__close"+(e.isDark?" html-preview-frame__close--dark":""),onClick:()=>e.onClose?.()},"\n ×\n "))])),C(()=>k("iframe",{className:"html-preview-frame__iframe",sandbox:o,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:n,title:e.title||"Preview"}))]))))),document.body)}var sn=!1,cn=null,dn=!1;async function un(){if(cn)return cn;if(dn)return null;try{return cn=await import("stream-monaco"),await async function(e){if(sn)return;sn=!0;const t=globalThis?.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&e?.preloadMonacoWorkers&&await e.preloadMonacoWorkers()}(cn),cn}catch{return dn=!0,null}}var mn=null,fn=!1,hn=null,pn=null,gn=null,yn=null,bn=null,wn=/* @__PURE__ */new WeakMap,vn=0;function kn(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=wn.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return wn.set(e,t),t}catch{}const n="__theme_"+ ++vn;return wn.set(e,n),n}return String(e)}(e);return n?(mn!==t&&(mn=t),fn||bn!==n?!hn||yn!==n&&pn!==n?(gn=e,yn=n,hn||(fn=!0,hn=(async()=>{for(;null!=gn&&null!=yn;){const e=gn,t=yn;if(gn=null,yn=null,bn===t)continue;const n=mn;if(!n)break;try{pn=t,await Promise.resolve(n(e)),bn=t}catch{}}})().finally(()=>{fn=!1,hn=null,pn=null}))):hn:Promise.resolve()):Promise.resolve()}var xn=null,Sn=null,Cn=null,Mn=/* @__PURE__ */new Set,Nn=/* @__PURE__ */new WeakMap,$n=0;function Bn(){for(const e of Array.from(Mn))try{e()}catch{}}var Ln=/* @__PURE__ */O('<pre data-markstream-pre="1" tabindex="0"></pre>'),Tn=/* @__PURE__ */N(6),En=/* @__PURE__ */Symbol(Tn),jn=/* @__PURE__ */Symbol(Tn+1),Pn=/* @__PURE__ */Symbol(Tn+2),Dn=/* @__PURE__ */Symbol(Tn+3),_n=/* @__PURE__ */Symbol(Tn+4),Rn=/* @__PURE__ */Symbol(Tn+5),An=/* @__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=w(Ln);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&&(P(o.f,"aria-busy",t),o.e=t)}{const t=e.h3;o.g!==t&&(P(o.h,"aria-label",t),o.g=t)}{const t=e.h4;o.i!==t&&(D(o.j,"data-language",t),o.i=t)}{const t=e.h5;o.k!==t&&(D(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):H(e,n),o.o=n}}});function Fn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function Hn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function Wn(e){return e.startsWith("-")&&!e.startsWith("---")}function In(e){return e.startsWith("+")&&!e.startsWith("+++")}function On(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function zn(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 Kn(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?zn(e,"hunk",`inline-hunk-${n}`,""):Wn(e)?zn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):In(e)?zn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):zn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function Vn(e,t){const n=Hn(e),o=Hn(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(zn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:On(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(zn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:On(o,i)})),i++;e.push(zn(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(zn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:On(n,t)})),t++;for(;i<o.length;)e.push(zn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:On(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(zn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(zn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(zn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:On(n,d)}));for(let d=l;d<=s;d++)i.push(zn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:On(o,d)}));return i.concat(c)}function qn(e,t=!1,n=Fn(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=>Wn(e)),r=e.some(e=>In(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:Vn(e?.originalCode,e?.updatedCode)}];const n=Hn(e?.originalCode),o=Hn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>zn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:On(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>zn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:On(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Kn(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(zn(d,"hunk",`original-hunk-${c}`,"")),l.push(zn(d,"hunk",`modified-hunk-${c}`,""));else if(Wn(d))i.push(zn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(In(d))l.push(zn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(zn(e,"context",`original-context-${c}`,a++)),l.push(zn(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 Un({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=X(()=>Fn(e?.language),[e],En),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=X(()=>c?qn(e,!0===o,l):[],[o,c,e,l],jn),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],Dn),f=X(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],_n),h=X(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(4,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],Rn);return k(An,{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([k("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)]))})}Un.$$singleRoot=!0;var Xn=/* @__PURE__ */O('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),Yn=/* @__PURE__ */O('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Zn=["r","a","b"],Gn=/* @__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=w(Xn),f=y(m);{const l=e.h0;n=l,i=f,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=f,a=f,c=f;const h=W(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=Zn}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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&&(P(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):H(e,n),r.m=n}}}),Jn=/* @__PURE__ */N(93),Qn=/* @__PURE__ */Symbol(Jn),eo=/* @__PURE__ */Symbol(Jn+1),to=/* @__PURE__ */Symbol(Jn+2),no=/* @__PURE__ */Symbol(Jn+3),oo=/* @__PURE__ */Symbol(Jn+4),ro=/* @__PURE__ */Symbol(Jn+5),io=/* @__PURE__ */Symbol(Jn+6),lo=/* @__PURE__ */Symbol(Jn+7),ao=/* @__PURE__ */Symbol(Jn+8),so=/* @__PURE__ */Symbol(Jn+9),co=/* @__PURE__ */Symbol(Jn+10),uo=/* @__PURE__ */Symbol(Jn+11),mo=/* @__PURE__ */Symbol(Jn+12),fo=/* @__PURE__ */Symbol(Jn+13),ho=/* @__PURE__ */Symbol(Jn+14),po=/* @__PURE__ */Symbol(Jn+15),go=/* @__PURE__ */Symbol(Jn+16),yo=/* @__PURE__ */Symbol(Jn+17),bo=/* @__PURE__ */Symbol(Jn+18),wo=/* @__PURE__ */Symbol(Jn+19),vo=/* @__PURE__ */Symbol(Jn+20),ko=/* @__PURE__ */Symbol(Jn+21),xo=/* @__PURE__ */Symbol(Jn+22),So=/* @__PURE__ */Symbol(Jn+23),Co=/* @__PURE__ */Symbol(Jn+24),Mo=/* @__PURE__ */Symbol(Jn+25),No=/* @__PURE__ */Symbol(Jn+26),$o=/* @__PURE__ */Symbol(Jn+27),Bo=/* @__PURE__ */Symbol(Jn+28),Lo=/* @__PURE__ */Symbol(Jn+29),To=/* @__PURE__ */Symbol(Jn+30),Eo=/* @__PURE__ */Symbol(Jn+31),jo=/* @__PURE__ */Symbol(Jn+32),Po=/* @__PURE__ */Symbol(Jn+33),Do=/* @__PURE__ */Symbol(Jn+34),_o=/* @__PURE__ */Symbol(Jn+35),Ro=/* @__PURE__ */Symbol(Jn+36),Ao=/* @__PURE__ */Symbol(Jn+37),Fo=/* @__PURE__ */Symbol(Jn+38),Ho=/* @__PURE__ */Symbol(Jn+39),Wo=/* @__PURE__ */Symbol(Jn+40),Io=/* @__PURE__ */Symbol(Jn+41),Oo=/* @__PURE__ */Symbol(Jn+42),zo=/* @__PURE__ */Symbol(Jn+43),Ko=/* @__PURE__ */Symbol(Jn+44),Vo=/* @__PURE__ */Symbol(Jn+45),qo=/* @__PURE__ */Symbol(Jn+46),Uo=/* @__PURE__ */Symbol(Jn+47),Xo=/* @__PURE__ */Symbol(Jn+48),Yo=/* @__PURE__ */Symbol(Jn+49),Zo=/* @__PURE__ */Symbol(Jn+50),Go=/* @__PURE__ */Symbol(Jn+51),Jo=/* @__PURE__ */Symbol(Jn+52),Qo=/* @__PURE__ */Symbol(Jn+53),er=/* @__PURE__ */Symbol(Jn+54),tr=/* @__PURE__ */Symbol(Jn+55),nr=/* @__PURE__ */Symbol(Jn+56),or=/* @__PURE__ */Symbol(Jn+57),rr=/* @__PURE__ */Symbol(Jn+58),ir=/* @__PURE__ */Symbol(Jn+59),lr=/* @__PURE__ */Symbol(Jn+60),ar=/* @__PURE__ */Symbol(Jn+61),sr=/* @__PURE__ */Symbol(Jn+62),cr=/* @__PURE__ */Symbol(Jn+63),dr=/* @__PURE__ */Symbol(Jn+64),ur=/* @__PURE__ */Symbol(Jn+65),mr=/* @__PURE__ */Symbol(Jn+66),fr=/* @__PURE__ */Symbol(Jn+67),hr=/* @__PURE__ */Symbol(Jn+68),pr=/* @__PURE__ */Symbol(Jn+69),gr=/* @__PURE__ */Symbol(Jn+70),yr=/* @__PURE__ */Symbol(Jn+71),br=/* @__PURE__ */Symbol(Jn+72),wr=/* @__PURE__ */Symbol(Jn+73),vr=/* @__PURE__ */Symbol(Jn+74),kr=/* @__PURE__ */Symbol(Jn+75),xr=/* @__PURE__ */Symbol(Jn+76),Sr=/* @__PURE__ */Symbol(Jn+77),Cr=/* @__PURE__ */Symbol(Jn+78),Mr=/* @__PURE__ */Symbol(Jn+79),Nr=/* @__PURE__ */Symbol(Jn+80),$r=/* @__PURE__ */Symbol(Jn+81),Br=/* @__PURE__ */Symbol(Jn+82),Lr=/* @__PURE__ */Symbol(Jn+83),Tr=/* @__PURE__ */Symbol(Jn+84),Er=/* @__PURE__ */Symbol(Jn+85),jr=/* @__PURE__ */Symbol(Jn+86),Pr=/* @__PURE__ */Symbol(Jn+87),Dr=/* @__PURE__ */Symbol(Jn+88),_r=/* @__PURE__ */Symbol(Jn+89),Rr=/* @__PURE__ */Symbol(Jn+90),Ar=/* @__PURE__ */Symbol(Jn+91),Fr=/* @__PURE__ */Symbol(Jn+92),Hr=["r","a","b"],Wr=/* @__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,v;const k=w(Yn);{const l=e.h0;n=l,i=k,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=k,a=k;const x=W(y(k),1);s=x,c=k,d=y(k),u=x;const S=y(x);m=S,f=x,h=W(S,1),p=k;const C=W(x,1);b=C,v=W(C,1),r=g(t,k,{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:v,z:null,A:void 0}),t.refFields=Hr}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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):H(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):H(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):H(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):H(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):H(e,n),r.A=n}}}),Ir={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Or=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function zr({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return k(Gn,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:k(Un,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Kr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Vr(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?e:void 0}function qr(e){if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return{...Or,...t,enabled:t.enabled??!0}}return{...Or}}function Ur(e,t){const n=t?{...t}:{};if(!e)return n;const o=void 0===n.diffHideUnchangedRegions?{...Or}:qr(n.diffHideUnchangedRegions),r=void 0===n.hideUnchangedRegions?void 0:qr(n.hideUnchangedRegions),i=n.diffUnchangedRegionStyle??"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffHideUnchangedRegions:o,useInlineViewWhenSpaceIsLimited:n.useInlineViewWhenSpaceIsLimited??!1,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:i,diffHunkActionsOnHover:!1,diffHunkHoverHideDelayMs:160,...n,...void 0===r?{}:{hideUnchangedRegions:r},diffHideUnchangedRegions:o}}function Xr(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}function Yr(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Zr(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 Gr(e){const t=String(e??"").trim().toLowerCase();if(!t||"transparent"===t)return!0;const n=t.match(/rgba?\(([^)]+)\)/)?.[1]?.split(/[\s,/]+/).filter(Boolean);return 4===n?.length&&0===Number(n[3])}function Jr(e){const n={...Ir,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,monacoOptions:u,themes:m,minWidth:f,maxWidth:h,showHeader:p,showCopyButton:g,showExpandButton:y,showPreviewButton:b,showCollapseButton:w,showFontSizeButtons:v,showLineNumbers:x,showTooltips:M}=n,N=Y(null,Qn),$=Y(null,eo),B=Y(null,to),L=Y(null,no),E=Y(null,oo),j=Y(null,ro),P=Y(null,io),D=Y(0,lo),_=Y(null,ao),R=Y(null,so),A=J(co,et,co),F=Y(u,uo),H=Y(null,mo),W=Y(null,fo),I=Y([],ho),O=Y(null,po),z=Y(null,go),V=Y(!1,yo),U=Y(void 0,bo),[G,Q]=Z(!1,wo),[ee,te]=Z(()=>"undefined"==typeof window,vo),[ne,oe]=Z(!1,ko),[re,ie]=Z(!1,xo),[le,ae]=Z(!1,So),[se,ce]=Z(()=>o.language||"plaintext",Co),[de,ue]=Z(()=>qt(o.language),Mo),[me,fe]=Z(!1,No),[he,pe]=Z(!1,$o),[ge,ye]=Z(!1,Bo),[be,we]=Z(!1,Lo),[ve,ke]=Z(0,To),{t:xe}=J(Eo,$t,Eo);q(()=>{V.current=he},[he],jo);const Se=X(()=>Ur(Boolean(o.diff),u),[u,o.diff],Po),[Ce,Me]=Z(()=>{const e=Number(Ur(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:12},Do),[Ne,$e]=Z(Ce,_o),Be=X(()=>!1!==M,[M],Ro),Le=X(()=>!1!==x||Boolean(o.diff),[o.diff,x],Ao),Te=K(()=>{const e=F.current?.MAX_HEIGHT??500;if("number"==typeof e&&Number.isFinite(e))return Math.max(80,e);const t=String(e).match(/^(\d+(?:\.\d+)?)/),n=t?Number.parseFloat(t[1]):500;return Number.isFinite(n)?Math.max(80,n):500},[],Fo),Ee=K(e=>{if(G)return;const t=N.current,n=B.current;if(!t||!n)return;const o="diff"===j.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=Te();try{o.updateOptions?.({automaticLayout:e})}catch{}const i="diff"===j.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=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .margin-view-overlays .line-numbers",".editor.modified .margin-view-overlays .line-numbers",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];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{}},[Te,G],Ho),je=K(e=>{if(Ee(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Ee(e),window.requestAnimationFrame(()=>{Ee(e);const t=N.current;t&&null!=z.current&&(t.style.minHeight="0px",z.current=null)})});return window.setTimeout(()=>Ee(e),180),()=>window.cancelAnimationFrame(t)},[Ee],Wo),Pe=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||(z.current=n,e.style.minHeight=`${Math.ceil(n)}px`)},[],Io),De=K(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],Oo),_e=K(()=>{for(const e of I.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}I.current=[],O.current?.disconnect(),O.current=null},[],zo),Re=K(()=>{_e();const e=B.current,t=N.current;if(!e||!t||"diff"!==j.current)return;const n=()=>je(V.current),o=(e,t)=>{try{const o=e?.[t];if("function"!=typeof o)return;const r=o.call(e,n);r&&I.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"]}),O.current=e}},[_e,je],Ko);q(()=>Zt(()=>{ke(e=>e+1)}),[],Vo),q(()=>{ue(qt(o.language))},[o.language],qo);const Ae=Y(o,Uo);Ae.current=o;const Fe=K(()=>{D.current+=1;try{L.current?.()}catch{}_e(),E.current=null,j.current=null,P.current=null,z.current=null,ae(!1),ie(!1)},[_e],Xo),He=K(()=>{const e=N.current,t=$.current;if(!e||!t)return;if(t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),t.style.removeProperty("--vscode-editor-selectionBackground"),o.diff)return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");const n=e.querySelector(".monaco-editor")??e;try{const r="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(n):null,i=String(r?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(r?.color??"").trim(),l=String(r?.getPropertyValue("--vscode-editor-background")??"").trim(),a=String(r?.backgroundColor??"").trim(),s=Gr(l)?Gr(a)?"":a:l,c=String(r?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=Zr(e),i=Zr(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(s,i,"plaintext"===Ut(String(o.language||de||se||"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");i?e.style.setProperty("--vscode-editor-foreground",i):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{}},[de,se,o.diff,o.language],Yo),We=X(()=>r?c:d,[c,r,d],Zo),Ie=K(()=>{const e=Se?.theme,t=We??e??xn,n=Array.isArray(m)?m:[];if(!n.length||null==t)return t;const o=Yr(t),r=n.map(e=>Yr(e)).filter(e=>!!e);if(!o||r.includes(o))return t;const i=Yr(e);return null!=e&&i&&r.includes(i)?e:n[0]},[We,Se,m],Go),Oe=X(()=>Ie(),[Ie],Jo),ze=X(()=>function(e,t){const n=(Yr(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}(Oe,Boolean(r)),[r,Oe],Qo),Ke=X(()=>{if(!o.diff)return ze?"dark":"light";const e=Se?.diffAppearance;return"light"===e||"dark"===e?e:r?"dark":"light"},[r,o.diff,ze,Se],er),Ve=X(()=>o.diff?"dark"===Ke:ze,[Ke,o.diff,ze],tr),qe=X(()=>o.diff?"dark"===Ke:Boolean(r),[Ke,r,o.diff],nr),Ue=X(()=>{const e=Se,t=Kr(e?.fontSize)??Ne??12,n=Kr(e?.lineHeight)??(12===t?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=function(e,t){if(!e||"object"!=typeof e)return{top:t,bottom:t};const n=e;return{top:Vr(n.top)??t,bottom:Vr(n.bottom)??t}}(e?.padding,o.diff?0:8),l=Kr(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Ne,o.diff,Se],or),Xe=X(()=>!!o.diff&&!1===Se?.renderSideBySide,[o.diff,Se],rr),Ye=X(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Ue.lineHeight}px`,"--markstream-pre-line-number-top":`${Ue.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Ue.fontSize}px`,lineHeight:`${Ue.lineHeight}px`,paddingBottom:`${Ue.paddingBottom}px`,paddingTop:`${Ue.paddingTop}px`,tabSize:Ue.tabSize,"--markstream-code-font-family":Ue.fontFamily,fontFamily:Ue.fontFamily}),[Ue],ir),Ze=K(()=>({wordWrap:"on",wrappingIndent:"same",themes:m,...Se||{},theme:Oe,lineNumbers:Le,fontSize:Ue.fontSize,lineHeight:Ue.lineHeight,padding:{top:Ue.paddingTop,bottom:Ue.paddingBottom},tabSize:Ue.tabSize,fontFamily:Ue.fontFamily,...o.diff?{diffAppearance:Ke}:{},onThemeChange(){He()}}),[Ke,o.diff,Ue,Oe,Se,Le,He,m],lr),Ge=K(()=>{const e=Ze(),t=H.current;if(!t)return H.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[Ze],ar),Je=X(()=>JSON.stringify({diffLineStyle:Se?.diffLineStyle??"background",diffUnchangedRegionStyle:Se?.diffUnchangedRegionStyle??"line-info",diffHideUnchangedRegions:Se?.diffHideUnchangedRegions??!0,renderSideBySide:Se?.renderSideBySide??!0,enableSplitViewResizing:Se?.enableSplitViewResizing??!0,ignoreTrimWhitespace:Se?.ignoreTrimWhitespace??!0,originalEditable:Se?.originalEditable??!1}),[Se],sr);q(()=>{F.current=Se,Ge()},[Se,Ge],cr),q(()=>()=>{D.current+=1,L.current?.(),_e(),L.current=null,E.current=null,j.current=null,P.current=null,_.current=null,R.current?.destroy?.(),R.current=null},[_e],dr),q(()=>{if("undefined"==typeof window)return;if(ee)return;const e=$.current;if(!e)return;R.current?.destroy?.();const t=A(e,{rootMargin:"400px"});return R.current=t,t.isVisible()&&te(!0),t.whenVisible.then(()=>te(!0)),()=>{t.destroy(),R.current===t&&(R.current=null)}},[A,ee],ur),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(Ge(),()=>{e=!1}):((async()=>{try{const n=await un();if(!e)return;if(!n)return void Q(!0);const o=n.useMonaco,r=n.detectLanguage;if("function"==typeof r&&(_.current=r),"function"!=typeof o)return void Q(!0);const i=Ge(),l=J(fr,o,i,fr);B.current=l,"function"==typeof(t=l.setTheme)&&(Cn=t,null!=xn&&null!=Sn&&kn(xn,Cn).then(()=>Bn()).catch(()=>{})),L.current="function"==typeof l.safeClean?()=>l.safeClean():"function"==typeof l.cleanupEditor?()=>l.cleanupEditor():null,oe(!0)}catch{e&&Q(!0)}var t})(),()=>{e=!1})},[Ge],mr),q(()=>{if(!o.language&&!de&&_.current)try{const e=_.current(String(o.code??""));e&&ce(e)}catch{}},[de,o.code,o.language],hr);const Qe=X(()=>String(o.language||de||se||"plaintext"),[de,se,o.language],pr),tt=X(()=>qt(Qe),[Qe],gr),nt=X(()=>Ut(tt),[tt],yr),ot=X(()=>"plaintext"===nt,[nt],br),rt=X(()=>Gt(tt),[tt,ve],wr),it=X(()=>!!a&&("html"===tt||"svg"===tt),[tt,a],vr),lt=X(()=>{const e=tt;return e?Jt[e]||e.charAt(0).toUpperCase()+e.slice(1):Jt[""]||"Plain Text"},[tt],kr),at=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],xr),st=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=qe?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[h,f,o.diff,qe],Sr),ct=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),dt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],Mr),ut=!1===l&&i||!1!==l&&i&&!dt;q(()=>{if(G)return;if(!ne)return;if(!re||!ee)return;const e=B.current;Ge();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),He(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>je(he)):null)&&je(he)};e?.setTheme&&Oe?kn(Oe,e.setTheme).then(t).catch(()=>{}):t()},[ge,re,Ke,he,ne,o.diff,Oe,je,He,Ge,G,ee],Nr),q(()=>{var e;if("undefined"!=typeof window)return e=()=>{He()},Mn.add(e),()=>{Mn.delete(e)}},[He],$r);const mt=K(async()=>{if(G)return null;if(!ee)return null;if(ge)return null;if(ut)return null;const e=B.current,t=N.current;if(!e||!t||!e.createEditor)return null;Ge();const n=Ae.current,o=n.diff?"diff":"single",r=P.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(j.current===o&&r===t&&i)return null;if(E.current)return E.current;D.current+=1;const l=D.current;ie(!0);const a=(async()=>{try{L.current?.(),j.current=null,P.current=null,ae(!1);const o=nt;if(n.diff?"function"==typeof e.createDiffEditor?(j.current="diff",await e.createDiffEditor(t,Xr(n.originalCode),Xr(n.updatedCode),o)):(j.current="single",await e.createEditor(t,Xr(n.updatedCode??n.code),o)):(j.current="single",await e.createEditor(t,Xr(n.code),o)),P.current=t,D.current!==l)return;const r=Number(F.current?.fontSize);if(Number.isFinite(r)&&r>0){Me(r),$e(r);try{("diff"===j.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:r,automaticLayout:!1})}catch{}}if(Re(),He(),Pe(),Ee(he),await De(),D.current!==l)return;Ee(he),ae(!0),je(he)}catch{D.current===l&&(U.current=nt,Q(!0))}})().finally(()=>{E.current===a&&(E.current=null)});return E.current=a,a},[Ee,Re,_e,ge,he,nt,Pe,je,ut,He,Ge,G,ee,De],Br);q(()=>{Ge();const e=W.current;if(W.current=Je,!o.diff)return;if(G)return;if(!ne||!ee||!re)return;if(ge||ut)return;if(e===Je)return;let t=!1;return(async()=>{if(Fe(),!t)try{await mt()}catch{}})(),()=>{t=!0}},[ge,re,mt,ne,Je,o.diff,Fe,ut,Ge,G,ee],Lr),q(()=>{if(G){const e=U.current;if(void 0===e||e===nt)return;return U.current=void 0,Fe(),void Q(!1)}ne&&ee&&(ge||ut?Fe():mt())},[ge,mt,nt,ne,Fe,ut,G,ee],Tr),q(()=>{if(G)return;if(!ne)return;if(!ee)return;if(ge)return;if(ut)return;const e=B.current;if(!e)return;const t=Xr(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=de;if(!n&&_.current)try{n=qt(_.current(t)),n&&ue(n)}catch{}const r=Ut(n||tt);if(e.createEditor&&N.current){try{await Promise.resolve(mt())}catch{}const e=E.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(Xr(o.originalCode),Xr(o.updatedCode),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}je(he)})()},[tt,de,ge,re,mt,he,ne,o.code,o.diff,o.originalCode,o.updatedCode,je,ut,G,ee],Er),q(()=>{if(G)return;if(!ne)return;if(!ee)return;if(ge)return;if(ut)return;if(!he&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>je(he)):null;return null==e&&je(he),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,he,i,ne,je,ut,G,ee],jr),q(()=>{if(!s)return;if(G)return;const e=B.current;if(e){try{("diff"===j.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:Ne})}catch{}je(he)}},[s,he,Ne,o.diff,je,G],Pr),q(()=>{Be||At(!0)},[Be],Dr);const ft=K((e,t)=>{if(!Be)return;const n=e.currentTarget;n&&!n.disabled&&Rt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ve)},[Ve,Be],_r),ht=K(()=>{Be&&At()},[Be],Rr),pt=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(at)),fe(!0),n.onCopy?.(String(at)),setTimeout(()=>fe(!1),1e3)}catch{}},[n,at],Ar),gt=K(()=>{if(!it)return;const e="html"===tt?"text/html":"image/svg+xml",t="html"===tt?xe("artifacts.htmlPreviewTitle")||"HTML Preview":xe("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===tt&&we(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${tt}-${Date.now()}`})},[tt,it,o,n,xe],Fr);return k(Wr,{h0:$,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",qe?"border-gray-700/30":"border-gray-200",i?"is-rendering":"",qe?"is-dark":"",o.diff?"is-diff":"",ot?"is-plain-text":""].join(" "),h2:st,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:ct},()=>T([S("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden"},()=>T([C(()=>k("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:rt}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>lt)])),S("div",{className:"flex items-center space-x-2"},()=>T([w&&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:()=>ye(e=>!e),onMouseEnter:e=>ft(e,ge?xe("common.expand")||"Expand":xe("common.collapse")||"Collapse"),onFocus:e=>ft(e,ge?xe("common.expand")||"Expand":xe("common.collapse")||"Collapse"),onMouseLeave:ht,onBlur:ht},()=>C(()=>k("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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),v&&s&&S(t,{},()=>T([C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ne<=10,onClick:()=>$e(e=>Math.max(10,e-1)),onMouseEnter:e=>ft(e,xe("common.decrease")||"Decrease"),onFocus:e=>ft(e,xe("common.decrease")||"Decrease"),onMouseLeave:ht,onBlur:ht},k("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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ne===Ce,onClick:()=>$e(Ce),onMouseEnter:e=>ft(e,xe("common.reset")||"Reset"),onFocus:e=>ft(e,xe("common.reset")||"Reset"),onMouseLeave:ht,onBlur:ht},k("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"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),k("path",{d:"M3 3v5h5"}))))),C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Ne>=36,onClick:()=>$e(e=>Math.min(36,e+1)),onMouseEnter:e=>ft(e,xe("common.increase")||"Increase"),onFocus:e=>ft(e,xe("common.increase")||"Increase"),onMouseLeave:ht,onBlur:ht},k("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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),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-label":me?xe("common.copied")||"Copied":xe("common.copy")||"Copy",onClick:pt,onMouseEnter:e=>ft(e,me?xe("common.copied")||"Copied":xe("common.copy")||"Copy"),onFocus:e=>ft(e,me?xe("common.copied")||"Copied":xe("common.copy")||"Copy"),onMouseLeave:ht,onBlur:ht},()=>k("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"},me?k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),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-pressed":he,onClick:e=>{pe(e=>!e),ft(e,he?xe("common.expand")||"Expand":xe("common.collapse")||"Collapse")},onMouseEnter:e=>ft(e,he?xe("common.collapse")||"Collapse":xe("common.expand")||"Expand"),onFocus:e=>ft(e,he?xe("common.collapse")||"Collapse":xe("common.expand")||"Expand"),onMouseLeave:ht,onBlur:ht},()=>k("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"},k("path",he?{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"})))),it&&b&&C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":xe("common.preview")||"Preview",onClick:gt,onMouseEnter:e=>ft(e,xe("common.preview")||"Preview"),onFocus:e=>ft(e,xe("common.preview")||"Preview"),onMouseLeave:ht,onBlur:ht},k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},k("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"},k("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"}),k("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":""}${he?" code-block-body--expanded":""}`,h5:!ge&&(!!l||!i)&&C(G?()=>k(Un,{className:"code-fallback-plain m-0",diffInline:Xe,node:o,showLineNumbers:Le,style:Ye}):()=>k(zr,{editorHostRef:N,editorReady:le,node:o,preFallbackDiffInline:Xe,preFallbackStyle:Ye,showLineNumbers:Le,stream:l})),h6:!l&&i&&k("div",{className:"code-loading-placeholder"},k("div",{className:"loading-skeleton"},k("div",{className:"skeleton-line"}),k("div",{className:"skeleton-line"}),k("div",{className:"skeleton-line short"}))),h7:be&&!n.onPreviewCode&&it&&"html"===tt&&C(()=>k(an,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>we(!1)})),h8:me?xe("common.copied")||"Copied":""})}function Qr(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=Qr(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function ei(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Qr(e))&&(o&&(o+=" "),o+=t);return o}zr.$$singleRoot=!0,Jr.$$singleRoot=!0;var ti=()=>import("@terrastruct/d2"),ni=null,oi=ti;function ri(e){oi=e,ni=null}function ii(e){ri(e??ti)}function li(){ri(null)}function ai(){return"function"==typeof oi}var si=/* @__PURE__ */O("<div><!><!></div>"),ci=/* @__PURE__ */N(41),di=/* @__PURE__ */Symbol(ci),ui=/* @__PURE__ */Symbol(ci+1),mi=/* @__PURE__ */Symbol(ci+2),fi=/* @__PURE__ */Symbol(ci+3),hi=/* @__PURE__ */Symbol(ci+4),pi=/* @__PURE__ */Symbol(ci+5),gi=/* @__PURE__ */Symbol(ci+6),yi=/* @__PURE__ */Symbol(ci+7),bi=/* @__PURE__ */Symbol(ci+8),wi=/* @__PURE__ */Symbol(ci+9),vi=/* @__PURE__ */Symbol(ci+10),ki=/* @__PURE__ */Symbol(ci+11),xi=/* @__PURE__ */Symbol(ci+12),Si=/* @__PURE__ */Symbol(ci+13),Ci=/* @__PURE__ */Symbol(ci+14),Mi=/* @__PURE__ */Symbol(ci+15),Ni=/* @__PURE__ */Symbol(ci+16),$i=/* @__PURE__ */Symbol(ci+17),Bi=/* @__PURE__ */Symbol(ci+18),Li=/* @__PURE__ */Symbol(ci+19),Ti=/* @__PURE__ */Symbol(ci+20),Ei=/* @__PURE__ */Symbol(ci+21),ji=/* @__PURE__ */Symbol(ci+22),Pi=/* @__PURE__ */Symbol(ci+23),Di=/* @__PURE__ */Symbol(ci+24),_i=/* @__PURE__ */Symbol(ci+25),Ri=/* @__PURE__ */Symbol(ci+26),Ai=/* @__PURE__ */Symbol(ci+27),Fi=/* @__PURE__ */Symbol(ci+28),Hi=/* @__PURE__ */Symbol(ci+29),Wi=/* @__PURE__ */Symbol(ci+30),Ii=/* @__PURE__ */Symbol(ci+31),Oi=/* @__PURE__ */Symbol(ci+32),zi=/* @__PURE__ */Symbol(ci+33),Ki=/* @__PURE__ */Symbol(ci+34),Vi=/* @__PURE__ */Symbol(ci+35),qi=/* @__PURE__ */Symbol(ci+36),Ui=/* @__PURE__ */Symbol(ci+37),Xi=/* @__PURE__ */Symbol(ci+38),Yi=/* @__PURE__ */Symbol(ci+39),Zi=/* @__PURE__ */Symbol(ci+40),Gi=["r","a","b"],Ji=/* @__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=w(si);{const l=e.h0;n=l,i=m,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=m,s=m;const f=y(m);c=f,d=m,u=W(f,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=Gi}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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):H(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):H(e,n)}}}),Qi={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},el={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"},tl=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],nl=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function ol(e){if(!e)return"";const t=e.trim();return nl.test(t)?t:""}function rl(e){const n={...Qi,...e},{t:o}=J(di,$t,di),[r,i]=Z(!1,ui),[l,a]=Z(!1,mi),[s,c]=Z(!1,fi),[d,u]=Z(!1,hi),[m,f]=Z(null,pi),[h,p]=Z("",gi),[g,y]=Z(null,yi),[b,w]=Z(!1,bi),[v,x]=Z(()=>"undefined"==typeof window,wi),M=Y(0,vi),N=Y(null,ki),$=Y(!1,xi),B=Y(!1,Si),L=Y(0,Ci),E=Y(null,Mi),j=Y(!1,Ni),P=Y(null,$i),D=Y(null,Bi),_=Y(null,Li),R=Y(null,Ti),A=Y(!1,Ei),F=Y(()=>{},ji),H=J(Pi,et,Pi),W=n.node?.code??"",I=s||!d||!h,O=!!h,z=X(()=>{if(n.maxHeight)return{maxHeight:"number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight)}},[n.maxHeight],Di),V=X(()=>{if(I&&g)return{minHeight:`${g}px`}},[g,I],_i);q(()=>{A.current=b},[b],Ri),q(()=>{const e=P.current;if(!e)return;const t=H(e,{rootMargin:"160px"});return D.current=t,t.isVisible()&&x(!0),t.whenVisible.then(()=>x(!0)),()=>{t.destroy(),D.current=null}},[H],Ai);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&y(e=>e!==t?t:e)},[],Fi),G=K((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!v)return;if(A.current)return void(j.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-L.current;if(!e&&o<t)return j.current=!0,void(null==E.current&&(E.current=window.setTimeout(()=>{E.current=null,j.current&&(j.current=!1,G(!0))},Math.max(0,t-o))));$.current=!0;const r=()=>{$.current=!1,L.current=Date.now(),F.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[n.progressiveIntervalMs,v],Hi),Q=K(async()=>{if(N.current)return N.current;const e=await async function(){if(ni)return ni;const e=oi;if(!e)return null;let t;try{t=await e()}catch(n){if(e===ti)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(ni=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),ni):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)},[],Wi),ee=K(async()=>{if("undefined"==typeof window||B.current)return;if(!v)return;if(n.loading&&!n.progressiveRender)return;if(!W)return p(""),void f(null);const e=++M.current;w(!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(W);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={...el,...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(tl.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=ol(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&&(w(!1),j.current&&(j.current=!1,G()))}},[W,Q,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,G,v],Ii);q(()=>{F.current=ee},[ee],Oi);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(W),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[W],zi),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],Ki),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Rt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Vi),re=K(()=>{At()},[],qi);return q(()=>{G()},[W,n.loading,n.isDark,G],Ui),q(()=>{n.loading||G(!0)},[n.loading,G],Xi),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[I,h,W,U],Yi),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!=E.current&&(clearTimeout(E.current),E.current=null),R.current?.disconnect(),R.current=null,cancelAnimationFrame(e)}},[G,U],Zi),k(Ji,{h0:P,h1:ei("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([k("div",{className:"flex items-center gap-x-2"},k("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:ei("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:ei("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:ei("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},()=>k("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?k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("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(()=>k("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},k("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"},k("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(()=>k("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"},k("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&&!O?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>W)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>T([I?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>W)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):C(()=>S("div",{className:"d2-render",style:z},()=>T([C(()=>k("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:h}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}rl.$$singleRoot=!0;var il=/* @__PURE__ */O('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),ll=/* @__PURE__ */O('<dl class="definition-list"><!></dl>'),al=(e,t)=>`${String(indexKey??"definition")}-${t}`;function sl(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=w(il),r=y(o);e=r,n=W(r,1),s=f(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?De(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):H(e,n),s.c=n}}{const n=r&&l?De(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):H(e,n),s.f=n}}}var cl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(ll);e=i,n=i,r=y(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(D(o.b,"data-index-key",t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,al,sl,18,[e.h4,e.h5,e.h6],o.d,1)});function dl(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return k(cl,{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?De(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?De(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}dl.$$singleRoot=!0;var ul=/* @__PURE__ */O('<span class="emoji-node"></span>'),ml=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(ul);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):H(e,n),o.c=n}}});function fl(e){const{node:t}=e;return k(ml,{h0:t.name??t.markup})}fl.$$singleRoot=!0;var hl=/* @__PURE__ */O('<em class="emphasis-node"></em>'),pl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(hl);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):H(e,n),o.c=n}}});function gl(e){return k(pl,{h0:e.children})}gl.$$singleRoot=!0,M(["click"]);var yl=/* @__PURE__ */O('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),bl=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),wl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=w(yl);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&&(D(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(D(o.d,"title",t),o.c=t)}});function vl(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],bl);return k(wl,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}vl.$$singleRoot=!0;var kl=/* @__PURE__ */O('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),xl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(kl);e=r,n=y(r),o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(D(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):H(e,n),o.e=n}}});function Sl(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return k(xl,{h0:`fnref--${t.id}`,h1:n&&o?Pe(t.children,n,String(r??`footnote-${t.id}`),o):null})}Sl.$$singleRoot=!0,M(["click"]);var Cl=/* @__PURE__ */O('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),Ml=/* @__PURE__ */N(3),Nl=/* @__PURE__ */Symbol(Ml),$l=/* @__PURE__ */Symbol(Ml+1),Bl=/* @__PURE__ */Symbol(Ml+2),Ll=["s","h","g"],Tl=/* @__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=w(Cl);n=f,r=f,f.$$click=e.h1;const h=y(f);i=I(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&&j(e.ref,o.g)}),L(h),u=h,m=W(y(h),1),o=a(t,f,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=Ll}else{o.c.$$click=e.h1,o.d=I(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&&(D(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):H(e,n)}}});function El(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],Nl),o=X(()=>({href:n}),[n],$l),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(n);t&&t.scrollIntoView({behavior:"smooth"})},[n],Bl);return k(Tl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}El.$$singleRoot=!0;var jl=/* @__PURE__ */O('<br class="hard-break"/>'),Pl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(jl)))});function Dl(e){return k(Pl,{})}function _l(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:ei("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?Pe(t.children,n,String(r??`heading-${l}`),o):null))}Dl.$$singleRoot=!0;var Rl=/* @__PURE__ */O('<mark class="highlight-node"></mark>'),Al=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Rl);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):H(e,n),o.c=n}}});function Fl(e){return k(Al,{h0:e.children})}function Hl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Wl(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=Hl(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}Fl.$$singleRoot=!0;var Il=ve,Ol=ue;function zl(e,t){return ie(e,t)}function Kl(e,t){return re(e,t)}function Vl(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 ql(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Ul(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Xl(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(Xl).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Xl(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}>${Xl(n.props.children)}</${n.type}>`}function Yl(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Zl(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 Gl(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Jl(t,n,o,r,i,l,a,s=Zl(i)){const c=ce(t),d=l??function(e){return e.map(Xl).join("")}(o),u={type:c,tag:c,attrs:Yl(n),content:d,raw:a??`${Vl(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Ul(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Ql=/* @__PURE__ */O("<div></div>"),ea=/* @__PURE__ */N(22),ta=/* @__PURE__ */Symbol(ea),na=/* @__PURE__ */Symbol(ea+1),oa=/* @__PURE__ */Symbol(ea+2),ra=/* @__PURE__ */Symbol(ea+3),ia=/* @__PURE__ */Symbol(ea+4),la=/* @__PURE__ */Symbol(ea+5),aa=/* @__PURE__ */Symbol(ea+6),sa=/* @__PURE__ */Symbol(ea+7),ca=/* @__PURE__ */Symbol(ea+8),da=/* @__PURE__ */Symbol(ea+9),ua=/* @__PURE__ */Symbol(ea+10),ma=/* @__PURE__ */Symbol(ea+11),fa=/* @__PURE__ */Symbol(ea+12),ha=/* @__PURE__ */Symbol(ea+13),pa=/* @__PURE__ */Symbol(ea+14),ga=/* @__PURE__ */Symbol(ea+15),ya=/* @__PURE__ */Symbol(ea+16),ba=/* @__PURE__ */Symbol(ea+17),wa=/* @__PURE__ */Symbol(ea+18),va=/* @__PURE__ */Symbol(ea+19),ka=/* @__PURE__ */Symbol(ea+20),xa=/* @__PURE__ */Symbol(ea+21),Sa=["s","e","d"],Ca=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s;const c=w(Ql);n=e.h0,r="html-block-node",i=I(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&&j(e.ref,o.d)}),s=c,o=p(t,c,n,r,i,l,a,s,null,void 0),t.refFields=Sa}else{{const t=e.h0;o.a!==t&&(o.a=t)}{const e="html-block-node";o.b!==e&&(o.b=e)}o.c=I(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 Ma(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(ta,et,ta),[s,c]=Z(null,na),d=Y(null,oa),[u,m]=Z(()=>"undefined"==typeof window,ra),[f,h]=Z(o.content,ia),p=Boolean(o.loading),g=G(lt,at,at,la),y=X(()=>({...n.customComponents??n.ctx?.customComponents??ct(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,g],aa),b=X(()=>({...y,...n.ctx?.streamingComponents??{}}),[y,n.ctx?.streamingComponents],sa);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],ca),q(()=>()=>{d.current?.destroy(),d.current=null},[],da),q(()=>{p&&!u||h(o.content)},[p,o.content,u],ua);const w=X(()=>{const e=je(fe(o.attrs??void 0,l));return e?Wl(e):void 0},[l,o.attrs],ma),v=X(()=>String(o.tag??"").trim(),[o.tag],fa),x=X(()=>ce(v),[v],ha),M=X(()=>{const e=je(fe(o.attrs??void 0,l,v));return e?Wl(e):void 0},[l,o.attrs,v],pa),N=X(()=>te(we(fe(o.attrs??void 0,l,x))),[l,o.attrs,x],ga),$=X(()=>Array.isArray(o.children)?o.children:[],[o.children],ya),B=$.length>0&&!!v&&!ee.has(v.toLowerCase())&&!le(v,l)&&!!n.ctx&&!!n.renderNode,L=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],ba),E=X(()=>"escape"!==l&&Kl(o.content??"",b),[b,l,o.content],wa),j=X(()=>E&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Il(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=Vl(i,d,!0),m=zl(i,n),f=Boolean(Ul(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=Ol(d,o,i),p=h.key,g=null!=p&&""!==p?p:`${a}-${l++}`,y=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(f)b.push(Jl(i,d,[],g,r,"",u,{loading:!1,autoClosed:!1}));else if(y){const t=Gl(i,h,r);b.push(e.createElement(y,{...t,key:g}))}else b.push(e.createElement(i,{...Wl(h),key:g,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=zl(i,n),a=Boolean(Ul(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=`${Vl(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[Vl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=Ol(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(Ul(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Zl(r);m=Jl(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{...Gl(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{...Wl(s),key:f,suppressHydrationWarning:!0},...t.children)}s.length>0?ql(s[s.length-1].children,m):ql(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=`${Vl(t.tagName,t.attrs)}${i}`;if(t.softBlocked){ql(c,[Vl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=Ol(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(Ul(t.tagName,r))?Jl(t.tagName,t.attrs||{},t.children,f,r,i,d,Zl(r)):h?e.createElement(h,{...Gl(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{...Wl(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,y,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[y,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,E],va),P=X(()=>me(f??"",l),[l,f],ka),D=X(()=>B&&n.ctx&&n.renderNode?Pe($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],xa),_=x?n.ctx?.htmlComponents?.[x]:void 0,R=S("div",{className:"html-block-node__placeholder"},()=>r??T([k("span",{className:"html-block-node__placeholder-bar"}),k("span",{className:"html-block-node__placeholder-bar w-4/5"}),k("span",{className:"html-block-node__placeholder-bar w-2/3"})]));return B&&_?e.createElement(_,N,D)??null:B?e.createElement(v,{...L,ref:c},u?D:R)??null:k(Ca,{h0:c,h1:w,h2:u?E&&j?S(t,{},()=>T([j])):C(()=>k("div",{dangerouslySetInnerHTML:{__html:P}})):R})}var Na=/* @__PURE__ */O('<span class="html-inline-node"></span>'),$a=/* @__PURE__ */N(13),Ba=/* @__PURE__ */Symbol($a),La=/* @__PURE__ */Symbol($a+1),Ta=/* @__PURE__ */Symbol($a+2),Ea=/* @__PURE__ */Symbol($a+3),ja=/* @__PURE__ */Symbol($a+4),Pa=/* @__PURE__ */Symbol($a+5),Da=/* @__PURE__ */Symbol($a+6),_a=/* @__PURE__ */Symbol($a+7),Ra=/* @__PURE__ */Symbol($a+8),Aa=/* @__PURE__ */Symbol($a+9),Fa=/* @__PURE__ */Symbol($a+10),Ha=/* @__PURE__ */Symbol($a+11),Wa=/* @__PURE__ */Symbol($a+12),Ia=["r","a","b"],Oa=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(Na);{const l=e.h0;n=l,i=a,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=a,r=u(t,a,n,i,void 0,l),t.refFields=Ia}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(F(r.d,t,r.c),r.c=t)}}),za=(()=>{try{return Boolean(!1)}catch{}return!1})();function Ka(e){za&&console.warn(e)}function Va(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 qa(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Ua(e,t){for(const n of Il(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if(zl(e,t)&&"block"===mt(t[e]||t[e.toLowerCase()]))return!0}return!1}function Xa(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Ya(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(Ya).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Ya(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}>${Ya(n.props.children)}</${n.type}>`}function Za(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Ga(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 Ja(t,n,o,r,i,l,a,s,c,d){const u=zl(t,r),m=Boolean(Xa(t,a));if(Q.has(t.toLowerCase())||!u&&!m&&ae(t,l))return null;if(!u&&!m&&le(t,l))return[Va(t,n),...o,`</${t}>`];const f=Ol(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=Ga(i)){const c=ce(t),d=l??function(e){return e.map(Ya).join("")}(o),u={type:c,tag:c,attrs:Za(n),content:d,raw:a??`${Va(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Xa(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,{...Wl(f),key:p},...o)}function Qa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Y(null,Ba),[a,s]=Z(!1,La);q(()=>{s(!0)},[],Ta);const c=e.useMemo(()=>({...n.ctx?.customComponents??ct(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],Ea),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],ja),u=e.useMemo(()=>me(o.content??"",i),[i,o.content],Pa),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],Da),f=e.useMemo(()=>ce(m),[m],_a),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],Ra),p=e.useMemo(()=>te(we(fe(o.attrs??void 0,i,f))),[i,o.attrs,f],Aa),g=f?n.ctx?.htmlComponents?.[f]:void 0,y=h.length>0&&!!m&&"escape"!==i&&!le(m,i)&&!!n.ctx&&!!n.renderNode&&!!g,b=e.useMemo(()=>y&&n.ctx&&n.renderNode?Pe(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[y,n.ctx,n.indexKey,n.renderNode,h],Fa),w=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Kl(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=Va(s.tagName,e,!0),d=zl(s.tagName,t),u=Boolean(Xa(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=Ja(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});qa(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=zl(s.tagName,t),i=Boolean(Xa(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=`${Va(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Va(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Ga(o);m=Ja(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?qa(l[l.length-1].children,m):qa(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Ka(`Auto-closing unclosed tag: <${s.tagName}>`)}else Ka(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${Va(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[Va(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ja(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,Ga(o)),qa(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Ka(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Il(e),t,n,o)}catch(i){return r=i,za&&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:Ua(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],Ha);return q(()=>{if(!a||!l.current||"html"!==w.mode)return;const e=l.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=u,e.appendChild(t.content.cloneNode(!0))},[w.mode,a,u],Wa),!o.loading||o.autoClosed||y||"dynamic"===w.mode?y?e.createElement(g,p,b)??null:"dynamic"===w.mode?w.block?S(t,{},()=>T([w.nodes])):C(()=>S("span",{className:"html-inline-node",style:{display:"inline"}},()=>w.nodes)):k(Oa,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var es=/* @__PURE__ */N(5),ts=/* @__PURE__ */Symbol(es),ns=/* @__PURE__ */Symbol(es+1),os=/* @__PURE__ */Symbol(es+2),rs=/* @__PURE__ */Symbol(es+3),is=/* @__PURE__ */Symbol(es+4),ls={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function as(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function ss(e){const t={...ls,...e},n=he(t.node.src),o=he(t.fallbackSrc),r=as(n,o,t.node.loading),[i,l]=Z(!1,ts),[a,s]=Z(!1,ns),[c,d]=Z(r.src,os),[u,m]=Z(r.stage,rs),f=c;q(()=>{const e=as(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],is);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)},g=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,f])};return!t.node.loading&&"failed"!==u&&f?C(()=>k("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:g})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?T([k("span",{className:"image-node__spinner","aria-hidden":"true"}),k("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:k("span",{className:"image-node__error"},k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true"},k("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"})),k("span",{className:"image-node__placeholder-text"},"Image failed to load"))}function cs(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function ds(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 us(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var ms=null,fs=null,hs=/* @__PURE__ */N(35),ps=/* @__PURE__ */Symbol(hs),gs=/* @__PURE__ */Symbol(hs+1),ys=/* @__PURE__ */Symbol(hs+2),bs=/* @__PURE__ */Symbol(hs+3),ws=/* @__PURE__ */Symbol(hs+4),vs=/* @__PURE__ */Symbol(hs+5),ks=/* @__PURE__ */Symbol(hs+6),xs=/* @__PURE__ */Symbol(hs+7),Ss=/* @__PURE__ */Symbol(hs+8),Cs=/* @__PURE__ */Symbol(hs+9),Ms=/* @__PURE__ */Symbol(hs+10),Ns=/* @__PURE__ */Symbol(hs+11),$s=/* @__PURE__ */Symbol(hs+12),Bs=/* @__PURE__ */Symbol(hs+13),Ls=/* @__PURE__ */Symbol(hs+14),Ts=/* @__PURE__ */Symbol(hs+15),Es=/* @__PURE__ */Symbol(hs+16),js=/* @__PURE__ */Symbol(hs+17),Ps=/* @__PURE__ */Symbol(hs+18),Ds=/* @__PURE__ */Symbol(hs+19),_s=/* @__PURE__ */Symbol(hs+20),Rs=/* @__PURE__ */Symbol(hs+21),As=/* @__PURE__ */Symbol(hs+22),Fs=/* @__PURE__ */Symbol(hs+23),Hs=/* @__PURE__ */Symbol(hs+24),Ws=/* @__PURE__ */Symbol(hs+25),Is=/* @__PURE__ */Symbol(hs+26),Os=/* @__PURE__ */Symbol(hs+27),zs=/* @__PURE__ */Symbol(hs+28),Ks=/* @__PURE__ */Symbol(hs+29),Vs=/* @__PURE__ */Symbol(hs+30),qs=/* @__PURE__ */Symbol(hs+31),Us=/* @__PURE__ */Symbol(hs+32),Xs=/* @__PURE__ */Symbol(hs+33),Ys=/* @__PURE__ */Symbol(hs+34),Zs=k("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"},k("g",{},k("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"}),k("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"}),k("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"}),k("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"}),k("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"}))),Gs={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Js(e){const n={...Gs,...e},{t:o}=J(ps,$t,ps),[r,i]=Z(!1,gs),[l,a]=Z(!1,ys),[s,c]=Z(!1,bs),[d,u]=Z(!1,ws),[m,f]=Z(()=>"undefined"==typeof window,vs),h=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?cs(n.maxHeight):null,[n.maxHeight],ks),g=X(()=>us(cs(n.estimatedPreviewHeightPx)??ds(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],xs),[y,b]=Z(`${g}px`,Ss),[w,v]=Z(!1,Cs),[M,N]=Z(1,Ms),[$,B]=Z({x:0,y:0},Ns),[L,E]=Z(!1,$s),j=Y(null,Bs),P=Y(null,Ls),D=Y(null,Ts),_=Y(null,Es),R=Y(null,js),A=Y({x:0,y:0},Ps),F=Y(null,Ds),H=J(_s,et,_s),W=K(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,g)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),g)}px`:`${Math.max(e,g)}px`},[g,n.maxHeight],Rs),I=K(()=>{const e=j.current;if(!e)return;const t=e.scrollHeight;t>0&&b(W(t))},[W],As);q(()=>{s||l||b(e=>{const t=cs(e);return null!=t&&t>=g?e:`${g}px`})},[g,l,s],Fs);const O=K(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],Hs),z=K(async()=>{if(!m)return;if(!j.current)return;const e=j.current;try{const t=await async function(){return fs||ms||(ms=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),fs=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),ms)}();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),v(!0),setTimeout(()=>{I()},0)}catch(t){console.error("Failed to render infographic:",t),v(!1),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`}},[h,I,m],Ws);q(()=>{const e=P.current;if(!e)return;const t=H(e,{rootMargin:"160px"});return D.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),D.current=null}},[H],Is),q(()=>{!m||s||l||z()},[h,l,z,s,m],Os),q(()=>()=>{F.current&&(F.current.destroy?.(),F.current=null)},[],zs);const V=K(()=>{u(!1),_.current&&(_.current.innerHTML=""),R.current=null,document.body.style.overflow=""},[],Ks),U=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Vs);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&V()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,V],qs),q(()=>{d&&setTimeout(()=>{if(j.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=j.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],Us),q(()=>{d&&R.current&&(R.current.style.transform=`translate(${$.x}px, ${$.y}px) scale(${M})`)},[d,$,M],Xs);const G=K(()=>{const e=j.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)},[],Ys),Q=e=>{E(!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(!L)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=()=>E(!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,{},()=>T([C(()=>S("div",{ref:P,"data-markstream-infographic":"1","data-markstream-mode":s?"source":w?"preview":"pending",className:ei("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:ei("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([Zs,C(()=>k("span",{className:ei("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:ei("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{className:ei("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=>Rt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("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"}),k("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview")||"Preview")])))),C(()=>S("button",{className:ei("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=>Rt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},k("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:ne,onClick:()=>a(!l),onMouseEnter:e=>Rt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>C(()=>k("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"},k("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:O,onMouseEnter:e=>Rt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},r?k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("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(()=>k("button",{className:ei(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:G,onMouseEnter:e=>Rt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>At()},k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),k("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&C(()=>S("button",{className:ei(ne,oe&&"opacity-50 cursor-not-allowed"),disabled:oe,onClick:U,onMouseEnter:e=>Rt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>At()},()=>k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},k("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:ei("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:ei("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(()=>k("button",{className:ei("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(()=>k("button",{className:ei("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:ei("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})}},()=>T([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{className:ei("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:y,maxHeight:n.maxHeight??void 0},onMouseDown:Q,onMouseMove:ee,onMouseUp:te,onMouseLeave:te,onTouchStart:Q,onTouchMove:ee,onTouchEnd:te},()=>C(()=>S("div",{className:ei("absolute inset-0 cursor-grab",L&&"cursor-grabbing"),style:{transform:`translate(${$.x}px, ${$.y}px) scale(${M})`}},()=>C(()=>k("div",{ref:j,className:"w-full text-center flex items-center justify-center min-h-full"}))))))])))]))),d&&"undefined"!=typeof document&&x(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:ei("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(()=>k("button",{className:ei("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(()=>k("button",{className:ei("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:ei("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})}},()=>T([Math.round(100*M),"\n %\n "]))),C(()=>k("button",{className:ei("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(()=>k("div",{ref:_,className:ei("w-full h-full flex items-center justify-center p-4 overflow-hidden",!L&&"cursor-grab",L&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:ee,onMouseUp:te,onMouseLeave:te,onTouchStart:Q,onTouchMove:ee,onTouchEnd:te}))]))))),document.body)]))}var Qs=/* @__PURE__ */O('<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>'),ec=/* @__PURE__ */N(6),tc=/* @__PURE__ */Symbol(ec),nc=/* @__PURE__ */Symbol(ec+1),oc=/* @__PURE__ */Symbol(ec+2),rc=/* @__PURE__ */Symbol(ec+3),ic=/* @__PURE__ */Symbol(ec+4),lc=/* @__PURE__ */Symbol(ec+5),ac=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Qs);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):H(e,n),o.c=n}}});function sc(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 cc(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}]:[],tc),u=J(nc,Ve,nc),m=Y(l,oc),f=Y(1,rc),h=Y(void 0,ic);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)?sc(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],lc),k(ac,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?ei("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)?sc(e,t):e);var t}:void 0},()=>e.content))})}cc.$$singleRoot=!0;var dc=/* @__PURE__ */O('<ins class="insert-node"></ins>'),uc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(dc);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):H(e,n),o.c=n}}});function mc(e){return k(uc,{h0:e.children})}mc.$$singleRoot=!0,M(["animationend"]);var fc=/* @__PURE__ */O("<span></span>"),hc=/* @__PURE__ */O("<span><!></span>"),pc=/* @__PURE__ */N(6),gc=/* @__PURE__ */Symbol(pc),yc=/* @__PURE__ */Symbol(pc+1),bc=/* @__PURE__ */Symbol(pc+2),wc=/* @__PURE__ */Symbol(pc+3),vc=/* @__PURE__ */Symbol(pc+4),kc=/* @__PURE__ */Symbol(pc+5),xc=e=>e.id;function Sc(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(fc);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?ei("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):H(e,n),r.f=n}}}var Cc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(hc);e=i,n=i,r=y(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,xc,Sc,30,[e.h4],o.d,1)});function Mc(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 Nc(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}]:[],gc),u=J(yc,Ve,yc),m=Y(l,bc),f=Y(1,wc),h=Y(void 0,vc);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)?Mc(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],kc);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?Mc(t,e):t)};return null!=n?C(()=>S("span",{className:ei("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):k(Cc,{h0:ei("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?ei("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 $c=/* @__PURE__ */O('<a class="link-node"></a>',3),Bc=/* @__PURE__ */N(4),Lc=/* @__PURE__ */Symbol(Bc),Tc=/* @__PURE__ */Symbol(Bc+1),Ec=/* @__PURE__ */Symbol(Bc+2),jc=/* @__PURE__ */Symbol(Bc+3),Pc=/* @__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=w($c);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=g(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&&(D(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(D(o.d,"title",t),o.c=t)}{const t=e.h2;o.e!==t&&(P(o.f,"aria-label",t),o.e=t)}{const t=e.h3;o.g!==t&&(D(o.h,"target",t),o.g=t)}{const t=e.h4;o.i!==t&&(D(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):H(e,n),o.q=n}}});function Dc(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],Lc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],Tc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&Rt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],Ec),m=K(()=>{i&&At()},[i],jc);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(()=>k(Nc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-loading`,typewriter:e.typewriter}))),k("span",{className:"link-loading-indicator","aria-hidden":"true"})])))):k(Pc,{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?Pe(t.children,n,String(r??"link"),o):C(()=>k(Nc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var _c=/* @__PURE__ */O('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),Rc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(_c);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(D(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):H(e,n),o.e=n}}});function Ac(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return k(Rc,{h0:null==r?void 0:r,h1:l??(n&&o?Pe(t.children,n,String(i??"list-item"),o):null)})}function Fc(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&&ct(n.customId).list_item||Ac;return S(i,{className:ei("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)=>k(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 Hc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}Ac.$$singleRoot=!0;var Wc=null,Ic=null,Oc=!1,zc=/* @__PURE__ */new Map,Kc=/* @__PURE__ */new Map,Vc=5,qc=/* @__PURE__ */new Set;function Uc(){if(zc.size<Vc&&qc.size){const e=Array.from(qc);qc.clear();for(const t of e)try{t()}catch{}}}function Xc(e){Ic=null,(Wc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=zc.get(t);if(r)if(zc.delete(t),clearTimeout(r.timeoutId),Uc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Kc.set(e,n),Kc.size>200){const e=Kc.keys().next();e.done||Kc.delete(e.value)}}r.resolve(n)}},Wc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of zc.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));zc.clear(),Uc()}}function Yc(){Wc&&Wc.terminate?.(),Wc=null,Ic=null}function Zc(e){Oc=!!e,Wc&&Wc.postMessage({type:"init",debug:Oc})}var Gc="WORKER_BUSY";async function Jc(e,t=!0,n=2e3,o){performance.now();const r=Hc(e);if(Ic)return Promise.reject(Ic);const i=`${t?"d":"i"}:${r}`,l=Kc.get(i);if(l)return Promise.resolve(l);const a=Wc||((Ic=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Ic.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Ic);if(zc.size>=Vc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Gc,e.busy=!0,e.inFlight=zc.size,e.max=Vc,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(()=>{zc.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Uc()},n),c=()=>{},d=()=>{zc.delete(l),clearTimeout(s),qc.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),Uc()};o&&o.addEventListener("abort",d,{once:!0}),zc.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:Oc})}catch(u){zc.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),Uc()}})}function Qc(e,t,n){const o=`${t?"d":"i"}:${Hc(e)}`;if(Kc.set(o,n),Kc.size>200){const e=Kc.keys().next();e.done||Kc.delete(e.value)}}function ed(){Kc.clear()}function td(e){Vc=Math.max(1,Math.floor(e)),Uc()}function nd(e=1500,t){return zc.size<Vc?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(){qc.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}),qc.add(l)})}var od={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function rd(e){null!=e.timeout&&(od.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(od.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(od.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(od.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function id(){return{...od}}async function ld(e,t=!0,n={}){const o=n.timeout??od.timeout,r=n.waitTimeout??od.waitTimeout,i=n.backoffMs??od.backoffMs,l=n.maxRetries??od.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):od.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 Jc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await nd(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 ad=null,sd=!1;async function cd(){if(ad)return ad;if(sd)return null;try{return ad=await import("katex"),await import("katex/contrib/mhchem"),ad}catch{return sd=!0,null}}var dd=/* @__PURE__ */O('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),ud=/* @__PURE__ */N(9),md=/* @__PURE__ */Symbol(ud),fd=/* @__PURE__ */Symbol(ud+1),hd=/* @__PURE__ */Symbol(ud+2),pd=/* @__PURE__ */Symbol(ud+3),gd=/* @__PURE__ */Symbol(ud+4),yd=/* @__PURE__ */Symbol(ud+5),bd=/* @__PURE__ */Symbol(ud+6),wd=/* @__PURE__ */Symbol(ud+7),vd=/* @__PURE__ */Symbol(ud+8),kd=["r","a","b","r","c","d"],xd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=w(dd);{const l=e.h0;n=l,i=c,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}const d=c.firstChild;{const n=e.h1;l=n,a=d,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}s=d,r=f(t,c,n,i,l,a,void 0,s),t.refFields=kd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function Sd({node:e}){const t=Y(null,md),n=Y(null,fd),o=Y(null,hd),r=J(pd,et,pd),[i,l]=Z(!0,gd),[a,s]=Z(()=>"undefined"==typeof window,yd),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],wd),q(()=>{const t=Hc(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 ld(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 cd();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),Qc(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],vd),k(xd,{h0:t,h1:n,h2:i?"math-rendering":void 0})}Sd.$$singleRoot=!0;var Cd=/* @__PURE__ */O('<span class="math-inline-wrapper"><span></span><!></span>'),Md=/* @__PURE__ */N(9),Nd=/* @__PURE__ */Symbol(Md),$d=/* @__PURE__ */Symbol(Md+1),Bd=/* @__PURE__ */Symbol(Md+2),Ld=/* @__PURE__ */Symbol(Md+3),Td=/* @__PURE__ */Symbol(Md+4),Ed=/* @__PURE__ */Symbol(Md+5),jd=/* @__PURE__ */Symbol(Md+6),Pd=/* @__PURE__ */Symbol(Md+7),Dd=/* @__PURE__ */Symbol(Md+8),_d=["r","a","b","r","c","d"],Rd=/* @__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=w(Cd);{const l=e.h0;n=l,i=m,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}const f=y(m);{const n=e.h1;a=n,s=f,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}c=f,d=m,u=W(f,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=_d}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(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):H(e,n)}}});function Ad({node:e}){const t=Y(null,Nd),n=Y(null,$d),o=Y(null,Bd),r=J(Ld,et,Ld),[i,l]=Z(!0,Td),[a,s]=Z(()=>"undefined"==typeof window,Ed),c=Y(0,jd);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],Pd),q(()=>{const t=Hc(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 ld(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 cd();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),Qc(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],Dd),k(Rd,{h0:t,h1:n,h2:"math-inline"+(i?" math-inline--hidden":""),h3:i&&k("span",{className:"math-inline__loading",role:"status","aria-live":"polite"},k("span",{className:"math-inline__spinner","aria-hidden":"true"}),k("span",{className:"sr-only"},"Loading"))})}function Fd(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Hd(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 Wd(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Id(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}Ad.$$singleRoot=!0;var Od=null,zd=null,Kd=/* @__PURE__ */new Map,Vd=5,qd=!1;function Ud(e){qd=!!e}function Xd(e){Number.isFinite(e)&&e>0&&(Vd=Math.floor(e))}function Yd(){return{inFlight:Kd.size,max:Vd}}var Zd="WORKER_BUSY";function Gd(e){zd=null;const t=e;(Od=e).onmessage=e=>{if(Od!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Kd.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Od.onerror=e=>{if(Od===t)if(0!==Kd.size){try{qd?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Kd.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Kd.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Od.onmessageerror=e=>{if(Od===t)if(0!==Kd.size){try{qd?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Kd.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Kd.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Jd(){if(Od)try{for(const[e,t]of Kd.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Kd.clear(),Od.terminate?.()}catch{}Od=null,zd=null}function Qd(e,t,n=1400){if(zd)return Promise.reject(zd);const o=Od||((zd=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",zd.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(zd);if(Kd.size>=Vd){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Zd,e.inFlight=Kd.size,e.max=Vd,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),Kd.delete(l))};Kd.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Kd.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Kd.get(l)?.reject(e)},n)})}async function eu(e,t,n=1400){return Qd("canParse",{code:e,theme:t},n)}async function tu(e,t,n=2400){return Qd("findPrefix",{code:e,theme:t},n)}function nu(){Od?.terminate?.(),Od=null,zd=null,Kd.clear()}var ou=null,ru=!1,iu=null,lu=null;function au(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(iu!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),iu=n}catch{}}var su=/* @__PURE__ */N(68),cu=/* @__PURE__ */Symbol(su),du=/* @__PURE__ */Symbol(su+1),uu=/* @__PURE__ */Symbol(su+2),mu=/* @__PURE__ */Symbol(su+3),fu=/* @__PURE__ */Symbol(su+4),hu=/* @__PURE__ */Symbol(su+5),pu=/* @__PURE__ */Symbol(su+6),gu=/* @__PURE__ */Symbol(su+7),yu=/* @__PURE__ */Symbol(su+8),bu=/* @__PURE__ */Symbol(su+9),wu=/* @__PURE__ */Symbol(su+10),vu=/* @__PURE__ */Symbol(su+11),ku=/* @__PURE__ */Symbol(su+12),xu=/* @__PURE__ */Symbol(su+13),Su=/* @__PURE__ */Symbol(su+14),Cu=/* @__PURE__ */Symbol(su+15),Mu=/* @__PURE__ */Symbol(su+16),Nu=/* @__PURE__ */Symbol(su+17),$u=/* @__PURE__ */Symbol(su+18),Bu=/* @__PURE__ */Symbol(su+19),Lu=/* @__PURE__ */Symbol(su+20),Tu=/* @__PURE__ */Symbol(su+21),Eu=/* @__PURE__ */Symbol(su+22),ju=/* @__PURE__ */Symbol(su+23),Pu=/* @__PURE__ */Symbol(su+24),Du=/* @__PURE__ */Symbol(su+25),_u=/* @__PURE__ */Symbol(su+26),Ru=/* @__PURE__ */Symbol(su+27),Au=/* @__PURE__ */Symbol(su+28),Fu=/* @__PURE__ */Symbol(su+29),Hu=/* @__PURE__ */Symbol(su+30),Wu=/* @__PURE__ */Symbol(su+31),Iu=/* @__PURE__ */Symbol(su+32),Ou=/* @__PURE__ */Symbol(su+33),zu=/* @__PURE__ */Symbol(su+34),Ku=/* @__PURE__ */Symbol(su+35),Vu=/* @__PURE__ */Symbol(su+36),qu=/* @__PURE__ */Symbol(su+37),Uu=/* @__PURE__ */Symbol(su+38),Xu=/* @__PURE__ */Symbol(su+39),Yu=/* @__PURE__ */Symbol(su+40),Zu=/* @__PURE__ */Symbol(su+41),Gu=/* @__PURE__ */Symbol(su+42),Ju=/* @__PURE__ */Symbol(su+43),Qu=/* @__PURE__ */Symbol(su+44),em=/* @__PURE__ */Symbol(su+45),tm=/* @__PURE__ */Symbol(su+46),nm=/* @__PURE__ */Symbol(su+47),om=/* @__PURE__ */Symbol(su+48),rm=/* @__PURE__ */Symbol(su+49),im=/* @__PURE__ */Symbol(su+50),lm=/* @__PURE__ */Symbol(su+51),am=/* @__PURE__ */Symbol(su+52),sm=/* @__PURE__ */Symbol(su+53),cm=/* @__PURE__ */Symbol(su+54),dm=/* @__PURE__ */Symbol(su+55),um=/* @__PURE__ */Symbol(su+56),mm=/* @__PURE__ */Symbol(su+57),fm=/* @__PURE__ */Symbol(su+58),hm=/* @__PURE__ */Symbol(su+59),pm=/* @__PURE__ */Symbol(su+60),gm=/* @__PURE__ */Symbol(su+61),ym=/* @__PURE__ */Symbol(su+62),bm=/* @__PURE__ */Symbol(su+63),wm=/* @__PURE__ */Symbol(su+64),vm=/* @__PURE__ */Symbol(su+65),km=/* @__PURE__ */Symbol(su+66),xm=/* @__PURE__ */Symbol(su+67),Sm="undefined"!=typeof window?U:q,Cm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function Mm(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Nm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(Mm(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||Mm(e),o}function $m(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var Bm={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 Lm(e){const n={...Bm,...e},{t:o}=J(cu,$t,cu),r=X(()=>Gt("mermaid"),[],du),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],uu),a=n.workerTimeoutMs??Bm.workerTimeoutMs,s=n.parseTimeoutMs??Bm.parseTimeoutMs,c=n.renderTimeoutMs??Bm.renderTimeoutMs,d=n.fullRenderTimeoutMs??Bm.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??Bm.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?Fd(n.maxHeight):null,[n.maxHeight],mu),f=X(()=>Wd(Fd(n.estimatedPreviewHeightPx)??Hd(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],fu),[h,p]=Z(!1,hu),[g,y]=Z(!1,pu),[b,w]=Z(!1,gu),[v,M]=Z(!1,yu),[N,$]=Z(1,bu),[B,L]=Z({x:0,y:0},wu),[E,j]=Z(!1,vu),[P,D]=Z(!1,ku),[_,R]=Z(!1,xu),[A,F]=Z(null,Su),[H,W]=Z(!1,Cu),[I,O]=Z(`${f}px`,Mu),[z,V]=Z("undefined"==typeof window,Nu),G=Y(null,$u),Q=Y(null,Bu),ee=Y(null,Lu),te=Y(null,Tu),ne=Y(null,Eu),oe=Y(null,ju),re=Y(null,Pu),ie=Y({x:0,y:0},Du),le=Y(0,_u),ae=Y({},Ru),se=Y(null,Au),ce=Y("",Fu),de=Y(!1,Hu),ue=Y(null,Wu),me=Y(!1,Iu),fe=Y({zoom:1,translateX:0,translateY:0,containerHeight:I||"360px"},Ou),he=J(zu,et,zu),pe=Boolean(n.node?.loading??n.loading),ge=n.isDark?"dark":"light",ye=Boolean(n.isStrict),be=!0===n.enableMermaidInteractions,we=X(()=>ye?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Cm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ye],Ku);q(()=>{me.current=_},[_],Vu),q(()=>{g||b||O(e=>{const t=Fd(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,g],qu),q(()=>{ae.current={}},[ge,l,ye],Uu),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(ou)return au(ou,e),ou;if(lu){const t=await lu;return t&&au(t,e),t}if(ru)return null;try{ru=!0,lu=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(ou=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return au(ou,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),ou}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{lu=null}})();const t=await lu;return t&&au(t,e),t}catch{return null}}(we);e||(G.current=t,p(Boolean(t)),de.current||y(!t))})(),()=>{e=!0}},[we],Xu),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],Yu),q(()=>{if("undefined"==typeof document)return;if(!H)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[H],Zu);const ve=K(()=>m,[m],Gu),ke=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=ve(),u=null==d?c:Math.min(c,d);O(`${"none"===n.maxHeight?u:Math.max(u,f)}px`)},[f,n.maxHeight,ve],Ju);q(()=>{if(!Q.current||"undefined"==typeof ResizeObserver)return;if(g||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Id(()=>ke(t))});return e.observe(Q.current),()=>e.disconnect()},[b,g,ke],Qu),q(()=>{g||b||ke()},[b,n.maxHeight,g,ke],em),q(()=>()=>{nu()},[],tm),U(()=>{const e=ae.current[ge];!g&&te.current&&e?.svg&&(Nm(te.current,e.svg)&&(se.current=e.bindFunctions??null,$m(te.current,e.bindFunctions,be)),Id(()=>ke()))},[be,g,ge,ke],nm);const xe=K(async(e,t,o)=>{if(!G.current||!te.current)return!1;D(!0);try{const n=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=jm(e,t),i=await Rm(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=Nm(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,$m(te.current,i.bindFunctions,be),ke(),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{D(!1)}},[be,d,pe,ke],om),Se=K(async(e,t,n)=>{if(G.current&&te.current){D(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=jm(_m(e)||e,t),i=await Rm(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=Nm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,$m(te.current,i.bindFunctions,be)),e&&ke()}}catch{}finally{D(!1)}}},[be,c,pe,ke],rm),Ce=K(async(e,t)=>{if(!e.trim())return Mm(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"===Pm(e)){const i=_m(e);if(!i.trim())return;try{if(await Em(i,ge,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;i===e?await xe(e,ge,t)&&(ce.current=n):await Se(i,ge,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await Em(e,ge,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;return void(await xe(e,ge,t)&&(ce.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await tu(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return _m(e)}(e,ge,{workerTimeout:a,signal:t});if(!n||t?.aborted||le.current!==o)return;await Se(n,ge,t)}catch{}},[s,xe,Se,ge,a],im),Me=K(()=>z&&!g&&!b,[b,g,z],lm);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],am);const Ne=K((e,t)=>{e.clientX,e.clientY,Rt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],sm),$e=K(async()=>{try{await(navigator.clipboard?.writeText(l)),M(!0),n.onCopy?.(l),setTimeout(()=>M(!1),1e3)}catch{}},[l,n],cm),Be=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=Am(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??Am(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],dm),Le=K(()=>{re.current=null,Mm(oe.current)},[],um),Te=K(()=>{W(!1),Le()},[Le],mm),Ee=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?Am(e):null};n.onOpenModal?.(t),t.defaultPrevented||W(!0)},[n],fm);q(()=>{if(!H)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,H],hm),J(pm,Sm,()=>{if(!H)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),Mm(e),e.appendChild(o),$m(e,se.current??ae.current[ge]?.bindFunctions,be)},[be,H,ge],pm),q(()=>{H&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${N})`)},[H,B.x,B.y,N],gm);const je=g||P||b,Pe=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],ym),De=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){y(!1);const e=fe.current;$(e.zoom),L({x:e.translateX,y:e.translateY}),O(e.containerHeight)}else fe.current={zoom:N,translateX:B.x,translateY:B.y,containerHeight:I},y(!0)},[l,I,Ce,n,ge,B.x,B.y,ke,N],bm),_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=Tm(N+l,.5,3);if(a===N)return;const s=a/N;L({x:B.x-r*(s-1),y:B.y-i*(s-1)}),$(a)},[B,N],wm),Re=K((e,t)=>{j(!0),ie.current={x:e-B.x,y:t-B.y}},[B.x,B.y],vm),Ae=K((e,t)=>{E&&L({x:e-ie.current.x,y:t-ie.current.y})},[E],km),Fe=K(()=>{j(!1)},[],xm),He=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(()=>k("button",{type:"button",className:ei("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:()=>At(),onClick:()=>$(Tm(N+.1,.5,3))},"\n +\n ")),C(()=>k("button",{type:"button",className:ei("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:()=>At(),onClick:()=>$(Tm(N-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:ei("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:()=>At(),onClick:()=>{$(1),L({x:0,y:0})}},()=>T([Math.round(100*N),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:ei("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50"),style:{height:I,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:ei("absolute inset-0 cursor-grab",{"cursor-grabbing":E}),style:{transform:`translate(${B.x}px, ${B.y}px) scale(${N})`}},()=>C(()=>k("div",{ref:te,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})))),(P||pe)&&k("div",{className:"mermaid-loading"},k("span",{className:"mermaid-spinner"}),k("span",{},"Rendering diagram…"))])))])),We=n.showHeader&&C(()=>S("div",{className:ei("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(()=>k("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:r}})),C(()=>k("span",{className:ei("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:ei("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:ei("px-2.5 py-1 text-xs rounded transition-colors",g?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:()=>De("preview"),onMouseEnter:e=>Ne(e,o("common.preview")),onFocus:e=>Ne(e,o("common.preview")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([k("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"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("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"}),k("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview"))])))),C(()=>S("button",{type:"button",className:ei("px-2.5 py-1 text-xs rounded transition-colors",g?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:()=>De("source"),onMouseEnter:e=>Ne(e,o("common.source")),onFocus:e=>Ne(e,o("common.source")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([k("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"},k("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:Pe,"aria-pressed":b,onClick:()=>w(e=>!e),onMouseEnter:e=>Ne(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Ne(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>C(()=>k("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"},k("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:Pe,onClick:$e,onMouseEnter:e=>Ne(e,o(v?"common.copied":"common.copy")),onFocus:e=>Ne(e,o(v?"common.copied":"common.copy")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>k("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"},v?k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("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(()=>k("button",{type:"button",className:ei(Pe,je?"opacity-50 cursor-not-allowed":""),disabled:je,onClick:Be,onMouseEnter:e=>Ne(e,o("common.export")),onFocus:e=>Ne(e,o("common.export")),onMouseLeave:()=>At(),onBlur:()=>At()},k("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"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),k("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&h&&C(()=>S("button",{type:"button",className:ei(Pe,je?"opacity-50 cursor-not-allowed":""),disabled:je,onClick:H?Te:Ee,onMouseEnter:e=>Ne(e,o(H?"common.minimize":"common.open")),onFocus:e=>Ne(e,o(H?"common.minimize":"common.open")),onMouseLeave:()=>At(),onBlur:()=>At()},()=>k("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"},k("path",H?{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"}))))]))]))),Ie=S("div",{},()=>T([g?C(()=>S("div",{className:ei("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))):He,A&&S("div",{className:"mermaid-error"},()=>A)]));return S(t,{},()=>T([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":g?"source":_?"preview":"pending",className:ei("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":pe})},()=>T([We,C(()=>S("div",{ref:ne,style:{display:b?"none":""}},()=>Ie))]))),H&&"undefined"!=typeof document&&x(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Te()},()=>C(()=>S("div",{className:ei("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(()=>k("div",{ref:oe,className:"mermaid-modal-content"})))])))),document.body)]))}function Tm(e,t,n){return Math.min(Math.max(e,t),n)}async function Em(e,t,n){try{if(await eu(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=jm(e,t),r=n.mermaid;if("function"==typeof r.parse)return await Rm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Rm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function jm(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function Pm(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 Dm(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 _m(e){if("gantt"===Pm(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(Dm(e))break;t.pop()}else t.pop()}return t.some(Dm)?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 Rm(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 Am(e){return(new XMLSerializer).serializeToString(e)}var Fm=/* @__PURE__ */O('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),Hm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l;const a=w(Fm),s=W(y(a),1);i=a,l=W(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&&(H(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):H(e,n)}}});function Wm(e){const{node:t}=e;return k(Hm,{h0:" ",h1:String(t?.type)})}function Im(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:mt(c)}}function Om(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function zm(e,t,n,o){const r=e.filter(e=>!Om(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=>!Om(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return Pe(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Om(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Om(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Om(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Km(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??ct(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"},zm(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;Ee.has(e.type)||n&&function(e,t,n){return"block"===Im(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"},zm(a,r,o,String(i??"paragraph")))}Wm.$$singleRoot=!0,M(["click","keydown","mouseenter","mouseleave"]);var Vm=/* @__PURE__ */O('<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>'),qm=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),Um=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Vm);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):H(e,n),o.g=n}}});function Xm(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],qm);return k(Um,{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})}Xm.$$singleRoot=!0;var Ym=/* @__PURE__ */O('<s class="strikethrough-node"></s>'),Zm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Ym);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):H(e,n),o.c=n}}});function Gm(e){return k(Zm,{h0:e.children})}Gm.$$singleRoot=!0;var Jm=/* @__PURE__ */O('<strong class="strong-node"></strong>'),Qm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(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):H(e,n),o.c=n}}});function ef(e){return k(Qm,{h0:e.children})}ef.$$singleRoot=!0;var tf=/* @__PURE__ */O('<sub class="subscript-node"></sub>'),nf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(tf);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):H(e,n),o.c=n}}});function of(e){return k(nf,{h0:e.children})}of.$$singleRoot=!0;var rf=/* @__PURE__ */O('<sup class="superscript-node"></sup>'),lf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(rf);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):H(e,n),o.c=n}}});function af(e){return k(lf,{h0:e.children})}af.$$singleRoot=!0;var sf=/* @__PURE__ */O('<th dir="auto"><!><!></th>'),cf=/* @__PURE__ */O("<tr></tr>"),df=/* @__PURE__ */O('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),uf=/* @__PURE__ */N(5),mf=/* @__PURE__ */Symbol(uf),ff=/* @__PURE__ */Symbol(uf+1),hf=/* @__PURE__ */Symbol(uf+2),pf=/* @__PURE__ */Symbol(uf+3),gf=/* @__PURE__ */Symbol(uf+4),yf=(e,t)=>`header-${t}`;function bf(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=w(sf);e=a,n=a;const s=y(a);o=s,r=a,i=W(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=ei("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?De(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):H(e,n)}}{const e=u<a.length-1&&C(()=>k("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):H(o,e)}}}var wf=(e,t)=>`row-${t}`;function vf(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=w(cf);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=ei("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:ei("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?De(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):H(e,n),d.e=n}}}var kf=["r","c","d"],xf=/* @__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 v=w(df);n=v;const k=y(v);{const n=e.h1;i=n,l=k,E(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}a=k,s=k;const x=W(y(k),1),S=y(x);c=S,d=y(S);const C=W(x,1);u=C,m=y(C),f=k,h=y(k),p=v,b=W(k,1),r=g(t,v,{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=kf}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&E(t,()=>o(n,r.d)),r.c=n}}{const t=e.h0;r.a!==t&&(D(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&&(P(r.h,"aria-busy",t),r.g=t)}B(t,1,r.i,e.h5,e.h6,e.h7,yf,bf,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,wf,vf,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):H(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):H(e,n)}}});function Sf(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,mf),d=e.useRef(null,ff),u=e.useRef(null,hf),[m,f]=e.useState([],pf),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},g=(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],gf),k(xf,{h0:i,h1:c,h2:ei("my-8 text-sm table-node",a&&"table-node--loading"),h3:a,h4:m.length>0&&S("colgroup",{},()=>l.map((e,t)=>k("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:ei("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>T([o&&r?De(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>k("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>g(t,e)}))])),h8:[h,o,l,i,r,g],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:ei("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:ei("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?De(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&k("div",{className:"table-node__loading",role:"status","aria-live":"polite"},k("span",{className:"table-node__spinner","aria-hidden":"true"}),k("span",{className:"sr-only"},"Loading"))})}Sf.$$singleRoot=!0;var Cf=/* @__PURE__ */O('<hr class="hr-node thematic-break"/>'),Mf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(Cf)))});function Nf(){return k(Mf,{})}Nf.$$singleRoot=!0;var $f=/* @__PURE__ */O("<div></div>"),Bf=/* @__PURE__ */Symbol(/* @__PURE__ */N(1)),Lf=["s","d","c"],Tf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w($f);n=e.h0,r=I(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&&j(e.ref,o.c)}),a=s,o=h(t,s,n,r,i,l,a,null,void 0),t.refFields=Lf}else{{const t=e.h0;o.a!==t&&(o.a=t)}o.b=I(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 Ef(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)?je(n.attrs):n.attrs},[n.attrs],Bf);return k(Tf,{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})}Ef.$$singleRoot=!0;var jf=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function Pf(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))jf.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function Df(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function _f(t,n,o,r,i={}){const l=Pf(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),stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,langs:r.codeBlockThemes?.langs,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,...i,ctx:r,renderNode:Af,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function Rf(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function Af(t,n,o){const r=o.customComponents??ct(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:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(c)return function(t,n,o,r,i){const l=te(we(fe(n.attrs??void 0,r.htmlPolicy??"safe",i))),a=Array.isArray(n.children)?Pe(n.children,r,`${String(o)}-html`,Af):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:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=Im(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:ye(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&ge(c,s))return"html_inline"===t.type?Df(Nc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):Df(Km,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return Df(Nc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return Df(Nc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return Df(Km,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return Df(_l,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return Df(Wp,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return Df(Fc,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return Df(Ac,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return Df(Sf,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return Df(dl,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return Df(Sl,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return Df(El,t,n,{});case"footnote_anchor":return Df(vl,t,n,{});case"admonition":return Df(Oe,t,n,{ctx:o,renderNode:Af,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return Df(Dl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return Df(Dc,t,n,{ctx:o,renderNode:Af,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return Df(ss,t,n,{});case"inline_code":return Df(cc,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=qt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,qt(n),Ce(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==Fd(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Wd(Hd(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Fd(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return Rf(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(Lm,{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==cs(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=us(ds(String(e?.code??"")),void 0,"none"===n.maxHeight?null:cs(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?Rf(l,t,n,o,i):e.createElement(Js,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?Rf(i,t,n,o,o.d2Props||{}):e.createElement(rl,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return _f(a,t,n,o);const s=r.code_block;if(s)return _f(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=Pf(o.codeBlockProps,{omit:["langs"]});return e.createElement(Un,{key:n,node:t,showLineNumbers:!0===r.showLineNumbers})}return e.createElement(Jr,{key:n,node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:o.codeBlockThemes?.monacoOptions,themes:o.codeBlockThemes?.themes,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...Pf(o.codeBlockProps,{omit:["langs"]})})}(t,n,o,r);case"strong":return Df(ef,t,n,{},Pe(t.children,o,`${String(n)}-strong`,Af));case"emphasis":return Df(gl,t,n,{},Pe(t.children,o,`${String(n)}-em`,Af));case"strikethrough":return Df(Gm,t,n,{},Pe(t.children,o,`${String(n)}-strike`,Af));case"highlight":return Df(Fl,t,n,{},Pe(t.children,o,`${String(n)}-highlight`,Af));case"insert":return Df(mc,t,n,{},Pe(t.children,o,`${String(n)}-insert`,Af));case"subscript":return Df(of,t,n,{},Pe(t.children,o,`${String(n)}-sub`,Af));case"superscript":return Df(af,t,n,{},Pe(t.children,o,`${String(n)}-sup`,Af));case"checkbox":case"checkbox_input":return Df(Ct,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return Df(fl,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(Nf);case"math_inline":return Df(Ad,t,n,{});case"math_block":return Df(Sd,t,n,{});case"reference":return Df(Xm,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?Df(Ma,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):Df(Qa,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return Df(Ef,t,n,{ctx:o,renderNode:Af,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return Df(Wm,t,n,{})}}var Ff=/* @__PURE__ */N(100),Hf=/* @__PURE__ */Symbol(Ff),Wf=/* @__PURE__ */Symbol(Ff+1),If=/* @__PURE__ */Symbol(Ff+2),Of=/* @__PURE__ */Symbol(Ff+3),zf=/* @__PURE__ */Symbol(Ff+4),Kf=/* @__PURE__ */Symbol(Ff+5),Vf=/* @__PURE__ */Symbol(Ff+6),qf=/* @__PURE__ */Symbol(Ff+7),Uf=/* @__PURE__ */Symbol(Ff+8),Xf=/* @__PURE__ */Symbol(Ff+9),Yf=/* @__PURE__ */Symbol(Ff+10),Zf=/* @__PURE__ */Symbol(Ff+11),Gf=/* @__PURE__ */Symbol(Ff+12),Jf=/* @__PURE__ */Symbol(Ff+13),Qf=/* @__PURE__ */Symbol(Ff+14),eh=/* @__PURE__ */Symbol(Ff+15),th=/* @__PURE__ */Symbol(Ff+16),nh=/* @__PURE__ */Symbol(Ff+17),oh=/* @__PURE__ */Symbol(Ff+18),rh=/* @__PURE__ */Symbol(Ff+19),ih=/* @__PURE__ */Symbol(Ff+20),lh=/* @__PURE__ */Symbol(Ff+21),ah=/* @__PURE__ */Symbol(Ff+22),sh=/* @__PURE__ */Symbol(Ff+23),ch=/* @__PURE__ */Symbol(Ff+24),dh=/* @__PURE__ */Symbol(Ff+25),uh=/* @__PURE__ */Symbol(Ff+26),mh=/* @__PURE__ */Symbol(Ff+27),fh=/* @__PURE__ */Symbol(Ff+28),hh=/* @__PURE__ */Symbol(Ff+29),ph=/* @__PURE__ */Symbol(Ff+30),gh=/* @__PURE__ */Symbol(Ff+31),yh=/* @__PURE__ */Symbol(Ff+32),bh=/* @__PURE__ */Symbol(Ff+33),wh=/* @__PURE__ */Symbol(Ff+34),vh=/* @__PURE__ */Symbol(Ff+35),kh=/* @__PURE__ */Symbol(Ff+36),xh=/* @__PURE__ */Symbol(Ff+37),Sh=/* @__PURE__ */Symbol(Ff+38),Ch=/* @__PURE__ */Symbol(Ff+39),Mh=/* @__PURE__ */Symbol(Ff+40),Nh=/* @__PURE__ */Symbol(Ff+41),$h=/* @__PURE__ */Symbol(Ff+42),Bh=/* @__PURE__ */Symbol(Ff+43),Lh=/* @__PURE__ */Symbol(Ff+44),Th=/* @__PURE__ */Symbol(Ff+45),Eh=/* @__PURE__ */Symbol(Ff+46),jh=/* @__PURE__ */Symbol(Ff+47),Ph=/* @__PURE__ */Symbol(Ff+48),Dh=/* @__PURE__ */Symbol(Ff+49),_h=/* @__PURE__ */Symbol(Ff+50),Rh=/* @__PURE__ */Symbol(Ff+51),Ah=/* @__PURE__ */Symbol(Ff+52),Fh=/* @__PURE__ */Symbol(Ff+53),Hh=/* @__PURE__ */Symbol(Ff+54),Wh=/* @__PURE__ */Symbol(Ff+55),Ih=/* @__PURE__ */Symbol(Ff+56),Oh=/* @__PURE__ */Symbol(Ff+57),zh=/* @__PURE__ */Symbol(Ff+58),Kh=/* @__PURE__ */Symbol(Ff+59),Vh=/* @__PURE__ */Symbol(Ff+60),qh=/* @__PURE__ */Symbol(Ff+61),Uh=/* @__PURE__ */Symbol(Ff+62),Xh=/* @__PURE__ */Symbol(Ff+63),Yh=/* @__PURE__ */Symbol(Ff+64),Zh=/* @__PURE__ */Symbol(Ff+65),Gh=/* @__PURE__ */Symbol(Ff+66),Jh=/* @__PURE__ */Symbol(Ff+67),Qh=/* @__PURE__ */Symbol(Ff+68),ep=/* @__PURE__ */Symbol(Ff+69),tp=/* @__PURE__ */Symbol(Ff+70),np=/* @__PURE__ */Symbol(Ff+71),op=/* @__PURE__ */Symbol(Ff+72),rp=/* @__PURE__ */Symbol(Ff+73),ip=/* @__PURE__ */Symbol(Ff+74),lp=/* @__PURE__ */Symbol(Ff+75),ap=/* @__PURE__ */Symbol(Ff+76),sp=/* @__PURE__ */Symbol(Ff+77),cp=/* @__PURE__ */Symbol(Ff+78),dp=/* @__PURE__ */Symbol(Ff+79),up=/* @__PURE__ */Symbol(Ff+80),mp=/* @__PURE__ */Symbol(Ff+81),fp=/* @__PURE__ */Symbol(Ff+82),hp=/* @__PURE__ */Symbol(Ff+83),pp=/* @__PURE__ */Symbol(Ff+84),gp=/* @__PURE__ */Symbol(Ff+85),yp=/* @__PURE__ */Symbol(Ff+86),bp=/* @__PURE__ */Symbol(Ff+87),wp=/* @__PURE__ */Symbol(Ff+88),vp=/* @__PURE__ */Symbol(Ff+89),kp=/* @__PURE__ */Symbol(Ff+90),xp=/* @__PURE__ */Symbol(Ff+91),Sp=/* @__PURE__ */Symbol(Ff+92),Cp=/* @__PURE__ */Symbol(Ff+93),Mp=/* @__PURE__ */Symbol(Ff+94),Np=/* @__PURE__ */Symbol(Ff+95),$p=/* @__PURE__ */Symbol(Ff+96),Bp=/* @__PURE__ */Symbol(Ff+97),Lp=/* @__PURE__ */Symbol(Ff+98),Tp=/* @__PURE__ */Symbol(Ff+99),Ep={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},jp=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 Dp(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],Hf),n=Y(t,Wf);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 _p=e.memo(({node:e,nodeKey:t,renderCtx:n})=>Af(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Rp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J(If,et,If),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,g=!1!==e.viewportPriority,y=m&&(e.maxLiveNodes??0)<=0,b=X(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&g,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,g,p],Of),[w,v]=Z(()=>y?Math.min(t.length,u):t.length,zf),x=Y(w,Kf);q(()=>{x.current=w},[w],Vf);const M=y?w:t.length,[N,$]=Z(0,qf),[B,L]=Z({start:0,end:t.length},Uf),E=Y(/* @__PURE__ */new Map,Xf),[j,P]=Z(0,Yf),D=Y({},Zf),_=Y(/* @__PURE__ */new Map,Gf),R=Y(/* @__PURE__ */new Map,Jf),A=Y(/* @__PURE__ */new Map,Qf),F=Y(/* @__PURE__ */new Map,eh),H=Y(/* @__PURE__ */new Set,th),W=Y(w,nh),I=Y(null,oh),O=Y(null,rh),z=Y(null,ih),V=Y(!1,lh),U=Y(null,ah),G=Y(Math.max(1,d||1),sh),Q=Y(t.length,ch),ee=Y({key:e.indexKey,total:t.length},dh),te=Y({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:y},uh),ne=b||p,oe=X(()=>{const e=E.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[j],mh),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],fh);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(w,n)},[t.length,p,B.end,f,u,w],hh);const ie=K((e,t)=>{if(e>=t)return 0;const n=E.current;let o=0;for(let r=e;r<t;r++)o+=n.get(r)??oe;return o},[oe],ph),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!=I.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(I.current),I.current=null),null!=O.current&&(window.clearTimeout(O.current),O.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),V.current=!1,U.current=null},[],gh),ce=K(t=>{if(!y)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)))},[y,e.renderBatchBudgetMs,d],yh),de=K((t,n={})=>{if(!y)return;const o=Q.current;if(x.current>=o)return;const r=Math.max(1,t),i=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();v(t=>{const n=Math.min(Q.current,t+Math.max(1,e));return x.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=>{I.current=null,O.current=null,z.current=null,V.current=!1;const n=U.current;if(U.current=null,i(null!=n?n:r),x.current>=Q.current)return;if(!t)return void l();const o=Math.max(2,e.renderBatchBudgetMs??6);for(;x.current<Q.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)i(Math.max(1,Math.round(G.current)));x.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?I.current=requestAnimationFrame(()=>{0!==d?O.current=window.setTimeout(()=>a(),d):a()}):O.current=window.setTimeout(()=>a(),d)}},[ce,c,y,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],bh);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!==y;if(te.current={batchSize:d,initial:u,delay:a,enabled:y},(i||c||!y)&&se(),(i||c)&&(G.current=Math.max(1,d||1),H.current.clear()),!o)return x.current=0,void v(0);const m=Q.current;if(!y)return x.current=m,void v(m);if(i||c){const e=Math.min(m,u);return x.current=e,v(e),void(e<m&&de(Math.max(1,u),{immediate:!s}))}const f=Math.min(x.current,m);f!==x.current&&(x.current=f,v(f)),x.current<m&&de(Math.max(1,d||1))},[se,y,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],wh),q(()=>{if(!p)return void L({start:0,end:t.length});const e=t.length;if(!e)return void L({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))}L({start:o,end:r})},[N,f,h,t.length,p],vh),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],kh);const ue=K(e=>{for(const[t,n]of _.current.entries())t>=e&&(n.destroy(),_.current.delete(t),delete D.current[t],R.current.delete(t),A.current.delete(t),F.current.delete(t))},[],xh);q(()=>{ue(M)},[ue,M],Sh),q(()=>{const e=t.length;let n=!1;for(const t of Array.from(E.current.keys()))t>=e&&(E.current.delete(t),n=!0);n&&P(e=>e+1);for(const t of Object.keys(D.current))Number(t)>=e&&delete D.current[t];for(const t of Array.from(H.current))t>=e&&H.current.delete(t)},[t.length],Ch);const me=K((e,t)=>{b&&t&&(D.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],Mh),fe=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],Nh),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 D.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],$h),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],Bh),ge=K((e,t)=>{if(!t)return void(E.current.has(e)&&(E.current.delete(e),P(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&E.current.get(e)!==n&&(E.current.set(e,n),P(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],Lh),ye=K(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ge(e,t);return F.current.set(e,n),n},[ge],Th),be=K(e=>!(y&&e>=x.current)&&(!b||e<u||!0===D.current[e]),[b,y,u],Eh),we=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],jh);q(()=>{for(const[e,t]of R.current.entries())t&&he(e,t)},[he],Ph),q(()=>{p&&w>W.current&&$(w-1),W.current=w},[w,p],Dh);const ve=p?C(()=>k("div",{className:"node-spacer",style:{height:`${le}px`},"aria-hidden":"true"})):null,ke=p?C(()=>k("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:we(e.onMouseOver),onMouseOut:we(e.onMouseOut)},()=>T([ve,re.map(({node:t,index:r})=>{const i=be(r),l=E.current.get(r)??oe,a=!1!==e.fade&&"code_block"!==t.type&&!H.current.has(r)&&i;return a&&H.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:ye(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>k(_p,{node:t,nodeKey:`${o}-${r}`,renderCtx:n}))):()=>k("div",{className:"node-placeholder",style:{height:`${l}px`}})))}),ke,i&&C(()=>k("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 Ap(t){const n={...Ep,...t},o=Y(null,_h),r=Y(null,Rh),i=Y(/* @__PURE__ */new Map,Ah),l=Y(0,Fh),a=Y(null,Hh),s=J(Wh,gt,n.smoothStreamingOptions,Wh),c=e.useContext(ze),d=Y(/* @__PURE__ */new Set,Ih),[u,m]=Z(()=>!0===n.smoothStreaming,Oh);q(()=>{m(!0)},[],zh);const f=Array.isArray(n.nodes)&&n.nodes.length>0,h=X(()=>!1!==n.smoothStreaming&&!f&&(!0===n.smoothStreaming||!c)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[f,c,n.maxLiveNodes,n.smoothStreaming,n.typewriter],Kh),p=u&&h,g=p?s.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Vh),b=n.content??"",w=f||s.source===b,v=X(()=>p&&null!=y?Boolean(y&&w&&s.caughtUp):y,[y,w,s.caughtUp,p],qh),x=Y(null,Uh),[M,N]=Z(!1,Xh),$=Y(void 0,Yh),B=Y(0,Zh),L=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],Gh),T=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&L.has(t)},[L],Jh),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},[],Qh),j=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+E(t),0):(n.content??"").length,[n.nodes,n.content,E],ep),P=K(()=>{$.current&&(clearTimeout($.current),$.current=void 0)},[],tp),D=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},[],np),_=K(()=>{if("undefined"==typeof window||!M||!o.current||!x.current)return;const e=o.current,t=x.current,n=D(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`},[M,o,D],op);q(()=>{M&&requestAnimationFrame(()=>{_()})},[M,_],rp),q(()=>()=>{P()},[P],ip);const R=f?n.nodes:g;a.current!==R&&(l.current+=1,a.current=R);const A=G(lt,at,at,lp),F=X(()=>ct(n.customId),[n.customId,A],ap),H=J(sp,Dp,n.streamingComponents,sp),W=J(cp,Dp,n.htmlComponents,cp);q(()=>{!function(e,t,n){if(tt())for(const o of Object.keys(e))t[o]&&!n.has(o)&&(n.add(o),console.warn(`[markstream-octane] "${o}" was provided in both streamingComponents and htmlComponents. The streamingComponents entry will be used for parser-backed rendering.`))}(H,W,d.current)},[W,H],dp);const I=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],up),O=X(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return se(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(H))},[n.customId,n.customHtmlTags,n.parseOptions,A,H],mp),z=X(()=>{const e=O;return e&&0!==e.length?oe(I,{customHtmlTags:e}):oe(I)},[I,O],fp),V=X(()=>{const e=z;return n.customMarkdownIt?n.customMarkdownIt(e):e},[z,n.customMarkdownIt],hp),U=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],pp),Q=X(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return f?o=n.nodes.map(e=>({...e})):g&&(o=de(g,V??jp,U)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:g.length}),o},[n.debugPerformance,g,f,n.nodes,U,V,n.customId,A,O],gp),ee=K(()=>{const e=Q[Q.length-1];return!T(e)},[Q,T],yp);q(()=>{if("undefined"==typeof window||f)return;if(v)return N(!1),void P();const e=j(),t=ee();return!1===n.typewriter||!t||e<=B.current?(!1!==n.typewriter&&t||N(!1),void(B.current=e)):(B.current=e,N(!0),P(),requestAnimationFrame(()=>{_()}),$.current=setTimeout(()=>{N(!1)},3e3),()=>{P()})},[g,n.nodes,n.typewriter,n.content,v,Q.length,f,j,ee,P,_],bp);const te=Y([],wp),ne=U?.postTransformNodes,re=Y(ne,vp);re.current!==ne&&(te.current=[],re.current=ne);const ie=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}(Q,te.current);te.current=ie,q(()=>{if(f)return void s.reset("");const e=n.content??"";if(!p)return s.reset(e),void(y&&s.finish({flush:!0}));const t=s.getSnapshot().source;e?e===t||(e.startsWith(t)?s.enqueue(e.slice(t.length)):s.reset(e)):s.reset(""),y&&s.finish()},[f,n.content,y,p],kp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!ie.some(e=>"code_block"===e?.type&&"mermaid"!==qt(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(()=>{un()},{timeout:900});return()=>t(o)},[ie,n.renderCodeBlocksAsPre],xp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&r.current!==t&&(r.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Nn.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Nn.set(e,t),t}catch{}const n="__theme_"+ ++$n;return Nn.set(e,n),n}return String(e)}(e);t&&Sn!==t&&(xn=e,Sn=t,Cn&&kn(xn,Cn).then(()=>Bn()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre],Sp);const le=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],Cp),ae=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],Mp),ce=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],Np),ue=X(()=>({...n.d2Props||{}}),[n.d2Props],$p),me=X(()=>({...n.infographicProps||{}}),[n.infographicProps],Bp),fe=X(()=>({customId:n.customId,isDark:n.isDark,final:v,indexKey:le,typewriter:n.typewriter,fade:n.fade,textStreamState:i.current,streamRenderVersion:l.current,customComponents:F,streamingComponents:H,htmlComponents:W,customHtmlTags:O,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:ae,mermaidProps:ce,d2Props:ue,infographicProps:me,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,langs:n.langs,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,v,le,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,O,ae,ce,ue,me,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.langs,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,F,H,W],Lp);fe.streamRenderVersion=l.current,fe.textStreamState=i.current;const he=Y(null,Tp);return he.current||(he.current={textStreamState:i.current,getStreamRenderVersion:()=>l.current}),S(Ke.Provider,{value:he.current},()=>S(ze.Provider,{value:p},()=>S(Qe,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>k(Rp,{props:n,parsedNodes:ie,renderCtx:fe,indexPrefix:le,containerRef:o,showTypewriterCursor:M,typewriterCursorRef:x})))))}var Fp=/* @__PURE__ */O('<blockquote class="blockquote-node" dir="auto"></blockquote>'),Hp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(Fp);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(D(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):H(e,n),o.e=n}}});function Wp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return k(Hp,{h0:t.cite,h1:i??(n&&o?C(()=>k(Ap,{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,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMonacoOptions:n.codeBlockThemes?.monacoOptions,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}Wp.$$singleRoot=!0;var Ip=/* @__PURE__ */O('<div><!><!><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Op=/* @__PURE__ */N(72),zp=/* @__PURE__ */Symbol(Op),Kp=/* @__PURE__ */Symbol(Op+1),Vp=/* @__PURE__ */Symbol(Op+2),qp=/* @__PURE__ */Symbol(Op+3),Up=/* @__PURE__ */Symbol(Op+4),Xp=/* @__PURE__ */Symbol(Op+5),Yp=/* @__PURE__ */Symbol(Op+6),Zp=/* @__PURE__ */Symbol(Op+7),Gp=/* @__PURE__ */Symbol(Op+8),Jp=/* @__PURE__ */Symbol(Op+9),Qp=/* @__PURE__ */Symbol(Op+10),eg=/* @__PURE__ */Symbol(Op+11),tg=/* @__PURE__ */Symbol(Op+12),ng=/* @__PURE__ */Symbol(Op+13),og=/* @__PURE__ */Symbol(Op+14),rg=/* @__PURE__ */Symbol(Op+15),ig=/* @__PURE__ */Symbol(Op+16),lg=/* @__PURE__ */Symbol(Op+17),ag=/* @__PURE__ */Symbol(Op+18),sg=/* @__PURE__ */Symbol(Op+19),cg=/* @__PURE__ */Symbol(Op+20),dg=/* @__PURE__ */Symbol(Op+21),ug=/* @__PURE__ */Symbol(Op+22),mg=/* @__PURE__ */Symbol(Op+23),fg=/* @__PURE__ */Symbol(Op+24),hg=/* @__PURE__ */Symbol(Op+25),pg=/* @__PURE__ */Symbol(Op+26),gg=/* @__PURE__ */Symbol(Op+27),yg=/* @__PURE__ */Symbol(Op+28),bg=/* @__PURE__ */Symbol(Op+29),wg=/* @__PURE__ */Symbol(Op+30),vg=/* @__PURE__ */Symbol(Op+31),kg=/* @__PURE__ */Symbol(Op+32),xg=/* @__PURE__ */Symbol(Op+33),Sg=/* @__PURE__ */Symbol(Op+34),Cg=/* @__PURE__ */Symbol(Op+35),Mg=/* @__PURE__ */Symbol(Op+36),Ng=/* @__PURE__ */Symbol(Op+37),$g=/* @__PURE__ */Symbol(Op+38),Bg=/* @__PURE__ */Symbol(Op+39),Lg=/* @__PURE__ */Symbol(Op+40),Tg=/* @__PURE__ */Symbol(Op+41),Eg=/* @__PURE__ */Symbol(Op+42),jg=/* @__PURE__ */Symbol(Op+43),Pg=/* @__PURE__ */Symbol(Op+44),Dg=/* @__PURE__ */Symbol(Op+45),_g=/* @__PURE__ */Symbol(Op+46),Rg=/* @__PURE__ */Symbol(Op+47),Ag=/* @__PURE__ */Symbol(Op+48),Fg=/* @__PURE__ */Symbol(Op+49),Hg=/* @__PURE__ */Symbol(Op+50),Wg=/* @__PURE__ */Symbol(Op+51),Ig=/* @__PURE__ */Symbol(Op+52),Og=/* @__PURE__ */Symbol(Op+53),zg=/* @__PURE__ */Symbol(Op+54),Kg=/* @__PURE__ */Symbol(Op+55),Vg=/* @__PURE__ */Symbol(Op+56),qg=/* @__PURE__ */Symbol(Op+57),Ug=/* @__PURE__ */Symbol(Op+58),Xg=/* @__PURE__ */Symbol(Op+59),Yg=/* @__PURE__ */Symbol(Op+60),Zg=/* @__PURE__ */Symbol(Op+61),Gg=/* @__PURE__ */Symbol(Op+62),Jg=/* @__PURE__ */Symbol(Op+63),Qg=/* @__PURE__ */Symbol(Op+64),ey=/* @__PURE__ */Symbol(Op+65),ty=/* @__PURE__ */Symbol(Op+66),ny=/* @__PURE__ */Symbol(Op+67),oy=/* @__PURE__ */Symbol(Op+68),ry=/* @__PURE__ */Symbol(Op+69),iy=/* @__PURE__ */Symbol(Op+70),ly=/* @__PURE__ */Symbol(Op+71),ay=["r","a","b"],sy=/* @__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;const p=w(Ip);{const l=e.h0;n=l,i=p,E(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=p,a=p,s=p;const b=y(p);c=b,d=p;const v=W(b,1);u=v,m=p;const k=W(v,1);f=k,h=W(k,1),r=g(t,p,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:s,h:c,i:null,j:void 0,k:d,l:u,m:null,n:void 0,o:m,p:f,q:null,r:void 0,s:h,t:null,u:void 0}),t.refFields=ay}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&E(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 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):H(e,n)}}{const n=e.h4,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.n!==n){r.n=n;const e=r.m;null==e||o||null===n?r.m=z(t,2,r.k,n,r.l,!0):H(e,n)}}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.r!==n){r.r=n;const e=r.q;null==e||o||null===n?r.q=z(t,3,r.o,n,r.p,!0):H(e,n)}}{const n=e.h6,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.u!==n){const e=r.t;null==e||o||null===n?r.t=b(t,4,r.s,n,e):H(e,n),r.u=n}}}),cy=tt();function dy(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(String.fromCharCode(34),"&quot;").replaceAll(String.fromCharCode(39),"&#39;")}function uy(e){const n={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0,...e},o=X(()=>String(n.node.language??""),[n.node.language],zp),r=X(()=>qt(o),[o],Kp),[i,l]=Z(0,Vp);q(()=>Zt(()=>{l(e=>e+1)}),[],qp);const a=X(()=>{const e=Jt[r]||r;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[r],Up),s=X(()=>Gt(r),[r,i],Xp),{t:c}=J(Yp,$t,Yp),d=X(()=>!!n.isShowPreview&&("html"===r||"svg"===r),[r,n.isShowPreview],Zp),u=X(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=t(n.minWidth),r=t(n.maxWidth);return o&&(e.minWidth=o),r&&(e.maxWidth=r),e},[n.maxWidth,n.minWidth],Gp),[m,f]=Z(!1,Jp),[h,p]=Z(!1,Qp),[g,y]=Z(!1,eg),[b,w]=Z(()=>n.node.code?`<pre class="shiki shiki-fallback"><code>${dy(n.node.code)}</code></pre>`:"",tg),[v,x]=Z(!1,ng),[M,N]=Z(14,og),[$,B]=Z(M,rg),L=X(()=>!1!==n.showTooltips,[n.showTooltips],ig),E=xe(n.themes,n.langs),j=Y(null,lg);j.current&&j.current.key===E||(j.current={key:E,themes:n.themes,langs:n.langs});const P=Y(null,ag),D=Y(null,sg),_=Y(null,cg),R=Y(null,dg),A=Y(null,ug),F=Y("",mg),H=Y("",fg),W=Y(0,hg),I=Y(null,pg),O=Y(null,gg),z=Y(null,yg),V=Y(!1,bg),U=Y(!1,wg),G=Y(null,vg),Q=Y(!1,kg),ee=Y(/* @__PURE__ */new Set,xg),te=Y(/* @__PURE__ */new Set,Sg),ne=Y("",Cg),oe=Y(0,Mg),re=Y(E,Ng),ie=Y(0,$g),le=Y(!0,Bg),ae=Y(null,Lg),se=J(Tg,et,Tg),[ce,de]=Z(()=>"undefined"==typeof window,Eg),ue=K(()=>n.isDark?n.darkTheme:n.lightTheme,[n.darkTheme,n.isDark,n.lightTheme],jg),me=K(e=>{e?.disconnect(),e&&R.current!==e||(R.current=null)},[],Pg),fe=K(()=>{_.current&&(_.current.innerHTML="")},[],Dg),he=K(e=>{if(I.current=null,me(),!e)return fe(),H.current="",w(""),void x(!1);w(`<pre class="shiki shiki-fallback"><code>${dy(e)}</code></pre>`),x(!1)},[fe,me],_g),pe=K(()=>{me(),w(""),x(!0)},[me],Rg),ge=K(e=>{H.current=e,pe()},[pe],Ag),ye=K(()=>{const e=_.current;return!!e&&(e.childNodes.length>0||Boolean(e.textContent?.trim().length))},[],Fg),be=K((e=!0)=>{const t=A.current;me(),A.current=null,F.current="",H.current="",I.current=null,ee.current.clear();try{t?.dispose()}catch(n){cy&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to dispose Shiki renderer.",n)}finally{fe(),e&&x(!1)}},[fe,me],Hg),we=K(()=>(ie.current+=1,ie.current),[],Wg),ve=K(e=>le.current&&ie.current===e,[],Ig),ke=K((e,t)=>{me();const n=_.current;if(!n||"undefined"==typeof MutationObserver)return;I.current=null;const o=new MutationObserver(()=>{W.current+=1;const n=I.current;if(n)return ve(e)?void(W.current!==t&&ye()&&(I.current=null,me(o),ge(n))):(I.current=null,void me(o))});R.current=o,o.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0})},[me,ye,ve,ge],Og),Ne=K(async(e,t,n,o)=>{if(I.current=n,await Promise.resolve(),!ve(e))return;const r=ye(),i=W.current!==t,l=void 0!==o&&_.current?.innerHTML!==o;r&&(!H.current||i||l||H.current===n)&&(I.current=null,me(),ge(n))},[me,ye,ve,ge],zg),$e=K(async()=>{if(!O.current&&!V.current)return z.current||(z.current=(async()=>{try{const e=await import("stream-markdown"),t=e.createShikiStreamRenderer;if("function"!=typeof t)throw new TypeError("stream-markdown.createShikiStreamRenderer is not available");O.current=t;const n=e.registerHighlight;G.current="function"==typeof n?n:null,V.current=!1,U.current=!1}catch(e){V.current=!0,cy&&!U.current&&"undefined"!=typeof console&&(U.current=!0,console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e))}finally{z.current=null}})()),z.current},[],Kg),Be=K(async e=>{const t=e.key;if(re.current!==t)return"stale";if(!G.current)return"ready";if(ne.current===t)return"ready";const n=++oe.current;try{await Me(G.current,e.registerOptions,t)}catch{return n!==oe.current||re.current!==t?"stale":"failed"}return n!==oe.current||re.current!==t?"stale":(ne.current=t,"ready")},[],Vg),Le=K(async e=>{const t=await Be(e);return"failed"!==t?t:re.current!==e.key?"stale":Be(e)},[Be],qg),Te=K(e=>{const t={hasRegisterHighlight:Boolean(G.current),hasCreateRenderer:Boolean(O.current)},n=Se(e?.themes,e?.langs,t),o=n.rendererOptions.langs?.length&&te.current.has(n.key)?Se(e?.themes,void 0,t):n;return n.ignoredLangs&&cy&&!Q.current&&"undefined"!=typeof console&&(Q.current=!0,console.warn("[MarkdownCodeBlockNode] `langs` requires stream-markdown >=0.0.15 with registerHighlight(); ignoring `langs` and using stream-markdown default language preload.")),{key:o.key,registerOptions:o.registerOptions,rendererOptions:o.rendererOptions}},[],Ug),Ee=K(async(e,t,n)=>{const o=A.current;if(!o||!ve(n))return;const r=function(e){return Ce(e)||"plaintext"}(t),i=async t=>{const o=A.current;if(o&&ve(n)){t&&"plaintext"!==r&&ee.current.add(r);try{return await o.updateCode(e,"plaintext"),ve(n)?"plaintext":void 0}catch{return}}};if("plaintext"!==r&&ee.current.has(r))return i();try{return await o.updateCode(e,r),ve(n)?r:void 0}catch(l){if(!ve(n)||"plaintext"===r)return;return i(l)}},[ve],Xg),je=K(async()=>{const e=we(),t=n.node.code,o=n.node.language,r=j.current;if(!ce)return void he(t);if(await $e(),!ve(e))return;let i=Te(r),l=i.key;re.current=l;let a=Boolean(A.current&&F.current!==l);a&&he(t);let s=await Le(i);if("failed"===s&&i.rendererOptions.langs?.length&&(te.current.add(i.key),cy&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to register configured Shiki languages; retrying without `langs`.",{langs:i.rendererOptions.langs}),i=Te({themes:r?.themes,langs:void 0}),l=i.key,re.current=l,s=await Le(i)),!ve(e)||"stale"===s)return;if(a=Boolean(A.current&&F.current!==l),"failed"===s)return void(a&&A.current&&ye()?pe():he(t));if(a&&be(),!D.current||!_.current)return void he(t);if(!A.current&&O.current&&(A.current=O.current(_.current,{theme:ue(),themes:i.rendererOptions.themes,langs:i.rendererOptions.langs}),F.current=l,x(!0)),!A.current)return void he(t);if(!1===n.stream&&n.loading)return void he(t);he(t);const c=W.current,d=_.current?.innerHTML;ke(e,c);const u=await Ee(t,o,e);ve(e)&&(u?await Ne(e,c,function(e,t,n){return`${e??""}\0${t}\0${n}`}(l,u,t),d):(I.current=null,me()))},[we,n.node.code,n.node.language,n.stream,n.loading,E,ce,$e,Te,Le,be,pe,ue,ye,he,ke,Ee,Ne,me,ve],Yg);q(()=>{const e=P.current;if(!e)return;let t=!0;const n=se(e,{rootMargin:"400px"});return ae.current=n,n.isVisible()&&de(!0),n.whenVisible.then(()=>{t&&de(!0)}),()=>{t=!1,n.destroy(),ae.current=null}},[se],Zg),q(()=>{je().catch(()=>{le.current&&_.current&&he(n.node.code)})},[je,n.node.code,he],Gg),q(()=>(le.current=!0,()=>{le.current=!1,ie.current+=1,be(!1)}),[be],Jg),q(()=>{A.current&&ce&&A.current.setTheme(ue())},[ue,ce],Qg),q(()=>{L||At(!0)},[L],ey);const Pe=K((e,t)=>{if(!L)return;const o=e.currentTarget;o&&!o.disabled&&Rt(o,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),n.isDark)},[n.isDark,L],ty),De=K(()=>{L&&At()},[L],ny),_e=K(async()=>{try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(n.node.code),f(!0),n.onCopy?.(n.node.code),setTimeout(()=>f(!1),1e3)}catch{}},[n],oy),Re=K(()=>{if(!d)return;const e="html"===r?"text/html":"image/svg+xml",t="html"===r?"HTML Preview":"SVG Preview";n.onPreviewCode?.({type:e,content:n.node.code,title:t})},[r,d,n],ry),Ae=X(()=>({fontSize:`${$}px`}),[$],iy),Fe=()=>B(e=>Math.max(10,e-1)),He=()=>B(e=>Math.min(36,e+1)),We=()=>B(M);return q(()=>{N(14),B(14)},[],ly),k(sy,{h0:P,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),h2:u,h3:n.showHeader&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"}},()=>T([S("div",{className:"flex items-center space-x-2"},()=>T([C(()=>k("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:s}})),S("span",{className:"text-sm font-medium font-mono"},()=>a)])),S("div",{className:"flex items-center space-x-2"},()=>T([n.showCollapseButton&&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":g,onClick:()=>y(e=>!e),onMouseEnter:e=>Pe(e,g?c("common.expand")||"Expand":c("common.collapse")||"Collapse"),onFocus:e=>Pe(e,g?c("common.expand")||"Expand":c("common.collapse")||"Collapse"),onMouseLeave:De,onBlur:De},()=>C(()=>k("svg",{style:{rotate:g?"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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),n.showFontSizeButtons&&n.enableFontSizeControl&&S(t,{},()=>T([C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$<=10,onClick:Fe,onMouseEnter:e=>Pe(e,c("common.decrease")||"Decrease"),onFocus:e=>Pe(e,c("common.decrease")||"Decrease"),onMouseLeave:De,onBlur:De},k("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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$===M,onClick:We,onMouseEnter:e=>Pe(e,c("common.reset")||"Reset"),onFocus:e=>Pe(e,c("common.reset")||"Reset"),onMouseLeave:De,onBlur:De},k("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"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),k("path",{d:"M3 3v5h5"}))))),C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$>=36,onClick:He,onMouseEnter:e=>Pe(e,c("common.increase")||"Increase"),onFocus:e=>Pe(e,c("common.increase")||"Increase"),onMouseLeave:De,onBlur:De},k("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"},k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),n.showCopyButton&&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":m?c("common.copied")||"Copied":c("common.copy")||"Copy",onClick:_e,onMouseEnter:e=>Pe(e,m?c("common.copied")||"Copied":c("common.copy")||"Copy"),onFocus:e=>Pe(e,m?c("common.copied")||"Copied":c("common.copy")||"Copy"),onMouseLeave:De,onBlur:De},()=>k("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"},m?k("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExpandButton&&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":h,onClick:e=>{p(e=>!e),Pe(e,h?c("common.expand")||"Expand":c("common.collapse")||"Collapse")},onMouseEnter:e=>Pe(e,h?c("common.collapse")||"Collapse":c("common.expand")||"Expand"),onFocus:e=>Pe(e,h?c("common.collapse")||"Collapse":c("common.expand")||"Expand"),onMouseLeave:De,onBlur:De},()=>k("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"},k("path",h?{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"})))),d&&n.showPreviewButton&&C(()=>k("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":c("common.preview")||"Preview",onClick:Re,onMouseEnter:e=>Pe(e,c("common.preview")||"Preview"),onFocus:e=>Pe(e,c("common.preview")||"Preview"),onMouseLeave:De,onBlur:De},k("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"},k("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},k("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"}),k("circle",{cx:"12",cy:"12",r:"3"})))))]))]))),h4:!g&&(!!n.stream||!n.loading)&&C(()=>S("div",{ref:D,className:"code-block-content",style:{...Ae,maxHeight:h?"none":"500px",overflowY:h?"visible":"auto",overflowX:"auto"}},()=>T([C(()=>k("div",{ref:_,className:"code-block-render"})),!v&&b&&C(()=>k("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:b}}))]))),h5:!n.stream&&n.loading&&k("div",{className:"code-loading-placeholder"},k("div",{className:"loading-skeleton"},k("div",{className:"skeleton-line"}),k("div",{className:"skeleton-line"}),k("div",{className:"skeleton-line short"}))),h6:m?c("common.copied")||"Copied":""})}uy.$$singleRoot=!0;var my=/* @__PURE__ */N(5),fy=/* @__PURE__ */Symbol(my),hy=/* @__PURE__ */Symbol(my+1),py=/* @__PURE__ */Symbol(my+2),gy=/* @__PURE__ */Symbol(my+3),yy=/* @__PURE__ */Symbol(my+4);function by(e){const t=Y(null,fy),[n,o]=Z(!1,hy),[r,i]=Z({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},py),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],gy);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 $e(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[Le(e.offset??8),Be(),Te({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=Ne(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],yy),"undefined"==typeof document?null:e.visible&&n?x(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{Oe as AdmonitionNode,Wp as BlockquoteNode,Ct as CheckboxNode,Jr as CodeBlockNode,Jr as OctaneCodeBlockNode,rl as D2BlockNode,dl as DefinitionListNode,fl as EmojiNode,gl as EmphasisNode,Wm as FallbackComponent,vl as FootnoteAnchorNode,Sl as FootnoteNode,El as FootnoteReferenceNode,Dl as HardBreakNode,_l as HeadingNode,Fl as HighlightNode,Ma as HtmlBlockNode,Qa as HtmlInlineNode,an as HtmlPreviewFrame,ss as ImageNode,Js as InfographicBlockNode,cc as InlineCodeNode,mc as InsertNode,Dc as LinkNode,Ac as ListItemNode,Fc as ListNode,Zd as MERMAID_WORKER_BUSY_CODE,uy as MarkdownCodeBlockNode,Sd as MathBlockNode,Ad as MathInlineNode,Lm as MermaidBlockNode,Ap as NodeRenderer,Ap as default,Km as ParagraphNode,Un as PreCodeNode,Xm as ReferenceNode,Gm as StrikethroughNode,ef as StrongNode,of as SubscriptNode,af as SuperscriptNode,Sf as TableNode,Nc as TextNode,Nf as ThematicBreakNode,by as Tooltip,Ef as VmrContainerNode,Gc as WORKER_BUSY_CODE,eu as canParseOffthread,ut as clearGlobalCustomComponents,ed as clearKaTeXCache,Yc as clearKaTeXWorker,Jd as clearMermaidWorker,pt as defineHtmlComponents,ht as defineStreamingComponents,li as disableD2,ii as enableD2,tu as findPrefixOffthread,mt as getCustomComponentDisplay,ct as getCustomNodeComponents,id as getKaTeXBackpressureDefaults,Gt as getLanguageIcon,Yd as getMermaidWorkerLoad,ai as isD2Enabled,Jt as languageMap,qt as normalizeLanguageIdentifier,Yt as preloadExtendedLanguageIcons,dt as removeCustomComponents,Jc as renderKaTeXInWorker,ld as renderKaTeXWithBackpressure,Af as renderNode,Ut as resolveMonacoLanguageId,st as setCustomComponents,ri as setD2Loader,Nt as setDefaultI18nMap,rd as setKaTeXBackpressureDefaults,Qc as setKaTeXCache,td as setKaTeXConcurrencyLimit,Xc as setKaTeXWorker,Zc as setKaTeXWorkerDebug,zt as setLanguageIconResolver,Gd as setMermaidWorker,Ud as setMermaidWorkerClientDebug,Xd as setMermaidWorkerMaxConcurrency,Zt as subscribeLanguageIconsRevision,nu as terminateWorker,$t as useSafeI18n,gt as useSmoothMarkdownStream,nd as waitForKaTeXWorkerSlot,ft as withMarkstreamComponentDisplay};