markstream-octane 2.0.23 → 2.0.24

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 f,bag7 as h,bag8 as p,bagOf as y,child as g,childTextHole as b,clone as w,createContext as v,createElement as x,createPortal as k,createScopedElement as S,createScopedValue as C,delegateEvents as N,hookSlots as M,htextSwap as $,mapSlot as B,markDangerouslySetInnerHTMLChildren as E,positionalChildren as T,queueRefAttach as L,queueRefDetach as D,setAriaAttribute as j,setAttribute as P,setCheckedCheckable as _,setClassAttr as R,setHostPropSources as A,setStyle as F,setText as I,sibling as H,snapshotSpread as O,template as W,textHole as z,useCallback as K,useContext as V,useEffect as q,useLayoutEffect as U,useMemo as X,useRef as Z,useState as Y,useSyncExternalStore as G,withSlot as J}from"octane";import{BLOCKED_HTML_TAGS as Q,NON_STRUCTURING_HTML_TAGS as ee,convertHtmlAttrsToProps as te,getHtmlTagFromContent as ne,getMarkdown as oe,hasCustomHtmlComponents as re,isCustomHtmlComponentTag as ie,isHtmlTagBlocked as le,isHtmlTagHardBlocked as ae,mergeCustomHtmlTags as se,normalizeCustomHtmlTagName as ce,parseMarkdownToStructure as de,sanitizeHtmlAttrs as ue,sanitizeHtmlContent as me,sanitizeHtmlTokenAttrs as fe,sanitizeImageSrc as he,shouldOpenLinkInNewTab as pe,shouldRenderUnknownHtmlTagAsText as ye,stripCustomHtmlWrapper as ge,toSafeSvgElement as be,tokenAttrsToRecord as we,tokenizeHtml as ve}from"stream-markdown-parser";import{applyMermaidThemeDirective as xe,createPanGesture as ke,createSmoothMarkdownStream as Se,normalizeShikiLanguage as Ce}from"markstream-core";import{autoUpdate as Ne,computePosition as Me,flip as $e,offset as Be,shift as Ee}from"@floating-ui/dom";var Te=/* @__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 Le(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,...Le(a.attrs)},De(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function je(e,t,n,o){return De(e,t,`${n}-inline`,o)}var Pe=/* @__PURE__ */W('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),_e=/* @__PURE__ */M(3),Re=/* @__PURE__ */Symbol(_e),Ae=/* @__PURE__ */Symbol(_e+1),Fe=/* @__PURE__ */Symbol(_e+2),Ie=/* @__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(Pe);e=m,n=m;const f=g(m);r=f,i=f;const h=g(f);l=h;const p=H(h,1);a=p,s=f,c=H(p,1),d=m,u=H(f,1),o=y(t,m,{a:void 0,b:e,c:void 0,d:n,e:void 0,f:r,g:i,h:l,i:null,j:void 0,k:a,l:null,m:void 0,n:s,o:c,p:null,q:void 0,r:d,s:u,t:null,u:void 0})}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"data-index-key",t),o.c=t)}{const t=e.h2;o.e!==t&&(P(o.f,"id",t),o.e=t)}{const n=e.h3,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.j!==n){o.j=n;const e=o.i;null==e||r||null===n?o.i=z(t,1,o.g,n,o.h,!0):I(e,n)}}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.m!==n){const e=o.l;null==e||r||null===n?o.l=b(t,2,o.k,n,e):I(e,n),o.m=n}}{const n=e.h5,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){o.q=n;const e=o.p;null==e||r||null===n?o.p=z(t,3,o.n,n,o.o,!0):I(e,n)}}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.u!==n){o.u=n;const e=o.t;null==e||r||null===n?o.t=z(t,4,o.r,n,o.s,!0):I(e,n)}}}),He={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],Re),[s,c]=Y(()=>!!t.collapsible&&!(t.open??1),Ae),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],Fe);return x(Ie,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:He[l]&&S("span",{className:"admonition-icon"},()=>He[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 We=v(!1),ze=v(null);function Ke(){return V(ze)}var Ve=/* @__PURE__ */M(3),qe=/* @__PURE__ */Symbol(Ve),Ue=/* @__PURE__ */Symbol(Ve+1),Xe=/* @__PURE__ */Symbol(Ve+2),Ze=v(null);function Ye(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,o=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,r=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null;let i=null,l=null;const a=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set;let c=null;const d=()=>{if(!a.size){try{i?.disconnect()}catch{}i=null,l=null,s.size||(()=>{if(null!=c){try{r?.(c)}catch{}c=null}})()}},u=e=>{const t=a.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{i?.unobserve(e)}catch{}a.delete(e),s.delete(e),d()}},m=()=>{o&&null==c&&s.size&&(c=o(()=>{c=null;const e=s.values().next().value;e&&(s.delete(e),u(e),s.size&&m())},{timeout:1200}))};return(o,r)=>{const c={current:!1};let f=!1;const{promise:h,resolve:p}=Promise.withResolvers(),y=()=>{f||(f=!0,p())},g=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g};const b=((t,o)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,o);if(i&&(c=r,(s=l)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return i;var s,c;if(i)try{i.disconnect()}catch{}i=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&u(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),l=r;for(const e of a.keys())i.observe(e);return i})(r?.rootMargin??"300px",r?.threshold??0);return b?(a.set(o,{resolve:y,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:g}):(c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Ge=Ye(()=>null,()=>!0);function Je({getRoot:e,enabled:t=!0,children:n}){const o=Z(t,qe);o.current=t;const r=Z(e,Ue);r.current=e;const i=X(()=>Ye(()=>r.current?.()??null,()=>o.current),[],Xe);return S(Ze.Provider,{value:i},()=>n)}function Qe(){return V(Ze)??Ge}var et="__global__",tt="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",nt=(()=>{const e=globalThis;if(e[tt])return e[tt];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[tt]=t,t})();function ot(){nt.revision++;for(const e of Array.from(nt.listeners))try{e()}catch{}}function rt(e){return nt.listeners.add(e),()=>{nt.listeners.delete(e)}}function it(){return nt.revision}function lt(e,t){"string"==typeof e?nt.scopedComponents[e]={...t||{}}:nt.scopedComponents[et]={...e},ot()}function at(e){const t=nt.scopedComponents[et]||{};if(!e)return t;const n=nt.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function st(e){if(e===et)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete nt.scopedComponents[e],ot()}function ct(){delete nt.scopedComponents[et],ot()}function dt(e){return e?.markstreamDisplay}function ut(e,t){return e.markstreamDisplay=t,e}function mt(e){return e}function ft(e){return e}function ht(e={}){const t=Z(null,yt);t.current||(t.current=Se(e));const n=t.current,[o,r]=Y(()=>n.getSnapshot(),gt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],bt),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],wt)}var pt=/* @__PURE__ */M(4),yt=/* @__PURE__ */Symbol(pt),gt=/* @__PURE__ */Symbol(pt+1),bt=/* @__PURE__ */Symbol(pt+2),wt=/* @__PURE__ */Symbol(pt+3),vt=/* @__PURE__ */W('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),xt=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=w(vt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function kt(e){const{node:t}=e;return x(xt,{h0:Boolean(t.checked)})}kt.$$singleRoot=!0;var St={"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 Ct(e){Object.assign(St,e)}function Nt(){return{t:e=>St[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 Mt=null,$t=null,Bt=null,Et=null,Tt=null,Lt=null;function Dt(){Et&&(clearTimeout(Et),Et=null),Tt&&(clearTimeout(Tt),Tt=null)}async function jt(e){if(!Mt||!$t)return;const{x:t,y:n}=await Me($t,Mt,{placement:e,middleware:[Be(8),$e(),Ee({padding:8})],strategy:"fixed"});Mt.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Pt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Mt||"undefined"==typeof document||((Mt=document.createElement("div")).className="markstream-octane ms-tooltip",Mt.setAttribute("role","tooltip"),Mt.dataset.visible="false",Mt.style.position="fixed",Mt.style.left="0px",Mt.style.top="0px",Mt.style.transform="translate3d(0,0,0)",document.body.appendChild(Mt)),!Mt)return;Dt();const l=async()=>{if(Mt){$t=e,Mt.textContent=t,Mt.dataset.placement=n,Mt.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",Mt.dataset.visible="false",Lt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Mt.id=Lt;try{e.setAttribute("aria-describedby",Lt)}catch{}await jt(n),Mt.dataset.visible="true",Bt?.(),Bt=Ne(e,Mt,()=>{jt(n)})}};o?l():Et=setTimeout(l,80)}function _t(e=!1){if(!Mt)return;Dt();const t=()=>{if(Mt){if(Mt.dataset.visible="false",$t&&Lt)try{$t.removeAttribute("aria-describedby")}catch{}$t=null,Lt=null,Bt&&(Bt(),Bt=null)}};e?t():Tt=setTimeout(t,120)}var Rt='<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',At=null,Ft=null,It=null,Ht=/* @__PURE__ */new Set;function Ot(e){At=e??null}var Wt={"":"",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"},zt={"":Rt,plain:Rt,text:Rt,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 Kt(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}function Vt(e){const t=Kt(e);return Wt[t]??t}function qt(e){const t=Vt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"shell":return"zsh";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}async function Ut(){return Ft||(It||(It=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Ft=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of Ht)try{e()}catch{}}(),Ft)).catch(()=>null)),It)}async function Xt(){await Ut()}function Zt(e){return Ht.add(e),()=>{Ht.delete(e)}}function Yt(e){if(At){const t=At(e);if(null!=t&&""!==t)return t}const t=Vt(e),n=zt[t];if(n)return n;const o=Ft?.[t];return o||(Ut(),'<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 Gt={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"},Jt=Array.from(/* @__PURE__ */new Set([...Object.keys(Wt),...Object.values(Wt),...Object.keys(zt),...Object.keys(Gt),"c","diff","go","java","php","ruby","rust","sql","yaml"]));function Qt(e){const t=Kt(e);return!!t&&!Jt.includes(t)&&Jt.some(e=>e.startsWith(t))}var en=/* @__PURE__ */M(4),tn=/* @__PURE__ */Symbol(en),nn=/* @__PURE__ */Symbol(en+1),on=/* @__PURE__ */Symbol(en+2),rn=/* @__PURE__ */Symbol(en+3),ln=void 0!==import.meta&&Boolean(!1),an=null;function sn(e){const{t:t}=J(tn,Nt,tn),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],nn),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!ln||"undefined"==typeof console||an===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")&&(an=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],on);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],rn),"undefined"==typeof document?null:k(C(()=>S("div",{className:"markstream-octane html-preview-frame__backdrop"+(e.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>e.onClose?.()},()=>C(()=>S("div",{className:"html-preview-frame"+(e.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation()},()=>T([S("div",{className:"html-preview-frame__header"},()=>T([S("div",{className:"html-preview-frame__title"},()=>T([x("span",{className:"html-preview-frame__dot"}),S("span",{className:"html-preview-frame__label"},()=>e.title||`HTML ${t("common.preview")}`)])),C(()=>x("button",{type:"button",className:"html-preview-frame__close"+(e.isDark?" html-preview-frame__close--dark":""),onClick:()=>e.onClose?.()},"\n ×\n "))])),C(()=>x("iframe",{className:"html-preview-frame__iframe",sandbox:o,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:n,title:e.title||"Preview"}))]))))),document.body)}var cn=!1,dn=null,un=!1;async function mn(){if(dn)return dn;if(un)return null;try{if(!(dn=function(e){const t="function"==typeof e?.createCodeBlockRuntime||"function"==typeof e?.useMonaco?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return"function"!=typeof n?null:{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:t?.detectLanguage?.bind(t),preloadStreamDiffs:t?.preloadStreamDiffs?.bind(t)}}(await import("stream-diffs/markstream"))))throw new Error("Invalid stream-diffs runtime");return await async function(e){cn||(cn=!0,e?.preloadStreamDiffs&&await e.preloadStreamDiffs())}(dn),dn}catch{return un=!0,null}}var fn=/* @__PURE__ */W('<pre data-markstream-pre="1" tabindex="0"></pre>'),hn=/* @__PURE__ */M(6),pn=/* @__PURE__ */Symbol(hn),yn=/* @__PURE__ */Symbol(hn+1),gn=/* @__PURE__ */Symbol(hn+2),bn=/* @__PURE__ */Symbol(hn+3),wn=/* @__PURE__ */Symbol(hn+4),vn=/* @__PURE__ */Symbol(hn+5),xn=/* @__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(fn);e=d,n=d,r=d,i=d,l=d,a=d,s=d,o=c(t,d,void 0,e,void 0,n,void 0,r,void 0,i,void 0,l,void 0,a,s,null,void 0)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(F(o.d,t,o.c),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-busy",t),o.e=t)}{const t=e.h3;o.g!==t&&(j(o.h,"aria-label",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"data-language",t),o.i=t)}{const t=e.h5;o.k!==t&&(P(o.l,"data-markstream-line-numbers",t),o.k=t)}{const n=e.h6,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.o!==n){const e=o.n;null==e||r||null===n?o.n=b(t,1,o.m,n,e):I(e,n),o.o=n}}});function kn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function Sn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function Cn(e){return e.startsWith("-")&&!e.startsWith("---")}function Nn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Mn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function $n(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 Bn(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?$n(e,"hunk",`inline-hunk-${n}`,""):Cn(e)?$n(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Nn(e)?$n(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):$n(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function En(e,t){const n=Sn(e),o=Sn(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($n(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Mn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push($n(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Mn(o,i)})),i++;e.push($n(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($n(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Mn(n,t)})),t++;for(;i<o.length;)e.push($n(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Mn(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($n(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift($n(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push($n(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Mn(n,d)}));for(let d=l;d<=s;d++)i.push($n(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Mn(o,d)}));return i.concat(c)}function Tn(e,t=!1,n=kn(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=>Cn(e)),r=e.some(e=>Nn(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:En(e?.originalCode,e?.updatedCode)}];const n=Sn(e?.originalCode),o=Sn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>$n(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Mn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>$n(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Mn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Bn(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push($n(d,"hunk",`original-hunk-${c}`,"")),l.push($n(d,"hunk",`modified-hunk-${c}`,""));else if(Cn(d))i.push($n(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Nn(d))l.push($n(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push($n(e,"context",`original-context-${c}`,a++)),l.push($n(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 Ln({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=X(()=>kn(e?.language),[e],pn),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=X(()=>c?Tn(e,!0===o,l):[],[o,c,e,l],yn),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],gn),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],bn),f=X(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],wn),h=X(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(2,String(m).length)}ch`,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}},[m,c,r],vn);return x(xn,{h0:[a,n,r?"markstream-pre--line-numbers":"",c?"markstream-pre--diff-preview":"",c&&o?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),h1:h?{...i,...h}:i,h2:!0===e?.loading,h3:s,h4:l,h5:r?"1":void 0,h6:c?S("code",{translate:"no",className:"markstream-pre__diff-code"},()=>d.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-pane",e.className].join(" ")},()=>e.lines.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-line",`markstream-pre__diff-line--${e.kind}`,e.empty?"markstream-pre__diff-line--empty":""].filter(Boolean).join(" ")},()=>T([x("span",{className:"markstream-pre__diff-rail","aria-hidden":"true"}),S("span",{className:"markstream-pre__diff-number","aria-hidden":"true"},()=>e.number),S("span",{className:"markstream-pre__diff-content"},()=>S("span",{className:"markstream-pre__diff-content-inner"},()=>e.code))])))))):S(t,{},()=>T([r&&S("span",{className:"markstream-pre__line-numbers","aria-hidden":"true"},()=>S("span",{className:"markstream-pre__line-numbers-text"},()=>f)),S("code",{translate:"no",className:"markstream-pre__code"},()=>u)]))})}Ln.$$singleRoot=!0;var Dn=/* @__PURE__ */W('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),jn=/* @__PURE__ */W('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),Pn=["r","a","b"],_n=/* @__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(Dn),f=g(m);{const l=e.h0;n=l,i=f,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=f,a=f,c=f;const h=H(f,1);d=h,u=h,r=s(t,m,n,i,void 0,l,void 0,a,void 0,c,void 0,d,u,null,void 0),t.refFields=Pn}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-hidden",t),r.g=t)}{const t=e.h4;r.i!==t&&(F(r.j,t,r.i),r.i=t)}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.m!==n){const e=r.l;null==e||o||null===n?r.l=b(t,1,r.k,n,e):I(e,n),r.m=n}}}),Rn=/* @__PURE__ */M(96),An=/* @__PURE__ */Symbol(Rn),Fn=/* @__PURE__ */Symbol(Rn+1),In=/* @__PURE__ */Symbol(Rn+2),Hn=/* @__PURE__ */Symbol(Rn+3),On=/* @__PURE__ */Symbol(Rn+4),Wn=/* @__PURE__ */Symbol(Rn+5),zn=/* @__PURE__ */Symbol(Rn+6),Kn=/* @__PURE__ */Symbol(Rn+7),Vn=/* @__PURE__ */Symbol(Rn+8),qn=/* @__PURE__ */Symbol(Rn+9),Un=/* @__PURE__ */Symbol(Rn+10),Xn=/* @__PURE__ */Symbol(Rn+11),Zn=/* @__PURE__ */Symbol(Rn+12),Yn=/* @__PURE__ */Symbol(Rn+13),Gn=/* @__PURE__ */Symbol(Rn+14),Jn=/* @__PURE__ */Symbol(Rn+15),Qn=/* @__PURE__ */Symbol(Rn+16),eo=/* @__PURE__ */Symbol(Rn+17),to=/* @__PURE__ */Symbol(Rn+18),no=/* @__PURE__ */Symbol(Rn+19),oo=/* @__PURE__ */Symbol(Rn+20),ro=/* @__PURE__ */Symbol(Rn+21),io=/* @__PURE__ */Symbol(Rn+22),lo=/* @__PURE__ */Symbol(Rn+23),ao=/* @__PURE__ */Symbol(Rn+24),so=/* @__PURE__ */Symbol(Rn+25),co=/* @__PURE__ */Symbol(Rn+26),uo=/* @__PURE__ */Symbol(Rn+27),mo=/* @__PURE__ */Symbol(Rn+28),fo=/* @__PURE__ */Symbol(Rn+29),ho=/* @__PURE__ */Symbol(Rn+30),po=/* @__PURE__ */Symbol(Rn+31),yo=/* @__PURE__ */Symbol(Rn+32),go=/* @__PURE__ */Symbol(Rn+33),bo=/* @__PURE__ */Symbol(Rn+34),wo=/* @__PURE__ */Symbol(Rn+35),vo=/* @__PURE__ */Symbol(Rn+36),xo=/* @__PURE__ */Symbol(Rn+37),ko=/* @__PURE__ */Symbol(Rn+38),So=/* @__PURE__ */Symbol(Rn+39),Co=/* @__PURE__ */Symbol(Rn+40),No=/* @__PURE__ */Symbol(Rn+41),Mo=/* @__PURE__ */Symbol(Rn+42),$o=/* @__PURE__ */Symbol(Rn+43),Bo=/* @__PURE__ */Symbol(Rn+44),Eo=/* @__PURE__ */Symbol(Rn+45),To=/* @__PURE__ */Symbol(Rn+46),Lo=/* @__PURE__ */Symbol(Rn+47),Do=/* @__PURE__ */Symbol(Rn+48),jo=/* @__PURE__ */Symbol(Rn+49),Po=/* @__PURE__ */Symbol(Rn+50),_o=/* @__PURE__ */Symbol(Rn+51),Ro=/* @__PURE__ */Symbol(Rn+52),Ao=/* @__PURE__ */Symbol(Rn+53),Fo=/* @__PURE__ */Symbol(Rn+54),Io=/* @__PURE__ */Symbol(Rn+55),Ho=/* @__PURE__ */Symbol(Rn+56),Oo=/* @__PURE__ */Symbol(Rn+57),Wo=/* @__PURE__ */Symbol(Rn+58),zo=/* @__PURE__ */Symbol(Rn+59),Ko=/* @__PURE__ */Symbol(Rn+60),Vo=/* @__PURE__ */Symbol(Rn+61),qo=/* @__PURE__ */Symbol(Rn+62),Uo=/* @__PURE__ */Symbol(Rn+63),Xo=/* @__PURE__ */Symbol(Rn+64),Zo=/* @__PURE__ */Symbol(Rn+65),Yo=/* @__PURE__ */Symbol(Rn+66),Go=/* @__PURE__ */Symbol(Rn+67),Jo=/* @__PURE__ */Symbol(Rn+68),Qo=/* @__PURE__ */Symbol(Rn+69),er=/* @__PURE__ */Symbol(Rn+70),tr=/* @__PURE__ */Symbol(Rn+71),nr=/* @__PURE__ */Symbol(Rn+72),or=/* @__PURE__ */Symbol(Rn+73),rr=/* @__PURE__ */Symbol(Rn+74),ir=/* @__PURE__ */Symbol(Rn+75),lr=/* @__PURE__ */Symbol(Rn+76),ar=/* @__PURE__ */Symbol(Rn+77),sr=/* @__PURE__ */Symbol(Rn+78),cr=/* @__PURE__ */Symbol(Rn+79),dr=/* @__PURE__ */Symbol(Rn+80),ur=/* @__PURE__ */Symbol(Rn+81),mr=/* @__PURE__ */Symbol(Rn+82),fr=/* @__PURE__ */Symbol(Rn+83),hr=/* @__PURE__ */Symbol(Rn+84),pr=/* @__PURE__ */Symbol(Rn+85),yr=/* @__PURE__ */Symbol(Rn+86),gr=/* @__PURE__ */Symbol(Rn+87),br=/* @__PURE__ */Symbol(Rn+88),wr=/* @__PURE__ */Symbol(Rn+89),vr=/* @__PURE__ */Symbol(Rn+90),xr=/* @__PURE__ */Symbol(Rn+91),kr=/* @__PURE__ */Symbol(Rn+92),Sr=/* @__PURE__ */Symbol(Rn+93),Cr=/* @__PURE__ */Symbol(Rn+94),Nr=/* @__PURE__ */Symbol(Rn+95),Mr=["r","a","b"],$r=/* @__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 x=w(jn);{const l=e.h0;n=l,i=x,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=x,a=x;const k=H(g(x),1);s=k,c=x,d=g(x),u=k;const S=g(k);m=S,f=k,h=H(S,1),p=x;const C=H(k,1);b=C,v=H(C,1),r=y(t,x,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:null,l:void 0,m:u,n:m,o:null,p:void 0,q:f,r:h,s:null,t:void 0,u:p,v:b,w:null,x:void 0,y:v,z:null,A:void 0}),t.refFields=Mr}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const t=e.h2;r.e!==t&&(F(r.f,t,r.e),r.e=t)}{const t=e.h4;r.g!==t&&(R(r.h,t),r.g=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,1,r.i,n,r.j,!0):I(e,n)}}{const n=e.h5,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,2,r.m,n,r.n,!0):I(e,n)}}{const n=e.h6,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,3,r.q,n,r.r,!0):I(e,n)}}{const n=e.h7,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.x!==n){r.x=n;const e=r.w;null==e||o||null===n?r.w=z(t,4,r.u,n,r.v,!0):I(e,n)}}{const n=e.h8,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.A!==n){const e=r.z;null==e||o||null===n?r.z=b(t,5,r.y,n,e):I(e,n),r.A=n}}}),Br="undefined"!=typeof window?U:q,Er={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Tr=12;function Lr({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return x(_n,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(Ln,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Dr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function jr(e,t){return"number"!=typeof e||!Number.isFinite(e)||e<0?{top:t,bottom:t}:{top:e,bottom:e}}function Pr(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const o=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},r={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...r,...n,parseDiffOptions:{...r.parseDiffOptions,...o}}}function _r(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}function Rr(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 Ar(e){const t=String(e??"").trim().toLowerCase();if(!t||"transparent"===t)return!0;const n=t.match(/^#([0-9a-f]{8})$/);if(n)return 0===Number.parseInt(n[1].slice(6),16);const o=t.match(/^#([0-9a-f]{4})$/);if(o)return 0===Number.parseInt(o[1][3]+o[1][3],16);const r=t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1]?.split(/[\s,/]+/).filter(Boolean);return 4===r?.length&&0===Number(r[3])}function Fr(e){const n={...Er,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,codeBlockOptions:u,themes:m,minWidth:f,maxWidth:h,showHeader:p,showCopyButton:y,showExpandButton:g,showPreviewButton:b,showCollapseButton:w,showFontSizeButtons:v,showLineNumbers:k,showTooltips:N}=n,M=Z(null,An),$=Z(null,Fn),B=Z(null,In),E=Z(null,Hn),L=Z(null,On),D=Z(null,Wn),j=Z(null,zn),P=Z(0,Kn),_=Z(null,Vn),R=Z(null,qn),A=J(Un,Qe,Un),F=Z(null,Xn),I=Z(null,Zn),H=Z(u,Yn),O=Z(null,Gn),W=Z([],Jn),z=Z(null,Qn),V=Z(null,eo),U=Z(!1,to),G=Z(void 0,no),[Q,ee]=Y(!1,oo),[te,ne]=Y(()=>"undefined"==typeof window,ro),[oe,re]=Y(!1,io),[ie,le]=Y(!1,lo),[ae,se]=Y(!1,ao),[ce,de]=Y(()=>o.language||"plaintext",so),[ue,me]=Y(()=>Vt(o.language),co),[fe,he]=Y(!1,uo),[pe,ye]=Y(!1,mo),[ge,be]=Y(!1,fo),[we,ve]=Y(!1,ho),[xe,ke]=Y(0,po),{t:Se}=J(yo,Nt,yo);q(()=>{U.current=pe},[pe],go);const Ce=X(()=>Pr(Boolean(o.diff),u),[u,o.diff],bo),[Ne,Me]=Y(()=>{const e=Number(Pr(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:Tr},wo),[$e,Be]=Y(Ne,vo),Ee=X(()=>!1!==N,[N],xo),Te="boolean"==typeof k?k:!0!==Ce.disableLineNumbers,Le=Z(Te,ko),De=Number(H.current?.fontSize),je=Number(u?.fontSize),Pe=H.current!==u&&Number.isFinite(De)&&De>0&&(!Number.isFinite(je)||je<=0),_e=K(()=>{const e=Ce.maxHeight??500;return"number"==typeof e&&Number.isFinite(e)?e:500},[Ce.maxHeight],So);J(Co,Br,()=>{const e=Number(Ce.fontSize),t=Number.isFinite(e)&&e>0?e:Tr;Me(t),Be(t)},[Ce.fontSize],Co);const Re=K(e=>{if(Q)return;const t=M.current,n=B.current;if(!t||!n)return;const o="diff"===D.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=_e(),i="diff"===D.current,l=i?"important":"";e?(t.style.minHeight="0px",t.style.setProperty("max-height","none",l),t.style.overflow="visible"):(t.style.minHeight="0px",t.style.setProperty("max-height",`${Math.ceil(r)}px`,l),t.style.overflow=i?"hidden":"auto");try{const n=()=>{if(i){const e=function(e){if("undefined"==typeof window)return null;try{const t=e.getBoundingClientRect();if(t.width<=0)return null;const n=[".stream-diffs-shell",".stream-diffs-shell .diffs-container",".stream-diffs-shell .diff-line",".stream-diffs-shell .diff-hunk"];let o=0;for(const r of Array.from(e.querySelectorAll(n.join(",")))){if(!(r instanceof HTMLElement))continue;const e=window.getComputedStyle(r);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=r.getBoundingClientRect();n.height<=0||n.bottom<=t.top||(o=Math.max(o,n.bottom-t.top))}return o>0?Math.ceil(o+4):null}catch{return null}}(t);if(null!=e)return e}if("function"==typeof o.getContentHeight)return o.getContentHeight();if(i&&"function"==typeof o.getModifiedEditor){const e=o.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}},a=Number(n());if(Number.isFinite(a)&&a>0){const n=e?a:Math.min(a,r);t.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,l)}o.layout?.()}catch{}},[_e,Q],No),Ae=K(e=>{if(Re(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Re(e),window.requestAnimationFrame(()=>{Re(e);const t=M.current;t&&null!=V.current&&(t.style.minHeight="0px",V.current=null)})});return window.setTimeout(()=>Re(e),180),()=>window.cancelAnimationFrame(t)},[Re],Mo),Fe=K(()=>{const e=M.current,t=$.current?.querySelector(".code-editor-fallback-surface");if(!e||!t)return;const n=t.getBoundingClientRect().height;!Number.isFinite(n)||n<=0||(V.current=n,e.style.minHeight=`${Math.ceil(n)}px`)},[],$o),Ie=K(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],Bo),He=K(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],z.current?.disconnect(),z.current=null},[],Eo),Oe=K(()=>{He();const e=B.current,t=M.current;if(!e||!t||"diff"!==D.current)return;const n=()=>Ae(U.current),o=(e,t)=>{try{const o=e?.[t];if("function"!=typeof o)return;const r=o.call(e,n);r&&W.current.push(r)}catch{}},r=e.getDiffEditorView?.(),i=r?.getOriginalEditor?.(),l=r?.getModifiedEditor?.();if(o(r,"onDidUpdateDiff"),o(i,"onDidContentSizeChange"),o(l,"onDidContentSizeChange"),o(i,"onDidLayoutChange"),o(l,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),z.current=e}},[He,Ae],To);q(()=>Zt(()=>{ke(e=>e+1)}),[],Lo),q(()=>{me(Vt(o.language))},[o.language],Do);const We=Z(o,jo);We.current=o;const ze=K(()=>{P.current+=1;try{E.current?.()}catch{}He(),L.current=null,D.current=null,j.current=null,V.current=null,se(!1),le(!1)},[He],Po),Ke=K(()=>{const e=M.current,t=$.current;if(!e||!t)return;t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),t.style.removeProperty("--vscode-editor-selectionBackground");const n=Dr(Ce.tabSize)??4,r=jr(Ce.padding,o.diff?0:8);if(e.style.setProperty("--diffs-tab-size",String(n)),"number"==typeof Ce.padding&&Number.isFinite(Ce.padding)&&Ce.padding>=0?e.style.setProperty("--diffs-gap-block",`${r.top}px`):e.style.removeProperty("--diffs-gap-block"),o.diff)return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");const i=e.querySelector(".stream-diffs-shell")??e;try{const n="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(i):null,r=String(n?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(n?.color??"").trim(),l=String(n?.getPropertyValue("--vscode-editor-background")??"").trim(),a=String(n?.backgroundColor??"").trim(),s=Ar(l)?Ar(a)?"":a:l,c=String(n?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=Rr(e),i=Rr(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(s,r,"plaintext"===qt(String(o.language||ue||ce||"plaintext")),t.classList.contains("is-dark")))return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");r?e.style.setProperty("--vscode-editor-foreground",r):e.style.removeProperty("--vscode-editor-foreground"),s?e.style.setProperty("--vscode-editor-background",s):e.style.removeProperty("--vscode-editor-background"),c?e.style.setProperty("--vscode-editor-selectionBackground",c):e.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ue,ce,o.diff,o.language,Ce],_o),Ve=X(()=>r?c??m?.[0]??"vitesse-dark":d??m?.[1]??"vitesse-light",[c,r,d,m],Ro),qe=K(()=>Ve,[Ve],Ao),Ue=X(()=>qe(),[qe],Fo),Xe=X(()=>function(e,t){const n=(function(e){return"string"==typeof e?e:null}(e)??"").toLowerCase();return n?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>n.includes(e))&&!["light","latte","dawn","lotus"].some(e=>n.includes(e)):t}(Ue,Boolean(r)),[r,Ue],Io),Ze=X(()=>o.diff?r?"dark":"light":Xe?"dark":"light",[r,o.diff,Xe],Ho),Ye=X(()=>o.diff?"dark"===Ze:Xe,[Ze,o.diff,Xe],Oo),Ge=X(()=>o.diff?"dark"===Ze:Boolean(r),[Ze,r,o.diff],Wo),Je=X(()=>{const e=Ce,t=Dr(e?.fontSize)??(Pe?Tr:$e)??Tr,n=Dr(e?.lineHeight)??(t===Tr?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=jr(e?.padding,o.diff?0:8),l=Dr(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Pe,$e,o.diff,Ce],zo),et=X(()=>!!o.diff&&"unified"===Ce.diffStyle,[o.diff,Ce],Ko),tt=X(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Je.lineHeight}px`,"--markstream-pre-line-number-top":`${Je.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Je.fontSize}px`,lineHeight:`${Je.lineHeight}px`,maxHeight:`${_e()}px`,overflow:"auto",paddingBottom:`${Je.paddingBottom}px`,paddingTop:`${Je.paddingTop}px`,tabSize:Je.tabSize,whiteSpace:"scroll"===Ce.overflow?"pre":"pre-wrap","--markstream-code-font-family":Je.fontFamily,fontFamily:Je.fontFamily}),[_e,Je,Ce.overflow],Vo),nt=K(()=>{const e=Ce.maxHeight,t={...Ce||{},...null==e?{}:{MAX_HEIGHT:e},themes:m?[...m]:void 0,stream:!1,disableFileHeader:!0,theme:Ue,disableLineNumbers:!Te,fontSize:Je.fontSize,lineHeight:Je.lineHeight,fontFamily:Je.fontFamily,onThemeChange(){Ke()},themeType:r?"dark":"light"};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }","string"==typeof t.unsafeCSS?t.unsafeCSS:""].filter(Boolean).join("\n"),t},[r,Je,Ue,Ce,Te,Ke,m],qo),ot=K(()=>{const e=nt(),t=F.current;if(!t)return F.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[nt],Uo),rt=K(e=>{const t=e(ot());return B.current=t,E.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[ot],Xo),it=X(()=>JSON.stringify({diffStyle:Ce.diffStyle,expandUnchanged:Ce.expandUnchanged,collapsedContextThreshold:Ce.collapsedContextThreshold,hunkSeparators:Ce.hunkSeparators,lineDiffType:Ce.lineDiffType,maxLineDiffLength:Ce.maxLineDiffLength,expansionLineCount:Ce.expansionLineCount,context:Ce.parseDiffOptions?.context}),[Ce],Zo);q(()=>{ot()},[Ce,ot],Yo),q(()=>()=>{P.current+=1,E.current?.(),He(),E.current=null,L.current=null,D.current=null,j.current=null,B.current=null,I.current=null,_.current=null,R.current?.destroy?.(),R.current=null},[He],Go),q(()=>{if("undefined"==typeof window)return;if(te)return;const e=$.current;if(!e)return;R.current?.destroy?.();const t=A(e,{rootMargin:"400px"});return R.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),R.current===t&&(R.current=null)}},[A,te],Jo),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(ot(),()=>{e=!1}):((async()=>{try{const t=await mn();if(!e)return;if(!t)return void ee(!0);const n=t.createCodeBlockRuntime,o=t.detectLanguage;if("function"==typeof o&&(_.current=o),"function"!=typeof n)return void ee(!0);I.current=n,rt(n),re(!0)}catch{e&&ee(!0)}})(),()=>{e=!1})},[rt,ot],Qo),q(()=>{if(!o.language&&!ue&&_.current)try{const e=_.current(String(o.code??""));e&&de(e)}catch{}},[ue,o.code,o.language],er);const lt=X(()=>String(o.language||ue||ce||"plaintext"),[ue,ce,o.language],tr),at=X(()=>Vt(lt),[lt],nr),st=X(()=>!!i&&Qt(lt),[i,lt],or),ct=X(()=>st?"plaintext":qt(at),[at,st],rr),dt=X(()=>"plaintext"===ct,[ct],ir),ut=X(()=>Yt(at),[at,xe],lr),mt=X(()=>!!a&&("html"===at||"svg"===at),[at,a],ar),ft=X(()=>{const e=at;return e?Gt[e]||e.charAt(0).toUpperCase()+e.slice(1):Gt[""]||"Plain Text"},[at],sr),ht=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],cr),pt=X(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(f),r=e(h);return n&&(t.minWidth=n),r&&(t.maxWidth=r),o.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--markstream-code-fallback-fg, var(--code-fg))",t.backgroundColor="var(--markstream-code-fallback-bg, var(--code-bg, #fff))",t.borderColor=Ge?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[h,f,o.diff,Ge],dr),yt=X(()=>{if(!o.diff)return{color:"var(--markstream-code-fallback-fg, var(--code-fg))",backgroundColor:"var(--markstream-code-fallback-bg, var(--code-bg, #fff))"}},[o.diff],ur),gt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],mr),bt=!1===l&&i||!1!==l&&i&&!gt;q(()=>{if(Q)return;if(!oe)return;if(!ie||!te)return;const e=B.current;ot();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),Ke(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null)&&Ae(pe)};e?.setTheme&&Ue?Promise.resolve(e.setTheme(Ue)).then(t).catch(()=>{}):t()},[ge,ie,Ze,pe,oe,o.diff,Ue,Ae,Ke,ot,Q,te],fr);const wt=K(async()=>{if(Q)return null;if(!te)return null;if(ge)return null;if(bt)return null;const e=B.current,t=M.current;if(!e||!t||!e.createEditor)return null;ot();const n=We.current,o=n.diff?"diff":"single",r=j.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(D.current===o&&r===t&&i)return null;if(L.current)return L.current;P.current+=1;const l=P.current;le(!0);const a=(async()=>{try{E.current?.(),D.current=null,j.current=null,se(!1);const o=ct;if(n.diff?"function"==typeof e.createDiffEditor?(D.current="diff",await e.createDiffEditor(t,_r(n.originalCode),_r(n.updatedCode),o)):(D.current="single",await e.createEditor(t,_r(n.updatedCode??n.code),o)):(D.current="single",await e.createEditor(t,_r(n.code),o)),j.current=t,P.current!==l)return;const r=Number(Ce.fontSize),i=Number.isFinite(r)&&r>0?r:Tr;if(Number.isFinite(i)&&i>0){Me(i),Be(i);try{const t="diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.(),n=Dr(Ce.lineHeight)??(i===Tr?18:Math.max(12,Math.round(1.5*i)));t?.updateOptions?.({fontSize:i,lineHeight:n})}catch{}}if(Oe(),Ke(),Fe(),Re(pe),await Ie(),P.current!==l)return;Re(pe),se(!0),Ae(pe)}catch{P.current===l&&(G.current=ct,ee(!0))}})().finally(()=>{L.current===a&&(L.current=null)});return L.current=a,a},[Re,Oe,He,ge,pe,ct,Fe,Ce.fontSize,Ae,bt,Ke,ot,Q,te,Ie],hr);q(()=>{ot();const e=H.current!==u;H.current=u;const t=Le.current!==Te;Le.current=Te;const n=O.current;if(O.current=it,Q)return;if(!oe)return;let r=!1;if(e||t){const e=I.current;if(e){ze(),B.current=null,E.current=null;try{rt(e),r=!0}catch{return void ee(!0)}}}const i=Boolean(o.diff&&n!==it);if(!r&&!i)return;if(!te||!ie&&!r)return;if(ge||bt)return;let l=!1;return(async()=>{if(r||ze(),!l)try{await wt()}catch{}})(),()=>{l=!0}},[ge,u,ie,Te,wt,rt,oe,it,o.diff,ze,bt,ot,Q,te],pr),q(()=>{if(Q){const e=G.current;if(void 0===e||e===ct)return;return G.current=void 0,ze(),void ee(!1)}oe&&te&&(ge||bt?ze():wt())},[ge,wt,ct,oe,ze,bt,Q,te],yr),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;const e=B.current;if(!e)return;const t=_r(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=Vt(o.language)||ue;if(!n&&_.current)try{n=Vt(_.current(t)),n&&me(n)}catch{}const r=st?"plaintext":qt(n||at);if(e.createEditor&&M.current){try{await Promise.resolve(wt())}catch{}const e=L.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(_r(o.originalCode),_r(o.updatedCode),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}Ae(pe)})()},[at,ue,ge,ie,wt,pe,oe,o.code,o.diff,o.language,o.originalCode,o.updatedCode,Ae,st,bt,Q,te],gr),q(()=>{if(i)return;if(!oe||!te||ge||Q)return;const e=B.current;e&&(async()=>{try{o.diff&&e.finalizeDiff?await Promise.resolve(e.finalizeDiff()):e.finalizeCode&&await Promise.resolve(e.finalizeCode())}catch{}Ae(pe)})()},[ge,pe,i,o.diff,oe,Ae,Q,te],br),q(()=>{if(Q)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;if(!pe&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ae(pe)):null;return null==e&&Ae(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,pe,i,oe,Ae,bt,Q,te],wr),q(()=>{if(!s)return;if(Q)return;const e=B.current;if(e){try{("diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:$e})}catch{}Ae(pe)}},[s,pe,$e,o.diff,Ae,Q],vr),q(()=>{Ee||_t(!0)},[Ee],xr);const vt=K((e,t)=>{if(!Ee)return;const n=e.currentTarget;n&&!n.disabled&&Pt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ye)},[Ye,Ee],kr),xt=K(()=>{Ee&&_t()},[Ee],Sr),kt=K(async()=>{const e=String(ht);try{n.clipboardWriter?await n.clipboardWriter(e):"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(e),he(!0),n.onCopy?.(e),setTimeout(()=>he(!1),1e3)}catch{}},[n,ht],Cr),St=K(()=>{if(!mt)return;const e="html"===at?"text/html":"image/svg+xml",t="html"===at?Se("artifacts.htmlPreviewTitle")||"HTML Preview":Se("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===at&&ve(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${at}-${Date.now()}`})},[at,mt,o,n,Se],Nr);return x($r,{h0:$,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Ge?"border-gray-700/30":"border-gray-200",i?"is-rendering":"",Ge?"is-dark":"",o.diff?"is-diff":"",dt?"is-plain-text":""].join(" "),h2:pt,h3:p&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:yt},()=>T([S("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden"},()=>T([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:ut}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>ft)])),S("div",{className:"flex items-center space-x-2"},()=>T([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:()=>be(e=>!e),onMouseEnter:e=>vt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onFocus:e=>vt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onMouseLeave:xt,onBlur:xt},()=>C(()=>x("svg",{style:{rotate:ge?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),v&&s&&S(t,{},()=>T([C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e<=10,onClick:()=>Be(e=>Math.max(10,e-1)),onMouseEnter:e=>vt(e,Se("common.decrease")||"Decrease"),onFocus:e=>vt(e,Se("common.decrease")||"Decrease"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e===Ne,onClick:()=>Be(Ne),onMouseEnter:e=>vt(e,Se("common.reset")||"Reset"),onFocus:e=>vt(e,Se("common.reset")||"Reset"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),x("path",{d:"M3 3v5h5"}))))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e>=36,onClick:()=>Be(e=>Math.min(36,e+1)),onMouseEnter:e=>vt(e,Se("common.increase")||"Increase"),onFocus:e=>vt(e,Se("common.increase")||"Increase"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),y&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy",onClick:kt,onMouseEnter:e=>vt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onFocus:e=>vt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onMouseLeave:xt,onBlur:xt},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},fe?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),g&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":pe,onClick:e=>{ye(e=>!e),vt(e,pe?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse")},onMouseEnter:e=>vt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onFocus:e=>vt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onMouseLeave:xt,onBlur:xt},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",pe?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})))),mt&&b&&C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Se("common.preview")||"Preview",onClick:St,onMouseEnter:e=>vt(e,Se("common.preview")||"Preview"),onFocus:e=>vt(e,Se("common.preview")||"Preview"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},x("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"},x("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),x("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})))))]))]))),h4:`code-block-body${ge?" code-block-body--collapsed":""}${pe?" code-block-body--expanded":""}`,h5:!ge&&(!!l||!i)&&C(Q?()=>x(Ln,{className:"code-fallback-plain m-0",diffInline:et,node:o,showLineNumbers:Te,style:tt}):()=>x(Lr,{editorHostRef:M,editorReady:ae,node:o,preFallbackDiffInline:et,preFallbackStyle:tt,showLineNumbers:Te,stream:l})),h6:!l&&i&&x("div",{className:"code-loading-placeholder"},x("div",{className:"loading-skeleton"},x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line short"}))),h7:we&&!n.onPreviewCode&&mt&&"html"===at&&C(()=>x(sn,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>ve(!1)})),h8:fe?Se("common.copied")||"Copied":""})}function Ir(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=Ir(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Hr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ir(e))&&(o&&(o+=" "),o+=t);return o}Lr.$$singleRoot=!0,Fr.$$singleRoot=!0;var Or=0,Wr=()=>import("@terrastruct/d2"),zr=null,Kr=Wr;function Vr(e){Kr=e,zr=null}function qr(e){Vr(e??Wr)}function Ur(){Vr(null)}function Xr(){return"function"==typeof Kr}var Zr=/* @__PURE__ */W("<div><!><!></div>"),Yr=/* @__PURE__ */M(41),Gr=/* @__PURE__ */Symbol(Yr),Jr=/* @__PURE__ */Symbol(Yr+1),Qr=/* @__PURE__ */Symbol(Yr+2),ei=/* @__PURE__ */Symbol(Yr+3),ti=/* @__PURE__ */Symbol(Yr+4),ni=/* @__PURE__ */Symbol(Yr+5),oi=/* @__PURE__ */Symbol(Yr+6),ri=/* @__PURE__ */Symbol(Yr+7),ii=/* @__PURE__ */Symbol(Yr+8),li=/* @__PURE__ */Symbol(Yr+9),ai=/* @__PURE__ */Symbol(Yr+10),si=/* @__PURE__ */Symbol(Yr+11),ci=/* @__PURE__ */Symbol(Yr+12),di=/* @__PURE__ */Symbol(Yr+13),ui=/* @__PURE__ */Symbol(Yr+14),mi=/* @__PURE__ */Symbol(Yr+15),fi=/* @__PURE__ */Symbol(Yr+16),hi=/* @__PURE__ */Symbol(Yr+17),pi=/* @__PURE__ */Symbol(Yr+18),yi=/* @__PURE__ */Symbol(Yr+19),gi=/* @__PURE__ */Symbol(Yr+20),bi=/* @__PURE__ */Symbol(Yr+21),wi=/* @__PURE__ */Symbol(Yr+22),vi=/* @__PURE__ */Symbol(Yr+23),xi=/* @__PURE__ */Symbol(Yr+24),ki=/* @__PURE__ */Symbol(Yr+25),Si=/* @__PURE__ */Symbol(Yr+26),Ci=/* @__PURE__ */Symbol(Yr+27),Ni=/* @__PURE__ */Symbol(Yr+28),Mi=/* @__PURE__ */Symbol(Yr+29),$i=/* @__PURE__ */Symbol(Yr+30),Bi=/* @__PURE__ */Symbol(Yr+31),Ei=/* @__PURE__ */Symbol(Yr+32),Ti=/* @__PURE__ */Symbol(Yr+33),Li=/* @__PURE__ */Symbol(Yr+34),Di=/* @__PURE__ */Symbol(Yr+35),ji=/* @__PURE__ */Symbol(Yr+36),Pi=/* @__PURE__ */Symbol(Yr+37),_i=/* @__PURE__ */Symbol(Yr+38),Ri=/* @__PURE__ */Symbol(Yr+39),Ai=/* @__PURE__ */Symbol(Yr+40),Fi=["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(Zr);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=m,s=m;const f=g(m);c=f,d=m,u=H(f,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=Fi}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(R(r.d,t),r.c=t)}{const n=e.h2,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.h!==n){r.h=n;const e=r.g;null==e||o||null===n?r.g=z(t,1,r.e,n,r.f,!0):I(e,n)}}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.l!==n){r.l=n;const e=r.k;null==e||o||null===n?r.k=z(t,2,r.i,n,r.j,!0):I(e,n)}}}),Hi={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Oi={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"},Wi=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],zi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Ki(e){if(!e)return"";const t=e.trim();return zi.test(t)?t:""}function Vi(e){const n={...Hi,...e},{t:o}=J(Gr,Nt,Gr),[r,i]=Y(!1,Jr),[l,a]=Y(!1,Qr),[s,c]=Y(!1,ei),[d,u]=Y(!1,ti),[m,f]=Y(null,ni),[h,p]=Y("",oi),[y,g]=Y(null,ri),[b,w]=Y(!1,ii),[v,k]=Y(()=>"undefined"==typeof window,li),N=Z(0,ai),M=Z(null,si),$=Z(!1,ci),B=Z(!1,di),E=Z(0,ui),L=Z(null,mi),D=Z(!1,fi),j=Z(null,hi),P=Z(null,pi),_=Z(null,yi),R=Z(null,gi),A=Z(!1,bi),F=Z(()=>{},wi),I=J(vi,Qe,vi),H=n.node?.code??"",O=s||!d||!h,W=!!h,z=X(()=>{if(!n.maxHeight)return;const e="number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[n.maxHeight],xi),V=X(()=>{if(O&&y)return{minHeight:`${y}px`}},[y,O],ki);q(()=>{A.current=b},[b],Si),q(()=>{const e=j.current;if(!e)return;const t=I(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),P.current=null}},[I],Ci);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&g(e=>e!==t?t:e)},[],Ni),G=K((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!v)return;if(A.current)return void(D.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-E.current;if(!e&&o<t)return D.current=!0,void(null==L.current&&(L.current=window.setTimeout(()=>{L.current=null,D.current&&(D.current=!1,G(!0))},Math.max(0,t-o))));$.current=!0;const r=()=>{$.current=!1,E.current=Date.now(),F.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[n.progressiveIntervalMs,v],Mi),Q=K(async()=>{if(M.current)return M.current;const e=await async function(){if(zr)return zr;const e=Kr;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Wr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(zr=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),zr):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?M.current=t:"function"==typeof e.compile&&(M.current=e),M.current}return e?.D2&&"function"==typeof e.D2?(M.current=new e.D2,M.current):("function"==typeof e.compile&&(M.current=e),M.current)},[],$i),ee=K(async()=>{if("undefined"==typeof window||B.current)return;if(!v)return;if(n.loading&&!n.progressiveRender)return;if(!H)return p(""),void f(null);const e=++N.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(H);if(e!==N.current)return;const r=o?.diagram??o,i=o?.renderOptions??o?.options??{},l=n.themeId??i.themeID,a=n.darkThemeId??i.darkThemeID,s={...i};if(s.themeID=n.isDark&&null!=a?a:l,s.darkThemeID=null,s.darkThemeOverrides=null,n.isDark){const e=i.themeOverrides&&"object"==typeof i.themeOverrides?i.themeOverrides:null;s.themeOverrides={...Oi,...e||{}}}s.salt=s.salt??function(e="markstream-octane-d2"){return`${e}-${Or+=1}`}();const d=await t.render(r,s);if(e!==N.current)return;const m=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(d);if(!m)throw new Error("D2 render returned empty output.");const h=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Wi.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Ki(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(m);p(h||""),n.loading&&c(!1),f(null)}catch(t){if(e!==N.current)return;const o=t?.message?String(t.message):"D2 render failed.";n.loading||f(o),o.includes("@terrastruct/d2")&&(u(!1),c(!0))}finally{e===N.current&&(w(!1),D.current&&(D.current=!1,G()))}},[H,Q,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,G,v],Bi);q(()=>{F.current=ee},[ee],Ei);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(H),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[H],Ti),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],Li),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Pt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Di),re=K(()=>{_t()},[],ji);return q(()=>{G()},[H,n.loading,n.isDark,G],Pi),q(()=>{n.loading||G(!0)},[n.loading,G],_i),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[O,h,H,U],Ri),q(()=>{B.current=!1,G();const e=requestAnimationFrame(()=>U());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{U()});R.current=e,_.current&&e.observe(_.current)}return()=>{B.current=!0,null!=L.current&&(clearTimeout(L.current),L.current=null),R.current?.disconnect(),R.current=null,cancelAnimationFrame(e)}},[G,U],Ai),x(Ii,{h0:j,h1:Hr("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",n.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),h2:n.showHeader&&C(()=>S("div",{className:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"}},()=>T([x("div",{className:"flex items-center gap-x-2"},x("span",{className:"text-sm font-medium font-mono"},"D2")),S("div",{className:"flex items-center gap-x-2"},()=>T([n.showModeToggle&&C(()=>S("div",{className:Hr("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:Hr("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:Hr("mode-btn px-2 py-1 text-xs rounded",s&&"is-active"),onClick:()=>c(!0),onMouseEnter:e=>oe(e,o("common.source")||"Source"),onFocus:e=>oe(e,o("common.source")||"Source"),onMouseLeave:re,onBlur:re},()=>o("common.source")||"Source"))]))),n.showCopyButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":r?o("common.copied")||"Copied":o("common.copy")||"Copy",onClick:te,onMouseEnter:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onFocus:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onMouseLeave:re,onBlur:re},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":o("common.export")||"Export",onClick:ne,onMouseEnter:e=>oe(e,o("common.export")||"Export"),onFocus:e=>oe(e,o("common.export")||"Export"),onMouseLeave:re,onBlur:re},x("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})))),n.showCollapseButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":l,onClick:()=>a(e=>!e),onMouseEnter:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onFocus:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re},()=>C(()=>x("svg",{style:{transform:`rotate(${l?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})))))]))]))),h3:!l&&C(()=>S("div",{ref:_,className:"d2-block-body",style:V},()=>n.loading&&!W?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>T([O?S("div",{className:"d2-source px-4 py-4"},()=>T([S("pre",{className:"d2-code"},()=>S("code",{},()=>H)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):C(()=>S("div",{className:"d2-render",style:z},()=>T([C(()=>x("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:h}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}Vi.$$singleRoot=!0;var qi=/* @__PURE__ */W('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),Ui=/* @__PURE__ */W('<dl class="definition-list"><!></dl>'),Xi=(e,t)=>`${String(indexKey??"definition")}-${t}`;function Zi(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(qi),r=g(o);e=r,n=H(r,1),s=f(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?je(e.term,r,`${String(i??"definition")}-term-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.c!==n){const e=s.b;null==e||o||null===n?s.b=b(t,1,s.a,n,e):I(e,n),s.c=n}}{const n=r&&l?je(e.definition,r,`${String(i??"definition")}-desc-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.f!==n){const e=s.e;null==e||o||null===n?s.e=b(t,2,s.d,n,e):I(e,n),s.f=n}}}var Yi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(Ui);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(P(o.b,"data-index-key",t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,Xi,Zi,18,[e.h4,e.h5,e.h6],o.d,1)});function Gi(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(Yi,{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?je(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?je(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}Gi.$$singleRoot=!0;var Ji=/* @__PURE__ */W('<span class="emoji-node"></span>'),Qi=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Ji);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function el(e){const{node:t}=e;return x(Qi,{h0:t.name??t.markup})}el.$$singleRoot=!0;var tl=/* @__PURE__ */W('<em class="emphasis-node"></em>'),nl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(tl);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function ol(e){return x(nl,{h0:e.children})}ol.$$singleRoot=!0;var rl=".markdown-renderer";function il(e,t){if("undefined"==typeof document||"undefined"==typeof Element)return null;const n=function(e){return`[id="${e.replace(/["\\]/g,"\\$&")}"]`}(t);let o=e instanceof Element?e.closest(rl):null;for(;o;){const e=o.querySelector(n);if(e)return e;o=o.parentElement?.closest(rl)??null}return document.querySelector(n)}N(["click"]);var ll=/* @__PURE__ */W('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),al=/* @__PURE__ */Symbol(/* @__PURE__ */M(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=il(e.currentTarget,`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__ */W('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),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=g(r),o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function 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,N(["click"]);var fl=/* @__PURE__ */W('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),hl=/* @__PURE__ */M(3),pl=/* @__PURE__ */Symbol(hl),yl=/* @__PURE__ */Symbol(hl+1),gl=/* @__PURE__ */Symbol(hl+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 f=w(fl);n=f,r=f,f.$$click=e.h1;const h=g(f);i=O(e.h2),l=e.h3,s="footnote-link cursor-pointer",c=h,d=A(h,[[!0,i],[!1,"title",l],[!1,"className",s]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.h;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.g)}),E(h),u=h,m=H(g(h),1),o=a(t,f,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=bl}else{o.c.$$click=e.h1,o.d=O(e.h2);{const t=e.h3;o.e!==t&&(o.e=t)}{const e="footnote-link cursor-pointer";o.f!==e&&(o.f=e)}o.h=A(o.g,[[!0,o.d],[!1,"title",o.e],[!1,"className",o.f]],o.h,t,!0)}{const t=e.h0;o.a!==t&&(P(o.b,"id",t),o.a=t)}{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.l!==n){o.l=n;const e=o.k;null==e||r||null===n?o.k=z(t,1,o.i,n,o.j,!0):I(e,n)}}});function vl(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],pl),o=X(()=>({href:n}),[n],yl),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=il(e.currentTarget,`fnref--${t.id}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],gl);return x(wl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}vl.$$singleRoot=!0;var xl=/* @__PURE__ */W('<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:Hr("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 Nl=/* @__PURE__ */W('<mark class="highlight-node"></mark>'),Ml=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Nl);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function $l(e){return x(Ml,{h0:e.children})}function Bl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function El(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 Tl=ve,Ll=ue;function Dl(e,t){return ie(e,t)}function jl(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 Il(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 Hl(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Ol(t,n,o,r,i,l,a,s=Il(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 Wl=/* @__PURE__ */W("<div></div>"),zl=/* @__PURE__ */M(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),Zl=/* @__PURE__ */Symbol(zl+5),Yl=/* @__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"],fa=/* @__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(Wl);n=e.h0,r="html-block-node",i=O(e.h1),l=c,a=A(c,[[!1,"ref",n],[!1,"className",r],[!0,i]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.e;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.d)}),s=c,o=p(t,c,n,r,i,l,a,s,null,void 0),t.refFields=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=O(e.h1),o.e=A(o.d,[[!1,"ref",o.a],[!1,"className",o.b],[!0,o.c]],o.e,t,!0)}{const n=e.h2;o.g=b(t,1,o.f,n,o.g),o.h=n}});function ha(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(Kl,Qe,Kl),[s,c]=Y(null,Vl),d=Z(null,ql),[u,m]=Y(()=>"undefined"==typeof window,Ul),[f,h]=Y(o.content,Xl),p=Boolean(o.loading),y=G(rt,it,it,Zl),g=X(()=>({...n.customComponents??n.ctx?.customComponents??at(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,y],Yl),b=X(()=>({...g,...n.ctx?.streamingComponents??{}}),[g,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 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],Jl),q(()=>()=>{d.current?.destroy(),d.current=null},[],Ql),q(()=>{p&&!u||h(o.content)},[p,o.content,u],ea);const w=X(()=>{const e=Le(fe(o.attrs??void 0,l));return e?El(e):void 0},[l,o.attrs],ta),v=X(()=>String(o.tag??"").trim(),[o.tag],na),k=X(()=>ce(v),[v],oa),N=X(()=>{const e=Le(fe(o.attrs??void 0,l,v));return e?El(e):void 0},[l,o.attrs,v],ra),M=X(()=>te(we(fe(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,E=X(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(N),[N],aa),L=X(()=>"escape"!==l&&jl(o.content??"",b),[b,l,o.content],sa),D=X(()=>L&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Tl(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=Dl(i,n),f=Boolean(Rl(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=Ll(d,o,i),p=h.key,y=null!=p&&""!==p?p:`${a}-${l++}`,g=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(f)b.push(Ol(i,d,[],y,r,"",u,{loading:!1,autoClosed:!1}));else if(g){const t=Hl(i,h,r);b.push(e.createElement(g,{...t,key:y}))}else b.push(e.createElement(i,{...El(h),key:y,suppressHydrationWarning:!0}));s.length>0&&s[s.length-1].sourceParts.push(u);continue}if("tag_open"===t.type){const e=s.length>0&&s[s.length-1].hardBlocked,l=Dl(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=Ll(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(Rl(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Il(r);m=Ol(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{...Hl(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{...El(s),key:f,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=Ll(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(Rl(t.tagName,r))?Ol(t.tagName,t.attrs||{},t.children,f,r,i,d,Il(r)):h?e.createElement(h,{...Hl(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{...El(u),key:f,suppressHydrationWarning:!0},...t.children),c.push(p),s.length>0&&s[s.length-1].sourceParts.push(d)}return c}catch{return null}}(o.content,g,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[g,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,L],ca),j=X(()=>me(f??"",l),[l,f],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??T([x("span",{className:"html-block-node__placeholder-bar"}),x("span",{className:"html-block-node__placeholder-bar w-4/5"}),x("span",{className:"html-block-node__placeholder-bar w-2/3"})]));return B&&_?e.createElement(_,M,P)??null:B?e.createElement(v,{...E,ref:c},u?P:R)??null:x(fa,{h0:c,h1:w,h2:u?L&&D?S(t,{},()=>T([D])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:j}})):R})}var pa=/* @__PURE__ */W('<span class="html-inline-node"></span>'),ya=/* @__PURE__ */M(13),ga=/* @__PURE__ */Symbol(ya),ba=/* @__PURE__ */Symbol(ya+1),wa=/* @__PURE__ */Symbol(ya+2),va=/* @__PURE__ */Symbol(ya+3),xa=/* @__PURE__ */Symbol(ya+4),ka=/* @__PURE__ */Symbol(ya+5),Sa=/* @__PURE__ */Symbol(ya+6),Ca=/* @__PURE__ */Symbol(ya+7),Na=/* @__PURE__ */Symbol(ya+8),Ma=/* @__PURE__ */Symbol(ya+9),$a=/* @__PURE__ */Symbol(ya+10),Ba=/* @__PURE__ */Symbol(ya+11),Ea=/* @__PURE__ */Symbol(ya+12),Ta=["r","a","b"],La=/* @__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,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}l=a,r=u(t,a,n,i,void 0,l),t.refFields=Ta}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(F(r.d,t,r.c),r.c=t)}}),Da=(()=>{try{return Boolean(!1)}catch{}return!1})();function ja(e){Da&&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 Tl(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if(Dl(e,t)&&"block"===dt(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 Ia(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Ha(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 Oa(t,n,o,r,i,l,a,s,c,d){const u=Dl(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 f=Ll(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=Ha(i)){const c=ce(t),d=l??function(e){return e.map(Fa).join("")}(o),u={type:c,tag:c,attrs:Ia(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(f);return e.createElement(n,{...i,key:p},...o)}return e.createElement(t,{...El(f),key:p},...o)}function Wa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Z(null,ga),[a,s]=Y(!1,ba);q(()=>{s(!0)},[],wa);const c=e.useMemo(()=>({...n.ctx?.customComponents??at(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),f=e.useMemo(()=>ce(m),[m],Ca),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],Na),p=e.useMemo(()=>te(we(fe(o.attrs??void 0,i,f))),[i,o.attrs,f],Ma),y=f?n.ctx?.htmlComponents?.[f]:void 0,g=h.length>0&&!!m&&"escape"!==i&&!le(m,i)&&!!n.ctx&&!!n.renderNode&&!!y,b=e.useMemo(()=>g&&n.ctx&&n.renderNode?De(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[g,n.ctx,n.indexKey,n.renderNode,h],$a),w=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!jl(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=Dl(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=Oa(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=Dl(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}:Ha(o);m=Oa(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&&ja(`Auto-closing unclosed tag: <${s.tagName}>`)}else ja(`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}>`]:Oa(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,Ha(o)),_a(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),ja(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Tl(e),t,n,o)}catch(i){return r=i,Da&&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],Ea),!o.loading||o.autoClosed||g||"dynamic"===w.mode?g?e.createElement(y,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)):x(La,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var za=/* @__PURE__ */M(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),Za={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Ya(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function Ga(e){const t={...Za,...e},n=he(t.node.src),o=he(t.fallbackSrc),r=Ya(n,o,t.node.loading),[i,l]=Y(!1,Ka),[a,s]=Y(!1,Va),[c,d]=Y(r.src,qa),[u,m]=Y(r.stage,Ua),f=c;q(()=>{const e=Ya(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],Xa);const h=()=>{if("primary"===u&&o&&o!==c)return d(o),m("fallback"),l(!1),void s(!1);m("failed"),s(!0),t.onError?.(c)},p=()=>{l(!0),s(!1),t.onLoad?.(f)},y=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,f])};return!t.node.loading&&"failed"!==u&&f?C(()=>x("img",{key:"image",src:f,alt:String(t.node.alt??t.node.title??""),title:String(t.node.title??t.node.alt??""),className:"image-node__img"+(i?" is-loaded":""),loading:t.lazy?"lazy":"eager",decoding:"async",tabIndex:i?0:-1,"aria-label":t.node.alt??"Preview image",onError:h,onLoad:p,onClick:y})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?T([x("span",{className:"image-node__spinner","aria-hidden":"true"}),x("span",{className:"image-node__placeholder-text"},"Loading image...")]):S("span",{className:"image-node__placeholder-text"},()=>t.node.raw??"Loading image…")):t.node.loading||"failed"!==u?null:x("span",{className:"image-node__error"},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true"},x("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})),x("span",{className:"image-node__placeholder-text"},"Image failed to load"))}function 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__ */M(42),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),fs=/* @__PURE__ */Symbol(os+9),hs=/* @__PURE__ */Symbol(os+10),ps=/* @__PURE__ */Symbol(os+11),ys=/* @__PURE__ */Symbol(os+12),gs=/* @__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),Ns=/* @__PURE__ */Symbol(os+21),Ms=/* @__PURE__ */Symbol(os+22),$s=/* @__PURE__ */Symbol(os+23),Bs=/* @__PURE__ */Symbol(os+24),Es=/* @__PURE__ */Symbol(os+25),Ts=/* @__PURE__ */Symbol(os+26),Ls=/* @__PURE__ */Symbol(os+27),Ds=/* @__PURE__ */Symbol(os+28),js=/* @__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),Is=/* @__PURE__ */Symbol(os+35),Hs=/* @__PURE__ */Symbol(os+36),Os=/* @__PURE__ */Symbol(os+37),Ws=/* @__PURE__ */Symbol(os+38),zs=/* @__PURE__ */Symbol(os+39),Ks=/* @__PURE__ */Symbol(os+40),Vs=/* @__PURE__ */Symbol(os+41),qs=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"}))),Us={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Xs(e){const n={...Us,...e},{t:o}=J(rs,Nt,rs),[r,i]=Y(!1,is),[l,a]=Y(!1,ls),[s,c]=Y(!1,as),[d,u]=Y(!1,ss),[m,f]=Y(()=>"undefined"==typeof window,cs),h=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?Ja(n.maxHeight):null,[n.maxHeight],ds),y=X(()=>es(Ja(n.estimatedPreviewHeightPx)??Qa(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],us),[g,b]=Y(`${y}px`,ms),[w,v]=Y(!1,fs),[N,M]=Y(!1,hs),[$,B]=Y(1,ps),[E,L]=Y({x:0,y:0},ys),[D,j]=Y(!1,gs),P=Z(null,bs),_=Z(null,ws),R=Z(null,vs),A=Z(null,xs),F=Z(null,ks),I=Z(null,Ss),H=Z(null,Cs),O=Z(E,Ns);O.current=E;const W=Z($,Ms);W.current=$;const z=Z(d,$s);z.current=d;const V=Z(w,Bs);V.current=w;const U=Z(0,Es),G=J(Ts,Qe,Ts),Q=K(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,y)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),y)}px`:`${Math.max(e,y)}px`},[y,n.maxHeight],Ls),ee=K(()=>{const e=P.current;if(!e)return;const t=e.scrollHeight;t>0&&b(Q(t))},[Q],Ds);q(()=>{s||l||b(e=>{const t=Ja(e);return null!=t&&t>=y?e:`${y}px`})},[y,l,s],js);const te=K(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],Ps),ne=K(async()=>{if(!m)return;if(!P.current)return;const e=P.current,t=h,o=!1===n.loading,r=++U.current;let i=null,l=null;try{const n=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(r!==U.current||e!==P.current)return;if(!n)throw new Error("Infographic library failed to load.");l=Array.from(e.childNodes),i=new n({container:e,width:"100%",height:"100%"});let o="",a=!1;if(i.on?.("error",e=>{o=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?e.message??"":e??"")).filter(Boolean).join("; ")}),i.on?.("rendered",()=>{a=!0}),i.render(t),o)throw new Error(o);const s=Array.from(e.childNodes),c=s.length>0&&(s.length!==l.length||s.some((e,t)=>e!==l?.[t]));if(!a&&!c)throw new Error("Infographic render returned empty output.");H.current?.destroy?.(),H.current=i,i=null,v(!0),M(!1),setTimeout(()=>{ee()},0)}catch(a){if(r!==U.current||e!==P.current)return;i?.destroy?.(),i=null,o&&!1===n.loading&&t===h?(console.error("Failed to render infographic:",a),H.current?.destroy?.(),H.current=null,v(!1),M(!0),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${a instanceof Error?a.message:"Unknown error"}</div>`):l&&e.replaceChildren(...l)}finally{i?.destroy?.()}},[h,n.loading,ee,m],_s);q(()=>{const e=_.current;if(!e)return;const t=G(e,{rootMargin:"160px"});return R.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),R.current=null}},[G],Rs),q(()=>{!m||s||l||ne()},[h,l,ne,s,m],As),q(()=>()=>{U.current+=1,H.current&&(H.current.destroy?.(),H.current=null)},[],Fs);const oe=K(()=>{u(!1),A.current&&(A.current.innerHTML=""),F.current=null,document.body.style.overflow=""},[],Is),re=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Hs);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&oe()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,oe],Os),q(()=>{d&&setTimeout(()=>{if(P.current&&A.current){A.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=P.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),A.current.appendChild(e),F.current=e,e.style.transform=`translate(${E.x}px, ${E.y}px) scale(${$})`}},0)},[d],Ws),q(()=>{d&&F.current&&(F.current.style.transform=`translate(${E.x}px, ${E.y}px) scale(${$})`)},[d,E,$],zs);const ie=K(()=>{const e=P.current?.querySelector("svg");if(!e)return;const t=(new XMLSerializer).serializeToString(e),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=`infographic-${Date.now()}.svg`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)},[],Ks);I.current||(I.current=ke({getTranslate:()=>O.current,setTranslate:e=>L(e),canStart:e=>!!V.current&&("touch"!==e.pointerType||z.current||W.current>1),onActiveChange:e=>j(e)}));const le=I.current;q(()=>()=>le.stop(),[le],Vs);const ae=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",se=s||l,ce=d||$>1;return S(t,{},()=>T([C(()=>S("div",{ref:_,"data-markstream-infographic":"1","data-markstream-mode":s?"source":N?"error":w?"preview":"pending",className:Hr("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:Hr("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([qs,C(()=>x("span",{className:Hr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:Hr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{className:Hr("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=>Pt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>_t()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview")||"Preview")])))),C(()=>S("button",{className:Hr("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=>Pt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>_t()},()=>S("div",{className:"flex items-center gap-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source")||"Source")]))))]))),S("div",{className:"flex items-center gap-x-1"},()=>T([n.showCollapseButton&&C(()=>S("button",{className:ae,onClick:()=>a(!l),onMouseEnter:e=>Pt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>_t()},()=>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:ae,onClick:te,onMouseEnter:e=>Pt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>_t()},()=>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:Hr(ae,se&&"opacity-50 cursor-not-allowed"),disabled:se,onClick:ie,onMouseEnter:e=>Pt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>_t()},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"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:Hr(ae,se&&"opacity-50 cursor-not-allowed"),disabled:se,onClick:re,onMouseEnter:e=>Pt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>_t()},()=>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:Hr("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:Hr("text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)))):S("div",{className:"relative"},()=>T([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>T([C(()=>x("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"\n +\n ")),C(()=>x("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"\n -\n ")),C(()=>S("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),L({x:0,y:0})}},()=>T([Math.round(100*$),"\n %\n "])))]))),C(()=>S("div",{className:Hr("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50",{"infographic-pan-touch":ce}),style:{height:g,maxHeight:n.maxHeight??void 0},onPointerDown:e=>le.start(e)},()=>T([!w&&!N&&C(()=>S("pre",{className:Hr("absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)),C(()=>S("div",{className:Hr("absolute inset-0 cursor-grab",D&&"cursor-grabbing"),style:{transform:`translate(${E.x}px, ${E.y}px) scale(${$})`}},()=>C(()=>x("div",{ref:P,className:"w-full text-center flex items-center justify-center min-h-full"}))))])))])))]))),d&&"undefined"!=typeof document&&k(C(()=>S("div",{className:"markstream-octane fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:oe,role:"dialog","aria-modal":"true"},()=>C(()=>S("div",{className:Hr("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",n.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation()},()=>T([S("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2"},()=>T([C(()=>x("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"+")),C(()=>x("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"-")),C(()=>S("button",{className:Hr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),L({x:0,y:0})}},()=>T([Math.round(100*$),"\n %\n "]))),C(()=>x("button",{className:Hr("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:oe},"X"))])),C(()=>x("div",{ref:A,className:Hr("w-full h-full flex items-center justify-center p-4 overflow-hidden",!D&&"cursor-grab",D&&"cursor-grabbing",{"infographic-pan-touch":ce}),onPointerDown:e=>le.start(e)}))]))))),document.body)]))}var Zs=/* @__PURE__ */W('<code class="inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full"></code>'),Ys=/* @__PURE__ */M(6),Gs=/* @__PURE__ */Symbol(Ys),Js=/* @__PURE__ */Symbol(Ys+1),Qs=/* @__PURE__ */Symbol(Ys+2),ec=/* @__PURE__ */Symbol(Ys+3),tc=/* @__PURE__ */Symbol(Ys+4),nc=/* @__PURE__ */Symbol(Ys+5),oc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Zs);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function rc(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 ic(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]=Y(l?[{id:0,content:l,fading:!1}]:[],Gs),u=J(Js,Ke,Js),m=Z(l,Qs),f=Z(1,ec),h=Z(void 0,tc);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)?rc(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],nc),x(oc,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?Hr("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)?rc(e,t):e);var t}:void 0},()=>e.content))})}ic.$$singleRoot=!0;var lc=/* @__PURE__ */W('<ins class="insert-node"></ins>'),ac=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(lc);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function sc(e){return x(ac,{h0:e.children})}sc.$$singleRoot=!0,N(["animationend"]);var cc=/* @__PURE__ */W("<span></span>"),dc=/* @__PURE__ */W("<span><!></span>"),uc=/* @__PURE__ */M(6),mc=/* @__PURE__ */Symbol(uc),fc=/* @__PURE__ */Symbol(uc+1),hc=/* @__PURE__ */Symbol(uc+2),pc=/* @__PURE__ */Symbol(uc+3),yc=/* @__PURE__ */Symbol(uc+4),gc=/* @__PURE__ */Symbol(uc+5),bc=e=>e.id;function wc(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(cc);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?Hr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0;r.a!==t&&(R(r.b,t),r.a=t)}{const n=e.content,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.f!==n){const e=r.e;null==e||o||null===n?r.e=b(t,1,r.d,n,e):I(e,n),r.f=n}}}var vc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(dc);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,bc,wc,30,[e.h4],o.d,1)});function xc(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 kc(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]=Y(l?[{id:0,content:l,fading:!1}]:[],mc),u=J(fc,Ke,fc),m=Z(l,hc),f=Z(1,pc),h=Z(void 0,yc);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)?xc(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],gc);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?xc(t,e):t)};return null!=n?C(()=>S("span",{className:Hr("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):x(vc,{h0:Hr("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?Hr("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>p(e.id):void 0},()=>e.content),h4:p})}N(["mouseenter","mouseleave"]);var Sc=/* @__PURE__ */W('<a class="link-node"></a>',3),Cc=/* @__PURE__ */M(4),Nc=/* @__PURE__ */Symbol(Cc),Mc=/* @__PURE__ */Symbol(Cc+1),$c=/* @__PURE__ */Symbol(Cc+2),Bc=/* @__PURE__ */Symbol(Cc+3),Ec=/* @__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(Sc);n=m,r=m,i=m,l=m,a=m,s=m,c=m,m.$$mouseenter=e.h6,d=m,m.$$mouseleave=e.h7,u=m,o=y(t,m,{a:void 0,b:n,c:void 0,d:r,e:void 0,f:i,g:void 0,h:l,i:void 0,j:a,k:void 0,l:s,m:c,n:d,o:u,p:null,q:void 0})}else o.m.$$mouseenter=e.h6,o.n.$$mouseleave=e.h7;{const t=e.h0;o.a!==t&&(P(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(P(o.d,"title",t),o.c=t)}{const t=e.h2;o.e!==t&&(j(o.f,"aria-label",t),o.e=t)}{const t=e.h3;o.g!==t&&(P(o.h,"target",t),o.g=t)}{const t=e.h4;o.i!==t&&(P(o.j,"rel",t),o.i=t)}{const t=e.h5;o.k!==t&&(F(o.l,t,o.k),o.k=t)}{const n=e.h8,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.q!==n){const e=o.p;null==e||r||null===n?o.p=b(t,1,o.o,n,e):I(e,n),o.q=n}}});function Tc(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],Nc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],Mc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&Pt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],$c),m=K(()=>{i&&_t()},[i],Bc);return t.loading?C(()=>S("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:a},()=>S("span",{className:"link-text-wrapper relative inline-flex"},()=>T([S("span",{className:"leading-[normal] link-text"},()=>C(()=>x(kc,{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(Ec,{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(kc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var Lc=/* @__PURE__ */W('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),Dc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(Lc);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"value",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function jc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(Dc,{h0:null==r?void 0:r,h1:l??(n&&o?De(t.children,n,String(i??"list-item"),o):null)})}function Pc(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&&at(n.customId).list_item||jc;return S(i,{className:Hr("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 _c(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}jc.$$singleRoot=!0;var Rc=null,Ac=null,Fc=!1,Ic=/* @__PURE__ */new Map,Hc=/* @__PURE__ */new Map,Oc=5,Wc=/* @__PURE__ */new Set;function zc(){if(Ic.size<Oc&&Wc.size){const e=Array.from(Wc);Wc.clear();for(const t of e)try{t()}catch{}}}function Kc(e){Ac=null,(Rc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=Ic.get(t);if(r)if(Ic.delete(t),clearTimeout(r.timeoutId),zc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Hc.set(e,n),Hc.size>200){const e=Hc.keys().next();e.done||Hc.delete(e.value)}}r.resolve(n)}},Rc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Ic.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Ic.clear(),zc()}}function Vc(){Rc&&Rc.terminate?.(),Rc=null,Ac=null}function qc(e){Fc=!!e,Rc&&Rc.postMessage({type:"init",debug:Fc})}var Uc="WORKER_BUSY";async function Xc(e,t=!0,n=2e3,o){performance.now();const r=_c(e);if(Ac)return Promise.reject(Ac);const i=`${t?"d":"i"}:${r}`,l=Hc.get(i);if(l)return Promise.resolve(l);const a=Rc||((Ac=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Ac.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Ac);if(Ic.size>=Oc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Uc,e.busy=!0,e.inFlight=Ic.size,e.max=Oc,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(()=>{Ic.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),zc()},n),c=()=>{},d=()=>{Ic.delete(l),clearTimeout(s),Wc.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),zc()};o&&o.addEventListener("abort",d,{once:!0}),Ic.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:Fc})}catch(u){Ic.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),zc()}})}function Zc(e,t,n){const o=`${t?"d":"i"}:${_c(e)}`;if(Hc.set(o,n),Hc.size>200){const e=Hc.keys().next();e.done||Hc.delete(e.value)}}function Yc(){Hc.clear()}function Gc(e){Oc=Math.max(1,Math.floor(e)),zc()}function Jc(e=1500,t){return Ic.size<Oc?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(){Wc.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}),Wc.add(l)})}var Qc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function ed(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 td(){return{...Qc}}async function nd(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 Xc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await Jc(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 od=null,rd=!1;async function id(){if(od)return od;if(rd)return null;try{return od=await import("katex"),await import("katex/contrib/mhchem"),od}catch{return rd=!0,null}}var ld=/* @__PURE__ */W('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),ad=/* @__PURE__ */M(9),sd=/* @__PURE__ */Symbol(ad),cd=/* @__PURE__ */Symbol(ad+1),dd=/* @__PURE__ */Symbol(ad+2),ud=/* @__PURE__ */Symbol(ad+3),md=/* @__PURE__ */Symbol(ad+4),fd=/* @__PURE__ */Symbol(ad+5),hd=/* @__PURE__ */Symbol(ad+6),pd=/* @__PURE__ */Symbol(ad+7),yd=/* @__PURE__ */Symbol(ad+8),gd=["r","a","b","r","c","d"],bd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=w(ld);{const l=e.h0;n=l,i=c,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const d=c.firstChild;{const n=e.h1;l=n,a=d,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}s=d,r=f(t,c,n,i,l,a,void 0,s),t.refFields=gd}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function wd({node:e}){const t=Z(null,sd),n=Z(null,cd),o=Z(null,dd),r=J(ud,Qe,ud),[i,l]=Y(!0,md),[a,s]=Y(()=>"undefined"==typeof window,fd),c=Z(0,hd);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=_c(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 nd(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 id();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),Zc(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],yd),x(bd,{h0:t,h1:n,h2:i?"math-rendering":void 0})}wd.$$singleRoot=!0;var vd=/* @__PURE__ */W('<span class="math-inline-wrapper"><span></span><!></span>'),xd=/* @__PURE__ */M(9),kd=/* @__PURE__ */Symbol(xd),Sd=/* @__PURE__ */Symbol(xd+1),Cd=/* @__PURE__ */Symbol(xd+2),Nd=/* @__PURE__ */Symbol(xd+3),Md=/* @__PURE__ */Symbol(xd+4),$d=/* @__PURE__ */Symbol(xd+5),Bd=/* @__PURE__ */Symbol(xd+6),Ed=/* @__PURE__ */Symbol(xd+7),Td=/* @__PURE__ */Symbol(xd+8),Ld=["r","a","b","r","c","d"],Dd=/* @__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(vd);{const l=e.h0;n=l,i=m,L(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>D(r.a,r.b))}const f=g(m);{const n=e.h1;a=n,s=f,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}c=f,d=m,u=H(f,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=Ld}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&D(e,r.b),null!=n&&L(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const n=e.h3,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.j!==n){r.j=n;const e=r.i;null==e||o||null===n?r.i=z(t,1,r.g,n,r.h,!0):I(e,n)}}});function jd({node:e}){const t=Z(null,kd),n=Z(null,Sd),o=Z(null,Cd),r=J(Nd,Qe,Nd),[i,l]=Y(!0,Md),[a,s]=Y(()=>"undefined"==typeof window,$d),c=Z(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],Ed),q(()=>{const t=_c(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 nd(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 id();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),Zc(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],Td),x(Dd,{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 Pd(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function _d(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 Rd(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Ad(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}jd.$$singleRoot=!0;var Fd=null,Id=null,Hd=/* @__PURE__ */new Map,Od=5,Wd=!1;function zd(e){Wd=!!e}function Kd(e){Number.isFinite(e)&&e>0&&(Od=Math.floor(e))}function Vd(){return{inFlight:Hd.size,max:Od}}var qd="WORKER_BUSY";function Ud(e){Id=null;const t=e;(Fd=e).onmessage=e=>{if(Fd!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Hd.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Fd.onerror=e=>{if(Fd===t)if(0!==Hd.size){try{Wd?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Hd.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Hd.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Fd.onmessageerror=e=>{if(Fd===t)if(0!==Hd.size){try{Wd?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Hd.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Hd.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Xd(){if(Fd)try{for(const[e,t]of Hd.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Hd.clear(),Fd.terminate?.()}catch{}Fd=null,Id=null}function Zd(e,t,n=1400){if(Id)return Promise.reject(Id);const o=Fd||((Id=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",Id.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Id);if(Hd.size>=Od){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=qd,e.inFlight=Hd.size,e.max=Od,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),Hd.delete(l))};Hd.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Hd.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Hd.get(l)?.reject(e)},n)})}async function Yd(e,t,n=1400){return Zd("canParse",{code:e,theme:t},n)}async function Gd(e,t,n=2400){return Zd("findPrefix",{code:e,theme:t},n)}function Jd(){Fd?.terminate?.(),Fd=null,Id=null,Hd.clear()}var Qd=null,eu=!1,tu=null,nu=null;function ou(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(tu!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),tu=n}catch{}}var ru=/* @__PURE__ */M(69),iu=/* @__PURE__ */Symbol(ru),lu=/* @__PURE__ */Symbol(ru+1),au=/* @__PURE__ */Symbol(ru+2),su=/* @__PURE__ */Symbol(ru+3),cu=/* @__PURE__ */Symbol(ru+4),du=/* @__PURE__ */Symbol(ru+5),uu=/* @__PURE__ */Symbol(ru+6),mu=/* @__PURE__ */Symbol(ru+7),fu=/* @__PURE__ */Symbol(ru+8),hu=/* @__PURE__ */Symbol(ru+9),pu=/* @__PURE__ */Symbol(ru+10),yu=/* @__PURE__ */Symbol(ru+11),gu=/* @__PURE__ */Symbol(ru+12),bu=/* @__PURE__ */Symbol(ru+13),wu=/* @__PURE__ */Symbol(ru+14),vu=/* @__PURE__ */Symbol(ru+15),xu=/* @__PURE__ */Symbol(ru+16),ku=/* @__PURE__ */Symbol(ru+17),Su=/* @__PURE__ */Symbol(ru+18),Cu=/* @__PURE__ */Symbol(ru+19),Nu=/* @__PURE__ */Symbol(ru+20),Mu=/* @__PURE__ */Symbol(ru+21),$u=/* @__PURE__ */Symbol(ru+22),Bu=/* @__PURE__ */Symbol(ru+23),Eu=/* @__PURE__ */Symbol(ru+24),Tu=/* @__PURE__ */Symbol(ru+25),Lu=/* @__PURE__ */Symbol(ru+26),Du=/* @__PURE__ */Symbol(ru+27),ju=/* @__PURE__ */Symbol(ru+28),Pu=/* @__PURE__ */Symbol(ru+29),_u=/* @__PURE__ */Symbol(ru+30),Ru=/* @__PURE__ */Symbol(ru+31),Au=/* @__PURE__ */Symbol(ru+32),Fu=/* @__PURE__ */Symbol(ru+33),Iu=/* @__PURE__ */Symbol(ru+34),Hu=/* @__PURE__ */Symbol(ru+35),Ou=/* @__PURE__ */Symbol(ru+36),Wu=/* @__PURE__ */Symbol(ru+37),zu=/* @__PURE__ */Symbol(ru+38),Ku=/* @__PURE__ */Symbol(ru+39),Vu=/* @__PURE__ */Symbol(ru+40),qu=/* @__PURE__ */Symbol(ru+41),Uu=/* @__PURE__ */Symbol(ru+42),Xu=/* @__PURE__ */Symbol(ru+43),Zu=/* @__PURE__ */Symbol(ru+44),Yu=/* @__PURE__ */Symbol(ru+45),Gu=/* @__PURE__ */Symbol(ru+46),Ju=/* @__PURE__ */Symbol(ru+47),Qu=/* @__PURE__ */Symbol(ru+48),em=/* @__PURE__ */Symbol(ru+49),tm=/* @__PURE__ */Symbol(ru+50),nm=/* @__PURE__ */Symbol(ru+51),om=/* @__PURE__ */Symbol(ru+52),rm=/* @__PURE__ */Symbol(ru+53),im=/* @__PURE__ */Symbol(ru+54),lm=/* @__PURE__ */Symbol(ru+55),am=/* @__PURE__ */Symbol(ru+56),sm=/* @__PURE__ */Symbol(ru+57),cm=/* @__PURE__ */Symbol(ru+58),dm=/* @__PURE__ */Symbol(ru+59),um=/* @__PURE__ */Symbol(ru+60),mm=/* @__PURE__ */Symbol(ru+61),fm=/* @__PURE__ */Symbol(ru+62),hm=/* @__PURE__ */Symbol(ru+63),pm=/* @__PURE__ */Symbol(ru+64),ym=/* @__PURE__ */Symbol(ru+65),gm=/* @__PURE__ */Symbol(ru+66),bm=/* @__PURE__ */Symbol(ru+67),wm=/* @__PURE__ */Symbol(ru+68),vm="undefined"!=typeof window?U:q,xm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function km(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Sm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(km(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||km(e),o}function Cm(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var Nm={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 Mm(e){const n={...Nm,...e},{t:o}=J(iu,Nt,iu),r=X(()=>Yt("mermaid"),[],lu),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],au),a=n.workerTimeoutMs??Nm.workerTimeoutMs,s=n.parseTimeoutMs??Nm.parseTimeoutMs,c=n.renderTimeoutMs??Nm.renderTimeoutMs,d=n.fullRenderTimeoutMs??Nm.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??Nm.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?Pd(n.maxHeight):null,[n.maxHeight],su),f=X(()=>Rd(Pd(n.estimatedPreviewHeightPx)??_d(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],cu),[h,p]=Y(!1,du),[y,g]=Y(!1,uu),[b,w]=Y(!1,mu),[v,N]=Y(!1,fu),[M,$]=Y(1,hu),[B,E]=Y({x:0,y:0},pu),[L,D]=Y(!1,yu),[j,P]=Y(!1,gu),[_,R]=Y(!1,bu),[A,F]=Y(null,wu),[I,H]=Y(!1,vu),[O,W]=Y(`${f}px`,xu),[z,V]=Y("undefined"==typeof window,ku),G=Z(null,Su),Q=Z(null,Cu),ee=Z(null,Nu),te=Z(null,Mu),ne=Z(null,$u),oe=Z(null,Bu),re=Z(null,Eu),ie=Z(null,Tu),le=Z(0,Lu),ae=Z({},Du),se=Z(null,ju),ce=Z("",Pu),de=Z(!1,_u),ue=Z(null,Ru),me=Z(!1,Au),fe=Z({zoom:1,translateX:0,translateY:0,containerHeight:O||"360px"},Fu),he=Z(B,Iu);he.current=B;const pe=Z(M,Hu);pe.current=M;const ye=Z(I,Ou);ye.current=I;const ge=J(Wu,Qe,Wu),be=Boolean(n.node?.loading??n.loading),we=n.isDark?"dark":"light",ve=Boolean(n.isStrict),xe=!0===n.enableMermaidInteractions,Se=X(()=>ve?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:xm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ve],zu);q(()=>{me.current=_},[_],Ku),q(()=>{y||b||W(e=>{const t=Pd(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,y],Vu),q(()=>{ae.current={}},[we,l,ve],qu),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Qd)return ou(Qd,e),Qd;if(nu){const t=await nu;return t&&ou(t,e),t}if(eu)return null;try{eu=!0,nu=(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 ou(Qd,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Qd}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{nu=null}})();const t=await nu;return t&&ou(t,e),t}catch{return null}}(Se);e||(G.current=t,p(Boolean(t)),de.current||g(!t))})(),()=>{e=!0}},[Se],Uu),q(()=>{const e=Q.current;if(!e)return;const t=ge(e,{rootMargin:"400px"});return ue.current=t,t.isVisible()&&V(!0),t.whenVisible.then(()=>V(!0)),()=>{t.destroy(),ue.current=null}},[ge],Xu),q(()=>{if("undefined"==typeof document)return;if(!I)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[I],Zu);const Ce=K(()=>m,[m],Yu),Ne=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=Ce(),u=null==d?c:Math.min(c,d);W(`${"none"===n.maxHeight?u:Math.max(u,f)}px`)},[f,n.maxHeight,Ce],Gu);q(()=>{if(!Q.current||"undefined"==typeof ResizeObserver)return;if(y||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Ad(()=>Ne(t))});return e.observe(Q.current),()=>e.disconnect()},[b,y,Ne],Ju),q(()=>{y||b||Ne()},[b,n.maxHeight,y,Ne],Qu),q(()=>()=>{Jd()},[],em),U(()=>{const e=ae.current[we];!y&&te.current&&e?.svg&&(Sm(te.current,e.svg)&&(se.current=e.bindFunctions??null,Cm(te.current,e.bindFunctions,xe)),Ad(()=>Ne()))},[xe,y,we,Ne],tm);const Me=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=Em(e,t),i=await jm(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=Sm(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,Cm(te.current,i.bindFunctions,xe),Ne(),ae.current[t]={svg:l,bindFunctions:i.bindFunctions},R(!0),F(null),!0)}catch(r){if(!be){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)}},[xe,d,be,Ne],nm),$e=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=Em(Dm(e)||e,t),i=await jm(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=Sm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,Cm(te.current,i.bindFunctions,xe)),e&&Ne()}}catch{}finally{P(!1)}}},[xe,c,be,Ne],om),Be=K(async(e,t)=>{if(!e.trim())return km(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"===Tm(e)){const i=Dm(e);if(!i.trim())return;try{if(await Bm(i,we,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;i===e?await Me(e,we,t)&&(ce.current=n):await $e(i,we,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await Bm(e,we,{workerTimeout:a,parseTimeout:s,mermaid:G.current,signal:t}),t?.aborted||le.current!==o)return;return void(await Me(e,we,t)&&(ce.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await Gd(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return Dm(e)}(e,we,{workerTimeout:a,signal:t});if(!n||t?.aborted||le.current!==o)return;await $e(n,we,t)}catch{}},[s,Me,$e,we,a],rm),Ee=K(()=>z&&!y&&!b,[b,y,z],im);q(()=>{if(!Ee())return;if(!G.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Ee()&&Be(l,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[l,Ee,h,Be,u],lm);const Te=K((e,t)=>{e.clientX,e.clientY,Pt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],am),Le=K(async()=>{try{await(navigator.clipboard?.writeText(l)),N(!0),n.onCopy?.(l),setTimeout(()=>N(!1),1e3)}catch{}},[l,n],sm),De=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=Pm(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??Pm(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],cm),je=K(()=>{re.current=null,km(oe.current)},[],dm),Pe=K(()=>{H(!1),je()},[je],um),_e=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?Pm(e):null};n.onOpenModal?.(t),t.defaultPrevented||H(!0)},[n],mm);q(()=>{if(!I)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Pe()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Pe,I],fm),J(hm,vm,()=>{if(!I)return;const e=oe.current,t=Q.current;if(!e||!t)return;const n=`translate(${B.x}px, ${B.y}px) scale(${M})`,o=t.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="100%",o.style.maxHeight="100%";const r=o.querySelector("[data-mermaid-wrapper]");r&&(re.current=r,r.style.transform=n),km(e),e.appendChild(o),Cm(e,se.current??ae.current[we]?.bindFunctions,xe)},[xe,I,we],hm),q(()=>{I&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${M})`)},[I,B.x,B.y,M],pm);const Re=y||j||b,Ae=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),Fe=K(e=>{const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(n.onToggleMode?.(e,t),!t.defaultPrevented)if(de.current=!0,"preview"===e){g(!1);const e=fe.current;$(e.zoom),E({x:e.translateX,y:e.translateY}),W(e.containerHeight)}else fe.current={zoom:M,translateX:B.x,translateY:B.y,containerHeight:O},g(!0)},[l,O,Be,n,we,B.x,B.y,Ne,M],gm),Ie=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=$m(M+l,.5,3);if(a===M)return;const s=a/M;E({x:B.x-r*(s-1),y:B.y-i*(s-1)}),$(a)},[B,M],bm);ie.current||(ie.current=ke({getTranslate:()=>he.current,setTranslate:e=>E(e),canStart:e=>!!te.current?.querySelector("svg")&&("touch"!==e.pointerType||ye.current||pe.current>1),onActiveChange:e=>D(e)}));const He=ie.current;q(()=>()=>He.stop(),[He],wm);const Oe=I||M>1,We=S("div",{className:"relative"},()=>T([n.showZoomControls&&S("div",{className:"absolute top-2 right-2 z-10 rounded-lg"},()=>S("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg"},()=>T([C(()=>x("button",{type:"button",className:Hr("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=>Te(e,o("common.zoomIn")),onMouseLeave:()=>_t(),onClick:()=>$($m(M+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:Hr("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=>Te(e,o("common.zoomOut")),onMouseLeave:()=>_t(),onClick:()=>$($m(M-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:Hr("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=>Te(e,o("common.resetZoom")),onMouseLeave:()=>_t(),onClick:()=>{$(1),E({x:0,y:0})}},()=>T([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:Hr("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50",{"mermaid-pan-touch":Oe}),style:{height:O,maxHeight:n.maxHeight??void 0},onWheel:Ie,onPointerDown:e=>He.start(e)},()=>T([C(()=>S("div",{ref:ee,"data-mermaid-wrapper":!0,className:Hr("absolute inset-0 cursor-grab",{"cursor-grabbing":L}),style:{transform:`translate(${B.x}px, ${B.y}px) scale(${M})`}},()=>C(()=>x("div",{ref:te,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})))),(j||be)&&x("div",{className:"mermaid-loading"},x("span",{className:"mermaid-spinner"}),x("span",{},"Rendering diagram…"))])))])),ze=n.showHeader&&C(()=>S("div",{className:Hr("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",n.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200")},()=>T([S("div",{className:"flex items-center space-x-2 overflow-hidden"},()=>T([C(()=>x("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:r}})),C(()=>x("span",{className:Hr("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:Hr("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:Hr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Fe("preview"),onMouseEnter:e=>Te(e,o("common.preview")),onFocus:e=>Te(e,o("common.preview")),onMouseLeave:()=>_t(),onBlur:()=>_t()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),x("circle",{cx:"12",cy:"12",r:"3"}))),S("span",{},()=>o("common.preview"))])))),C(()=>S("button",{type:"button",className:Hr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Fe("source"),onMouseEnter:e=>Te(e,o("common.source")),onFocus:e=>Te(e,o("common.source")),onMouseLeave:()=>_t(),onBlur:()=>_t()},()=>S("div",{className:"flex items-center space-x-1"},()=>T([x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})),S("span",{},()=>o("common.source"))]))))]))),S("div",{className:"flex items-center space-x-1"},()=>T([n.showCollapseButton&&C(()=>S("button",{type:"button",className:Ae,"aria-pressed":b,onClick:()=>w(e=>!e),onMouseEnter:e=>Te(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Te(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>_t(),onBlur:()=>_t()},()=>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:Ae,onClick:Le,onMouseEnter:e=>Te(e,o(v?"common.copied":"common.copy")),onFocus:e=>Te(e,o(v?"common.copied":"common.copy")),onMouseLeave:()=>_t(),onBlur:()=>_t()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},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&&h&&C(()=>x("button",{type:"button",className:Hr(Ae,Re?"opacity-50 cursor-not-allowed":""),disabled:Re,onClick:De,onMouseEnter:e=>Te(e,o("common.export")),onFocus:e=>Te(e,o("common.export")),onMouseLeave:()=>_t(),onBlur:()=>_t()},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&h&&C(()=>S("button",{type:"button",className:Hr(Ae,Re?"opacity-50 cursor-not-allowed":""),disabled:Re,onClick:I?Pe:_e,onMouseEnter:e=>Te(e,o(I?"common.minimize":"common.open")),onFocus:e=>Te(e,o(I?"common.minimize":"common.open")),onMouseLeave:()=>_t(),onBlur:()=>_t()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",I?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),Ke=S("div",{},()=>T([y?C(()=>S("div",{className:Hr("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))):We,A&&S("div",{className:"mermaid-error"},()=>A)]));return S(t,{},()=>T([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":y?"source":_?"preview":"pending",className:Hr("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":be})},()=>T([ze,C(()=>S("div",{ref:ne,style:{display:b?"none":""}},()=>Ke))]))),I&&"undefined"!=typeof document&&k(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Pe()},()=>C(()=>S("div",{className:Hr("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:Pe},()=>o("common.close")))])),S("div",{className:"mermaid-modal-body"},()=>C(()=>x("div",{ref:oe,className:"mermaid-modal-content"})))])))),document.body)]))}function $m(e,t,n){return Math.min(Math.max(e,t),n)}async function Bm(e,t,n){try{if(await Yd(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=Em(e,t),r=n.mermaid;if("function"==typeof r.parse)return await jm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await jm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function Em(e,t){return xe(e,`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n`)}function Tm(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 Lm(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 Dm(e){if("gantt"===Tm(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(Lm(e))break;t.pop()}else t.pop()}return t.some(Lm)?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 jm(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 Pm(e){return(new XMLSerializer).serializeToString(e)}var _m=/* @__PURE__ */W('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),Rm=/* @__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=H(g(a),1);i=a,l=H(s,1);{const t=e.h0;n=$(s,t),r=t}o=f(t,a,n,r,i,l,null,void 0)}else{const t=e.h0;o.b!==t&&(I(o.a,t),o.b=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.f!==n){o.f=n;const e=o.e;null==e||r||null===n?o.e=z(t,1,o.c,n,o.d,!0):I(e,n)}}});function Am(e){const{node:t}=e;return x(Rm,{h0:" ",h1:String(t?.type)})}function Fm(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:dt(c)}}function Im(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function Hm(e,t,n,o){const r=e.filter(e=>!Im(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=>!Im(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(!Im(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Im(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Im(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Om(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??at(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"},Hm(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;Te.has(e.type)||n&&function(e,t,n){return"block"===Fm(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"},Hm(a,r,o,String(i??"paragraph")))}Am.$$singleRoot=!0,N(["click","keydown","mouseenter","mouseleave"]);var Wm=/* @__PURE__ */W('<span class="reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]" role="button" tabindex="0"></span>'),zm=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),Km=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Wm);n=s,s.$$click=e.h0,r=s,s.$$mouseenter=e.h1,i=s,s.$$mouseleave=e.h2,l=s,s.$$keydown=e.h3,a=s,o=h(t,s,n,r,i,l,a,null,void 0)}else o.a.$$click=e.h0,o.b.$$mouseenter=e.h1,o.c.$$mouseleave=e.h2,o.d.$$keydown=e.h3;{const n=e.h4,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.g!==n){const e=o.f;null==e||r||null===n?o.f=b(t,1,o.e,n,e):I(e,n),o.g=n}}});function Vm(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],zm);return x(Km,{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})}Vm.$$singleRoot=!0;var qm=/* @__PURE__ */W('<s class="strikethrough-node"></s>'),Um=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(qm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Xm(e){return x(Um,{h0:e.children})}Xm.$$singleRoot=!0;var Zm=/* @__PURE__ */W('<strong class="strong-node"></strong>'),Ym=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Zm);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function Gm(e){return x(Ym,{h0:e.children})}Gm.$$singleRoot=!0;var Jm=/* @__PURE__ */W('<sub class="subscript-node"></sub>'),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):I(e,n),o.c=n}}});function ef(e){return x(Qm,{h0:e.children})}ef.$$singleRoot=!0;var tf=/* @__PURE__ */W('<sup class="superscript-node"></sup>'),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):I(e,n),o.c=n}}});function of(e){return x(nf,{h0:e.children})}of.$$singleRoot=!0;var rf=/* @__PURE__ */W('<th dir="auto"><!><!></th>'),lf=/* @__PURE__ */W("<tr></tr>"),af=/* @__PURE__ */W('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),sf=/* @__PURE__ */M(5),cf=/* @__PURE__ */Symbol(sf),df=/* @__PURE__ */Symbol(sf+1),uf=/* @__PURE__ */Symbol(sf+2),mf=/* @__PURE__ */Symbol(sf+3),ff=/* @__PURE__ */Symbol(sf+4),hf=(e,t)=>`header-${t}`;function pf(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(rf);e=a,n=a;const s=g(a);o=s,r=a,i=H(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=Hr("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?je(e.children,i,`${String(s??"table")}-th-${u}`,c):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||m.f!==n){m.f=n;const e=m.e;null==e||o||null===n?m.e=z(t,1,m.c,n,m.d,!0):I(e,n)}}{const e=u<a.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${u+1} and ${u+2}`,onPointerDown:e=>d(u,e)})),n=null!==e&&("object"==typeof e||"function"==typeof e);if(n||m.j!==e){m.j=e;const o=m.i;null==o||n||null===e?m.i=z(t,2,m.g,e,m.h,!0):I(o,e)}}}var yf=(e,t)=>`row-${t}`;function gf(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(lf);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=Hr("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:Hr("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?je(e.children,i,`${String(a??"table")}-row-${c}-${t}`,s):null)),o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||d.e!==n){const e=d.d;null==e||o||null===n?d.d=b(t,1,d.c,n,e):I(e,n),d.e=n}}}var bf=["r","c","d"],wf=/* @__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(af);n=v;const x=g(v);{const n=e.h1;i=n,l=x,L(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>D(r.c,r.d))}a=x,s=x;const k=H(g(x),1),S=g(k);c=S,d=g(S);const C=H(k,1);u=C,m=g(C),f=x,h=g(x),p=v,b=H(x,1),r=y(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=bf}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&D(e,r.d),null!=n&&L(t,()=>o(n,r.d)),r.c=n}}{const t=e.h0;r.a!==t&&(P(r.b,"data-index-key",t),r.a=t)}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}{const t=e.h3;r.g!==t&&(j(r.h,"aria-busy",t),r.g=t)}B(t,1,r.i,e.h5,e.h6,e.h7,hf,pf,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,yf,gf,18,[e.h12,e.h13,e.h14,e.h15,e.h16],r.l,1);{const n=e.h4,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.p!==n){r.p=n;const e=r.o;null==e||o||null===n?r.o=z(t,3,r.m,n,r.n,!0):I(e,n)}}{const n=e.h17,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.t!==n){r.t=n;const e=r.s;null==e||o||null===n?r.s=z(t,4,r.q,n,r.r,!0):I(e,n)}}});function vf(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,cf),d=e.useRef(null,df),u=e.useRef(null,uf),[m,f]=e.useState([],mf),h=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",p=()=>{const e=u.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),u.current=null),d.current=null},y=(e,t)=>{if(0!==t.button)return;const n=(()=>{const e=c.current?.querySelectorAll("thead th");return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))})(),o=n[e],r=n[e+1];if(!o||!r)return;t.preventDefault(),p(),d.current={index:e,startX:t.clientX,startWidth:o,nextStartWidth:r,widths:n},f(n);const i=e=>{const t=d.current;if(!t)return;e.preventDefault();const n=t.startWidth+t.nextStartWidth,o=Math.min(48,Math.floor(n/2)),r=Math.max(o,Math.min(n-o,Math.round(t.startWidth+e.clientX-t.startX))),i=[...t.widths];i[t.index]=r,i[t.index+1]=n-r,f(i)},l=()=>{p()};u.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)};return e.useEffect(()=>(p(),f([]),p),[l.length],ff),x(wf,{h0:i,h1:c,h2:Hr("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:Hr("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>T([o&&r?je(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>y(t,e)}))])),h8:[h,o,l,i,r,y],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:Hr("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:Hr("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?je(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&x("div",{className:"table-node__loading",role:"status","aria-live":"polite"},x("span",{className:"table-node__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}vf.$$singleRoot=!0;var xf=/* @__PURE__ */W('<hr class="hr-node thematic-break"/>'),kf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(xf)))});function Sf(){return x(kf,{})}Sf.$$singleRoot=!0;var Cf=/* @__PURE__ */W("<div></div>"),Nf=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),Mf=["s","d","c"],$f=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Cf);n=e.h0,r=O(e.h1),i=s,l=A(s,[[!1,"className",n],[!0,r]],void 0,t,!0),(t.cleanups??=[]).push(()=>{const e=o.d;null!=e&&Object.prototype.propertyIsEnumerable.call(e,"ref")&&null!=e.ref&&D(e.ref,o.c)}),a=s,o=h(t,s,n,r,i,l,a,null,void 0),t.refFields=Mf}else{{const t=e.h0;o.a!==t&&(o.a=t)}o.b=O(e.h1),o.d=A(o.c,[[!1,"className",o.a],[!0,o.b]],o.d,t,!0)}{const n=e.h2;o.f=b(t,1,o.e,n,o.f),o.g=n}});function Bf(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)?Le(n.attrs):n.attrs},[n.attrs],Nf);return x($f,{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})}Bf.$$singleRoot=!0;var Ef=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function Tf(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))Ef.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function Lf(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function Df(t,n,o,r,i={}){const l=Tf(r.codeBlockProps),a=r.events.onHandleArtifactClick?e=>{const t="image/svg+xml"===e.type?"image/svg+xml":"text/html";r.events.onHandleArtifactClick?.({node:null==e.content?n:{...n,code:e.content},artifactType:t,artifactTitle:e.title||("image/svg+xml"===t?"SVG Preview":"HTML Preview"),id:String(o)})}:void 0;return e.createElement(t,{key:o,node:n,loading:Boolean(n.loading)||!1===r.final,stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,codeBlockOptions:r.codeBlockOptions,...i,ctx:r,renderNode:Pf,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function jf(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function Pf(t,n,o){const r=o.customComponents??at(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:Pf,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)?De(n.children,r,`${String(o)}-html`,Pf):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:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=Fm(t,{...r,...i},o.customHtmlTags),a=String(t.tag??"").trim().toLowerCase()||ne(t.content),s=l?.tag??a;if(s){const i=l?.component??r[s],a=l?.isWhitelisted??(o.customHtmlTags??[]).some(e=>e.toLowerCase()===s);if(a&&i){const r={...t,type:s,tag:s,content:ge(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&ye(c,s))return"html_inline"===t.type?Lf(kc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):Lf(Om,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return Lf(kc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return Lf(kc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return Lf(Om,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return Lf(Cl,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return Lf(_p,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return Lf(Pc,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return Lf(jc,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return Lf(vf,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return Lf(Gi,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return Lf(ml,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return Lf(vl,t,n,{});case"footnote_anchor":return Lf(cl,t,n,{});case"admonition":return Lf(Oe,t,n,{ctx:o,renderNode:Pf,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return Lf(Sl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return Lf(Tc,t,n,{ctx:o,renderNode:Pf,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return Lf(Ga,t,n,{});case"inline_code":return Lf(ic,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=Vt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,Vt(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==Pd(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Rd(_d(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Pd(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return jf(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(Mm,{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?jf(l,t,n,o,i):e.createElement(Xs,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?jf(i,t,n,o,o.d2Props||{}):e.createElement(Vi,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return Df(a,t,n,o);const s=r.code_block;if(s)return Df(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=Tf(o.codeBlockProps).showLineNumbers,i=o.codeBlockOptions?.disableLineNumbers,l=o.codeBlockOptions?.overflow;return e.createElement(Ln,{key:n,node:t,style:l?{whiteSpace:"scroll"===l?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof r?r:"boolean"==typeof i&&!i})}return e.createElement(Fr,{key:n,node:t,loading:Boolean(t.loading)||!1===o.final,stream:o.codeBlockStream,themes:o.codeBlockThemes?.themes,darkTheme:o.codeBlockThemes?.darkTheme,lightTheme:o.codeBlockThemes?.lightTheme,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...Tf(o.codeBlockProps),codeBlockOptions:o.codeBlockOptions})}(t,n,o,r);case"strong":return Lf(Gm,t,n,{},De(t.children,o,`${String(n)}-strong`,Pf));case"emphasis":return Lf(ol,t,n,{},De(t.children,o,`${String(n)}-em`,Pf));case"strikethrough":return Lf(Xm,t,n,{},De(t.children,o,`${String(n)}-strike`,Pf));case"highlight":return Lf($l,t,n,{},De(t.children,o,`${String(n)}-highlight`,Pf));case"insert":return Lf(sc,t,n,{},De(t.children,o,`${String(n)}-insert`,Pf));case"subscript":return Lf(ef,t,n,{},De(t.children,o,`${String(n)}-sub`,Pf));case"superscript":return Lf(of,t,n,{},De(t.children,o,`${String(n)}-sup`,Pf));case"checkbox":case"checkbox_input":return Lf(kt,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return Lf(el,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(Sf);case"math_inline":return Lf(jd,t,n,{});case"math_block":return Lf(wd,t,n,{});case"reference":return Lf(Vm,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?Lf(ha,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):Lf(Wa,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return Lf(Bf,t,n,{ctx:o,renderNode:Pf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return Lf(Am,t,n,{})}}var _f=/* @__PURE__ */M(98),Rf=/* @__PURE__ */Symbol(_f),Af=/* @__PURE__ */Symbol(_f+1),Ff=/* @__PURE__ */Symbol(_f+2),If=/* @__PURE__ */Symbol(_f+3),Hf=/* @__PURE__ */Symbol(_f+4),Of=/* @__PURE__ */Symbol(_f+5),Wf=/* @__PURE__ */Symbol(_f+6),zf=/* @__PURE__ */Symbol(_f+7),Kf=/* @__PURE__ */Symbol(_f+8),Vf=/* @__PURE__ */Symbol(_f+9),qf=/* @__PURE__ */Symbol(_f+10),Uf=/* @__PURE__ */Symbol(_f+11),Xf=/* @__PURE__ */Symbol(_f+12),Zf=/* @__PURE__ */Symbol(_f+13),Yf=/* @__PURE__ */Symbol(_f+14),Gf=/* @__PURE__ */Symbol(_f+15),Jf=/* @__PURE__ */Symbol(_f+16),Qf=/* @__PURE__ */Symbol(_f+17),eh=/* @__PURE__ */Symbol(_f+18),th=/* @__PURE__ */Symbol(_f+19),nh=/* @__PURE__ */Symbol(_f+20),oh=/* @__PURE__ */Symbol(_f+21),rh=/* @__PURE__ */Symbol(_f+22),ih=/* @__PURE__ */Symbol(_f+23),lh=/* @__PURE__ */Symbol(_f+24),ah=/* @__PURE__ */Symbol(_f+25),sh=/* @__PURE__ */Symbol(_f+26),ch=/* @__PURE__ */Symbol(_f+27),dh=/* @__PURE__ */Symbol(_f+28),uh=/* @__PURE__ */Symbol(_f+29),mh=/* @__PURE__ */Symbol(_f+30),fh=/* @__PURE__ */Symbol(_f+31),hh=/* @__PURE__ */Symbol(_f+32),ph=/* @__PURE__ */Symbol(_f+33),yh=/* @__PURE__ */Symbol(_f+34),gh=/* @__PURE__ */Symbol(_f+35),bh=/* @__PURE__ */Symbol(_f+36),wh=/* @__PURE__ */Symbol(_f+37),vh=/* @__PURE__ */Symbol(_f+38),xh=/* @__PURE__ */Symbol(_f+39),kh=/* @__PURE__ */Symbol(_f+40),Sh=/* @__PURE__ */Symbol(_f+41),Ch=/* @__PURE__ */Symbol(_f+42),Nh=/* @__PURE__ */Symbol(_f+43),Mh=/* @__PURE__ */Symbol(_f+44),$h=/* @__PURE__ */Symbol(_f+45),Bh=/* @__PURE__ */Symbol(_f+46),Eh=/* @__PURE__ */Symbol(_f+47),Th=/* @__PURE__ */Symbol(_f+48),Lh=/* @__PURE__ */Symbol(_f+49),Dh=/* @__PURE__ */Symbol(_f+50),jh=/* @__PURE__ */Symbol(_f+51),Ph=/* @__PURE__ */Symbol(_f+52),_h=/* @__PURE__ */Symbol(_f+53),Rh=/* @__PURE__ */Symbol(_f+54),Ah=/* @__PURE__ */Symbol(_f+55),Fh=/* @__PURE__ */Symbol(_f+56),Ih=/* @__PURE__ */Symbol(_f+57),Hh=/* @__PURE__ */Symbol(_f+58),Oh=/* @__PURE__ */Symbol(_f+59),Wh=/* @__PURE__ */Symbol(_f+60),zh=/* @__PURE__ */Symbol(_f+61),Kh=/* @__PURE__ */Symbol(_f+62),Vh=/* @__PURE__ */Symbol(_f+63),qh=/* @__PURE__ */Symbol(_f+64),Uh=/* @__PURE__ */Symbol(_f+65),Xh=/* @__PURE__ */Symbol(_f+66),Zh=/* @__PURE__ */Symbol(_f+67),Yh=/* @__PURE__ */Symbol(_f+68),Gh=/* @__PURE__ */Symbol(_f+69),Jh=/* @__PURE__ */Symbol(_f+70),Qh=/* @__PURE__ */Symbol(_f+71),ep=/* @__PURE__ */Symbol(_f+72),tp=/* @__PURE__ */Symbol(_f+73),np=/* @__PURE__ */Symbol(_f+74),op=/* @__PURE__ */Symbol(_f+75),rp=/* @__PURE__ */Symbol(_f+76),ip=/* @__PURE__ */Symbol(_f+77),lp=/* @__PURE__ */Symbol(_f+78),ap=/* @__PURE__ */Symbol(_f+79),sp=/* @__PURE__ */Symbol(_f+80),cp=/* @__PURE__ */Symbol(_f+81),dp=/* @__PURE__ */Symbol(_f+82),up=/* @__PURE__ */Symbol(_f+83),mp=/* @__PURE__ */Symbol(_f+84),fp=/* @__PURE__ */Symbol(_f+85),hp=/* @__PURE__ */Symbol(_f+86),pp=/* @__PURE__ */Symbol(_f+87),yp=/* @__PURE__ */Symbol(_f+88),gp=/* @__PURE__ */Symbol(_f+89),bp=/* @__PURE__ */Symbol(_f+90),wp=/* @__PURE__ */Symbol(_f+91),vp=/* @__PURE__ */Symbol(_f+92),xp=/* @__PURE__ */Symbol(_f+93),kp=/* @__PURE__ */Symbol(_f+94),Sp=/* @__PURE__ */Symbol(_f+95),Cp=/* @__PURE__ */Symbol(_f+96),Np=/* @__PURE__ */Symbol(_f+97),Mp={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},$p=oe();function Bp(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 Ep(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],Rf),n=Z(t,Af);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 Tp=e.memo(({node:e,nodeKey:t,renderCtx:n})=>Pf(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Lp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J(Ff,Qe,Ff),s="undefined"!=typeof window,c="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,d=Math.max(0,Math.trunc(e.renderBatchSize??80)),u=Math.max(0,Math.trunc(e.initialRenderBatchSize??(d||t.length))),m=!1!==e.batchRendering&&d>0&&s,f=Math.max(0,e.liveNodeBuffer??60),h=Math.max(1,e.maxLiveNodes??320),p=(e.maxLiveNodes??0)>0&&t.length>h,y=!1!==e.viewportPriority,g=m&&(e.maxLiveNodes??0)<=0,b=X(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&y,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,y,p],If),[w,v]=Y(()=>g?Math.min(t.length,u):t.length,Hf),k=Z(w,Of);q(()=>{k.current=w},[w],Wf);const N=g?w:t.length,[M,$]=Y(0,zf),[B,E]=Y({start:0,end:t.length},Kf),L=Z(/* @__PURE__ */new Map,Vf),[D,j]=Y(0,qf),P=Z({},Uf),_=Z(/* @__PURE__ */new Map,Xf),R=Z(/* @__PURE__ */new Map,Zf),A=Z(/* @__PURE__ */new Map,Yf),F=Z(/* @__PURE__ */new Map,Gf),I=Z(/* @__PURE__ */new Set,Jf),H=Z(w,Qf),O=Z(null,eh),W=Z(null,th),z=Z(null,nh),V=Z(!1,oh),U=Z(null,rh),G=Z(Math.max(1,d||1),ih),Q=Z(t.length,lh),ee=Z({key:e.indexKey,total:t.length},ah),te=Z({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:g},sh),ne=b||p,oe=X(()=>{const e=L.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[D],ch),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],dh);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],uh);const ie=K((e,t)=>{if(e>=t)return 0;const n=L.current;let o=0;for(let r=e;r<t;r++)o+=n.get(r)??oe;return o},[oe],mh),le=p?ie(0,Math.min(B.start,t.length)):0,ae=p?ie(Math.min(B.end,t.length),t.length):0,se=K(()=>{null!=O.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(O.current),O.current=null),null!=W.current&&(window.clearTimeout(W.current),W.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),V.current=!1,U.current=null},[],fh),ce=K(t=>{if(!g)return;const n=Math.max(2,e.renderBatchBudgetMs??6),o=Math.max(1,d||1),r=Math.max(1,Math.floor(o/4));t>1.2*n?G.current=Math.max(r,Math.floor(.7*G.current)):t<.5*n&&G.current<o&&(G.current=Math.min(o,Math.ceil(1.2*G.current)))},[g,e.renderBatchBudgetMs,d],hh),de=K((t,n={})=>{if(!g)return;const o=Q.current;if(k.current>=o)return;const r=Math.max(1,t),i=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();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=>{O.current=null,W.current=null,z.current=null,V.current=!1;const n=U.current;if(U.current=null,i(null!=n?n:r),k.current>=Q.current)return;if(!t)return void l();const o=Math.max(2,e.renderBatchBudgetMs??6);for(;k.current<Q.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)i(Math.max(1,Math.round(G.current)));k.current<Q.current&&l()};if(!s||n.immediate)return void a();const d=Math.max(0,e.renderBatchDelay??16);if(U.current=null!=U.current?Math.max(U.current,r):r,!V.current){if(V.current=!0,c){const t=Math.max(0,e.renderBatchIdleTimeoutMs??120);return void(z.current=window.requestIdleCallback(e=>a(e),{timeout:t}))}"function"==typeof requestAnimationFrame?O.current=requestAnimationFrame(()=>{0!==d?W.current=window.setTimeout(()=>a(),d):a()}):W.current=window.setTimeout(()=>a(),d)}},[ce,c,g,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],ph);q(()=>{const n=e.indexKey,o=t.length,r=ee.current,i=void 0!==n?n!==r.key:o!==r.total;ee.current={key:n,total:o};const l=te.current,a=e.renderBatchDelay??16,c=l.batchSize!==d||l.initial!==u||l.delay!==a||l.enabled!==g;if(te.current={batchSize:d,initial:u,delay:a,enabled:g},(i||c||!g)&&se(),(i||c)&&(G.current=Math.max(1,d||1),I.current.clear()),!o)return k.current=0,void v(0);const m=Q.current;if(!g)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 f=Math.min(k.current,m);f!==k.current&&(k.current=f,v(f)),k.current<m&&de(Math.max(1,d||1))},[se,g,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],yh),q(()=>{if(!p)return void E({start:0,end:t.length});const e=t.length;if(!e)return void E({start:0,end:0});const n=Math.max(0,Math.min(M,e-1));let o=Math.max(0,n-f),r=Math.min(e,n+f+1);const i=r-o;if(i>h){const e=i-h;o+=Math.ceil(e/2),r-=Math.floor(e/2)}else if(i<h){const t=h-i;o=Math.max(0,o-Math.ceil(t/2)),r=Math.min(e,r+Math.floor(t/2))}E({start:o,end:r})},[M,f,h,t.length,p],gh),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],bh);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))},[],wh);q(()=>{ue(N)},[ue,N],vh),q(()=>{const e=t.length;let n=!1;for(const t of Array.from(L.current.keys()))t>=e&&(L.current.delete(t),n=!0);n&&j(e=>e+1);for(const t of Object.keys(P.current))Number(t)>=e&&delete P.current[t];for(const t of Array.from(I.current))t>=e&&I.current.delete(t)},[t.length],xh);const me=K((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],kh),fe=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],Sh),he=K((e,t)=>{const n=R.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return fe(e),b&&!t&&delete P.current[e],void(t&&me(e,!0));if(e<u&&!p)return fe(e),void me(e,!0);fe(e);const o=a(t,{rootMargin:"400px"});_.current.set(e,o),o.isVisible()&&me(e,!0),o.whenVisible.then(()=>me(e,!0)).catch(()=>{})},[b,fe,me,a,u,ne,p],Ch),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],Nh),ye=K((e,t)=>{if(!t)return void(L.current.has(e)&&(L.current.delete(e),j(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&L.current.get(e)!==n&&(L.current.set(e,n),j(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],Mh),ge=K(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ye(e,t);return F.current.set(e,n),n},[ye],$h),be=K(e=>!(g&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,g,u],Bh),we=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],Eh);q(()=>{for(const[e,t]of R.current.entries())t&&he(e,t)},[he],Th),q(()=>{p&&w>H.current&&$(w-1),H.current=w},[w,p],Lh);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)},()=>T([ve,re.map(({node:t,index:r})=>{const i=be(r),l=L.current.get(r)??oe,a=!1!==e.fade&&"code_block"!==t.type&&!I.current.has(r)&&i;return a&&I.current.add(r),S("div",{key:`${o}-${r}`,ref:pe(r),className:"node-slot","data-node-index":r,"data-node-type":t.type},()=>C(i?()=>S("div",{ref:ge(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>x(Tp,{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 Dp(t){const n={...Mp,...t},o=Z(null,Dh),r=Z(/* @__PURE__ */new Map,jh),i=Z(0,Ph),l=Z(null,_h),a=J(Rh,ht,n.smoothStreamingOptions,Rh),s=e.useContext(We),c=Z(/* @__PURE__ */new Set,Ah),[d,u]=Y(()=>!0===n.smoothStreaming,Fh);q(()=>{u(!0)},[],Ih);const m=Array.isArray(n.nodes)&&n.nodes.length>0,f=X(()=>!1!==n.smoothStreaming&&!m&&(!0===n.smoothStreaming||!s)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[m,s,n.maxLiveNodes,n.smoothStreaming,n.typewriter],Hh),h=d&&f,p=h?a.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Oh),g=n.content??"",b=m||a.source===g,w=X(()=>h&&null!=y?Boolean(y&&b&&a.caughtUp):y,[y,b,a.caughtUp,h],Wh),v=Z(null,zh),[k,N]=Y(!1,Kh),M=Z(void 0,Vh),$=Z(0,qh),B=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],Uh),E=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&B.has(t)},[B],Xh),T=K(e=>{if(!e||"object"!=typeof e)return 0;const t=e,n=t.raw??t.content??t.code;if("string"==typeof n)return n.length;const o=t.children;if(Array.isArray(o))return o.reduce((e,t)=>e+T(t),0);const r=t.items;return Array.isArray(r)?r.reduce((e,t)=>e+T(t),0):0},[],Zh),L=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+T(t),0):(n.content??"").length,[n.nodes,n.content,T],Yh),D=K(()=>{M.current&&(clearTimeout(M.current),M.current=void 0)},[],Gh),j=K(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??"").trim())return NodeFilter.FILTER_REJECT;const t=e.parentElement;return t?t.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,o=t.nextNode();for(;o;)n=o,o=t.nextNode();return n},[],Jh),P=K(()=>{if("undefined"==typeof window||!k||!o.current||!v.current)return;const e=o.current,t=v.current,n=j(e),r=e.getBoundingClientRect();let i=0,l=0,a=20;if(n?.textContent){const t=document.createRange(),o=n.textContent.length;t.setStart(n,Math.max(0,o-1)),t.setEnd(n,o);const s="function"==typeof t.getClientRects?t.getClientRects():void 0,c=s?.[s.length-1]??n.parentElement?.getBoundingClientRect();c&&(i=c.right-r.left+e.scrollLeft,l=c.top-r.top+e.scrollTop,a=c.height||a),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,l)}px)`,t.style.height=`${a}px`},[k,o,j],Qh);q(()=>{k&&requestAnimationFrame(()=>{P()})},[k,P],ep),q(()=>()=>{D()},[D],tp);const _=m?n.nodes:p;l.current!==_&&(i.current+=1,l.current=_);const R=G(rt,it,it,np),A=X(()=>at(n.customId),[n.customId,R],op),F=J(rp,Ep,n.streamingComponents,rp),I=J(ip,Ep,n.htmlComponents,ip);q(()=>{c.current},[I,F],lp);const H=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],ap),O=X(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return se(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(F))},[n.customId,n.customHtmlTags,n.parseOptions,R,F],sp),W=X(()=>{const e=O;return e&&0!==e.length?oe(H,{customHtmlTags:e}):oe(H)},[H,O],cp),z=X(()=>{const e=W;return n.customMarkdownIt?n.customMarkdownIt(e):e},[W,n.customMarkdownIt],dp),V=X(()=>{const e=n.parseOptions??{},t=w,o=null!=t,r=O.length>0;return o||r?{...e,...o?{final:t}:{},...r?{customHtmlTags:O}:{}}:e},[O,w,n.parseOptions],up),U=X(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return m?o=n.nodes.map(e=>({...e})):p&&(o=de(p,z??$p,V)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:p.length}),o},[n.debugPerformance,p,m,n.nodes,V,z,n.customId,R,O],mp),Q=K(()=>{const e=U[U.length-1];return!E(e)},[U,E],fp);q(()=>{if("undefined"==typeof window||m)return;if(w)return N(!1),void D();const e=L(),t=Q();return!1===n.typewriter||!t||e<=$.current?(!1!==n.typewriter&&t||N(!1),void($.current=e)):($.current=e,N(!0),D(),requestAnimationFrame(()=>{P()}),M.current=setTimeout(()=>{N(!1)},3e3),()=>{D()})},[p,n.nodes,n.typewriter,n.content,w,U.length,m,L,Q,D,P],hp);const ee=Z([],pp),te=V?.postTransformNodes,ne=Z(te,yp);ne.current!==te&&(ee.current=[],ne.current=te);const re=function(e,t){if(!t.length)return e;const n=new Array(e.length);let o=e.length===t.length;for(let r=0;r<e.length;r++){const i=r<t.length?t[r]:null;i&&Bp(i,e[r])?n[r]=i:(n[r]=e[r],o=!1)}return o?t:n}(U,ee.current);ee.current=re,q(()=>{if(m)return void a.reset("");const e=n.content??"";if(!h)return a.reset(e),void(y&&a.finish({flush:!0}));const t=a.getSnapshot().source;e?e===t||(e.startsWith(t)?a.enqueue(e.slice(t.length)):a.reset(e)):a.reset(""),y&&a.finish()},[m,n.content,y,h],gp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!re.some(e=>"code_block"===e?.type&&"mermaid"!==Vt(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(()=>{mn()},{timeout:900});return()=>t(o)},[re,n.renderCodeBlocksAsPre],bp);const ie=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],wp),le=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],vp),ae=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],xp),ce=X(()=>({...n.d2Props||{}}),[n.d2Props],kp),ue=X(()=>({...n.infographicProps||{}}),[n.infographicProps],Sp),me=X(()=>({customId:n.customId,isDark:n.isDark,final:w,indexKey:ie,typewriter:n.typewriter,fade:n.fade,textStreamState:r.current,streamRenderVersion:i.current,customComponents:A,streamingComponents:F,htmlComponents:I,customHtmlTags:O,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockOptions:n.codeBlockOptions,codeBlockProps:le,mermaidProps:ae,d2Props:ce,infographicProps:ue,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,w,ie,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockOptions,O,le,ae,ce,ue,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,A,F,I],Cp);me.streamRenderVersion=i.current,me.textStreamState=r.current;const fe=Z(null,Np);return fe.current||(fe.current={textStreamState:r.current,getStreamRenderVersion:()=>i.current}),S(ze.Provider,{value:fe.current},()=>S(We.Provider,{value:h},()=>S(Je,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(Lp,{props:n,parsedNodes:re,renderCtx:me,indexPrefix:ie,containerRef:o,showTypewriterCursor:k,typewriterCursorRef:v})))))}var jp=/* @__PURE__ */W('<blockquote class="blockquote-node" dir="auto"></blockquote>'),Pp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(jp);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(P(o.b,"cite",t),o.a=t)}{const n=e.h1,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.e!==n){const e=o.d;null==e||r||null===n?o.d=b(t,1,o.c,n,e):I(e,n),o.e=n}}});function _p(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(Pp,{h0:t.cite,h1:i??(n&&o?C(()=>x(Dp,{nodes:t.children||[],indexKey:`blockquote-${String(r??"blockquote")}`,customId:n.customId,isDark:n.isDark,typewriter:n.typewriter,viewportPriority:!0,codeBlockStream:n.codeBlockStream,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockOptions:n.codeBlockOptions,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}_p.$$singleRoot=!0;var Rp=/* @__PURE__ */M(5),Ap=/* @__PURE__ */Symbol(Rp),Fp=/* @__PURE__ */Symbol(Rp+1),Ip=/* @__PURE__ */Symbol(Rp+2),Hp=/* @__PURE__ */Symbol(Rp+3),Op=/* @__PURE__ */Symbol(Rp+4);function Wp(e){const t=Z(null,Ap),[n,o]=Y(!1,Fp),[r,i]=Y({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},Ip),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],Hp);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 Me(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[Be(e.offset??8),$e(),Ee({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],Op),"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,_p as BlockquoteNode,kt as CheckboxNode,Fr as CodeBlockNode,Fr as OctaneCodeBlockNode,Vi as D2BlockNode,Gi as DefinitionListNode,el as EmojiNode,ol as EmphasisNode,Am as FallbackComponent,cl as FootnoteAnchorNode,ml as FootnoteNode,vl as FootnoteReferenceNode,Sl as HardBreakNode,Cl as HeadingNode,$l as HighlightNode,ha as HtmlBlockNode,Wa as HtmlInlineNode,sn as HtmlPreviewFrame,Ga as ImageNode,Xs as InfographicBlockNode,ic as InlineCodeNode,sc as InsertNode,Tc as LinkNode,jc as ListItemNode,Pc as ListNode,qd as MERMAID_WORKER_BUSY_CODE,wd as MathBlockNode,jd as MathInlineNode,Mm as MermaidBlockNode,Dp as NodeRenderer,Dp as default,Om as ParagraphNode,Ln as PreCodeNode,Vm as ReferenceNode,Xm as StrikethroughNode,Gm as StrongNode,ef as SubscriptNode,of as SuperscriptNode,vf as TableNode,kc as TextNode,Sf as ThematicBreakNode,Wp as Tooltip,Bf as VmrContainerNode,Uc as WORKER_BUSY_CODE,Yd as canParseOffthread,ct as clearGlobalCustomComponents,Yc as clearKaTeXCache,Vc as clearKaTeXWorker,Xd as clearMermaidWorker,ft as defineHtmlComponents,mt as defineStreamingComponents,Ur as disableD2,qr as enableD2,Gd as findPrefixOffthread,dt as getCustomComponentDisplay,at as getCustomNodeComponents,td as getKaTeXBackpressureDefaults,Yt as getLanguageIcon,Vd as getMermaidWorkerLoad,Xr as isD2Enabled,Qt as isLikelyIncompleteLanguageIdentifier,Gt as languageMap,Vt as normalizeLanguageIdentifier,Xt as preloadExtendedLanguageIcons,st as removeCustomComponents,Xc as renderKaTeXInWorker,nd as renderKaTeXWithBackpressure,Pf as renderNode,qt as resolveLanguageId,lt as setCustomComponents,Vr as setD2Loader,Ct as setDefaultI18nMap,ed as setKaTeXBackpressureDefaults,Zc as setKaTeXCache,Gc as setKaTeXConcurrencyLimit,Kc as setKaTeXWorker,qc as setKaTeXWorkerDebug,Ot as setLanguageIconResolver,Ud as setMermaidWorker,zd as setMermaidWorkerClientDebug,Kd as setMermaidWorkerMaxConcurrency,Zt as subscribeLanguageIconsRevision,Jd as terminateWorker,Nt as useSafeI18n,ht as useSmoothMarkdownStream,Jc as waitForKaTeXWorkerSlot,ut as withMarkstreamComponentDisplay};
2
+ import*as e from"octane";import{Fragment as t,__s as n,attachRef as o,bag0 as r,bag1 as i,bag10 as l,bag12 as a,bag13 as s,bag15 as c,bag3 as d,bag4 as u,bag5 as m,bag6 as f,bag7 as h,bag8 as p,bagOf as y,child as g,childTextHole as b,clone as w,createContext as v,createElement as x,createPortal as k,createScopedElement as S,createScopedValue as C,delegateEvents as N,flushSync as M,hookSlots as $,htextSwap as B,mapSlot as T,markDangerouslySetInnerHTMLChildren as E,positionalChildren as L,queueRefAttach as D,queueRefDetach as j,setAriaAttribute as P,setAttribute as _,setCheckedCheckable as A,setClassAttr as R,setHostPropSources as F,setStyle as I,setText as O,sibling as H,snapshotSpread as W,template as z,textHole as K,useCallback as V,useContext as q,useEffect as U,useLayoutEffect as X,useMemo as Z,useRef as Y,useState as G,useSyncExternalStore as J,withSlot as Q}from"octane";import{RENDERER_STREAM_DEFAULTS as ee,applyMermaidThemeDirective as te,createPanGesture as ne,createRendererStreamBridge as oe,createSmoothMarkdownStream as re,createStreamingTextDom as ie,createStreamingTextScope as le,normalizeShikiLanguage as ae}from"markstream-core";import{BLOCKED_HTML_TAGS as se,NON_STRUCTURING_HTML_TAGS as ce,convertHtmlAttrsToProps as de,getHtmlTagFromContent as ue,getMarkdown as me,hasCustomHtmlComponents as fe,isCustomHtmlComponentTag as he,isHtmlTagBlocked as pe,isHtmlTagHardBlocked as ye,mergeCustomHtmlTags as ge,normalizeCustomHtmlTagName as be,parseMarkdownToStructure as we,sanitizeHtmlAttrs as ve,sanitizeHtmlContent as xe,sanitizeHtmlTokenAttrs as ke,sanitizeImageSrc as Se,shouldOpenLinkInNewTab as Ce,shouldRenderUnknownHtmlTagAsText as Ne,stripCustomHtmlWrapper as Me,toSafeSvgElement as $e,tokenAttrsToRecord as Be,tokenizeHtml as Te}from"stream-markdown-parser";import{autoUpdate as Ee,computePosition as Le,flip as De,offset as je,shift as Pe}from"@floating-ui/dom";var _e=/* @__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 Ae(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 Re(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,...Ae(a.attrs)},Re(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function Fe(e,t,n,o){return Re(e,t,`${n}-inline`,o)}var Ie=/* @__PURE__ */z('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),Oe=/* @__PURE__ */$(3),He=/* @__PURE__ */Symbol(Oe),We=/* @__PURE__ */Symbol(Oe+1),ze=/* @__PURE__ */Symbol(Oe+2),Ke=/* @__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(Ie);e=m,n=m;const f=g(m);r=f,i=f;const h=g(f);l=h;const p=H(h,1);a=p,s=f,c=H(p,1),d=m,u=H(f,1),o=y(t,m,{a:void 0,b:e,c:void 0,d:n,e:void 0,f:r,g:i,h:l,i:null,j:void 0,k:a,l:null,m:void 0,n:s,o:c,p:null,q:void 0,r:d,s:u,t:null,u:void 0})}{const t=e.h0;o.a!==t&&(R(o.b,t),o.a=t)}{const t=e.h1;o.c!==t&&(_(o.d,"data-index-key",t),o.c=t)}{const t=e.h2;o.e!==t&&(_(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=K(t,1,o.g,n,o.h,!0):O(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):O(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=K(t,3,o.n,n,o.o,!0):O(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=K(t,4,o.r,n,o.s,!0):O(e,n)}}}),Ve={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function qe(e){const{node:t,ctx:n,renderNode:o,indexKey:r,isDark:i}=e,l=String(t.kind||"note"),a=Z(()=>t.title&&String(t.title).trim().length?String(t.title):l.charAt(0).toUpperCase()+l.slice(1),[l,t.title],He),[s,c]=G(()=>!!t.collapsible&&!(t.open??1),We),d=Z(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],ze);return x(Ke,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Ve[l]&&S("span",{className:"admonition-icon"},()=>Ve[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?Re(t.children,n,String(r??d),o):null))})}qe.$$singleRoot=!0;var Ue=v(void 0),Xe=v(!1),Ze=v(null);function Ye(){return q(Ze)}var Ge=/* @__PURE__ */$(3),Je=/* @__PURE__ */Symbol(Ge),Qe=/* @__PURE__ */Symbol(Ge+1),et=/* @__PURE__ */Symbol(Ge+2),tt=v(null);function nt(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,o=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,r=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null;let i=null,l=null;const a=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set;let c=null;const d=()=>{if(!a.size){try{i?.disconnect()}catch{}i=null,l=null,s.size||(()=>{if(null!=c){try{r?.(c)}catch{}c=null}})()}},u=e=>{const t=a.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{i?.unobserve(e)}catch{}a.delete(e),s.delete(e),d()}},m=()=>{o&&null==c&&s.size&&(c=o(()=>{c=null;const e=s.values().next().value;e&&(s.delete(e),u(e),s.size&&m())},{timeout:1200}))};return(o,r)=>{const c={current:!1};let f=!1;const{promise:h,resolve:p}=Promise.withResolvers(),y=()=>{f||(f=!0,p())},g=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g};const b=((t,o)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,o);if(i&&(c=r,(s=l)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return i;var s,c;if(i)try{i.disconnect()}catch{}i=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&u(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),l=r;for(const e of a.keys())i.observe(e);return i})(r?.rootMargin??"300px",r?.threshold??0);return b?(a.set(o,{resolve:y,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:g}):(c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var ot=nt(()=>null,()=>!0);function rt({getRoot:e,enabled:t=!0,children:n}){const o=Y(t,Je);o.current=t;const r=Y(e,Qe);r.current=e;const i=Z(()=>nt(()=>r.current?.()??null,()=>o.current),[],et);return S(tt.Provider,{value:i},()=>n)}function it(){return q(tt)??ot}var lt="__global__",at="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",st=(()=>{const e=globalThis;if(e[at])return e[at];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[at]=t,t})();function ct(){st.revision++;for(const e of Array.from(st.listeners))try{e()}catch{}}function dt(e){return st.listeners.add(e),()=>{st.listeners.delete(e)}}function ut(){return st.revision}function mt(e,t){"string"==typeof e?st.scopedComponents[e]={...t||{}}:st.scopedComponents[lt]={...e},ct()}function ft(e){const t=st.scopedComponents[lt]||{};if(!e)return t;const n=st.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function ht(e){if(e===lt)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete st.scopedComponents[e],ct()}function pt(){delete st.scopedComponents[lt],ct()}function yt(e){return e?.markstreamDisplay}function gt(e,t){return e.markstreamDisplay=t,e}function bt(e){return e}function wt(e){return e}function vt(e={}){const t=Y(null,kt);t.current||(t.current=re(e));const n=t.current,[o,r]=G(()=>n.getSnapshot(),St);return X(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],Ct),Z(()=>({...o,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,o],Nt)}var xt=/* @__PURE__ */$(4),kt=/* @__PURE__ */Symbol(xt),St=/* @__PURE__ */Symbol(xt+1),Ct=/* @__PURE__ */Symbol(xt+2),Nt=/* @__PURE__ */Symbol(xt+3),Mt=/* @__PURE__ */z('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),$t=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=w(Mt),l=r.firstChild;A(l,e.h0),n=l,o=i(t,r,n)}else A(o.a,e.h0)});function Bt(e){const{node:t}=e;return x($t,{h0:Boolean(t.checked)})}Bt.$$singleRoot=!0;var Tt={"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 Et(e){Object.assign(Tt,e)}function Lt(){return{t:e=>Tt[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 Dt=null,jt=null,Pt=null,_t=null,At=null,Rt=null;function Ft(){_t&&(clearTimeout(_t),_t=null),At&&(clearTimeout(At),At=null)}async function It(e){if(!Dt||!jt)return;const{x:t,y:n}=await Le(jt,Dt,{placement:e,middleware:[je(8),De(),Pe({padding:8})],strategy:"fixed"});Dt.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Ot(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Dt||"undefined"==typeof document||((Dt=document.createElement("div")).className="markstream-octane ms-tooltip",Dt.setAttribute("role","tooltip"),Dt.dataset.visible="false",Dt.style.position="fixed",Dt.style.left="0px",Dt.style.top="0px",Dt.style.transform="translate3d(0,0,0)",document.body.appendChild(Dt)),!Dt)return;Ft();const l=async()=>{if(Dt){jt=e,Dt.textContent=t,Dt.dataset.placement=n,Dt.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",Dt.dataset.visible="false",Rt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Dt.id=Rt;try{e.setAttribute("aria-describedby",Rt)}catch{}await It(n),Dt.dataset.visible="true",Pt?.(),Pt=Ee(e,Dt,()=>{It(n)})}};o?l():_t=setTimeout(l,80)}function Ht(e=!1){if(!Dt)return;Ft();const t=()=>{if(Dt){if(Dt.dataset.visible="false",jt&&Rt)try{jt.removeAttribute("aria-describedby")}catch{}jt=null,Rt=null,Pt&&(Pt(),Pt=null)}};e?t():At=setTimeout(t,120)}var Wt='<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',zt=null,Kt=null,Vt=null,qt=/* @__PURE__ */new Set;function Ut(e){zt=e??null}var Xt={"":"",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"},Zt={"":Wt,plain:Wt,text:Wt,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 Yt(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}function Gt(e){const t=Yt(e);return Xt[t]??t}function Jt(e){const t=Gt(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"shell":return"zsh";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}async function Qt(){return Kt||(Vt||(Vt=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(Kt=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of qt)try{e()}catch{}}(),Kt)).catch(()=>null)),Vt)}async function en(){await Qt()}function tn(e){return qt.add(e),()=>{qt.delete(e)}}function nn(e){if(zt){const t=zt(e);if(null!=t&&""!==t)return t}const t=Gt(e),n=Zt[t];if(n)return n;const o=Kt?.[t];return o||(Qt(),'<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 on={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"},rn=Array.from(/* @__PURE__ */new Set([...Object.keys(Xt),...Object.values(Xt),...Object.keys(Zt),...Object.keys(on),"c","diff","go","java","php","ruby","rust","sql","yaml"]));function ln(e){const t=Yt(e);return!!t&&!rn.includes(t)&&rn.some(e=>e.startsWith(t))}var an=/* @__PURE__ */$(4),sn=/* @__PURE__ */Symbol(an),cn=/* @__PURE__ */Symbol(an+1),dn=/* @__PURE__ */Symbol(an+2),un=/* @__PURE__ */Symbol(an+3),mn=void 0!==import.meta&&Boolean(!1),fn=null;function hn(e){const{t:t}=Q(sn,Lt,sn),n=Z(()=>{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],cn),o=Z(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!mn||"undefined"==typeof console||fn===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")&&(fn=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],dn);return U(()=>{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],un),"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 pn=!1,yn=null,gn=!1;async function bn(){if(yn)return yn;if(gn)return null;try{if(!(yn=function(e){const t="function"==typeof e?.createCodeBlockRuntime||"function"==typeof e?.useMonaco?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return"function"!=typeof n?null:{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:t?.detectLanguage?.bind(t),preloadStreamDiffs:t?.preloadStreamDiffs?.bind(t)}}(await import("stream-diffs/markstream"))))throw new Error("Invalid stream-diffs runtime");return await async function(e){pn||(pn=!0,e?.preloadStreamDiffs&&await e.preloadStreamDiffs())}(yn),yn}catch{return gn=!0,null}}var wn=/* @__PURE__ */z('<pre data-markstream-pre="1" tabindex="0"></pre>'),vn=/* @__PURE__ */$(6),xn=/* @__PURE__ */Symbol(vn),kn=/* @__PURE__ */Symbol(vn+1),Sn=/* @__PURE__ */Symbol(vn+2),Cn=/* @__PURE__ */Symbol(vn+3),Nn=/* @__PURE__ */Symbol(vn+4),Mn=/* @__PURE__ */Symbol(vn+5),$n=/* @__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(wn);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&&(I(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&&(_(o.j,"data-language",t),o.i=t)}{const t=e.h5;o.k!==t&&(_(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):O(e,n),o.o=n}}});function Bn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function Tn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function En(e){return e.startsWith("-")&&!e.startsWith("---")}function Ln(e){return e.startsWith("+")&&!e.startsWith("+++")}function Dn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function jn(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 Pn(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?jn(e,"hunk",`inline-hunk-${n}`,""):En(e)?jn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Ln(e)?jn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):jn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function _n(e,t){const n=Tn(e),o=Tn(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(jn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Dn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(jn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Dn(o,i)})),i++;e.push(jn(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(jn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Dn(n,t)})),t++;for(;i<o.length;)e.push(jn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Dn(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(jn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(jn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(jn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Dn(n,d)}));for(let d=l;d<=s;d++)i.push(jn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Dn(o,d)}));return i.concat(c)}function An(e,t=!1,n=Bn(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=>En(e)),r=e.some(e=>Ln(e));return o&&r||function(e,t){if("diff"===t)return!0;const n=String(e?.raw??"").split(/\r?\n/,1)[0]?.trim()??"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(n)}(t,n)&&(o||r)}(o,e,n)&&function(e){return null!=e?.originalCode||null!=e?.updatedCode}(e)){if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:_n(e?.originalCode,e?.updatedCode)}];const n=Tn(e?.originalCode),o=Tn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>jn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Dn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>jn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Dn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Pn(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(jn(d,"hunk",`original-hunk-${c}`,"")),l.push(jn(d,"hunk",`modified-hunk-${c}`,""));else if(En(d))i.push(jn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Ln(d))l.push(jn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(jn(e,"context",`original-context-${c}`,a++)),l.push(jn(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 Rn({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=Z(()=>Bn(e?.language),[e],xn),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=Z(()=>c?An(e,!0===o,l):[],[o,c,e,l],kn),u=Z(()=>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],Sn),m=Z(()=>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],Cn),f=Z(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],Nn),h=Z(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(2,String(m).length)}ch`,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}},[m,c,r],Mn);return x($n,{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(" ")},()=>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(t,{},()=>L([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)]))})}Rn.$$singleRoot=!0;var Fn=/* @__PURE__ */z('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),In=/* @__PURE__ */z('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),On=["r","a","b"],Hn=/* @__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(Fn),f=g(m);{const l=e.h0;n=l,i=f,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=f,a=f,c=f;const h=H(f,1);d=h,u=h,r=s(t,m,n,i,void 0,l,void 0,a,void 0,c,void 0,d,u,null,void 0),t.refFields=On}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(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&&(I(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&&(I(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):O(e,n),r.m=n}}}),Wn=/* @__PURE__ */$(96),zn=/* @__PURE__ */Symbol(Wn),Kn=/* @__PURE__ */Symbol(Wn+1),Vn=/* @__PURE__ */Symbol(Wn+2),qn=/* @__PURE__ */Symbol(Wn+3),Un=/* @__PURE__ */Symbol(Wn+4),Xn=/* @__PURE__ */Symbol(Wn+5),Zn=/* @__PURE__ */Symbol(Wn+6),Yn=/* @__PURE__ */Symbol(Wn+7),Gn=/* @__PURE__ */Symbol(Wn+8),Jn=/* @__PURE__ */Symbol(Wn+9),Qn=/* @__PURE__ */Symbol(Wn+10),eo=/* @__PURE__ */Symbol(Wn+11),to=/* @__PURE__ */Symbol(Wn+12),no=/* @__PURE__ */Symbol(Wn+13),oo=/* @__PURE__ */Symbol(Wn+14),ro=/* @__PURE__ */Symbol(Wn+15),io=/* @__PURE__ */Symbol(Wn+16),lo=/* @__PURE__ */Symbol(Wn+17),ao=/* @__PURE__ */Symbol(Wn+18),so=/* @__PURE__ */Symbol(Wn+19),co=/* @__PURE__ */Symbol(Wn+20),uo=/* @__PURE__ */Symbol(Wn+21),mo=/* @__PURE__ */Symbol(Wn+22),fo=/* @__PURE__ */Symbol(Wn+23),ho=/* @__PURE__ */Symbol(Wn+24),po=/* @__PURE__ */Symbol(Wn+25),yo=/* @__PURE__ */Symbol(Wn+26),go=/* @__PURE__ */Symbol(Wn+27),bo=/* @__PURE__ */Symbol(Wn+28),wo=/* @__PURE__ */Symbol(Wn+29),vo=/* @__PURE__ */Symbol(Wn+30),xo=/* @__PURE__ */Symbol(Wn+31),ko=/* @__PURE__ */Symbol(Wn+32),So=/* @__PURE__ */Symbol(Wn+33),Co=/* @__PURE__ */Symbol(Wn+34),No=/* @__PURE__ */Symbol(Wn+35),Mo=/* @__PURE__ */Symbol(Wn+36),$o=/* @__PURE__ */Symbol(Wn+37),Bo=/* @__PURE__ */Symbol(Wn+38),To=/* @__PURE__ */Symbol(Wn+39),Eo=/* @__PURE__ */Symbol(Wn+40),Lo=/* @__PURE__ */Symbol(Wn+41),Do=/* @__PURE__ */Symbol(Wn+42),jo=/* @__PURE__ */Symbol(Wn+43),Po=/* @__PURE__ */Symbol(Wn+44),_o=/* @__PURE__ */Symbol(Wn+45),Ao=/* @__PURE__ */Symbol(Wn+46),Ro=/* @__PURE__ */Symbol(Wn+47),Fo=/* @__PURE__ */Symbol(Wn+48),Io=/* @__PURE__ */Symbol(Wn+49),Oo=/* @__PURE__ */Symbol(Wn+50),Ho=/* @__PURE__ */Symbol(Wn+51),Wo=/* @__PURE__ */Symbol(Wn+52),zo=/* @__PURE__ */Symbol(Wn+53),Ko=/* @__PURE__ */Symbol(Wn+54),Vo=/* @__PURE__ */Symbol(Wn+55),qo=/* @__PURE__ */Symbol(Wn+56),Uo=/* @__PURE__ */Symbol(Wn+57),Xo=/* @__PURE__ */Symbol(Wn+58),Zo=/* @__PURE__ */Symbol(Wn+59),Yo=/* @__PURE__ */Symbol(Wn+60),Go=/* @__PURE__ */Symbol(Wn+61),Jo=/* @__PURE__ */Symbol(Wn+62),Qo=/* @__PURE__ */Symbol(Wn+63),er=/* @__PURE__ */Symbol(Wn+64),tr=/* @__PURE__ */Symbol(Wn+65),nr=/* @__PURE__ */Symbol(Wn+66),or=/* @__PURE__ */Symbol(Wn+67),rr=/* @__PURE__ */Symbol(Wn+68),ir=/* @__PURE__ */Symbol(Wn+69),lr=/* @__PURE__ */Symbol(Wn+70),ar=/* @__PURE__ */Symbol(Wn+71),sr=/* @__PURE__ */Symbol(Wn+72),cr=/* @__PURE__ */Symbol(Wn+73),dr=/* @__PURE__ */Symbol(Wn+74),ur=/* @__PURE__ */Symbol(Wn+75),mr=/* @__PURE__ */Symbol(Wn+76),fr=/* @__PURE__ */Symbol(Wn+77),hr=/* @__PURE__ */Symbol(Wn+78),pr=/* @__PURE__ */Symbol(Wn+79),yr=/* @__PURE__ */Symbol(Wn+80),gr=/* @__PURE__ */Symbol(Wn+81),br=/* @__PURE__ */Symbol(Wn+82),wr=/* @__PURE__ */Symbol(Wn+83),vr=/* @__PURE__ */Symbol(Wn+84),xr=/* @__PURE__ */Symbol(Wn+85),kr=/* @__PURE__ */Symbol(Wn+86),Sr=/* @__PURE__ */Symbol(Wn+87),Cr=/* @__PURE__ */Symbol(Wn+88),Nr=/* @__PURE__ */Symbol(Wn+89),Mr=/* @__PURE__ */Symbol(Wn+90),$r=/* @__PURE__ */Symbol(Wn+91),Br=/* @__PURE__ */Symbol(Wn+92),Tr=/* @__PURE__ */Symbol(Wn+93),Er=/* @__PURE__ */Symbol(Wn+94),Lr=/* @__PURE__ */Symbol(Wn+95),Dr=["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,f,h,p,b,v;const x=w(In);{const l=e.h0;n=l,i=x,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=x,a=x;const k=H(g(x),1);s=k,c=x,d=g(x),u=k;const S=g(k);m=S,f=k,h=H(S,1),p=x;const C=H(k,1);b=C,v=H(C,1),r=y(t,x,{a:n,b:i,c:void 0,d:l,e:void 0,f:a,g:void 0,h:s,i:c,j:d,k:null,l:void 0,m:u,n:m,o:null,p:void 0,q:f,r:h,s:null,t:void 0,u:p,v:b,w:null,x:void 0,y:v,z:null,A:void 0}),t.refFields=Dr}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(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&&(I(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=K(t,1,r.i,n,r.j,!0):O(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=K(t,2,r.m,n,r.n,!0):O(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=K(t,3,r.q,n,r.r,!0):O(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=K(t,4,r.u,n,r.v,!0):O(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):O(e,n),r.A=n}}}),Pr="undefined"!=typeof window?X:U,_r={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Ar=12;function Rr({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return x(Hn,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(Rn,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Fr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Ir(e,t){return"number"!=typeof e||!Number.isFinite(e)||e<0?{top:t,bottom:t}:{top:e,bottom:e}}function Or(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const o=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},r={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...r,...n,parseDiffOptions:{...r.parseDiffOptions,...o}}}function Hr(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}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 zr(e){const t=String(e??"").trim().toLowerCase();if(!t||"transparent"===t)return!0;const n=t.match(/^#([0-9a-f]{8})$/);if(n)return 0===Number.parseInt(n[1].slice(6),16);const o=t.match(/^#([0-9a-f]{4})$/);if(o)return 0===Number.parseInt(o[1][3]+o[1][3],16);const r=t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1]?.split(/[\s,/]+/).filter(Boolean);return 4===r?.length&&0===Number(r[3])}function Kr(e){const n={..._r,...e},{node:o,isDark:r,loading:i,stream:l,isShowPreview:a,enableFontSizeControl:s,darkTheme:c,lightTheme:d,codeBlockOptions:u,themes:m,minWidth:f,maxWidth:h,showHeader:p,showCopyButton:y,showExpandButton:g,showPreviewButton:b,showCollapseButton:w,showFontSizeButtons:v,showLineNumbers:k,showTooltips:N}=n,M=Y(null,zn),$=Y(null,Kn),B=Y(null,Vn),T=Y(null,qn),E=Y(null,Un),D=Y(null,Xn),j=Y(null,Zn),P=Y(0,Yn),_=Y(null,Gn),A=Y(null,Jn),R=Q(Qn,it,Qn),F=Y(null,eo),I=Y(null,to),O=Y(u,no),H=Y(null,oo),W=Y([],ro),z=Y(null,io),K=Y(null,lo),q=Y(!1,ao),X=Y(void 0,so),[J,ee]=G(!1,co),[te,ne]=G(()=>"undefined"==typeof window,uo),[oe,re]=G(!1,mo),[ie,le]=G(!1,fo),[ae,se]=G(!1,ho),[ce,de]=G(()=>o.language||"plaintext",po),[ue,me]=G(()=>Gt(o.language),yo),[fe,he]=G(!1,go),[pe,ye]=G(!1,bo),[ge,be]=G(!1,wo),[we,ve]=G(!1,vo),[xe,ke]=G(0,xo),{t:Se}=Q(ko,Lt,ko);U(()=>{q.current=pe},[pe],So);const Ce=Z(()=>Or(Boolean(o.diff),u),[u,o.diff],Co),[Ne,Me]=G(()=>{const e=Number(Or(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:Ar},No),[$e,Be]=G(Ne,Mo),Te=Z(()=>!1!==N,[N],$o),Ee="boolean"==typeof k?k:!0!==Ce.disableLineNumbers,Le=Y(Ee,Bo),De=Number(O.current?.fontSize),je=Number(u?.fontSize),Pe=O.current!==u&&Number.isFinite(De)&&De>0&&(!Number.isFinite(je)||je<=0),_e=V(()=>{const e=Ce.maxHeight??500;return"number"==typeof e&&Number.isFinite(e)?e:500},[Ce.maxHeight],To);Q(Eo,Pr,()=>{const e=Number(Ce.fontSize),t=Number.isFinite(e)&&e>0?e:Ar;Me(t),Be(t)},[Ce.fontSize],Eo);const Ae=V(e=>{if(J)return;const t=M.current,n=B.current;if(!t||!n)return;const o="diff"===D.current?n.getDiffEditorView?.():n.getEditorView?.();if(!o)return;const r=_e(),i="diff"===D.current,l=i?"important":"";e?(t.style.minHeight="0px",t.style.setProperty("max-height","none",l),t.style.overflow="visible"):(t.style.minHeight="0px",t.style.setProperty("max-height",`${Math.ceil(r)}px`,l),t.style.overflow=i?"hidden":"auto");try{const n=()=>{if(i){const e=function(e){if("undefined"==typeof window)return null;try{const t=e.getBoundingClientRect();if(t.width<=0)return null;const n=[".stream-diffs-shell",".stream-diffs-shell .diffs-container",".stream-diffs-shell .diff-line",".stream-diffs-shell .diff-hunk"];let o=0;for(const r of Array.from(e.querySelectorAll(n.join(",")))){if(!(r instanceof HTMLElement))continue;const e=window.getComputedStyle(r);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=r.getBoundingClientRect();n.height<=0||n.bottom<=t.top||(o=Math.max(o,n.bottom-t.top))}return o>0?Math.ceil(o+4):null}catch{return null}}(t);if(null!=e)return e}if("function"==typeof o.getContentHeight)return o.getContentHeight();if(i&&"function"==typeof o.getModifiedEditor){const e=o.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}},a=Number(n());if(Number.isFinite(a)&&a>0){const n=e?a:Math.min(a,r);t.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,l)}o.layout?.()}catch{}},[_e,J],Lo),Re=V(e=>{if(Ae(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Ae(e),window.requestAnimationFrame(()=>{Ae(e);const t=M.current;t&&null!=K.current&&(t.style.minHeight="0px",K.current=null)})});return window.setTimeout(()=>Ae(e),180),()=>window.cancelAnimationFrame(t)},[Ae],Do),Fe=V(()=>{const e=M.current,t=$.current?.querySelector(".code-editor-fallback-surface");if(!e||!t)return;const n=t.getBoundingClientRect().height;!Number.isFinite(n)||n<=0||(K.current=n,e.style.minHeight=`${Math.ceil(n)}px`)},[],jo),Ie=V(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],Po),Oe=V(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],z.current?.disconnect(),z.current=null},[],_o),He=V(()=>{Oe();const e=B.current,t=M.current;if(!e||!t||"diff"!==D.current)return;const n=()=>Re(q.current),o=(e,t)=>{try{const o=e?.[t];if("function"!=typeof o)return;const r=o.call(e,n);r&&W.current.push(r)}catch{}},r=e.getDiffEditorView?.(),i=r?.getOriginalEditor?.(),l=r?.getModifiedEditor?.();if(o(r,"onDidUpdateDiff"),o(i,"onDidContentSizeChange"),o(l,"onDidContentSizeChange"),o(i,"onDidLayoutChange"),o(l,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),z.current=e}},[Oe,Re],Ao);U(()=>tn(()=>{ke(e=>e+1)}),[],Ro),U(()=>{me(Gt(o.language))},[o.language],Fo);const We=Y(o,Io);We.current=o;const ze=V(()=>{P.current+=1;try{T.current?.()}catch{}Oe(),E.current=null,D.current=null,j.current=null,K.current=null,se(!1),le(!1)},[Oe],Oo),Ke=V(()=>{const e=M.current,t=$.current;if(!e||!t)return;t.style.removeProperty("--vscode-editor-foreground"),t.style.removeProperty("--vscode-editor-background"),t.style.removeProperty("--vscode-editor-selectionBackground");const n=Fr(Ce.tabSize)??4,r=Ir(Ce.padding,o.diff?0:8);if(e.style.setProperty("--diffs-tab-size",String(n)),"number"==typeof Ce.padding&&Number.isFinite(Ce.padding)&&Ce.padding>=0?e.style.setProperty("--diffs-gap-block",`${r.top}px`):e.style.removeProperty("--diffs-gap-block"),o.diff)return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");const i=e.querySelector(".stream-diffs-shell")??e;try{const n="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(i):null,r=String(n?.getPropertyValue("--vscode-editor-foreground")??"").trim()||String(n?.color??"").trim(),l=String(n?.getPropertyValue("--vscode-editor-background")??"").trim(),a=String(n?.backgroundColor??"").trim(),s=zr(l)?zr(a)?"":a:l,c=String(n?.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}(s,r,"plaintext"===Jt(String(o.language||ue||ce||"plaintext")),t.classList.contains("is-dark")))return e.style.removeProperty("--vscode-editor-foreground"),e.style.removeProperty("--vscode-editor-background"),void e.style.removeProperty("--vscode-editor-selectionBackground");r?e.style.setProperty("--vscode-editor-foreground",r):e.style.removeProperty("--vscode-editor-foreground"),s?e.style.setProperty("--vscode-editor-background",s):e.style.removeProperty("--vscode-editor-background"),c?e.style.setProperty("--vscode-editor-selectionBackground",c):e.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ue,ce,o.diff,o.language,Ce],Ho),Ve=Z(()=>r?c??m?.[0]??"vitesse-dark":d??m?.[1]??"vitesse-light",[c,r,d,m],Wo),qe=V(()=>Ve,[Ve],zo),Ue=Z(()=>qe(),[qe],Ko),Xe=Z(()=>function(e,t){const n=(function(e){return"string"==typeof e?e:null}(e)??"").toLowerCase();return n?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>n.includes(e))&&!["light","latte","dawn","lotus"].some(e=>n.includes(e)):t}(Ue,Boolean(r)),[r,Ue],Vo),Ze=Z(()=>o.diff?r?"dark":"light":Xe?"dark":"light",[r,o.diff,Xe],qo),Ye=Z(()=>o.diff?"dark"===Ze:Xe,[Ze,o.diff,Xe],Uo),Ge=Z(()=>o.diff?"dark"===Ze:Boolean(r),[Ze,r,o.diff],Xo),Je=Z(()=>{const e=Ce,t=Fr(e?.fontSize)??(Pe?Ar:$e)??Ar,n=Fr(e?.lineHeight)??(t===Ar?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=Ir(e?.padding,o.diff?0:8),l=Fr(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Pe,$e,o.diff,Ce],Zo),Qe=Z(()=>!!o.diff&&"unified"===Ce.diffStyle,[o.diff,Ce],Yo),et=Z(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Je.lineHeight}px`,"--markstream-pre-line-number-top":`${Je.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Je.fontSize}px`,lineHeight:`${Je.lineHeight}px`,maxHeight:`${_e()}px`,overflow:"auto",paddingBottom:`${Je.paddingBottom}px`,paddingTop:`${Je.paddingTop}px`,tabSize:Je.tabSize,whiteSpace:"scroll"===Ce.overflow?"pre":"pre-wrap","--markstream-code-font-family":Je.fontFamily,fontFamily:Je.fontFamily}),[_e,Je,Ce.overflow],Go),tt=V(()=>{const e=Ce.maxHeight,t={...Ce||{},...null==e?{}:{MAX_HEIGHT:e},themes:m?[...m]:void 0,stream:!1,disableFileHeader:!0,theme:Ue,disableLineNumbers:!Ee,fontSize:Je.fontSize,lineHeight:Je.lineHeight,fontFamily:Je.fontFamily,onThemeChange(){Ke()},themeType:r?"dark":"light"};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }","string"==typeof t.unsafeCSS?t.unsafeCSS:""].filter(Boolean).join("\n"),t},[r,Je,Ue,Ce,Ee,Ke,m],Jo),nt=V(()=>{const e=tt(),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},[tt],Qo),ot=V(e=>{const t=e(nt());return B.current=t,T.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[nt],er),rt=Z(()=>JSON.stringify({diffStyle:Ce.diffStyle,expandUnchanged:Ce.expandUnchanged,collapsedContextThreshold:Ce.collapsedContextThreshold,hunkSeparators:Ce.hunkSeparators,lineDiffType:Ce.lineDiffType,maxLineDiffLength:Ce.maxLineDiffLength,expansionLineCount:Ce.expansionLineCount,context:Ce.parseDiffOptions?.context}),[Ce],tr);U(()=>{nt()},[Ce,nt],nr),U(()=>()=>{P.current+=1,T.current?.(),Oe(),T.current=null,E.current=null,D.current=null,j.current=null,B.current=null,I.current=null,_.current=null,A.current?.destroy?.(),A.current=null},[Oe],or),U(()=>{if("undefined"==typeof window)return;if(te)return;const e=$.current;if(!e)return;A.current?.destroy?.();const t=R(e,{rootMargin:"400px"});return A.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),A.current===t&&(A.current=null)}},[R,te],rr),U(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(nt(),()=>{e=!1}):((async()=>{try{const t=await bn();if(!e)return;if(!t)return void ee(!0);const n=t.createCodeBlockRuntime,o=t.detectLanguage;if("function"==typeof o&&(_.current=o),"function"!=typeof n)return void ee(!0);I.current=n,ot(n),re(!0)}catch{e&&ee(!0)}})(),()=>{e=!1})},[ot,nt],ir),U(()=>{if(!o.language&&!ue&&_.current)try{const e=_.current(String(o.code??""));e&&de(e)}catch{}},[ue,o.code,o.language],lr);const lt=Z(()=>String(o.language||ue||ce||"plaintext"),[ue,ce,o.language],ar),at=Z(()=>Gt(lt),[lt],sr),st=Z(()=>!!i&&ln(lt),[i,lt],cr),ct=Z(()=>st?"plaintext":Jt(at),[at,st],dr),dt=Z(()=>"plaintext"===ct,[ct],ur),ut=Z(()=>nn(at),[at,xe],mr),mt=Z(()=>!!a&&("html"===at||"svg"===at),[at,a],fr),ft=Z(()=>{const e=at;return e?on[e]||e.charAt(0).toUpperCase()+e.slice(1):on[""]||"Plain Text"},[at],hr),ht=Z(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],pr),pt=Z(()=>{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=Ge?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[h,f,o.diff,Ge],yr),yt=Z(()=>{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],gr),gt=Z(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],br),bt=!1===l&&i||!1!==l&&i&&!gt;U(()=>{if(J)return;if(!oe)return;if(!ie||!te)return;const e=B.current;nt();const t=()=>{o.diff&&e?.refreshDiffPresentation?.(),Ke(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Re(pe)):null)&&Re(pe)};e?.setTheme&&Ue?Promise.resolve(e.setTheme(Ue)).then(t).catch(()=>{}):t()},[ge,ie,Ze,pe,oe,o.diff,Ue,Re,Ke,nt,J,te],wr);const wt=V(async()=>{if(J)return null;if(!te)return null;if(ge)return null;if(bt)return null;const e=B.current,t=M.current;if(!e||!t||!e.createEditor)return null;nt();const n=We.current,o=n.diff?"diff":"single",r=j.current,i="diff"===o?Boolean(e.getDiffEditorView?.()):Boolean(e.getEditorView?.());if(D.current===o&&r===t&&i)return null;if(E.current)return E.current;P.current+=1;const l=P.current;le(!0);const a=(async()=>{try{T.current?.(),D.current=null,j.current=null,se(!1);const o=ct;if(n.diff?"function"==typeof e.createDiffEditor?(D.current="diff",await e.createDiffEditor(t,Hr(n.originalCode),Hr(n.updatedCode),o)):(D.current="single",await e.createEditor(t,Hr(n.updatedCode??n.code),o)):(D.current="single",await e.createEditor(t,Hr(n.code),o)),j.current=t,P.current!==l)return;const r=Number(Ce.fontSize),i=Number.isFinite(r)&&r>0?r:Ar;if(Number.isFinite(i)&&i>0){Me(i),Be(i);try{const t="diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.(),n=Fr(Ce.lineHeight)??(i===Ar?18:Math.max(12,Math.round(1.5*i)));t?.updateOptions?.({fontSize:i,lineHeight:n})}catch{}}if(He(),Ke(),Fe(),Ae(pe),await Ie(),P.current!==l)return;Ae(pe),se(!0),Re(pe)}catch{P.current===l&&(X.current=ct,ee(!0))}})().finally(()=>{E.current===a&&(E.current=null)});return E.current=a,a},[Ae,He,Oe,ge,pe,ct,Fe,Ce.fontSize,Re,bt,Ke,nt,J,te,Ie],vr);U(()=>{nt();const e=O.current!==u;O.current=u;const t=Le.current!==Ee;Le.current=Ee;const n=H.current;if(H.current=rt,J)return;if(!oe)return;let r=!1;if(e||t){const e=I.current;if(e){ze(),B.current=null,T.current=null;try{ot(e),r=!0}catch{return void ee(!0)}}}const i=Boolean(o.diff&&n!==rt);if(!r&&!i)return;if(!te||!ie&&!r)return;if(ge||bt)return;let l=!1;return(async()=>{if(r||ze(),!l)try{await wt()}catch{}})(),()=>{l=!0}},[ge,u,ie,Ee,wt,ot,oe,rt,o.diff,ze,bt,nt,J,te],xr),U(()=>{if(J){const e=X.current;if(void 0===e||e===ct)return;return X.current=void 0,ze(),void ee(!1)}oe&&te&&(ge||bt?ze():wt())},[ge,wt,ct,oe,ze,bt,J,te],kr),U(()=>{if(J)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;const e=B.current;if(!e)return;const t=Hr(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=Gt(o.language)||ue;if(!n&&_.current)try{n=Gt(_.current(t)),n&&me(n)}catch{}const r=st?"plaintext":Jt(n||at);if(e.createEditor&&M.current){try{await Promise.resolve(wt())}catch{}const e=E.current;if(e)try{await e}catch{}}try{o.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(Hr(o.originalCode),Hr(o.updatedCode),r)):e.updateCode&&await Promise.resolve(e.updateCode(t,r))}catch{}Re(pe)})()},[at,ue,ge,ie,wt,pe,oe,o.code,o.diff,o.language,o.originalCode,o.updatedCode,Re,st,bt,J,te],Sr),U(()=>{if(i)return;if(!oe||!te||ge||J)return;const e=B.current;e&&(async()=>{try{o.diff&&e.finalizeDiff?await Promise.resolve(e.finalizeDiff()):e.finalizeCode&&await Promise.resolve(e.finalizeCode())}catch{}Re(pe)})()},[ge,pe,i,o.diff,oe,Re,J,te],Cr),U(()=>{if(J)return;if(!oe)return;if(!te)return;if(ge)return;if(bt)return;if(!pe&&i)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Re(pe)):null;return null==e&&Re(pe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,pe,i,oe,Re,bt,J,te],Nr),U(()=>{if(!s)return;if(J)return;const e=B.current;if(e){try{("diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.())?.updateOptions?.({fontSize:$e})}catch{}Re(pe)}},[s,pe,$e,o.diff,Re,J],Mr),U(()=>{Te||Ht(!0)},[Te],$r);const vt=V((e,t)=>{if(!Te)return;const n=e.currentTarget;n&&!n.disabled&&Ot(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ye)},[Ye,Te],Br),xt=V(()=>{Te&&Ht()},[Te],Tr),kt=V(async()=>{const e=String(ht);try{n.clipboardWriter?await n.clipboardWriter(e):"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(e),he(!0),n.onCopy?.(e),setTimeout(()=>he(!1),1e3)}catch{}},[n,ht],Er),St=V(()=>{if(!mt)return;const e="html"===at?"text/html":"image/svg+xml",t="html"===at?Se("artifacts.htmlPreviewTitle")||"HTML Preview":Se("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof n.onPreviewCode?"html"===at&&ve(e=>!e):n.onPreviewCode({node:o,artifactType:e,artifactTitle:t,id:`temp-${at}-${Date.now()}`})},[at,mt,o,n,Se],Lr);return x(jr,{h0:$,h1:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Ge?"border-gray-700/30":"border-gray-200",i?"is-rendering":"",Ge?"is-dark":"",o.diff?"is-diff":"",dt?"is-plain-text":""].join(" "),h2:pt,h3:p&&C(()=>S("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:yt},()=>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:ut}})),S("span",{className:"text-sm font-medium font-mono truncate"},()=>ft)])),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":ge,onClick:()=>be(e=>!e),onMouseEnter:e=>vt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onFocus:e=>vt(e,ge?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse"),onMouseLeave:xt,onBlur:xt},()=>C(()=>x("svg",{style:{rotate:ge?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"}))))),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:$e<=10,onClick:()=>Be(e=>Math.max(10,e-1)),onMouseEnter:e=>vt(e,Se("common.decrease")||"Decrease"),onFocus:e=>vt(e,Se("common.decrease")||"Decrease"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e===Ne,onClick:()=>Be(Ne),onMouseEnter:e=>vt(e,Se("common.reset")||"Reset"),onFocus:e=>vt(e,Se("common.reset")||"Reset"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),x("path",{d:"M3 3v5h5"}))))),C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$e>=36,onClick:()=>Be(e=>Math.min(36,e+1)),onMouseEnter:e=>vt(e,Se("common.increase")||"Increase"),onFocus:e=>vt(e,Se("common.increase")||"Increase"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"}))))])),y&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy",onClick:kt,onMouseEnter:e=>vt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onFocus:e=>vt(e,fe?Se("common.copied")||"Copied":Se("common.copy")||"Copy"),onMouseLeave:xt,onBlur:xt},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},fe?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),g&&C(()=>S("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":pe,onClick:e=>{ye(e=>!e),vt(e,pe?Se("common.expand")||"Expand":Se("common.collapse")||"Collapse")},onMouseEnter:e=>vt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onFocus:e=>vt(e,pe?Se("common.collapse")||"Collapse":Se("common.expand")||"Expand"),onMouseLeave:xt,onBlur:xt},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",pe?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})))),mt&&b&&C(()=>x("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Se("common.preview")||"Preview",onClick:St,onMouseEnter:e=>vt(e,Se("common.preview")||"Preview"),onFocus:e=>vt(e,Se("common.preview")||"Preview"),onMouseLeave:xt,onBlur:xt},x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},x("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"},x("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),x("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})))))]))]))),h4:`code-block-body${ge?" code-block-body--collapsed":""}${pe?" code-block-body--expanded":""}`,h5:!ge&&(!!l||!i)&&C(J?()=>x(Rn,{className:"code-fallback-plain m-0",diffInline:Qe,node:o,showLineNumbers:Ee,style:et}):()=>x(Rr,{editorHostRef:M,editorReady:ae,node:o,preFallbackDiffInline:Qe,preFallbackStyle:et,showLineNumbers:Ee,stream:l})),h6:!l&&i&&x("div",{className:"code-loading-placeholder"},x("div",{className:"loading-skeleton"},x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line"}),x("div",{className:"skeleton-line short"}))),h7:we&&!n.onPreviewCode&&mt&&"html"===at&&C(()=>x(hn,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>ve(!1)})),h8:fe?Se("common.copied")||"Copied":""})}function Vr(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=Vr(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function qr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Vr(e))&&(o&&(o+=" "),o+=t);return o}Rr.$$singleRoot=!0,Kr.$$singleRoot=!0;var Ur=0,Xr=()=>import("@terrastruct/d2"),Zr=null,Yr=Xr;function Gr(e){Yr=e,Zr=null}function Jr(e){Gr(e??Xr)}function Qr(){Gr(null)}function ei(){return"function"==typeof Yr}var ti=/* @__PURE__ */z("<div><!><!></div>"),ni=/* @__PURE__ */$(41),oi=/* @__PURE__ */Symbol(ni),ri=/* @__PURE__ */Symbol(ni+1),ii=/* @__PURE__ */Symbol(ni+2),li=/* @__PURE__ */Symbol(ni+3),ai=/* @__PURE__ */Symbol(ni+4),si=/* @__PURE__ */Symbol(ni+5),ci=/* @__PURE__ */Symbol(ni+6),di=/* @__PURE__ */Symbol(ni+7),ui=/* @__PURE__ */Symbol(ni+8),mi=/* @__PURE__ */Symbol(ni+9),fi=/* @__PURE__ */Symbol(ni+10),hi=/* @__PURE__ */Symbol(ni+11),pi=/* @__PURE__ */Symbol(ni+12),yi=/* @__PURE__ */Symbol(ni+13),gi=/* @__PURE__ */Symbol(ni+14),bi=/* @__PURE__ */Symbol(ni+15),wi=/* @__PURE__ */Symbol(ni+16),vi=/* @__PURE__ */Symbol(ni+17),xi=/* @__PURE__ */Symbol(ni+18),ki=/* @__PURE__ */Symbol(ni+19),Si=/* @__PURE__ */Symbol(ni+20),Ci=/* @__PURE__ */Symbol(ni+21),Ni=/* @__PURE__ */Symbol(ni+22),Mi=/* @__PURE__ */Symbol(ni+23),$i=/* @__PURE__ */Symbol(ni+24),Bi=/* @__PURE__ */Symbol(ni+25),Ti=/* @__PURE__ */Symbol(ni+26),Ei=/* @__PURE__ */Symbol(ni+27),Li=/* @__PURE__ */Symbol(ni+28),Di=/* @__PURE__ */Symbol(ni+29),ji=/* @__PURE__ */Symbol(ni+30),Pi=/* @__PURE__ */Symbol(ni+31),_i=/* @__PURE__ */Symbol(ni+32),Ai=/* @__PURE__ */Symbol(ni+33),Ri=/* @__PURE__ */Symbol(ni+34),Fi=/* @__PURE__ */Symbol(ni+35),Ii=/* @__PURE__ */Symbol(ni+36),Oi=/* @__PURE__ */Symbol(ni+37),Hi=/* @__PURE__ */Symbol(ni+38),Wi=/* @__PURE__ */Symbol(ni+39),zi=/* @__PURE__ */Symbol(ni+40),Ki=["r","a","b"],Vi=/* @__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(ti);{const l=e.h0;n=l,i=m,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=m,s=m;const f=g(m);c=f,d=m,u=H(f,1),r=a(t,m,n,i,void 0,l,s,c,null,void 0,d,u,null,void 0),t.refFields=Ki}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(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=K(t,1,r.e,n,r.f,!0):O(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=K(t,2,r.i,n,r.j,!0):O(e,n)}}}),qi={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Ui={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"},Xi=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Zi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Yi(e){if(!e)return"";const t=e.trim();return Zi.test(t)?t:""}function Gi(e){const n={...qi,...e},{t:o}=Q(oi,Lt,oi),[r,i]=G(!1,ri),[l,a]=G(!1,ii),[s,c]=G(!1,li),[d,u]=G(!1,ai),[m,f]=G(null,si),[h,p]=G("",ci),[y,g]=G(null,di),[b,w]=G(!1,ui),[v,k]=G(()=>"undefined"==typeof window,mi),N=Y(0,fi),M=Y(null,hi),$=Y(!1,pi),B=Y(!1,yi),T=Y(0,gi),E=Y(null,bi),D=Y(!1,wi),j=Y(null,vi),P=Y(null,xi),_=Y(null,ki),A=Y(null,Si),R=Y(!1,Ci),F=Y(()=>{},Ni),I=Q(Mi,it,Mi),O=n.node?.code??"",H=s||!d||!h,W=!!h,z=Z(()=>{if(!n.maxHeight)return;const e="number"==typeof n.maxHeight?`${n.maxHeight}px`:String(n.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[n.maxHeight],$i),K=Z(()=>{if(H&&y)return{minHeight:`${y}px`}},[y,H],Bi);U(()=>{R.current=b},[b],Ti),U(()=>{const e=j.current;if(!e)return;const t=I(e,{rootMargin:"160px"});return P.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),P.current=null}},[I],Ei);const q=V(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&g(e=>e!==t?t:e)},[],Li),X=V((e=!1)=>{if($.current||"undefined"==typeof window)return;if(B.current)return;if(!v)return;if(R.current)return void(D.current=!0);const t=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-T.current;if(!e&&o<t)return D.current=!0,void(null==E.current&&(E.current=window.setTimeout(()=>{E.current=null,D.current&&(D.current=!1,X(!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],Di),J=V(async()=>{if(M.current)return M.current;const e=await async function(){if(Zr)return Zr;const e=Yr;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Xr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Zr=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),Zr):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?M.current=t:"function"==typeof e.compile&&(M.current=e),M.current}return e?.D2&&"function"==typeof e.D2?(M.current=new e.D2,M.current):("function"==typeof e.compile&&(M.current=e),M.current)},[],ji),ee=V(async()=>{if("undefined"==typeof window||B.current)return;if(!v)return;if(n.loading&&!n.progressiveRender)return;if(!O)return p(""),void f(null);const e=++N.current;w(!0),f(null);try{const t=await J();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(O);if(e!==N.current)return;const r=o?.diagram??o,i=o?.renderOptions??o?.options??{},l=n.themeId??i.themeID,a=n.darkThemeId??i.darkThemeID,s={...i};if(s.themeID=n.isDark&&null!=a?a:l,s.darkThemeID=null,s.darkThemeOverrides=null,n.isDark){const e=i.themeOverrides&&"object"==typeof i.themeOverrides?i.themeOverrides:null;s.themeOverrides={...Ui,...e||{}}}s.salt=s.salt??function(e="markstream-octane-d2"){return`${e}-${Ur+=1}`}();const d=await t.render(r,s);if(e!==N.current)return;const m=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(d);if(!m)throw new Error("D2 render returned empty output.");const h=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Xi.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Yi(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(m);p(h||""),n.loading&&c(!1),f(null)}catch(t){if(e!==N.current)return;const o=t?.message?String(t.message):"D2 render failed.";n.loading||f(o),o.includes("@terrastruct/d2")&&(u(!1),c(!0))}finally{e===N.current&&(w(!1),D.current&&(D.current=!1,X()))}},[O,J,n.darkThemeId,n.isDark,n.loading,n.progressiveRender,n.themeId,X,v],Pi);U(()=>{F.current=ee},[ee],_i);const te=V(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(O),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[O],Ai),ne=V(()=>{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],Ri),oe=V((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&Ot(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Fi),re=V(()=>{Ht()},[],Ii);return U(()=>{X()},[O,n.loading,n.isDark,X],Oi),U(()=>{n.loading||X(!0)},[n.loading,X],Hi),U(()=>{const e=requestAnimationFrame(()=>q());return()=>cancelAnimationFrame(e)},[H,h,O,q],Wi),U(()=>{B.current=!1,X();const e=requestAnimationFrame(()=>q());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{q()});A.current=e,_.current&&e.observe(_.current)}return()=>{B.current=!0,null!=E.current&&(clearTimeout(E.current),E.current=null),A.current?.disconnect(),A.current=null,cancelAnimationFrame(e)}},[X,q],zi),x(Vi,{h0:j,h1:qr("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:qr("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:qr("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:qr("mode-btn px-2 py-1 text-xs rounded",s&&"is-active"),onClick:()=>c(!0),onMouseEnter:e=>oe(e,o("common.source")||"Source"),onFocus:e=>oe(e,o("common.source")||"Source"),onMouseLeave:re,onBlur:re},()=>o("common.source")||"Source"))]))),n.showCopyButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":r?o("common.copied")||"Copied":o("common.copy")||"Copy",onClick:te,onMouseEnter:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onFocus:e=>oe(e,r?o("common.copied")||"Copied":o("common.copy")||"Copy"),onMouseLeave:re,onBlur:re},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},r?x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"}):x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),x("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}))))),n.showExportButton&&h&&C(()=>x("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":o("common.export")||"Export",onClick:ne,onMouseEnter:e=>oe(e,o("common.export")||"Export"),onFocus:e=>oe(e,o("common.export")||"Export"),onMouseLeave:re,onBlur:re},x("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})))),n.showCollapseButton&&C(()=>S("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":l,onClick:()=>a(e=>!e),onMouseEnter:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onFocus:e=>oe(e,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re},()=>C(()=>x("svg",{style:{transform:`rotate(${l?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})))))]))]))),h3:!l&&C(()=>S("div",{ref:_,className:"d2-block-body",style:K},()=>n.loading&&!W?S("div",{className:"d2-source px-4 py-4"},()=>L([S("pre",{className:"d2-code"},()=>S("code",{},()=>O)),m&&S("p",{className:"d2-error mt-2 text-xs"},()=>m)])):S(t,{},()=>L([H?S("div",{className:"d2-source px-4 py-4"},()=>L([S("pre",{className:"d2-code"},()=>S("code",{},()=>O)),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:h}})),m&&S("p",{className:"d2-error px-4 pb-3 text-xs"},()=>m)])))]))))})}Gi.$$singleRoot=!0;var Ji=/* @__PURE__ */z('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),Qi=/* @__PURE__ */z('<dl class="definition-list"><!></dl>'),el=(e,t)=>`${String(indexKey??"definition")}-${t}`;function tl(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(Ji),r=g(o);e=r,n=H(r,1),s=f(t,o,e,null,void 0,n,null,void 0)}{const n=r&&l?Fe(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):O(e,n),s.c=n}}{const n=r&&l?Fe(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):O(e,n),s.f=n}}}var nl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(Qi);e=i,n=i,r=g(i),o=u(t,i,void 0,e,n,r)}{const t=e.h0;o.a!==t&&(_(o.b,"data-index-key",t),o.a=t)}T(t,1,o.c,e.h1,e.h2,e.h3,el,tl,18,[e.h4,e.h5,e.h6],o.d,1)});function ol(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(nl,{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?Fe(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?Fe(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}ol.$$singleRoot=!0;var rl=/* @__PURE__ */z('<span class="emoji-node"></span>'),il=/* @__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):O(e,n),o.c=n}}});function ll(e){const{node:t}=e;return x(il,{h0:t.name??t.markup})}ll.$$singleRoot=!0;var al=/* @__PURE__ */z('<em class="emphasis-node"></em>'),sl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(al);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):O(e,n),o.c=n}}});function cl(e){return x(sl,{h0:e.children})}cl.$$singleRoot=!0;var dl=".markdown-renderer";function ul(e,t){if("undefined"==typeof document||"undefined"==typeof Element)return null;const n=function(e){return`[id="${e.replace(/["\\]/g,"\\$&")}"]`}(t);let o=e instanceof Element?e.closest(dl):null;for(;o;){const e=o.querySelector(n);if(e)return e;o=o.parentElement?.closest(dl)??null}return document.querySelector(n)}N(["click"]);var ml=/* @__PURE__ */z('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),fl=/* @__PURE__ */Symbol(/* @__PURE__ */$(1)),hl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=w(ml);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&&(_(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(_(o.d,"title",t),o.c=t)}});function pl(e){const{node:t}=e,n=V(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=ul(e.currentTarget,`fnref-${String(t.id??"")}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],fl);return x(hl,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}pl.$$singleRoot=!0;var yl=/* @__PURE__ */z('<div class="footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2"><div class="flex-1"></div></div>'),gl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(yl);e=r,n=g(r),o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(_(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):O(e,n),o.e=n}}});function bl(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return x(gl,{h0:`fnref--${t.id}`,h1:n&&o?Re(t.children,n,String(r??`footnote-${t.id}`),o):null})}bl.$$singleRoot=!0,N(["click"]);var wl=/* @__PURE__ */z('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),vl=/* @__PURE__ */$(3),xl=/* @__PURE__ */Symbol(vl),kl=/* @__PURE__ */Symbol(vl+1),Sl=/* @__PURE__ */Symbol(vl+2),Cl=["s","h","g"],Nl=/* @__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(wl);n=f,r=f,f.$$click=e.h1;const h=g(f);i=W(e.h2),l=e.h3,s="footnote-link cursor-pointer",c=h,d=F(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)}),E(h),u=h,m=H(g(h),1),o=a(t,f,void 0,n,r,i,l,s,c,d,u,m,null,void 0),t.refFields=Cl}else{o.c.$$click=e.h1,o.d=W(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=F(o.g,[[!0,o.d],[!1,"title",o.e],[!1,"className",o.f]],o.h,t,!0)}{const t=e.h0;o.a!==t&&(_(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=K(t,1,o.i,n,o.j,!0):O(e,n)}}});function Ml(e){const{node:t}=e,n=Z(()=>`#fnref--${t.id}`,[t.id],xl),o=Z(()=>({href:n}),[n],kl),r=V(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=ul(e.currentTarget,`fnref--${t.id}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],Sl);return x(Nl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}Ml.$$singleRoot=!0;var $l=/* @__PURE__ */z('<br class="hard-break"/>'),Bl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w($l)))});function Tl(e){return x(Bl,{})}function El(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:qr("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?Re(t.children,n,String(r??`heading-${l}`),o):null))}Tl.$$singleRoot=!0;var Ll=/* @__PURE__ */z('<mark class="highlight-node"></mark>'),Dl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Ll);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):O(e,n),o.c=n}}});function jl(e){return x(Dl,{h0:e.children})}function Pl(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function _l(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=Pl(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}jl.$$singleRoot=!0;var Al=Te,Rl=ve;function Fl(e,t){return he(e,t)}function Il(e,t){return fe(e,t)}function Ol(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 Hl(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Wl(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function zl(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(zl).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return zl(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}>${zl(n.props.children)}</${n.type}>`}function Kl(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Vl(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 ql(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?de(t):t}function Ul(t,n,o,r,i,l,a,s=Vl(i)){const c=be(t),d=l??function(e){return e.map(zl).join("")}(o),u={type:c,tag:c,attrs:Kl(n),content:d,raw:a??`${Ol(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Wl(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Xl=/* @__PURE__ */z("<div></div>"),Zl=/* @__PURE__ */$(22),Yl=/* @__PURE__ */Symbol(Zl),Gl=/* @__PURE__ */Symbol(Zl+1),Jl=/* @__PURE__ */Symbol(Zl+2),Ql=/* @__PURE__ */Symbol(Zl+3),ea=/* @__PURE__ */Symbol(Zl+4),ta=/* @__PURE__ */Symbol(Zl+5),na=/* @__PURE__ */Symbol(Zl+6),oa=/* @__PURE__ */Symbol(Zl+7),ra=/* @__PURE__ */Symbol(Zl+8),ia=/* @__PURE__ */Symbol(Zl+9),la=/* @__PURE__ */Symbol(Zl+10),aa=/* @__PURE__ */Symbol(Zl+11),sa=/* @__PURE__ */Symbol(Zl+12),ca=/* @__PURE__ */Symbol(Zl+13),da=/* @__PURE__ */Symbol(Zl+14),ua=/* @__PURE__ */Symbol(Zl+15),ma=/* @__PURE__ */Symbol(Zl+16),fa=/* @__PURE__ */Symbol(Zl+17),ha=/* @__PURE__ */Symbol(Zl+18),pa=/* @__PURE__ */Symbol(Zl+19),ya=/* @__PURE__ */Symbol(Zl+20),ga=/* @__PURE__ */Symbol(Zl+21),ba=["s","e","d"],wa=/* @__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(Xl);n=e.h0,r="html-block-node",i=W(e.h1),l=c,a=F(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=ba}else{{const t=e.h0;o.a!==t&&(o.a=t)}{const e="html-block-node";o.b!==e&&(o.b=e)}o.c=W(e.h1),o.e=F(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 va(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=Q(Yl,it,Yl),[s,c]=G(null,Gl),d=Y(null,Jl),[u,m]=G(()=>"undefined"==typeof window,Ql),[f,h]=G(o.content,ea),p=Boolean(o.loading),y=J(dt,ut,ut,ta),g=Z(()=>({...n.customComponents??n.ctx?.customComponents??ft(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,y],na),b=Z(()=>({...g,...n.ctx?.streamingComponents??{}}),[g,n.ctx?.streamingComponents],oa);U(()=>{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],ra),U(()=>()=>{d.current?.destroy(),d.current=null},[],ia),U(()=>{p&&!u||h(o.content)},[p,o.content,u],la);const w=Z(()=>{const e=Ae(ke(o.attrs??void 0,l));return e?_l(e):void 0},[l,o.attrs],aa),v=Z(()=>String(o.tag??"").trim(),[o.tag],sa),k=Z(()=>be(v),[v],ca),N=Z(()=>{const e=Ae(ke(o.attrs??void 0,l,v));return e?_l(e):void 0},[l,o.attrs,v],da),M=Z(()=>de(Be(ke(o.attrs??void 0,l,k))),[l,o.attrs,k],ua),$=Z(()=>Array.isArray(o.children)?o.children:[],[o.children],ma),B=$.length>0&&!!v&&!ce.has(v.toLowerCase())&&!pe(v,l)&&!!n.ctx&&!!n.renderNode,T=Z(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(N),[N],fa),E=Z(()=>"escape"!==l&&Il(o.content??"",b),[b,l,o.content],ha),D=Z(()=>E&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=Al(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=Ol(i,d,!0),m=Fl(i,n),f=Boolean(Wl(i,r));if(se.has(i.toLowerCase())||!m&&!f&&ye(i,o))continue;if(!m&&!f&&pe(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=Rl(d,o,i),p=h.key,y=null!=p&&""!==p?p:`${a}-${l++}`,g=m?n[i]||n[i.toLowerCase()]:void 0,b=s.length>0?s[s.length-1].children:c;if(f)b.push(Ul(i,d,[],y,r,"",u,{loading:!1,autoClosed:!1}));else if(g){const t=ql(i,h,r);b.push(e.createElement(g,{...t,key:y}))}else b.push(e.createElement(i,{..._l(h),key:y,suppressHydrationWarning:!0}));s.length>0&&s[s.length-1].sourceParts.push(u);continue}if("tag_open"===t.type){const e=s.length>0&&s[s.length-1].hardBlocked,l=Fl(i,n),a=Boolean(Wl(i,r));s.push({tagName:i,children:[],attrs:t.attrs,sourceParts:[],customComponent:l||a,hardBlocked:e||se.has(i.toLowerCase())||!l&&!a&&ye(i,o),softBlocked:!e&&!l&&!a&&pe(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=`${Ol(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[Ol(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=Rl(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(Wl(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Vl(r);m=Ul(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{...ql(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{..._l(s),key:f,suppressHydrationWarning:!0},...t.children)}s.length>0?Hl(s[s.length-1].children,m):Hl(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=`${Ol(t.tagName,t.attrs)}${i}`;if(t.softBlocked){Hl(c,[Ol(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=Rl(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(Wl(t.tagName,r))?Ul(t.tagName,t.attrs||{},t.children,f,r,i,d,Vl(r)):h?e.createElement(h,{...ql(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{..._l(u),key:f,suppressHydrationWarning:!0},...t.children),c.push(p),s.length>0&&s[s.length-1].sourceParts.push(d)}return c}catch{return null}}(o.content,g,l,{ctx:n.ctx,keyPrefix:String(n.indexKey??"html-block"),nodeComponents:n.ctx?.streamingComponents,propComponents:n.ctx?.htmlComponents,renderNode:n.renderNode,sourceNode:o}):null,[g,l,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode,E],pa),j=Z(()=>xe(f??"",l),[l,f],ya),P=Z(()=>B&&n.ctx&&n.renderNode?Re($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],ga),_=k?n.ctx?.htmlComponents?.[k]:void 0,A=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(_,M,P)??null:B?e.createElement(v,{...T,ref:c},u?P:A)??null:x(wa,{h0:c,h1:w,h2:u?E&&D?S(t,{},()=>L([D])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:j}})):A})}var xa=/* @__PURE__ */z('<span class="html-inline-node"></span>'),ka=/* @__PURE__ */$(13),Sa=/* @__PURE__ */Symbol(ka),Ca=/* @__PURE__ */Symbol(ka+1),Na=/* @__PURE__ */Symbol(ka+2),Ma=/* @__PURE__ */Symbol(ka+3),$a=/* @__PURE__ */Symbol(ka+4),Ba=/* @__PURE__ */Symbol(ka+5),Ta=/* @__PURE__ */Symbol(ka+6),Ea=/* @__PURE__ */Symbol(ka+7),La=/* @__PURE__ */Symbol(ka+8),Da=/* @__PURE__ */Symbol(ka+9),ja=/* @__PURE__ */Symbol(ka+10),Pa=/* @__PURE__ */Symbol(ka+11),_a=/* @__PURE__ */Symbol(ka+12),Aa=["r","a","b"],Ra=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(xa);{const l=e.h0;n=l,i=a,D(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=Aa}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(t,()=>o(n,r.b)),r.a=n}}{const t=e.h1;r.c!==t&&(I(r.d,t,r.c),r.c=t)}}),Fa=(()=>{try{return Boolean(!1)}catch{}return!1})();function Ia(e){Fa&&console.warn(e)}function Oa(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 Ha(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Wa(e,t){for(const n of Al(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if(Fl(e,t)&&"block"===yt(t[e]||t[e.toLowerCase()]))return!0}return!1}function za(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Ka(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(Ka).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Ka(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}>${Ka(n.props.children)}</${n.type}>`}function Va(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function qa(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 Ua(t,n,o,r,i,l,a,s,c,d){const u=Fl(t,r),m=Boolean(za(t,a));if(se.has(t.toLowerCase())||!u&&!m&&ye(t,l))return null;if(!u&&!m&&pe(t,l))return[Oa(t,n),...o,`</${t}>`];const f=Rl(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=qa(i)){const c=be(t),d=l??function(e){return e.map(Ka).join("")}(o),u={type:c,tag:c,attrs:Va(n),content:d,raw:a??`${Oa(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=za(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=de(f);return e.createElement(n,{...i,key:p},...o)}return e.createElement(t,{..._l(f),key:p},...o)}function Xa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Y(null,Sa),[a,s]=G(!1,Ca);U(()=>{s(!0)},[],Na);const c=e.useMemo(()=>({...n.ctx?.customComponents??ft(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],Ma),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],$a),u=e.useMemo(()=>xe(o.content??"",i),[i,o.content],Ba),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],Ta),f=e.useMemo(()=>be(m),[m],Ea),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],La),p=e.useMemo(()=>de(Be(ke(o.attrs??void 0,i,f))),[i,o.attrs,f],Da),y=f?n.ctx?.htmlComponents?.[f]:void 0,g=h.length>0&&!!m&&"escape"!==i&&!pe(m,i)&&!!n.ctx&&!!n.renderNode&&!!y,b=e.useMemo(()=>g&&n.ctx&&n.renderNode?Re(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[g,n.ctx,n.indexKey,n.renderNode,h],ja),w=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Il(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=Oa(s.tagName,e,!0),d=Fl(s.tagName,t),u=Boolean(za(s.tagName,o));if(se.has(s.tagName.toLowerCase())||!d&&!u&&ye(s.tagName,n))continue;if(!d&&!u&&pe(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=Ua(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});Ha(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=Fl(s.tagName,t),i=Boolean(za(s.tagName,o));l.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:r||i,hardBlocked:e||se.has(s.tagName.toLowerCase())||!r&&!i&&ye(s.tagName,n),softBlocked:!e&&!r&&!i&&pe(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=`${Oa(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Oa(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:qa(o);m=Ua(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?Ha(l[l.length-1].children,m):Ha(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Ia(`Auto-closing unclosed tag: <${s.tagName}>`)}else Ia(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${Oa(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[Oa(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ua(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,qa(o)),Ha(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Ia(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(Al(e),t,n,o)}catch(i){return r=i,Fa&&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:Wa(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],Pa);return U(()=>{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],_a),!o.loading||o.autoClosed||g||"dynamic"===w.mode?g?e.createElement(y,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(Ra,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var Za=/* @__PURE__ */$(5),Ya=/* @__PURE__ */Symbol(Za),Ga=/* @__PURE__ */Symbol(Za+1),Ja=/* @__PURE__ */Symbol(Za+2),Qa=/* @__PURE__ */Symbol(Za+3),es=/* @__PURE__ */Symbol(Za+4),ts={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function ns(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function os(e){const t={...ts,...e},n=Se(t.node.src),o=Se(t.fallbackSrc),r=ns(n,o,t.node.loading),[i,l]=G(!1,Ya),[a,s]=G(!1,Ga),[c,d]=G(r.src,Ja),[u,m]=G(r.stage,Qa),f=c;U(()=>{const e=ns(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],es);const h=()=>{if("primary"===u&&o&&o!==c)return d(o),m("fallback"),l(!1),void s(!1);m("failed"),s(!0),t.onError?.(c)},p=()=>{l(!0),s(!1),t.onLoad?.(f)},y=e=>{e.preventDefault(),i&&!a&&t.onClick?.([e,f])};return!t.node.loading&&"failed"!==u&&f?C(()=>x("img",{key:"image",src:f,alt:String(t.node.alt??t.node.title??""),title:String(t.node.title??t.node.alt??""),className:"image-node__img"+(i?" is-loaded":""),loading:t.lazy?"lazy":"eager",decoding:"async",tabIndex:i?0:-1,"aria-label":t.node.alt??"Preview image",onError:h,onLoad:p,onClick:y})):t.node.loading&&!a?S("span",{key:"placeholder",className:"image-node__placeholder"},()=>t.usePlaceholder?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 rs(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function is(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 ls(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var as=null,ss=null,cs=/* @__PURE__ */$(42),ds=/* @__PURE__ */Symbol(cs),us=/* @__PURE__ */Symbol(cs+1),ms=/* @__PURE__ */Symbol(cs+2),fs=/* @__PURE__ */Symbol(cs+3),hs=/* @__PURE__ */Symbol(cs+4),ps=/* @__PURE__ */Symbol(cs+5),ys=/* @__PURE__ */Symbol(cs+6),gs=/* @__PURE__ */Symbol(cs+7),bs=/* @__PURE__ */Symbol(cs+8),ws=/* @__PURE__ */Symbol(cs+9),vs=/* @__PURE__ */Symbol(cs+10),xs=/* @__PURE__ */Symbol(cs+11),ks=/* @__PURE__ */Symbol(cs+12),Ss=/* @__PURE__ */Symbol(cs+13),Cs=/* @__PURE__ */Symbol(cs+14),Ns=/* @__PURE__ */Symbol(cs+15),Ms=/* @__PURE__ */Symbol(cs+16),$s=/* @__PURE__ */Symbol(cs+17),Bs=/* @__PURE__ */Symbol(cs+18),Ts=/* @__PURE__ */Symbol(cs+19),Es=/* @__PURE__ */Symbol(cs+20),Ls=/* @__PURE__ */Symbol(cs+21),Ds=/* @__PURE__ */Symbol(cs+22),js=/* @__PURE__ */Symbol(cs+23),Ps=/* @__PURE__ */Symbol(cs+24),_s=/* @__PURE__ */Symbol(cs+25),As=/* @__PURE__ */Symbol(cs+26),Rs=/* @__PURE__ */Symbol(cs+27),Fs=/* @__PURE__ */Symbol(cs+28),Is=/* @__PURE__ */Symbol(cs+29),Os=/* @__PURE__ */Symbol(cs+30),Hs=/* @__PURE__ */Symbol(cs+31),Ws=/* @__PURE__ */Symbol(cs+32),zs=/* @__PURE__ */Symbol(cs+33),Ks=/* @__PURE__ */Symbol(cs+34),Vs=/* @__PURE__ */Symbol(cs+35),qs=/* @__PURE__ */Symbol(cs+36),Us=/* @__PURE__ */Symbol(cs+37),Xs=/* @__PURE__ */Symbol(cs+38),Zs=/* @__PURE__ */Symbol(cs+39),Ys=/* @__PURE__ */Symbol(cs+40),Gs=/* @__PURE__ */Symbol(cs+41),Js=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"}))),Qs={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function ec(e){const n={...Qs,...e},{t:o}=Q(ds,Lt,ds),[r,i]=G(!1,us),[l,a]=G(!1,ms),[s,c]=G(!1,fs),[d,u]=G(!1,hs),[m,f]=G(()=>"undefined"==typeof window,ps),h=n.node.code,p=Z(()=>n.maxHeight&&"none"!==n.maxHeight?rs(n.maxHeight):null,[n.maxHeight],ys),y=Z(()=>ls(rs(n.estimatedPreviewHeightPx)??is(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],gs),[g,b]=G(`${y}px`,bs),[w,v]=G(!1,ws),[N,M]=G(!1,vs),[$,B]=G(1,xs),[T,E]=G({x:0,y:0},ks),[D,j]=G(!1,Ss),P=Y(null,Cs),_=Y(null,Ns),A=Y(null,Ms),R=Y(null,$s),F=Y(null,Bs),I=Y(null,Ts),O=Y(null,Es),H=Y(T,Ls);H.current=T;const W=Y($,Ds);W.current=$;const z=Y(d,js);z.current=d;const K=Y(w,Ps);K.current=w;const q=Y(0,_s),X=Q(As,it,As),J=V(e=>{if(!n.maxHeight||"none"===n.maxHeight)return`${Math.max(e,y)}px`;const t=Number.parseFloat(String(n.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),y)}px`:`${Math.max(e,y)}px`},[y,n.maxHeight],Rs),ee=V(()=>{const e=P.current;if(!e)return;const t=e.scrollHeight;t>0&&b(J(t))},[J],Fs);U(()=>{s||l||b(e=>{const t=rs(e);return null!=t&&t>=y?e:`${y}px`})},[y,l,s],Is);const te=V(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],Os),oe=V(async()=>{if(!m)return;if(!P.current)return;const e=P.current,t=h,o=!1===n.loading,r=++q.current;let i=null,l=null;try{const n=await async function(){return ss||as||(as=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),ss=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),as)}();if(r!==q.current||e!==P.current)return;if(!n)throw new Error("Infographic library failed to load.");l=Array.from(e.childNodes),i=new n({container:e,width:"100%",height:"100%"});let o="",a=!1;if(i.on?.("error",e=>{o=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?e.message??"":e??"")).filter(Boolean).join("; ")}),i.on?.("rendered",()=>{a=!0}),i.render(t),o)throw new Error(o);const s=Array.from(e.childNodes),c=s.length>0&&(s.length!==l.length||s.some((e,t)=>e!==l?.[t]));if(!a&&!c)throw new Error("Infographic render returned empty output.");O.current?.destroy?.(),O.current=i,i=null,v(!0),M(!1),setTimeout(()=>{ee()},0)}catch(a){if(r!==q.current||e!==P.current)return;i?.destroy?.(),i=null,o&&!1===n.loading&&t===h?(console.error("Failed to render infographic:",a),O.current?.destroy?.(),O.current=null,v(!1),M(!0),e.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${a instanceof Error?a.message:"Unknown error"}</div>`):l&&e.replaceChildren(...l)}finally{i?.destroy?.()}},[h,n.loading,ee,m],Hs);U(()=>{const e=_.current;if(!e)return;const t=X(e,{rootMargin:"160px"});return A.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),A.current=null}},[X],Ws),U(()=>{!m||s||l||oe()},[h,l,oe,s,m],zs),U(()=>()=>{q.current+=1,O.current&&(O.current.destroy?.(),O.current=null)},[],Ks);const re=V(()=>{u(!1),R.current&&(R.current.innerHTML=""),F.current=null,document.body.style.overflow=""},[],Vs),ie=V(()=>{u(!0),document.body.style.overflow="hidden"},[],qs);U(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&re()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,re],Us),U(()=>{d&&setTimeout(()=>{if(P.current&&R.current){R.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=P.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),R.current.appendChild(e),F.current=e,e.style.transform=`translate(${T.x}px, ${T.y}px) scale(${$})`}},0)},[d],Xs),U(()=>{d&&F.current&&(F.current.style.transform=`translate(${T.x}px, ${T.y}px) scale(${$})`)},[d,T,$],Zs);const le=V(()=>{const e=P.current?.querySelector("svg");if(!e)return;const t=(new XMLSerializer).serializeToString(e),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=`infographic-${Date.now()}.svg`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)},[],Ys);I.current||(I.current=ne({getTranslate:()=>H.current,setTranslate:e=>E(e),canStart:e=>!!K.current&&("touch"!==e.pointerType||z.current||W.current>1),onActiveChange:e=>j(e)}));const ae=I.current;U(()=>()=>ae.stop(),[ae],Gs);const se=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",ce=s||l,de=d||$>1;return S(t,{},()=>L([C(()=>S("div",{ref:_,"data-markstream-infographic":"1","data-markstream-mode":s?"source":N?"error":w?"preview":"pending",className:qr("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:qr("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([Js,C(()=>x("span",{className:qr("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:qr("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>L([C(()=>S("button",{className:qr("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=>Ot(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},()=>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:qr("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=>Ot(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},()=>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:se,onClick:()=>a(!l),onMouseEnter:e=>Ot(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},()=>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:se,onClick:te,onMouseEnter:e=>Ot(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},()=>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:qr(se,ce&&"opacity-50 cursor-not-allowed"),disabled:ce,onClick:le,onMouseEnter:e=>Ot(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},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:qr(se,ce&&"opacity-50 cursor-not-allowed"),disabled:ce,onClick:ie,onMouseEnter:e=>Ot(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>Ht()},()=>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:qr("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:qr("text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)))):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:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"\n +\n ")),C(()=>x("button",{className:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"\n -\n ")),C(()=>S("button",{className:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),E({x:0,y:0})}},()=>L([Math.round(100*$),"\n %\n "])))]))),C(()=>S("div",{className:qr("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",n.isDark?"bg-gray-900":"bg-gray-50",{"infographic-pan-touch":de}),style:{height:g,maxHeight:n.maxHeight??void 0},onPointerDown:e=>ae.start(e)},()=>L([!w&&!N&&C(()=>S("pre",{className:qr("absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap",n.isDark?"text-gray-300":"text-gray-700")},()=>h)),C(()=>S("div",{className:qr("absolute inset-0 cursor-grab",D&&"cursor-grabbing"),style:{transform:`translate(${T.x}px, ${T.y}px) scale(${$})`}},()=>C(()=>x("div",{ref:P,className:"w-full text-center flex items-center justify-center min-h-full"}))))])))])))]))),d&&"undefined"!=typeof document&&k(C(()=>S("div",{className:"markstream-octane fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:re,role:"dialog","aria-modal":"true"},()=>C(()=>S("div",{className:qr("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:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.min($+.1,3))},"+")),C(()=>x("button",{className:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>B(Math.max($-.1,.5))},"-")),C(()=>S("button",{className:qr("p-2 text-xs rounded transition-colors",n.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{B(1),E({x:0,y:0})}},()=>L([Math.round(100*$),"\n %\n "]))),C(()=>x("button",{className:qr("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:re},"X"))])),C(()=>x("div",{ref:R,className:qr("w-full h-full flex items-center justify-center p-4 overflow-hidden",!D&&"cursor-grab",D&&"cursor-grabbing",{"infographic-pan-touch":de}),onPointerDown:e=>ae.start(e)}))]))))),document.body)]))}function tc(e,t,n,o,r=!0){const i=q(Ue),l=Y(le(e=>e()),oc).current,a=Y(null,rc),s=Y(e,ic).current,c=Y(null,lc);return X(()=>{if(r&&a.current)return c.current??=ie(a.current,s,i??l),c.current.resume(),()=>c.current?.dispose()},[r,i,l,s],ac),X(()=>{i||l.setFinal(!0===n),r?c.current?.update(e,t,o):c.current=null},[e,t,n,o,r,i,l],sc),{host:a,initial:s}}var nc=/* @__PURE__ */$(6),oc=/* @__PURE__ */Symbol(nc),rc=/* @__PURE__ */Symbol(nc+1),ic=/* @__PURE__ */Symbol(nc+2),lc=/* @__PURE__ */Symbol(nc+3),ac=/* @__PURE__ */Symbol(nc+4),sc=/* @__PURE__ */Symbol(nc+5),cc=/* @__PURE__ */z('<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>'),dc=/* @__PURE__ */$(3),uc=/* @__PURE__ */Symbol(dc),mc=/* @__PURE__ */Symbol(dc+1),fc=/* @__PURE__ */Symbol(dc+2),hc=["r","a","b"],pc=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(cc);{const l=e.h0;n=l,i=a,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=a,r=m(t,a,n,i,l,null,void 0),t.refFields=hc}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(t,()=>o(n,r.b)),r.a=n}}{const n=e.h1,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||r.e!==n){const e=r.d;null==e||o||null===n?r.d=b(t,1,r.c,n,e):O(e,n),r.e=n}}});function yc(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.code??""),a=Q(uc,Ye,uc)?.textStreamState??o?.textStreamState,s=null==r?"":String(r),{host:c,initial:d}=Q(mc,tc,l,i??o?.fade??!0,o?.final,s?a?.get(s):void 0,null==n,mc);return X(()=>{s&&a?.set(s,l)},[a,s,l],fc),x(pc,{h0:c,h1:n??S("span",{},()=>d)})}yc.$$singleRoot=!0;var gc=/* @__PURE__ */z('<ins class="insert-node"></ins>'),bc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(gc);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):O(e,n),o.c=n}}});function wc(e){return x(bc,{h0:e.children})}wc.$$singleRoot=!0;var vc=/* @__PURE__ */z("<span></span>"),xc=/* @__PURE__ */$(3),kc=/* @__PURE__ */Symbol(xc),Sc=/* @__PURE__ */Symbol(xc+1),Cc=/* @__PURE__ */Symbol(xc+2),Nc=["r","a","b"],Mc=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a;const s=w(vc);{const l=e.h0;n=l,i=s,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}l=s,a=s,r=h(t,s,n,i,void 0,l,a,null,void 0),t.refFields=Nc}else{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(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.g!==n){const e=r.f;null==e||o||null===n?r.f=b(t,1,r.e,n,e):O(e,n),r.g=n}}});function $c(e){const{node:t,children:n,ctx:o,indexKey:r,fade:i}=e,l=String(t.content??""),a=Q(kc,Ye,kc)?.textStreamState??o?.textStreamState,s=null==r?"":String(r),{host:c,initial:d}=Q(Sc,tc,l,i??o?.fade??!0,o?.final,s?a?.get(s):void 0,null==n,Sc);return X(()=>{s&&a?.set(s,l)},[a,s,l],Cc),x(Mc,{h0:c,h1:"text-node whitespace-pre-wrap break-words"+(t.center?" text-node-center":""),h2:n??S("span",{},()=>d)})}$c.$$singleRoot=!0,N(["mouseenter","mouseleave"]);var Bc=/* @__PURE__ */z('<a class="link-node"></a>',3),Tc=/* @__PURE__ */$(4),Ec=/* @__PURE__ */Symbol(Tc),Lc=/* @__PURE__ */Symbol(Tc+1),Dc=/* @__PURE__ */Symbol(Tc+2),jc=/* @__PURE__ */Symbol(Tc+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(Bc);n=m,r=m,i=m,l=m,a=m,s=m,c=m,m.$$mouseenter=e.h6,d=m,m.$$mouseleave=e.h7,u=m,o=y(t,m,{a:void 0,b:n,c:void 0,d:r,e:void 0,f:i,g:void 0,h:l,i:void 0,j:a,k:void 0,l:s,m:c,n:d,o:u,p:null,q:void 0})}else o.m.$$mouseenter=e.h6,o.n.$$mouseleave=e.h7;{const t=e.h0;o.a!==t&&(_(o.b,"href",t),o.a=t)}{const t=e.h1;o.c!==t&&(_(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&&(_(o.h,"target",t),o.g=t)}{const t=e.h4;o.i!==t&&(_(o.j,"rel",t),o.i=t)}{const t=e.h5;o.k!==t&&(I(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):O(e,n),o.q=n}}});function _c(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=!1!==e.showTooltip,l=e.isDark??n?.isDark,a=Z(()=>{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],Ec),s=Z(()=>ve({href:String(t.href??"")}).href,[t.href],Lc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=Ce(s),u=V(e=>{i&&Ot(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],Dc),m=V(()=>{i&&Ht()},[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"},()=>L([S("span",{className:"leading-[normal] link-text"},()=>C(()=>x($c,{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(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?Re(t.children,n,String(r??"link"),o):C(()=>x($c,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var Ac=/* @__PURE__ */z('<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(Ac);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(_(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):O(e,n),o.e=n}}});function Fc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(Rc,{h0:null==r?void 0:r,h1:l??(n&&o?Re(t.children,n,String(i??"list-item"),o):null)})}function Ic(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&&ft(n.customId).list_item||Fc;return S(i,{className:qr("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 Oc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}Fc.$$singleRoot=!0;var Hc=null,Wc=null,zc=!1,Kc=/* @__PURE__ */new Map,Vc=/* @__PURE__ */new Map,qc=5,Uc=/* @__PURE__ */new Set;function Xc(){if(Kc.size<qc&&Uc.size){const e=Array.from(Uc);Uc.clear();for(const t of e)try{t()}catch{}}}function Zc(e){Wc=null,(Hc=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=Kc.get(t);if(r)if(Kc.delete(t),clearTimeout(r.timeoutId),Xc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Vc.set(e,n),Vc.size>200){const e=Vc.keys().next();e.done||Vc.delete(e.value)}}r.resolve(n)}},Hc.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Kc.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Kc.clear(),Xc()}}function Yc(){Hc&&Hc.terminate?.(),Hc=null,Wc=null}function Gc(e){zc=!!e,Hc&&Hc.postMessage({type:"init",debug:zc})}var Jc="WORKER_BUSY";async function Qc(e,t=!0,n=2e3,o){performance.now();const r=Oc(e);if(Wc)return Promise.reject(Wc);const i=`${t?"d":"i"}:${r}`,l=Vc.get(i);if(l)return Promise.resolve(l);const a=Hc||((Wc=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Wc.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Wc);if(Kc.size>=qc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Jc,e.busy=!0,e.inFlight=Kc.size,e.max=qc,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(()=>{Kc.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Xc()},n),c=()=>{},d=()=>{Kc.delete(l),clearTimeout(s),Uc.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),Xc()};o&&o.addEventListener("abort",d,{once:!0}),Kc.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:zc})}catch(u){Kc.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),Xc()}})}function ed(e,t,n){const o=`${t?"d":"i"}:${Oc(e)}`;if(Vc.set(o,n),Vc.size>200){const e=Vc.keys().next();e.done||Vc.delete(e.value)}}function td(){Vc.clear()}function nd(e){qc=Math.max(1,Math.floor(e)),Xc()}function od(e=1500,t){return Kc.size<qc?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(){Uc.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}),Uc.add(l)})}var rd={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function id(e){null!=e.timeout&&(rd.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(rd.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(rd.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(rd.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ld(){return{...rd}}async function ad(e,t=!0,n={}){const o=n.timeout??rd.timeout,r=n.waitTimeout??rd.waitTimeout,i=n.backoffMs??rd.backoffMs,l=n.maxRetries??rd.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):rd.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 Qc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await od(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 sd=null,cd=!1;async function dd(){if(sd)return sd;if(cd)return null;try{return sd=await import("katex"),await import("katex/contrib/mhchem"),sd}catch{return cd=!0,null}}var ud=/* @__PURE__ */z('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),md=/* @__PURE__ */$(9),fd=/* @__PURE__ */Symbol(md),hd=/* @__PURE__ */Symbol(md+1),pd=/* @__PURE__ */Symbol(md+2),yd=/* @__PURE__ */Symbol(md+3),gd=/* @__PURE__ */Symbol(md+4),bd=/* @__PURE__ */Symbol(md+5),wd=/* @__PURE__ */Symbol(md+6),vd=/* @__PURE__ */Symbol(md+7),xd=/* @__PURE__ */Symbol(md+8),kd=["r","a","b","r","c","d"],Sd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=w(ud);{const l=e.h0;n=l,i=c,D(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,D(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&&D(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&&D(t,()=>o(n,r.d)),r.c=n}}}{const t=e.h2;r.e!==t&&(R(r.f,t),r.e=t)}});function Cd({node:e}){const t=Y(null,fd),n=Y(null,hd),o=Y(null,pd),r=Q(yd,it,yd),[i,l]=G(!0,gd),[a,s]=G(()=>"undefined"==typeof window,bd),c=Y(0,wd);return U(()=>{const e=t.current;if(!e)return;const n=r(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&s(!0),n.whenVisible.then(()=>s(!0)),()=>{n.destroy(),o.current=null}},[r],vd),U(()=>{const t=Oc(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 ad(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 dd();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),ed(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],xd),x(Sd,{h0:t,h1:n,h2:i?"math-rendering":void 0})}Cd.$$singleRoot=!0;var Nd=/* @__PURE__ */z('<span class="math-inline-wrapper"><span></span><!></span>'),Md=/* @__PURE__ */$(9),$d=/* @__PURE__ */Symbol(Md),Bd=/* @__PURE__ */Symbol(Md+1),Td=/* @__PURE__ */Symbol(Md+2),Ed=/* @__PURE__ */Symbol(Md+3),Ld=/* @__PURE__ */Symbol(Md+4),Dd=/* @__PURE__ */Symbol(Md+5),jd=/* @__PURE__ */Symbol(Md+6),Pd=/* @__PURE__ */Symbol(Md+7),_d=/* @__PURE__ */Symbol(Md+8),Ad=["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(Nd);{const l=e.h0;n=l,i=m,D(t,()=>o(l,r.b)),(t.cleanups??=[]).push(()=>j(r.a,r.b))}const f=g(m);{const n=e.h1;a=n,s=f,D(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}c=f,d=m,u=H(f,1),r=l(t,m,n,i,a,s,void 0,c,d,u,null,void 0),t.refFields=Ad}else{{const n=e.h0;if(n!==r.a){const e=r.a;null!=e&&j(e,r.b),null!=n&&D(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&&D(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=K(t,1,r.g,n,r.h,!0):O(e,n)}}});function Fd({node:e}){const t=Y(null,$d),n=Y(null,Bd),o=Y(null,Td),r=Q(Ed,it,Ed),[i,l]=G(!0,Ld),[a,s]=G(()=>"undefined"==typeof window,Dd),c=Y(0,jd);return U(()=>{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),U(()=>{const t=Oc(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 ad(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 dd();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),ed(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],_d),x(Rd,{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 Id(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Od(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 Hd(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Wd(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}Fd.$$singleRoot=!0;var zd=null,Kd=null,Vd=/* @__PURE__ */new Map,qd=5,Ud=!1;function Xd(e){Ud=!!e}function Zd(e){Number.isFinite(e)&&e>0&&(qd=Math.floor(e))}function Yd(){return{inFlight:Vd.size,max:qd}}var Gd="WORKER_BUSY";function Jd(e){Kd=null;const t=e;(zd=e).onmessage=e=>{if(zd!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Vd.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},zd.onerror=e=>{if(zd===t)if(0!==Vd.size){try{Ud?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Vd.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Vd.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},zd.onmessageerror=e=>{if(zd===t)if(0!==Vd.size){try{Ud?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Vd.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Vd.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Qd(){if(zd)try{for(const[e,t]of Vd.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Vd.clear(),zd.terminate?.()}catch{}zd=null,Kd=null}function eu(e,t,n=1400){if(Kd)return Promise.reject(Kd);const o=zd||((Kd=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",Kd.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Kd);if(Vd.size>=qd){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Gd,e.inFlight=Vd.size,e.max=qd,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),Vd.delete(l))};Vd.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Vd.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Vd.get(l)?.reject(e)},n)})}async function tu(e,t,n=1400){return eu("canParse",{code:e,theme:t},n)}async function nu(e,t,n=2400){return eu("findPrefix",{code:e,theme:t},n)}function ou(){zd?.terminate?.(),zd=null,Kd=null,Vd.clear()}var ru=null,iu=!1,lu=null,au=null;function su(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(lu!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),lu=n}catch{}}var cu=/* @__PURE__ */$(69),du=/* @__PURE__ */Symbol(cu),uu=/* @__PURE__ */Symbol(cu+1),mu=/* @__PURE__ */Symbol(cu+2),fu=/* @__PURE__ */Symbol(cu+3),hu=/* @__PURE__ */Symbol(cu+4),pu=/* @__PURE__ */Symbol(cu+5),yu=/* @__PURE__ */Symbol(cu+6),gu=/* @__PURE__ */Symbol(cu+7),bu=/* @__PURE__ */Symbol(cu+8),wu=/* @__PURE__ */Symbol(cu+9),vu=/* @__PURE__ */Symbol(cu+10),xu=/* @__PURE__ */Symbol(cu+11),ku=/* @__PURE__ */Symbol(cu+12),Su=/* @__PURE__ */Symbol(cu+13),Cu=/* @__PURE__ */Symbol(cu+14),Nu=/* @__PURE__ */Symbol(cu+15),Mu=/* @__PURE__ */Symbol(cu+16),$u=/* @__PURE__ */Symbol(cu+17),Bu=/* @__PURE__ */Symbol(cu+18),Tu=/* @__PURE__ */Symbol(cu+19),Eu=/* @__PURE__ */Symbol(cu+20),Lu=/* @__PURE__ */Symbol(cu+21),Du=/* @__PURE__ */Symbol(cu+22),ju=/* @__PURE__ */Symbol(cu+23),Pu=/* @__PURE__ */Symbol(cu+24),_u=/* @__PURE__ */Symbol(cu+25),Au=/* @__PURE__ */Symbol(cu+26),Ru=/* @__PURE__ */Symbol(cu+27),Fu=/* @__PURE__ */Symbol(cu+28),Iu=/* @__PURE__ */Symbol(cu+29),Ou=/* @__PURE__ */Symbol(cu+30),Hu=/* @__PURE__ */Symbol(cu+31),Wu=/* @__PURE__ */Symbol(cu+32),zu=/* @__PURE__ */Symbol(cu+33),Ku=/* @__PURE__ */Symbol(cu+34),Vu=/* @__PURE__ */Symbol(cu+35),qu=/* @__PURE__ */Symbol(cu+36),Uu=/* @__PURE__ */Symbol(cu+37),Xu=/* @__PURE__ */Symbol(cu+38),Zu=/* @__PURE__ */Symbol(cu+39),Yu=/* @__PURE__ */Symbol(cu+40),Gu=/* @__PURE__ */Symbol(cu+41),Ju=/* @__PURE__ */Symbol(cu+42),Qu=/* @__PURE__ */Symbol(cu+43),em=/* @__PURE__ */Symbol(cu+44),tm=/* @__PURE__ */Symbol(cu+45),nm=/* @__PURE__ */Symbol(cu+46),om=/* @__PURE__ */Symbol(cu+47),rm=/* @__PURE__ */Symbol(cu+48),im=/* @__PURE__ */Symbol(cu+49),lm=/* @__PURE__ */Symbol(cu+50),am=/* @__PURE__ */Symbol(cu+51),sm=/* @__PURE__ */Symbol(cu+52),cm=/* @__PURE__ */Symbol(cu+53),dm=/* @__PURE__ */Symbol(cu+54),um=/* @__PURE__ */Symbol(cu+55),mm=/* @__PURE__ */Symbol(cu+56),fm=/* @__PURE__ */Symbol(cu+57),hm=/* @__PURE__ */Symbol(cu+58),pm=/* @__PURE__ */Symbol(cu+59),ym=/* @__PURE__ */Symbol(cu+60),gm=/* @__PURE__ */Symbol(cu+61),bm=/* @__PURE__ */Symbol(cu+62),wm=/* @__PURE__ */Symbol(cu+63),vm=/* @__PURE__ */Symbol(cu+64),xm=/* @__PURE__ */Symbol(cu+65),km=/* @__PURE__ */Symbol(cu+66),Sm=/* @__PURE__ */Symbol(cu+67),Cm=/* @__PURE__ */Symbol(cu+68),Nm="undefined"!=typeof window?X:U,Mm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function $m(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Bm(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=$e(t);return n?($m(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||$m(e),o}function Tm(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var Em={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={...Em,...e},{t:o}=Q(du,Lt,du),r=Z(()=>nn("mermaid"),[],uu),i=n.node?.code??"",l=Z(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],mu),a=n.workerTimeoutMs??Em.workerTimeoutMs,s=n.parseTimeoutMs??Em.parseTimeoutMs,c=n.renderTimeoutMs??Em.renderTimeoutMs,d=n.fullRenderTimeoutMs??Em.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??Em.renderDebounceMs),m=Z(()=>n.maxHeight&&"none"!==n.maxHeight?Id(n.maxHeight):null,[n.maxHeight],fu),f=Z(()=>Hd(Id(n.estimatedPreviewHeightPx)??Od(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],hu),[h,p]=G(!1,pu),[y,g]=G(!1,yu),[b,w]=G(!1,gu),[v,N]=G(!1,bu),[M,$]=G(1,wu),[B,T]=G({x:0,y:0},vu),[E,D]=G(!1,xu),[j,P]=G(!1,ku),[_,A]=G(!1,Su),[R,F]=G(null,Cu),[I,O]=G(!1,Nu),[H,W]=G(`${f}px`,Mu),[z,K]=G("undefined"==typeof window,$u),q=Y(null,Bu),J=Y(null,Tu),ee=Y(null,Eu),te=Y(null,Lu),oe=Y(null,Du),re=Y(null,ju),ie=Y(null,Pu),le=Y(null,_u),ae=Y(0,Au),se=Y({},Ru),ce=Y(null,Fu),de=Y("",Iu),ue=Y(!1,Ou),me=Y(null,Hu),fe=Y(!1,Wu),he=Y({zoom:1,translateX:0,translateY:0,containerHeight:H||"360px"},zu),pe=Y(B,Ku);pe.current=B;const ye=Y(M,Vu);ye.current=M;const ge=Y(I,qu);ge.current=I;const be=Q(Uu,it,Uu),we=Boolean(n.node?.loading??n.loading),ve=n.isDark?"dark":"light",xe=Boolean(n.isStrict),ke=!0===n.enableMermaidInteractions,Se=Z(()=>xe?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Mm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[xe],Xu);U(()=>{fe.current=_},[_],Zu),U(()=>{y||b||W(e=>{const t=Id(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,y],Yu),U(()=>{se.current={}},[ve,l,xe],Gu),U(()=>{let e=!1;return(async()=>{const t=await async function(e){if(ru)return su(ru,e),ru;if(au){const t=await au;return t&&su(t,e),t}if(iu)return null;try{iu=!0,au=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(ru=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return su(ru,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),ru}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{au=null}})();const t=await au;return t&&su(t,e),t}catch{return null}}(Se);e||(q.current=t,p(Boolean(t)),ue.current||g(!t))})(),()=>{e=!0}},[Se],Ju),U(()=>{const e=J.current;if(!e)return;const t=be(e,{rootMargin:"400px"});return me.current=t,t.isVisible()&&K(!0),t.whenVisible.then(()=>K(!0)),()=>{t.destroy(),me.current=null}},[be],Qu),U(()=>{if("undefined"==typeof document)return;if(!I)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[I],em);const Ce=V(()=>m,[m],tm),Ne=V(e=>{const t=J.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=Ce(),u=null==d?c:Math.min(c,d);W(`${"none"===n.maxHeight?u:Math.max(u,f)}px`)},[f,n.maxHeight,Ce],nm);U(()=>{if(!J.current||"undefined"==typeof ResizeObserver)return;if(y||b)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Wd(()=>Ne(t))});return e.observe(J.current),()=>e.disconnect()},[b,y,Ne],om),U(()=>{y||b||Ne()},[b,n.maxHeight,y,Ne],rm),U(()=>()=>{ou()},[],im),X(()=>{const e=se.current[ve];!y&&te.current&&e?.svg&&(Bm(te.current,e.svg)&&(ce.current=e.bindFunctions??null,Tm(te.current,e.bindFunctions,ke)),Wd(()=>Ne()))},[ke,y,ve,Ne],lm);const Me=V(async(e,t,o)=>{if(!q.current||!te.current)return!1;P(!0);try{const n=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=Pm(e,t),i=await Fm(()=>q.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=Bm(te.current,i.svg);return!!l&&(ce.current=i.bindFunctions??null,Tm(te.current,i.bindFunctions,ke),Ne(),se.current[t]={svg:l,bindFunctions:i.bindFunctions},A(!0),F(null),!0)}catch(r){if(!we){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)}},[ke,d,we,Ne],am),$e=V(async(e,t,n)=>{if(q.current&&te.current){P(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,r=Pm(Rm(e)||e,t),i=await Fm(()=>q.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=Bm(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(ce.current=i.bindFunctions??null,Tm(te.current,i.bindFunctions,ke)),e&&Ne()}}catch{}finally{P(!1)}}},[ke,c,we,Ne],sm),Be=V(async(e,t)=>{if(!e.trim())return $m(te.current),A(!1),void(de.current="");const n=e.replace(/\s+/g,"");if(n===de.current&&fe.current)return;const o=++ae.current;if("gantt"===_m(e)){const i=Rm(e);if(!i.trim())return;try{if(await jm(i,ve,{workerTimeout:a,parseTimeout:s,mermaid:q.current,signal:t}),t?.aborted||ae.current!==o)return;i===e?await Me(e,ve,t)&&(de.current=n):await $e(i,ve,t)}catch(r){if("AbortError"===r?.name)return}return}try{if(await jm(e,ve,{workerTimeout:a,parseTimeout:s,mermaid:q.current,signal:t}),t?.aborted||ae.current!==o)return;return void(await Me(e,ve,t)&&(de.current=n))}catch(r){if("AbortError"===r?.name)return}try{const n=await async function(e,t,n){try{const o=await nu(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return Rm(e)}(e,ve,{workerTimeout:a,signal:t});if(!n||t?.aborted||ae.current!==o)return;await $e(n,ve,t)}catch{}},[s,Me,$e,ve,a],cm),Te=V(()=>z&&!y&&!b,[b,y,z],dm);U(()=>{if(!Te())return;if(!q.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Te()&&Be(l,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[l,Te,h,Be,u],um);const Ee=V((e,t)=>{e.clientX,e.clientY,Ot(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],mm),Le=V(async()=>{try{await(navigator.clipboard?.writeText(l)),N(!0),n.onCopy?.(l),setTimeout(()=>N(!1),1e3)}catch{}},[l,n],fm),De=V(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=Im(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??Im(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],hm),je=V(()=>{ie.current=null,$m(re.current)},[],pm),Pe=V(()=>{O(!1),je()},[je],ym),_e=V(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?Im(e):null};n.onOpenModal?.(t),t.defaultPrevented||O(!0)},[n],gm);U(()=>{if(!I)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Pe()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Pe,I],bm),Q(wm,Nm,()=>{if(!I)return;const e=re.current,t=J.current;if(!e||!t)return;const n=`translate(${B.x}px, ${B.y}px) scale(${M})`,o=t.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="100%",o.style.maxHeight="100%";const r=o.querySelector("[data-mermaid-wrapper]");r&&(ie.current=r,r.style.transform=n),$m(e),e.appendChild(o),Tm(e,ce.current??se.current[ve]?.bindFunctions,ke)},[ke,I,ve],wm),U(()=>{I&&ie.current&&(ie.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${M})`)},[I,B.x,B.y,M],vm);const Ae=y||j||b,Re=Z(()=>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],xm),Fe=V(e=>{const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(n.onToggleMode?.(e,t),!t.defaultPrevented)if(ue.current=!0,"preview"===e){g(!1);const e=he.current;$(e.zoom),T({x:e.translateX,y:e.translateY}),W(e.containerHeight)}else he.current={zoom:M,translateX:B.x,translateY:B.y,containerHeight:H},g(!0)},[l,H,Be,n,ve,B.x,B.y,Ne,M],km),Ie=V(e=>{if(!1===n.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=J.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=Dm(M+l,.5,3);if(a===M)return;const s=a/M;T({x:B.x-r*(s-1),y:B.y-i*(s-1)}),$(a)},[B,M],Sm);le.current||(le.current=ne({getTranslate:()=>pe.current,setTranslate:e=>T(e),canStart:e=>!!te.current?.querySelector("svg")&&("touch"!==e.pointerType||ge.current||ye.current>1),onActiveChange:e=>D(e)}));const Oe=le.current;U(()=>()=>Oe.stop(),[Oe],Cm);const He=I||M>1,We=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:qr("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=>Ee(e,o("common.zoomIn")),onMouseLeave:()=>Ht(),onClick:()=>$(Dm(M+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:qr("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=>Ee(e,o("common.zoomOut")),onMouseLeave:()=>Ht(),onClick:()=>$(Dm(M-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:qr("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=>Ee(e,o("common.resetZoom")),onMouseLeave:()=>Ht(),onClick:()=>{$(1),T({x:0,y:0})}},()=>L([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{ref:J,className:qr("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",n.isDark?"bg-gray-900":"bg-gray-50",{"mermaid-pan-touch":He}),style:{height:H,maxHeight:n.maxHeight??void 0},onWheel:Ie,onPointerDown:e=>Oe.start(e)},()=>L([C(()=>S("div",{ref:ee,"data-mermaid-wrapper":!0,className:qr("absolute inset-0 cursor-grab",{"cursor-grabbing":E}),style:{transform:`translate(${B.x}px, ${B.y}px) scale(${M})`}},()=>C(()=>x("div",{ref:te,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})))),(j||we)&&x("div",{className:"mermaid-loading"},x("span",{className:"mermaid-spinner"}),x("span",{},"Rendering diagram…"))])))])),ze=n.showHeader&&C(()=>S("div",{className:qr("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:qr("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:qr("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:qr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Fe("preview"),onMouseEnter:e=>Ee(e,o("common.preview")),onFocus:e=>Ee(e,o("common.preview")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},()=>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:qr("px-2.5 py-1 text-xs rounded transition-colors",y?n.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":n.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Fe("source"),onMouseEnter:e=>Ee(e,o("common.source")),onFocus:e=>Ee(e,o("common.source")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},()=>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:Re,"aria-pressed":b,onClick:()=>w(e=>!e),onMouseEnter:e=>Ee(e,o(b?"common.expand":"common.collapse")),onFocus:e=>Ee(e,o(b?"common.expand":"common.collapse")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},()=>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:Re,onClick:Le,onMouseEnter:e=>Ee(e,o(v?"common.copied":"common.copy")),onFocus:e=>Ee(e,o(v?"common.copied":"common.copy")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},()=>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&&h&&C(()=>x("button",{type:"button",className:qr(Re,Ae?"opacity-50 cursor-not-allowed":""),disabled:Ae,onClick:De,onMouseEnter:e=>Ee(e,o("common.export")),onFocus:e=>Ee(e,o("common.export")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"},x("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),x("path",{d:"m7 10l5 5l5-5"}))))),n.showFullscreenButton&&h&&C(()=>S("button",{type:"button",className:qr(Re,Ae?"opacity-50 cursor-not-allowed":""),disabled:Ae,onClick:I?Pe:_e,onMouseEnter:e=>Ee(e,o(I?"common.minimize":"common.open")),onFocus:e=>Ee(e,o(I?"common.minimize":"common.open")),onMouseLeave:()=>Ht(),onBlur:()=>Ht()},()=>x("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3"},x("path",I?{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"}:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"}))))]))]))),Ke=S("div",{},()=>L([y?C(()=>S("div",{className:qr("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))):We,R&&S("div",{className:"mermaid-error"},()=>R)]));return S(t,{},()=>L([C(()=>S("div",{"data-markstream-mermaid":"1","data-markstream-mode":y?"source":_?"preview":"pending",className:qr("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",n.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":we})},()=>L([ze,C(()=>S("div",{ref:oe,style:{display:b?"none":""}},()=>Ke))]))),I&&"undefined"!=typeof document&&k(S("div",{className:"markstream-octane mermaid-modal-overlay",onClick:()=>Pe()},()=>C(()=>S("div",{className:qr("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:Pe},()=>o("common.close")))])),S("div",{className:"mermaid-modal-body"},()=>C(()=>x("div",{ref:re,className:"mermaid-modal-content"})))])))),document.body)]))}function Dm(e,t,n){return Math.min(Math.max(e,t),n)}async function jm(e,t,n){try{if(await tu(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=Pm(e,t),r=n.mermaid;if("function"==typeof r.parse)return await Fm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Fm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function Pm(e,t){return te(e,`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n`)}function _m(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 Am(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 Rm(e){if("gantt"===_m(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(Am(e))break;t.pop()}else t.pop()}return t.some(Am)?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 Fm(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 Im(e){return(new XMLSerializer).serializeToString(e)}var Om=/* @__PURE__ */z('<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(Om),s=H(g(a),1);i=a,l=H(s,1);{const t=e.h0;n=B(s,t),r=t}o=f(t,a,n,r,i,l,null,void 0)}else{const t=e.h0;o.b!==t&&(O(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=K(t,1,o.c,n,o.d,!0):O(e,n)}}});function Wm(e){const{node:t}=e;return x(Hm,{h0:" ",h1:String(t?.type)})}function zm(e,t,n){const o=be(e.type),r=(n??[]).map(e=>be(e)).filter(Boolean),i="html_inline"===o||"html_block"===o;if(!i&&!r.includes(o))return null;const l=i?be(e.tag)||ue(e.content):be(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:yt(c)}}function Km(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function Vm(e,t,n,o){const r=e.filter(e=>!Km(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=>!Km(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return Re(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Km(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Km(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Km(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function qm(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??ft(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"},Vm(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;_e.has(e.type)||n&&function(e,t,n){return"block"===zm(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"},Vm(a,r,o,String(i??"paragraph")))}Wm.$$singleRoot=!0,N(["click","keydown","mouseenter","mouseleave"]);var Um=/* @__PURE__ */z('<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>'),Xm=/* @__PURE__ */Symbol(/* @__PURE__ */$(1)),Zm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Um);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):O(e,n),o.g=n}}});function Ym(e){const{node:t}=e,n=V(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],Xm);return x(Zm,{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})}Ym.$$singleRoot=!0;var Gm=/* @__PURE__ */z('<s class="strikethrough-node"></s>'),Jm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Gm);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):O(e,n),o.c=n}}});function Qm(e){return x(Jm,{h0:e.children})}Qm.$$singleRoot=!0;var ef=/* @__PURE__ */z('<strong class="strong-node"></strong>'),tf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(ef);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):O(e,n),o.c=n}}});function nf(e){return x(tf,{h0:e.children})}nf.$$singleRoot=!0;var of=/* @__PURE__ */z('<sub class="subscript-node"></sub>'),rf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(of);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):O(e,n),o.c=n}}});function lf(e){return x(rf,{h0:e.children})}lf.$$singleRoot=!0;var af=/* @__PURE__ */z('<sup class="superscript-node"></sup>'),sf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(af);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):O(e,n),o.c=n}}});function cf(e){return x(sf,{h0:e.children})}cf.$$singleRoot=!0;var df=/* @__PURE__ */z('<th dir="auto"><!><!></th>'),uf=/* @__PURE__ */z("<tr></tr>"),mf=/* @__PURE__ */z('<div class="table-node-wrapper"><table><!><thead class="border-[var(--table-border,#cbd5e1)]"><tr class="border-b"><!></tr></thead><tbody><!></tbody></table><!></div>'),ff=/* @__PURE__ */$(5),hf=/* @__PURE__ */Symbol(ff),pf=/* @__PURE__ */Symbol(ff+1),yf=/* @__PURE__ */Symbol(ff+2),gf=/* @__PURE__ */Symbol(ff+3),bf=/* @__PURE__ */Symbol(ff+4),wf=(e,t)=>`header-${t}`;function vf(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(df);e=a,n=a;const s=g(a);o=s,r=a,i=H(s,1),m=l(t,a,void 0,e,n,o,null,void 0,r,i,null,void 0)}{const t=qr("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?Fe(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=K(t,1,m.c,n,m.d,!0):O(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=K(t,2,m.g,e,m.h,!0):O(o,e)}}}var xf=(e,t)=>`row-${t}`;function kf(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(uf);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=qr("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:qr("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?Fe(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):O(e,n),d.e=n}}}var Sf=["r","c","d"],Cf=/* @__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(mf);n=v;const x=g(v);{const n=e.h1;i=n,l=x,D(t,()=>o(n,r.d)),(t.cleanups??=[]).push(()=>j(r.c,r.d))}a=x,s=x;const k=H(g(x),1),S=g(k);c=S,d=g(S);const C=H(k,1);u=C,m=g(C),f=x,h=g(x),p=v,b=H(x,1),r=y(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=Sf}else{const n=e.h1;if(n!==r.c){const e=r.c;null!=e&&j(e,r.d),null!=n&&D(t,()=>o(n,r.d)),r.c=n}}{const t=e.h0;r.a!==t&&(_(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)}T(t,1,r.i,e.h5,e.h6,e.h7,wf,vf,18,e.h8,r.j,1),T(t,2,r.k,e.h9,e.h10,e.h11,xf,kf,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=K(t,3,r.m,n,r.n,!0):O(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=K(t,4,r.q,n,r.r,!0):O(e,n)}}});function Nf(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,hf),d=e.useRef(null,pf),u=e.useRef(null,yf),[m,f]=e.useState([],gf),h=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",p=()=>{const e=u.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),u.current=null),d.current=null},y=(e,t)=>{if(0!==t.button)return;const n=(()=>{const e=c.current?.querySelectorAll("thead th");return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))})(),o=n[e],r=n[e+1];if(!o||!r)return;t.preventDefault(),p(),d.current={index:e,startX:t.clientX,startWidth:o,nextStartWidth:r,widths:n},f(n);const i=e=>{const t=d.current;if(!t)return;e.preventDefault();const n=t.startWidth+t.nextStartWidth,o=Math.min(48,Math.floor(n/2)),r=Math.max(o,Math.min(n-o,Math.round(t.startWidth+e.clientX-t.startX))),i=[...t.widths];i[t.index]=r,i[t.index+1]=n-r,f(i)},l=()=>{p()};u.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)};return e.useEffect(()=>(p(),f([]),p),[l.length],bf),x(Cf,{h0:i,h1:c,h2:qr("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:qr("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>L([o&&r?Fe(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>x("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>y(t,e)}))])),h8:[h,o,l,i,r,y],h9:s,h10:s.map,h11:(e,t)=>S("tr",{key:`row-${t}`,className:qr("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:qr("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?Fe(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&x("div",{className:"table-node__loading",role:"status","aria-live":"polite"},x("span",{className:"table-node__spinner","aria-hidden":"true"}),x("span",{className:"sr-only"},"Loading"))})}Nf.$$singleRoot=!0;var Mf=/* @__PURE__ */z('<hr class="hr-node thematic-break"/>'),$f=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(Mf)))});function Bf(){return x($f,{})}Bf.$$singleRoot=!0;var Tf=/* @__PURE__ */z("<div></div>"),Ef=/* @__PURE__ */Symbol(/* @__PURE__ */$(1)),Lf=["s","d","c"],Df=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Tf);n=e.h0,r=W(e.h1),i=s,l=F(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=W(e.h1),o.d=F(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 jf(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=`vmr-container vmr-container-${n.name}`,a=Z(()=>{if(n.attrs)return Array.isArray(n.attrs)?Ae(n.attrs):n.attrs},[n.attrs],Ef);return x(Df,{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})}jf.$$singleRoot=!0;var Pf=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function _f(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))Pf.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function Af(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function Rf(t,n,o,r,i={}){const l=_f(r.codeBlockProps),a=r.events.onHandleArtifactClick?e=>{const t="image/svg+xml"===e.type?"image/svg+xml":"text/html";r.events.onHandleArtifactClick?.({node:null==e.content?n:{...n,code:e.content},artifactType:t,artifactTitle:e.title||("image/svg+xml"===t?"SVG Preview":"HTML Preview"),id:String(o)})}:void 0;return e.createElement(t,{key:o,node:n,loading:Boolean(n.loading)||!1===r.final,stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:a,...l,codeBlockOptions:r.codeBlockOptions,...i,ctx:r,renderNode:If,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function Ff(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function If(t,n,o){const r=o.customComponents??ft(o.customId),i=o.streamingComponents??{},l=o.htmlComponents??{},a=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const t=be(e.type),n=be(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:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(c)return function(t,n,o,r,i){const l=de(Be(ke(n.attrs??void 0,r.htmlPolicy??"safe",i))),a=Array.isArray(n.children)?Re(n.children,r,`${String(o)}-html`,If):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:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=zm(t,{...r,...i},o.customHtmlTags),a=String(t.tag??"").trim().toLowerCase()||ue(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:Me(t.content,s)};return e.createElement(i,{key:n,node:r,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(t.content??t.raw??"");if(!a&&Ne(c,s))return"html_inline"===t.type?Af($c,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):Af(qm,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return Af($c,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return Af($c,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return Af(qm,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return Af(El,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return Af(Vp,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return Af(Ic,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return Af(Fc,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return Af(Nf,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return Af(ol,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return Af(bl,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return Af(Ml,t,n,{});case"footnote_anchor":return Af(pl,t,n,{});case"admonition":return Af(qe,t,n,{ctx:o,renderNode:If,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return Af(Tl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return Af(_c,t,n,{ctx:o,renderNode:If,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return Af(os,t,n,{});case"inline_code":return Af(yc,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=Gt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,Gt(n),ae(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==Id(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Hd(Od(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Id(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return Ff(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==rs(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=ls(is(String(e?.code??"")),void 0,"none"===n.maxHeight?null:rs(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?Ff(l,t,n,o,i):e.createElement(ec,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?Ff(i,t,n,o,o.d2Props||{}):e.createElement(Gi,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return Rf(a,t,n,o);const s=r.code_block;if(s)return Rf(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=_f(o.codeBlockProps).showLineNumbers,i=o.codeBlockOptions?.disableLineNumbers,l=o.codeBlockOptions?.overflow;return e.createElement(Rn,{key:n,node:t,style:l?{whiteSpace:"scroll"===l?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof r?r:"boolean"==typeof i&&!i})}return e.createElement(Kr,{key:n,node:t,loading:Boolean(t.loading)||!1===o.final,stream:o.codeBlockStream,themes:o.codeBlockThemes?.themes,darkTheme:o.codeBlockThemes?.darkTheme,lightTheme:o.codeBlockThemes?.lightTheme,minWidth:o.codeBlockThemes?.minWidth,maxWidth:o.codeBlockThemes?.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,..._f(o.codeBlockProps),codeBlockOptions:o.codeBlockOptions})}(t,n,o,r);case"strong":return Af(nf,t,n,{},Re(t.children,o,`${String(n)}-strong`,If));case"emphasis":return Af(cl,t,n,{},Re(t.children,o,`${String(n)}-em`,If));case"strikethrough":return Af(Qm,t,n,{},Re(t.children,o,`${String(n)}-strike`,If));case"highlight":return Af(jl,t,n,{},Re(t.children,o,`${String(n)}-highlight`,If));case"insert":return Af(wc,t,n,{},Re(t.children,o,`${String(n)}-insert`,If));case"subscript":return Af(lf,t,n,{},Re(t.children,o,`${String(n)}-sub`,If));case"superscript":return Af(cf,t,n,{},Re(t.children,o,`${String(n)}-sup`,If));case"checkbox":case"checkbox_input":return Af(Bt,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return Af(ll,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(Bf);case"math_inline":return Af(Fd,t,n,{});case"math_block":return Af(Cd,t,n,{});case"reference":return Af(Ym,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?Af(va,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):Af(Xa,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return Af(jf,t,n,{ctx:o,renderNode:If,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return Af(Wm,t,n,{})}}var Of=/* @__PURE__ */$(103),Hf=/* @__PURE__ */Symbol(Of),Wf=/* @__PURE__ */Symbol(Of+1),zf=/* @__PURE__ */Symbol(Of+2),Kf=/* @__PURE__ */Symbol(Of+3),Vf=/* @__PURE__ */Symbol(Of+4),qf=/* @__PURE__ */Symbol(Of+5),Uf=/* @__PURE__ */Symbol(Of+6),Xf=/* @__PURE__ */Symbol(Of+7),Zf=/* @__PURE__ */Symbol(Of+8),Yf=/* @__PURE__ */Symbol(Of+9),Gf=/* @__PURE__ */Symbol(Of+10),Jf=/* @__PURE__ */Symbol(Of+11),Qf=/* @__PURE__ */Symbol(Of+12),eh=/* @__PURE__ */Symbol(Of+13),th=/* @__PURE__ */Symbol(Of+14),nh=/* @__PURE__ */Symbol(Of+15),oh=/* @__PURE__ */Symbol(Of+16),rh=/* @__PURE__ */Symbol(Of+17),ih=/* @__PURE__ */Symbol(Of+18),lh=/* @__PURE__ */Symbol(Of+19),ah=/* @__PURE__ */Symbol(Of+20),sh=/* @__PURE__ */Symbol(Of+21),ch=/* @__PURE__ */Symbol(Of+22),dh=/* @__PURE__ */Symbol(Of+23),uh=/* @__PURE__ */Symbol(Of+24),mh=/* @__PURE__ */Symbol(Of+25),fh=/* @__PURE__ */Symbol(Of+26),hh=/* @__PURE__ */Symbol(Of+27),ph=/* @__PURE__ */Symbol(Of+28),yh=/* @__PURE__ */Symbol(Of+29),gh=/* @__PURE__ */Symbol(Of+30),bh=/* @__PURE__ */Symbol(Of+31),wh=/* @__PURE__ */Symbol(Of+32),vh=/* @__PURE__ */Symbol(Of+33),xh=/* @__PURE__ */Symbol(Of+34),kh=/* @__PURE__ */Symbol(Of+35),Sh=/* @__PURE__ */Symbol(Of+36),Ch=/* @__PURE__ */Symbol(Of+37),Nh=/* @__PURE__ */Symbol(Of+38),Mh=/* @__PURE__ */Symbol(Of+39),$h=/* @__PURE__ */Symbol(Of+40),Bh=/* @__PURE__ */Symbol(Of+41),Th=/* @__PURE__ */Symbol(Of+42),Eh=/* @__PURE__ */Symbol(Of+43),Lh=/* @__PURE__ */Symbol(Of+44),Dh=/* @__PURE__ */Symbol(Of+45),jh=/* @__PURE__ */Symbol(Of+46),Ph=/* @__PURE__ */Symbol(Of+47),_h=/* @__PURE__ */Symbol(Of+48),Ah=/* @__PURE__ */Symbol(Of+49),Rh=/* @__PURE__ */Symbol(Of+50),Fh=/* @__PURE__ */Symbol(Of+51),Ih=/* @__PURE__ */Symbol(Of+52),Oh=/* @__PURE__ */Symbol(Of+53),Hh=/* @__PURE__ */Symbol(Of+54),Wh=/* @__PURE__ */Symbol(Of+55),zh=/* @__PURE__ */Symbol(Of+56),Kh=/* @__PURE__ */Symbol(Of+57),Vh=/* @__PURE__ */Symbol(Of+58),qh=/* @__PURE__ */Symbol(Of+59),Uh=/* @__PURE__ */Symbol(Of+60),Xh=/* @__PURE__ */Symbol(Of+61),Zh=/* @__PURE__ */Symbol(Of+62),Yh=/* @__PURE__ */Symbol(Of+63),Gh=/* @__PURE__ */Symbol(Of+64),Jh=/* @__PURE__ */Symbol(Of+65),Qh=/* @__PURE__ */Symbol(Of+66),ep=/* @__PURE__ */Symbol(Of+67),tp=/* @__PURE__ */Symbol(Of+68),np=/* @__PURE__ */Symbol(Of+69),op=/* @__PURE__ */Symbol(Of+70),rp=/* @__PURE__ */Symbol(Of+71),ip=/* @__PURE__ */Symbol(Of+72),lp=/* @__PURE__ */Symbol(Of+73),ap=/* @__PURE__ */Symbol(Of+74),sp=/* @__PURE__ */Symbol(Of+75),cp=/* @__PURE__ */Symbol(Of+76),dp=/* @__PURE__ */Symbol(Of+77),up=/* @__PURE__ */Symbol(Of+78),mp=/* @__PURE__ */Symbol(Of+79),fp=/* @__PURE__ */Symbol(Of+80),hp=/* @__PURE__ */Symbol(Of+81),pp=/* @__PURE__ */Symbol(Of+82),yp=/* @__PURE__ */Symbol(Of+83),gp=/* @__PURE__ */Symbol(Of+84),bp=/* @__PURE__ */Symbol(Of+85),wp=/* @__PURE__ */Symbol(Of+86),vp=/* @__PURE__ */Symbol(Of+87),xp=/* @__PURE__ */Symbol(Of+88),kp=/* @__PURE__ */Symbol(Of+89),Sp=/* @__PURE__ */Symbol(Of+90),Cp=/* @__PURE__ */Symbol(Of+91),Np=/* @__PURE__ */Symbol(Of+92),Mp=/* @__PURE__ */Symbol(Of+93),$p=/* @__PURE__ */Symbol(Of+94),Bp=/* @__PURE__ */Symbol(Of+95),Tp=/* @__PURE__ */Symbol(Of+96),Ep=/* @__PURE__ */Symbol(Of+97),Lp=/* @__PURE__ */Symbol(Of+98),Dp=/* @__PURE__ */Symbol(Of+99),jp=/* @__PURE__ */Symbol(Of+100),Pp=/* @__PURE__ */Symbol(Of+101),_p=/* @__PURE__ */Symbol(Of+102),Ap={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},Rp=me();function Fp(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 Ip(e){const t=Z(()=>function(e){if(!e)return{};const t={};for(const[n,o]of Object.entries(e)){const e=be(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 Op=e.memo(({node:e,nodeKey:t,renderCtx:n})=>If(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Hp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=Q(zf,it,zf),s="undefined"!=typeof window,c="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,d=Math.max(0,Math.trunc(e.renderBatchSize??80)),u=Math.max(0,Math.trunc(e.initialRenderBatchSize??(d||t.length))),m=!1!==e.batchRendering&&d>0&&s,f=Math.max(0,e.liveNodeBuffer??60),h=Math.max(1,e.maxLiveNodes??320),p=(e.maxLiveNodes??0)>0&&t.length>h,y=!1!==e.viewportPriority,g=m&&(e.maxLiveNodes??0)<=0,b=Z(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!p&&!(t.length>900)&&y,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,y,p],Kf),[w,v]=G(()=>g?Math.min(t.length,u):t.length,Vf),k=Y(w,qf);U(()=>{k.current=w},[w],Uf);const N=g?w:t.length,[M,$]=G(0,Xf),[B,T]=G({start:0,end:t.length},Zf),E=Y(/* @__PURE__ */new Map,Yf),[D,j]=G(0,Gf),P=Y({},Jf),_=Y(/* @__PURE__ */new Map,Qf),A=Y(/* @__PURE__ */new Map,eh),R=Y(/* @__PURE__ */new Map,th),F=Y(/* @__PURE__ */new Map,nh),I=Y(/* @__PURE__ */new Set,oh),O=Y(w,rh),H=Y(null,ih),W=Y(null,lh),z=Y(null,ah),K=Y(!1,sh),q=Y(null,ch),X=Y(Math.max(1,d||1),dh),J=Y(t.length,uh),ee=Y({key:e.indexKey,total:t.length},mh),te=Y({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:g},fh),ne=b||p,oe=Z(()=>{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)},[D],hh),re=Z(()=>{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],ph);J.current=Z(()=>{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],yh);const ie=V((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],gh),le=p?ie(0,Math.min(B.start,t.length)):0,ae=p?ie(Math.min(B.end,t.length),t.length):0,se=V(()=>{null!=H.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(H.current),H.current=null),null!=W.current&&(window.clearTimeout(W.current),W.current=null),null!=z.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(z.current),z.current=null),K.current=!1,q.current=null},[],bh),ce=V(t=>{if(!g)return;const n=Math.max(2,e.renderBatchBudgetMs??6),o=Math.max(1,d||1),r=Math.max(1,Math.floor(o/4));t>1.2*n?X.current=Math.max(r,Math.floor(.7*X.current)):t<.5*n&&X.current<o&&(X.current=Math.min(o,Math.ceil(1.2*X.current)))},[g,e.renderBatchBudgetMs,d],wh),de=V((t,n={})=>{if(!g)return;const o=J.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(J.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(X.current));de(e)},a=t=>{H.current=null,W.current=null,z.current=null,K.current=!1;const n=q.current;if(q.current=null,i(null!=n?n:r),k.current>=J.current)return;if(!t)return void l();const o=Math.max(2,e.renderBatchBudgetMs??6);for(;k.current<J.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)i(Math.max(1,Math.round(X.current)));k.current<J.current&&l()};if(!s||n.immediate)return void a();const d=Math.max(0,e.renderBatchDelay??16);if(q.current=null!=q.current?Math.max(q.current,r):r,!K.current){if(K.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?H.current=requestAnimationFrame(()=>{0!==d?W.current=window.setTimeout(()=>a(),d):a()}):W.current=window.setTimeout(()=>a(),d)}},[ce,c,g,s,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs],vh);U(()=>{const n=e.indexKey,o=t.length,r=ee.current,i=void 0!==n?n!==r.key:o!==r.total;ee.current={key:n,total:o};const l=te.current,a=e.renderBatchDelay??16,c=l.batchSize!==d||l.initial!==u||l.delay!==a||l.enabled!==g;if(te.current={batchSize:d,initial:u,delay:a,enabled:g},(i||c||!g)&&se(),(i||c)&&(X.current=Math.max(1,d||1),I.current.clear()),!o)return k.current=0,void v(0);const m=J.current;if(!g)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 f=Math.min(k.current,m);f!==k.current&&(k.current=f,v(f)),k.current<m&&de(Math.max(1,d||1))},[se,g,s,t.length,e.indexKey,e.renderBatchDelay,d,u,de],xh),U(()=>{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(M,e-1));let o=Math.max(0,n-f),r=Math.min(e,n+f+1);const i=r-o;if(i>h){const e=i-h;o+=Math.ceil(e/2),r-=Math.floor(e/2)}else if(i<h){const t=h-i;o=Math.max(0,o-Math.ceil(t/2)),r=Math.min(e,r+Math.floor(t/2))}T({start:o,end:r})},[M,f,h,t.length,p],kh),U(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],Sh);const ue=V(e=>{for(const[t,n]of _.current.entries())t>=e&&(n.destroy(),_.current.delete(t),delete P.current[t],A.current.delete(t),R.current.delete(t),F.current.delete(t))},[],Ch);U(()=>{ue(N)},[ue,N],Nh),U(()=>{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&&j(e=>e+1);for(const t of Object.keys(P.current))Number(t)>=e&&delete P.current[t];for(const t of Array.from(I.current))t>=e&&I.current.delete(t)},[t.length],Mh);const me=V((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],$h),fe=V(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],Bh),he=V((e,t)=>{const n=A.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return fe(e),b&&!t&&delete P.current[e],void(t&&me(e,!0));if(e<u&&!p)return fe(e),void me(e,!0);fe(e);const o=a(t,{rootMargin:"400px"});_.current.set(e,o),o.isVisible()&&me(e,!0),o.whenVisible.then(()=>me(e,!0)).catch(()=>{})},[b,fe,me,a,u,ne,p],Th),pe=V(e=>{const t=R.current.get(e);if(t)return t;const n=t=>he(e,t);return R.current.set(e,n),n},[he],Eh),ye=V((e,t)=>{if(!t)return void(E.current.has(e)&&(E.current.delete(e),j(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&E.current.get(e)!==n&&(E.current.set(e,n),j(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[],Lh),ge=V(e=>{const t=F.current.get(e);if(t)return t;const n=t=>ye(e,t);return F.current.set(e,n),n},[ye],Dh),be=V(e=>!(g&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,g,u],jh),we=V(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],Ph);U(()=>{for(const[e,t]of A.current.entries())t&&he(e,t)},[he],_h),U(()=>{p&&w>O.current&&$(w-1),O.current=w},[w,p],Ah);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-stream-final":!0===(e.final??e.parseOptions?.final)?"":void 0,"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&&!0!==(e.final??e.parseOptions?.final)&&"code_block"!==t.type&&!I.current.has(r)&&i;return a&&I.current.add(r),S("div",{key:`${o}-${r}`,ref:pe(r),className:"node-slot","data-node-index":r,"data-node-type":t.type},()=>C(i?()=>S("div",{ref:ge(r),className:"node-content"+(a?" fade-node typewriter-node":"")},()=>C(()=>x(Op,{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 Wp(t){const n={...Ap,...t},o=Y(null,Rh),r=Y(/* @__PURE__ */new Map,Fh),i=Y(0,Ih),l=Y(null,Oh),a=Q(Hh,vt,{...ee,...n.smoothStreamingOptions,burstInitialContent:!1===n.fade&&!n.typewriter},Hh),[s,c]=G(!1,Wh),d=Y(null,zh);d.current||(d.current=oe(a,{flushOnFinish:n.smoothStreamingOptions?.flushOnFinish,commit:e=>{M(e)},measure:()=>{o.current},onReady:c}));const u=d.current;U(()=>()=>u.dispose(),[u],Kh);const m=e.useContext(Xe),f=Y(/* @__PURE__ */new Set,Vh),[h,p]=G(()=>!0===n.smoothStreaming,qh);U(()=>{p(!0)},[],Uh);const y=Array.isArray(n.nodes)&&n.nodes.length>0,g=Z(()=>!1!==n.smoothStreaming&&!y&&(!0===n.smoothStreaming||!m)&&(!0===n.smoothStreaming||!0===n.typewriter||(n.maxLiveNodes??0)<=0),[y,m,n.maxLiveNodes,n.smoothStreaming,n.typewriter],Xh),b=h&&g,w=b?a.visible:n.content??"",v=Z(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Zh),k=e.useContext(Ue),N=Y(le(u.scheduleCleanup,k),Yh).current,$=N;X(()=>{N.setFinal(!0===v)},[N,v],Gh);const B=n.content??"",T=y||a.source===B,E=Z(()=>b&&null!=v?Boolean(v&&s&&T&&a.caughtUp):v,[s,v,T,a.caughtUp,b],Jh),L=Y(null,Qh),[D,j]=G(!1,ep),P=Y(void 0,tp),_=Y(0,np),A=Z(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],op),R=V(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&A.has(t)},[A],rp),F=V(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+F(t),0);const r=t.items;return Array.isArray(r)?r.reduce((e,t)=>e+F(t),0):0},[],ip),I=V(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+F(t),0):(n.content??"").length,[n.nodes,n.content,F],lp),O=V(()=>{P.current&&(clearTimeout(P.current),P.current=void 0)},[],ap),H=V(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},[],sp),W=V(()=>{if("undefined"==typeof window||!D||!o.current||!L.current)return;const e=o.current,t=L.current,n=H(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`},[D,o,H],cp);U(()=>{D&&requestAnimationFrame(()=>{W()})},[D,W],dp),U(()=>()=>{O()},[O],up);const z=y?n.nodes:w;l.current!==z&&(i.current+=1,l.current=z);const K=J(dt,ut,ut,mp),q=Z(()=>ft(n.customId),[n.customId,K],fp),te=Q(hp,Ip,n.streamingComponents,hp),ne=Q(pp,Ip,n.htmlComponents,pp);U(()=>{f.current},[ne,te],yp);const re=Z(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],gp),ie=Z(()=>{const e=(n.parseOptions??{}).customHtmlTags??[];return ge(n.customHtmlTags,Array.isArray(e)?e:[],Object.keys(te))},[n.customId,n.customHtmlTags,n.parseOptions,K,te],bp),ae=Z(()=>{const e=ie;return e&&0!==e.length?me(re,{customHtmlTags:e}):me(re)},[re,ie],wp),se=Z(()=>{const e=ae;return n.customMarkdownIt?n.customMarkdownIt(e):e},[ae,n.customMarkdownIt],vp),ce=Z(()=>{const e=n.parseOptions??{},t=E,o=null!=t,r=ie.length>0;return o||r?{...e,...o?{final:t}:{},...r?{customHtmlTags:ie}:{}}:e},[ie,E,n.parseOptions],xp),de=Z(()=>{const e=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let o=[];return y?o=n.nodes.map(e=>({...e})):w&&(o=we(w,se??Rp,ce)),e&&console.info("[markstream-octane][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:o.length,contentLength:w.length}),o},[n.debugPerformance,w,y,n.nodes,ce,se,n.customId,K,ie],kp),ue=V(()=>{const e=de[de.length-1];return!R(e)},[de,R],Sp);U(()=>{if("undefined"==typeof window||y)return;if(E)return j(!1),void O();const e=I(),t=ue();return!1===n.typewriter||!t||e<=_.current?(!1!==n.typewriter&&t||j(!1),void(_.current=e)):(_.current=e,j(!0),O(),requestAnimationFrame(()=>{W()}),P.current=setTimeout(()=>{j(!1)},3e3),()=>{O()})},[w,n.nodes,n.typewriter,n.content,E,de.length,y,I,ue,O,W],Cp);const fe=Y([],Np),he=ce?.postTransformNodes,pe=Y(he,Mp);pe.current!==he&&(fe.current=[],pe.current=he);const ye=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&&Fp(i,e[r])?n[r]=i:(n[r]=e[r],o=!1)}return o?t:n}(de,fe.current);fe.current=ye,X(()=>{u.update(n.content??"",y,b,v,!1!==n.fade)},[y,n.content,v,b,n.fade,u],$p),U(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!ye.some(e=>"code_block"===e?.type&&"mermaid"!==Gt(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(()=>{bn()},{timeout:900});return()=>t(o)},[ye,n.renderCodeBlocksAsPre],Bp);const be=Z(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],Tp),ve=Z(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],Ep),xe=Z(()=>({...n.mermaidProps||{}}),[n.mermaidProps],Lp),ke=Z(()=>({...n.d2Props||{}}),[n.d2Props],Dp),Se=Z(()=>({...n.infographicProps||{}}),[n.infographicProps],jp),Ce=Z(()=>({customId:n.customId,isDark:n.isDark,final:E,indexKey:be,typewriter:n.typewriter,fade:n.fade,textStreamState:r.current,streamRenderVersion:i.current,customComponents:q,streamingComponents:te,htmlComponents:ne,customHtmlTags:ie,htmlPolicy:n.htmlPolicy??"safe",showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockOptions:n.codeBlockOptions,codeBlockProps:ve,mermaidProps:xe,d2Props:ke,infographicProps:Se,codeBlockThemes:{themes:n.themes,darkTheme:n.codeBlockDarkTheme,lightTheme:n.codeBlockLightTheme,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,E,be,n.typewriter,n.fade,n.showTooltips,n.htmlPolicy,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockOptions,ie,ve,xe,ke,Se,n.themes,n.codeBlockDarkTheme,n.codeBlockLightTheme,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,q,te,ne],Pp);Ce.streamRenderVersion=i.current,Ce.textStreamState=r.current;const Ne=Y(null,_p);return Ne.current||(Ne.current={textStreamState:r.current,getStreamRenderVersion:()=>i.current}),S(Ue.Provider,{value:$},()=>S(Ze.Provider,{value:Ne.current},()=>S(Xe.Provider,{value:b},()=>S(rt,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(Hp,{props:n,parsedNodes:ye,renderCtx:Ce,indexPrefix:be,containerRef:o,showTypewriterCursor:D,typewriterCursorRef:L}))))))}var zp=/* @__PURE__ */z('<blockquote class="blockquote-node" dir="auto"></blockquote>'),Kp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(zp);e=r,n=r,o=m(t,r,void 0,e,n,null,void 0)}{const t=e.h0;o.a!==t&&(_(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):O(e,n),o.e=n}}});function Vp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(Kp,{h0:t.cite,h1:i??(n&&o?C(()=>x(Wp,{nodes:t.children||[],indexKey:`blockquote-${String(r??"blockquote")}`,customId:n.customId,isDark:n.isDark,typewriter:n.typewriter,viewportPriority:!0,codeBlockStream:n.codeBlockStream,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockOptions:n.codeBlockOptions,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick})):null)})}Vp.$$singleRoot=!0;var qp=/* @__PURE__ */$(5),Up=/* @__PURE__ */Symbol(qp),Xp=/* @__PURE__ */Symbol(qp+1),Zp=/* @__PURE__ */Symbol(qp+2),Yp=/* @__PURE__ */Symbol(qp+3),Gp=/* @__PURE__ */Symbol(qp+4);function Jp(e){const t=Y(null,Up),[n,o]=G(!1,Xp),[r,i]=G({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},Zp),l=Z(()=>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],Yp);return U(()=>{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 Le(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[je(e.offset??8),De(),Pe({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=Ee(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],Gp),"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{qe as AdmonitionNode,Vp as BlockquoteNode,Bt as CheckboxNode,Kr as CodeBlockNode,Kr as OctaneCodeBlockNode,Gi as D2BlockNode,ol as DefinitionListNode,ll as EmojiNode,cl as EmphasisNode,Wm as FallbackComponent,pl as FootnoteAnchorNode,bl as FootnoteNode,Ml as FootnoteReferenceNode,Tl as HardBreakNode,El as HeadingNode,jl as HighlightNode,va as HtmlBlockNode,Xa as HtmlInlineNode,hn as HtmlPreviewFrame,os as ImageNode,ec as InfographicBlockNode,yc as InlineCodeNode,wc as InsertNode,_c as LinkNode,Fc as ListItemNode,Ic as ListNode,Gd as MERMAID_WORKER_BUSY_CODE,Cd as MathBlockNode,Fd as MathInlineNode,Lm as MermaidBlockNode,Wp as NodeRenderer,Wp as default,qm as ParagraphNode,Rn as PreCodeNode,Ym as ReferenceNode,Qm as StrikethroughNode,nf as StrongNode,lf as SubscriptNode,cf as SuperscriptNode,Nf as TableNode,$c as TextNode,Bf as ThematicBreakNode,Jp as Tooltip,jf as VmrContainerNode,Jc as WORKER_BUSY_CODE,tu as canParseOffthread,pt as clearGlobalCustomComponents,td as clearKaTeXCache,Yc as clearKaTeXWorker,Qd as clearMermaidWorker,wt as defineHtmlComponents,bt as defineStreamingComponents,Qr as disableD2,Jr as enableD2,nu as findPrefixOffthread,yt as getCustomComponentDisplay,ft as getCustomNodeComponents,ld as getKaTeXBackpressureDefaults,nn as getLanguageIcon,Yd as getMermaidWorkerLoad,ei as isD2Enabled,ln as isLikelyIncompleteLanguageIdentifier,on as languageMap,Gt as normalizeLanguageIdentifier,en as preloadExtendedLanguageIcons,ht as removeCustomComponents,Qc as renderKaTeXInWorker,ad as renderKaTeXWithBackpressure,If as renderNode,Jt as resolveLanguageId,mt as setCustomComponents,Gr as setD2Loader,Et as setDefaultI18nMap,id as setKaTeXBackpressureDefaults,ed as setKaTeXCache,nd as setKaTeXConcurrencyLimit,Zc as setKaTeXWorker,Gc as setKaTeXWorkerDebug,Ut as setLanguageIconResolver,Jd as setMermaidWorker,Xd as setMermaidWorkerClientDebug,Zd as setMermaidWorkerMaxConcurrency,tn as subscribeLanguageIconsRevision,ou as terminateWorker,Lt as useSafeI18n,vt as useSmoothMarkdownStream,od as waitForKaTeXWorkerSlot,gt as withMarkstreamComponentDisplay};