markstream-octane 2.0.18 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/client/workers/mermaidParser.worker.js +32 -27
- package/dist/index.d.ts +4 -0
- package/dist/server.d.ts +2 -0
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/dist/types/components/LinkNode/LinkNode.d.ts +2 -0
- package/dist/types/types/component-props.d.ts +2 -0
- package/package.json +3 -3
package/dist/client/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// octane-no-slot: compiler-assigned hook slots are already present.
|
|
2
|
-
import*as e from"octane";import{Fragment as t,__s as n,attachRef as o,bag0 as r,bag1 as i,bag10 as l,bag12 as a,bag13 as s,bag15 as c,bag3 as d,bag4 as u,bag5 as m,bag6 as f,bag7 as h,bag8 as p,bagOf as y,child as g,childTextHole as b,clone as 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{createPanGesture as xe,createSmoothMarkdownStream as ke,normalizeShikiLanguage as Se}from"markstream-core";import{autoUpdate as Ce,computePosition as Ne,flip as Me,offset as $e,shift as Be}from"@floating-ui/dom";var Ee=/* @__PURE__ */new Set(["table","code_block","html_block","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function Te(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=n??!0,e):e,{})}function Le(t,n,o,r){if("function"!=typeof r)throw new TypeError("renderNodeChildren expected a function, received "+typeof r);if(!Array.isArray(t)||0===t.length)return null;const i=[];for(let l=0;l<t.length;l++){const a=t[l];if(a){if("label_open"===a.type){const s=[];for(l++;l<t.length;){const e=t[l];if("label_close"===e?.type)break;e&&s.push(e),l++}const c=`${o}-label-${l}`;i.push(e.createElement("label",{key:c,...Te(a.attrs)},Le(s,n,`${c}-child`,r)));continue}"label_close"!==a.type&&i.push(r(a,`${o}-${l}`,n))}}return i}function De(e,t,n,o){return Le(e,t,`${n}-inline`,o)}var je=/* @__PURE__ */W('<div><div class="admonition-header"><!><span class="admonition-title"></span><!></div><!></div>'),Pe=/* @__PURE__ */M(3),_e=/* @__PURE__ */Symbol(Pe),Re=/* @__PURE__ */Symbol(Pe+1),Ae=/* @__PURE__ */Symbol(Pe+2),Fe=/* @__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(je);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)}}}),Ie={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function He(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],_e),[s,c]=Y(()=>!!t.collapsible&&!(t.open??1),Re),d=X(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[],Ae);return x(Fe,{h0:`admonition admonition-${l}${i?" is-dark":""}`,h1:r,h2:d,h3:Ie[l]&&S("span",{className:"admonition-icon"},()=>Ie[l]),h4:a,h5:t.collapsible&&C(()=>S("button",{type:"button",className:"admonition-toggle","aria-expanded":!s,"aria-controls":`${d}-content`,title:s?"Expand":"Collapse",onClick:()=>c(e=>!e)},()=>S("span",{},()=>s?"▶":"▼"))),h6:!s&&C(()=>S("div",{id:`${d}-content`,className:"admonition-content","aria-labelledby":d},()=>n&&o?Le(t.children,n,String(r??d),o):null))})}He.$$singleRoot=!0;var Oe=v(!1),We=v(null);function ze(){return V(We)}var Ke=/* @__PURE__ */M(3),Ve=/* @__PURE__ */Symbol(Ke),qe=/* @__PURE__ */Symbol(Ke+1),Ue=/* @__PURE__ */Symbol(Ke+2),Xe=v(null);function Ze(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,o=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,r=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null;let i=null,l=null;const a=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set;let c=null;const d=()=>{if(!a.size){try{i?.disconnect()}catch{}i=null,l=null,s.size||(()=>{if(null!=c){try{r?.(c)}catch{}c=null}})()}},u=e=>{const t=a.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{i?.unobserve(e)}catch{}a.delete(e),s.delete(e),d()}},m=()=>{o&&null==c&&s.size&&(c=o(()=>{c=null;const e=s.values().next().value;e&&(s.delete(e),u(e),s.size&&m())},{timeout:1200}))};return(o,r)=>{const c={current:!1};let f=!1;const{promise:h,resolve:p}=Promise.withResolvers(),y=()=>{f||(f=!0,p())},g=()=>{if(a.has(o)){a.delete(o);try{i?.unobserve(o)}catch{}}s.delete(o),d()};if(!n||!t())return c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g};const b=((t,o)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,o);if(i&&(c=r,(s=l)&&s.root===c.root&&s.rootMargin===c.rootMargin&&s.threshold===c.threshold))return i;var s,c;if(i)try{i.disconnect()}catch{}i=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&u(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),l=r;for(const e of a.keys())i.observe(e);return i})(r?.rootMargin??"300px",r?.threshold??0);return b?(a.set(o,{resolve:y,state:c}),b.observe(o),s.add(o),m(),{isVisible:()=>c.current,whenVisible:h,destroy:g}):(c.current=!0,y(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Ye=Ze(()=>null,()=>!0);function Ge({getRoot:e,enabled:t=!0,children:n}){const o=Z(t,Ve);o.current=t;const r=Z(e,qe);r.current=e;const i=X(()=>Ze(()=>r.current?.()??null,()=>o.current),[],Ue);return S(Xe.Provider,{value:i},()=>n)}function Je(){return V(Xe)??Ye}var Qe="__global__",et="__MARKSTREAM_OCTANE_CUSTOM_COMPONENTS_STORE__",tt=(()=>{const e=globalThis;if(e[et])return e[et];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[et]=t,t})();function nt(){tt.revision++;for(const e of Array.from(tt.listeners))try{e()}catch{}}function ot(e){return tt.listeners.add(e),()=>{tt.listeners.delete(e)}}function rt(){return tt.revision}function it(e,t){"string"==typeof e?tt.scopedComponents[e]={...t||{}}:tt.scopedComponents[Qe]={...e},nt()}function lt(e){const t=tt.scopedComponents[Qe]||{};if(!e)return t;const n=tt.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function at(e){if(e===Qe)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete tt.scopedComponents[e],nt()}function st(){delete tt.scopedComponents[Qe],nt()}function ct(e){return e?.markstreamDisplay}function dt(e,t){return e.markstreamDisplay=t,e}function ut(e){return e}function mt(e){return e}function ft(e={}){const t=Z(null,pt);t.current||(t.current=ke(e));const n=t.current,[o,r]=Y(()=>n.getSnapshot(),yt);return q(()=>{const e=n.subscribe(()=>{r(n.getSnapshot())});return n.resume(),r(n.getSnapshot()),()=>{e(),n.pause()}},[n],gt),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],bt)}var ht=/* @__PURE__ */M(4),pt=/* @__PURE__ */Symbol(ht),yt=/* @__PURE__ */Symbol(ht+1),gt=/* @__PURE__ */Symbol(ht+2),bt=/* @__PURE__ */Symbol(ht+3),wt=/* @__PURE__ */W('<span class="checkbox-node"><input type="checkbox" disabled="" class="checkbox-input" readonly=""/></span>'),vt=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n;const r=w(wt),l=r.firstChild;_(l,e.h0),n=l,o=i(t,r,n)}else _(o.a,e.h0)});function xt(e){const{node:t}=e;return x(vt,{h0:Boolean(t.checked)})}xt.$$singleRoot=!0;var kt={"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 St(e){Object.assign(kt,e)}function Ct(){return{t:e=>kt[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 Nt=null,Mt=null,$t=null,Bt=null,Et=null,Tt=null;function Lt(){Bt&&(clearTimeout(Bt),Bt=null),Et&&(clearTimeout(Et),Et=null)}async function Dt(e){if(!Nt||!Mt)return;const{x:t,y:n}=await Ne(Mt,Nt,{placement:e,middleware:[$e(8),Me(),Be({padding:8})],strategy:"fixed"});Nt.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function jt(e,t,n="top",o=!1,r,i){if(!e||"undefined"==typeof document)return;if(Nt||"undefined"==typeof document||((Nt=document.createElement("div")).className="markstream-octane ms-tooltip",Nt.setAttribute("role","tooltip"),Nt.dataset.visible="false",Nt.style.position="fixed",Nt.style.left="0px",Nt.style.top="0px",Nt.style.transform="translate3d(0,0,0)",document.body.appendChild(Nt)),!Nt)return;Lt();const l=async()=>{if(Nt){Mt=e,Nt.textContent=t,Nt.dataset.placement=n,Nt.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",Nt.dataset.visible="false",Tt=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Nt.id=Tt;try{e.setAttribute("aria-describedby",Tt)}catch{}await Dt(n),Nt.dataset.visible="true",$t?.(),$t=Ce(e,Nt,()=>{Dt(n)})}};o?l():Bt=setTimeout(l,80)}function Pt(e=!1){if(!Nt)return;Lt();const t=()=>{if(Nt){if(Nt.dataset.visible="false",Mt&&Tt)try{Mt.removeAttribute("aria-describedby")}catch{}Mt=null,Tt=null,$t&&($t(),$t=null)}};e?t():Et=setTimeout(t,120)}var _t='<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',Rt=null,At=null,Ft=null,It=/* @__PURE__ */new Set;function Ht(e){Rt=e??null}var Ot={"":"",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"},Wt={"":_t,plain:_t,text:_t,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 zt(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[o]=n.split(":");return o.toLowerCase()}function Kt(e){const t=zt(e);return Ot[t]??t}function Vt(e){const t=Kt(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 At||(Ft||(Ft=import("./chunks/languageIconExtended-BZR3DrgI.js").then(e=>(At=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of It)try{e()}catch{}}(),At)).catch(()=>null)),Ft)}async function Ut(){await qt()}function Xt(e){return It.add(e),()=>{It.delete(e)}}function Zt(e){if(Rt){const t=Rt(e);if(null!=t&&""!==t)return t}const t=Kt(e),n=Wt[t];if(n)return n;const o=At?.[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 Yt={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",csharp:"C#",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"},Gt=Array.from(/* @__PURE__ */new Set([...Object.keys(Ot),...Object.values(Ot),...Object.keys(Wt),...Object.keys(Yt),"c","diff","go","java","php","ruby","rust","sql","yaml"]));function Jt(e){const t=zt(e);return!!t&&!Gt.includes(t)&&Gt.some(e=>e.startsWith(t))}var Qt=/* @__PURE__ */M(4),en=/* @__PURE__ */Symbol(Qt),tn=/* @__PURE__ */Symbol(Qt+1),nn=/* @__PURE__ */Symbol(Qt+2),on=/* @__PURE__ */Symbol(Qt+3),rn=void 0!==import.meta&&Boolean(!1),ln=null;function an(e){const{t:t}=J(en,Ct,en),n=X(()=>{const t=e.code||"",n=t.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?t:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${e.isDark?"#020617":"#ffffff"};\n color: ${e.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${t}\n </body>\n</html>`},[e.code,e.isDark],tn),o=X(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,"string"==typeof t?(function(e){if(!rn||"undefined"==typeof console||ln===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(ln=e,console.warn("[markstream-octane] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(t),t):void 0!==t?"":!0===n?"allow-scripts":"";var t,n},[e.htmlPreviewAllowScripts,e.htmlPreviewSandbox],nn);return q(()=>{const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||e.onClose?.()};return"undefined"!=typeof window&&window.addEventListener("keydown",t),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",t)}},[e],on),"undefined"==typeof document?null:k(C(()=>S("div",{className:"markstream-octane html-preview-frame__backdrop"+(e.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>e.onClose?.()},()=>C(()=>S("div",{className:"html-preview-frame"+(e.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation()},()=>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 sn=!1,cn=null,dn=!1;async function un(){if(cn)return cn;if(dn)return null;try{if(!(cn=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){sn||(sn=!0,e?.preloadStreamDiffs&&await e.preloadStreamDiffs())}(cn),cn}catch{return dn=!0,null}}var mn=/* @__PURE__ */W('<pre data-markstream-pre="1" tabindex="0"></pre>'),fn=/* @__PURE__ */M(6),hn=/* @__PURE__ */Symbol(fn),pn=/* @__PURE__ */Symbol(fn+1),yn=/* @__PURE__ */Symbol(fn+2),gn=/* @__PURE__ */Symbol(fn+3),bn=/* @__PURE__ */Symbol(fn+4),wn=/* @__PURE__ */Symbol(fn+5),vn=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r,i,l,a,s;const d=w(mn);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 xn(e){return String(String(e??"").split(/\s+/g)[0]??"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function kn(e){const t=String(e??"");return t?t.split(/\r\n|\n|\r/):[]}function Sn(e){return e.startsWith("-")&&!e.startsWith("---")}function Cn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Nn(e,t){return n=e[t],!(0===String(n??"").trim().length)||t<e.length-1;var n}function Mn(e,t,n,o,r={}){const i=0===String(e??"").trim().length;return{code:e,empty:i,kind:i&&"hunk"!==t&&!r.preserveBlankKind?"context":t,key:n,number:o}}function $n(e){let t=1;return e.map((e,n)=>e.startsWith("@@")?Mn(e,"hunk",`inline-hunk-${n}`,""):Sn(e)?Mn(e.slice(1),"removed",`inline-removed-${n}`,"",{preserveBlankKind:!0}):Cn(e)?Mn(e.slice(1),"added",`inline-added-${n}`,t++,{preserveBlankKind:!0}):Mn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${n}`,t++))}function Bn(e,t){const n=kn(e),o=kn(t),r=function(e,t){const n=e.length,o=t.length;if((n+1)*(o+1)>15e5)return null;const r=o+1,i=new Uint16Array((n+1)*(o+1));for(let c=n-1;c>=0;c--)for(let n=o-1;n>=0;n--){const o=c*r+n;e[c]===t[n]?i[o]=i[(c+1)*r+n+1]+1:i[o]=Math.max(i[(c+1)*r+n],i[c*r+n+1])}const l=[];let a=0,s=0;for(;a<n&&s<o;)e[a]===t[s]?(l.push({originalIndex:a,modifiedIndex:s}),a++,s++):i[(a+1)*r+s]>=i[a*r+s+1]?a++:s++;return l}(n,o);if(r){const e=[];let t=0,i=0;for(const l of r){for(;t<l.originalIndex;)e.push(Mn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Nn(n,t)})),t++;for(;i<l.modifiedIndex;)e.push(Mn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Nn(o,i)})),i++;e.push(Mn(o[l.modifiedIndex],"context",`inline-context-source-${l.originalIndex}-${l.modifiedIndex}`,l.modifiedIndex+1)),t=l.originalIndex+1,i=l.modifiedIndex+1}for(;t<n.length;)e.push(Mn(n[t],"removed",`inline-removed-source-${t}`,"",{preserveBlankKind:Nn(n,t)})),t++;for(;i<o.length;)e.push(Mn(o[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Nn(o,i)})),i++;return e}const i=[];let l=0,a=n.length-1,s=o.length-1;for(;l<=a&&l<=s&&n[l]===o[l];)i.push(Mn(o[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&n[a]===o[s];)c.unshift(Mn(o[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(Mn(n[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Nn(n,d)}));for(let d=l;d<=s;d++)i.push(Mn(o[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Nn(o,d)}));return i.concat(c)}function En(e,t=!1,n=xn(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=>Sn(e)),r=e.some(e=>Cn(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:Bn(e?.originalCode,e?.updatedCode)}];const n=kn(e?.originalCode),o=kn(e?.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:n.map((e,t)=>Mn(e,o[t]===e?"context":"removed",`original-${t}`,t+1,{preserveBlankKind:Nn(n,t)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:o.map((e,t)=>Mn(e,n[t]===e?"context":"added",`modified-${t}`,t+1,{preserveBlankKind:Nn(o,t)}))}]}if(t)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:$n(o)}];const i=[],l=[];let a=1,s=1;for(const[c,d]of o.entries())if(d.startsWith("@@"))i.push(Mn(d,"hunk",`original-hunk-${c}`,"")),l.push(Mn(d,"hunk",`modified-hunk-${c}`,""));else if(Sn(d))i.push(Mn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Cn(d))l.push(Mn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(Mn(e,"context",`original-context-${c}`,a++)),l.push(Mn(e,"context",`modified-context-${c}`,s++))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:i},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:l}]}function Tn({node:e,className:n,diffInline:o,showLineNumbers:r,style:i}){const l=X(()=>xn(e?.language),[e],hn),a=`language-${l}`,s=l?`Code block: ${l}`:"Code block",c=!0===r&&!0===e?.diff,d=X(()=>c?En(e,!0===o,l):[],[o,c,e,l],pn),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],yn),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],gn),f=X(()=>{let e="";for(let t=1;t<=m;t++)e+=`${e?"\n":""}${t}`;return e},[m],bn),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],wn);return x(vn,{h0:[a,n,r?"markstream-pre--line-numbers":"",c?"markstream-pre--diff-preview":"",c&&o?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),h1:h?{...i,...h}:i,h2:!0===e?.loading,h3:s,h4:l,h5:r?"1":void 0,h6:c?S("code",{translate:"no",className:"markstream-pre__diff-code"},()=>d.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-pane",e.className].join(" ")},()=>e.lines.map(e=>S("span",{key:e.key,className:["markstream-pre__diff-line",`markstream-pre__diff-line--${e.kind}`,e.empty?"markstream-pre__diff-line--empty":""].filter(Boolean).join(" ")},()=>T([x("span",{className:"markstream-pre__diff-rail","aria-hidden":"true"}),S("span",{className:"markstream-pre__diff-number","aria-hidden":"true"},()=>e.number),S("span",{className:"markstream-pre__diff-content"},()=>S("span",{className:"markstream-pre__diff-content-inner"},()=>e.code))])))))):S(t,{},()=>T([r&&S("span",{className:"markstream-pre__line-numbers","aria-hidden":"true"},()=>S("span",{className:"markstream-pre__line-numbers-text"},()=>f)),S("code",{translate:"no",className:"markstream-pre__code"},()=>u)]))})}Tn.$$singleRoot=!0;var Ln=/* @__PURE__ */W('<div class="code-editor-layer"><div></div><div class="code-editor-fallback-surface"></div></div>'),Dn=/* @__PURE__ */W('<div><!><div><!><!></div><!><span class="sr-only" aria-live="polite" role="status"></span></div>'),jn=["r","a","b"],Pn=/* @__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(Ln),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=jn}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}}}),_n=/* @__PURE__ */M(96),Rn=/* @__PURE__ */Symbol(_n),An=/* @__PURE__ */Symbol(_n+1),Fn=/* @__PURE__ */Symbol(_n+2),In=/* @__PURE__ */Symbol(_n+3),Hn=/* @__PURE__ */Symbol(_n+4),On=/* @__PURE__ */Symbol(_n+5),Wn=/* @__PURE__ */Symbol(_n+6),zn=/* @__PURE__ */Symbol(_n+7),Kn=/* @__PURE__ */Symbol(_n+8),Vn=/* @__PURE__ */Symbol(_n+9),qn=/* @__PURE__ */Symbol(_n+10),Un=/* @__PURE__ */Symbol(_n+11),Xn=/* @__PURE__ */Symbol(_n+12),Zn=/* @__PURE__ */Symbol(_n+13),Yn=/* @__PURE__ */Symbol(_n+14),Gn=/* @__PURE__ */Symbol(_n+15),Jn=/* @__PURE__ */Symbol(_n+16),Qn=/* @__PURE__ */Symbol(_n+17),eo=/* @__PURE__ */Symbol(_n+18),to=/* @__PURE__ */Symbol(_n+19),no=/* @__PURE__ */Symbol(_n+20),oo=/* @__PURE__ */Symbol(_n+21),ro=/* @__PURE__ */Symbol(_n+22),io=/* @__PURE__ */Symbol(_n+23),lo=/* @__PURE__ */Symbol(_n+24),ao=/* @__PURE__ */Symbol(_n+25),so=/* @__PURE__ */Symbol(_n+26),co=/* @__PURE__ */Symbol(_n+27),uo=/* @__PURE__ */Symbol(_n+28),mo=/* @__PURE__ */Symbol(_n+29),fo=/* @__PURE__ */Symbol(_n+30),ho=/* @__PURE__ */Symbol(_n+31),po=/* @__PURE__ */Symbol(_n+32),yo=/* @__PURE__ */Symbol(_n+33),go=/* @__PURE__ */Symbol(_n+34),bo=/* @__PURE__ */Symbol(_n+35),wo=/* @__PURE__ */Symbol(_n+36),vo=/* @__PURE__ */Symbol(_n+37),xo=/* @__PURE__ */Symbol(_n+38),ko=/* @__PURE__ */Symbol(_n+39),So=/* @__PURE__ */Symbol(_n+40),Co=/* @__PURE__ */Symbol(_n+41),No=/* @__PURE__ */Symbol(_n+42),Mo=/* @__PURE__ */Symbol(_n+43),$o=/* @__PURE__ */Symbol(_n+44),Bo=/* @__PURE__ */Symbol(_n+45),Eo=/* @__PURE__ */Symbol(_n+46),To=/* @__PURE__ */Symbol(_n+47),Lo=/* @__PURE__ */Symbol(_n+48),Do=/* @__PURE__ */Symbol(_n+49),jo=/* @__PURE__ */Symbol(_n+50),Po=/* @__PURE__ */Symbol(_n+51),_o=/* @__PURE__ */Symbol(_n+52),Ro=/* @__PURE__ */Symbol(_n+53),Ao=/* @__PURE__ */Symbol(_n+54),Fo=/* @__PURE__ */Symbol(_n+55),Io=/* @__PURE__ */Symbol(_n+56),Ho=/* @__PURE__ */Symbol(_n+57),Oo=/* @__PURE__ */Symbol(_n+58),Wo=/* @__PURE__ */Symbol(_n+59),zo=/* @__PURE__ */Symbol(_n+60),Ko=/* @__PURE__ */Symbol(_n+61),Vo=/* @__PURE__ */Symbol(_n+62),qo=/* @__PURE__ */Symbol(_n+63),Uo=/* @__PURE__ */Symbol(_n+64),Xo=/* @__PURE__ */Symbol(_n+65),Zo=/* @__PURE__ */Symbol(_n+66),Yo=/* @__PURE__ */Symbol(_n+67),Go=/* @__PURE__ */Symbol(_n+68),Jo=/* @__PURE__ */Symbol(_n+69),Qo=/* @__PURE__ */Symbol(_n+70),er=/* @__PURE__ */Symbol(_n+71),tr=/* @__PURE__ */Symbol(_n+72),nr=/* @__PURE__ */Symbol(_n+73),or=/* @__PURE__ */Symbol(_n+74),rr=/* @__PURE__ */Symbol(_n+75),ir=/* @__PURE__ */Symbol(_n+76),lr=/* @__PURE__ */Symbol(_n+77),ar=/* @__PURE__ */Symbol(_n+78),sr=/* @__PURE__ */Symbol(_n+79),cr=/* @__PURE__ */Symbol(_n+80),dr=/* @__PURE__ */Symbol(_n+81),ur=/* @__PURE__ */Symbol(_n+82),mr=/* @__PURE__ */Symbol(_n+83),fr=/* @__PURE__ */Symbol(_n+84),hr=/* @__PURE__ */Symbol(_n+85),pr=/* @__PURE__ */Symbol(_n+86),yr=/* @__PURE__ */Symbol(_n+87),gr=/* @__PURE__ */Symbol(_n+88),br=/* @__PURE__ */Symbol(_n+89),wr=/* @__PURE__ */Symbol(_n+90),vr=/* @__PURE__ */Symbol(_n+91),xr=/* @__PURE__ */Symbol(_n+92),kr=/* @__PURE__ */Symbol(_n+93),Sr=/* @__PURE__ */Symbol(_n+94),Cr=/* @__PURE__ */Symbol(_n+95),Nr=["r","a","b"],Mr=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s,c,d,u,m,f,h,p,b,v;const x=w(Dn);{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=Nr}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}}}),$r="undefined"!=typeof window?U:q,Br={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Er=12;function Tr({editorHostRef:e,editorReady:t,node:n,preFallbackDiffInline:o,preFallbackStyle:r,showLineNumbers:i,stream:l}){return x(Pn,{h0:e,h1:"code-editor-container"+(l?"":" code-height-placeholder"),h2:{visibility:t?"visible":"hidden"},h3:!t,h4:{display:t?"none":"block"},h5:x(Tn,{className:"code-fallback-plain m-0",diffInline:o,node:n,showLineNumbers:i,style:r})})}function Lr(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Dr(e,t){return"number"!=typeof e||!Number.isFinite(e)||e<0?{top:t,bottom:t}:{top:e,bottom:e}}function jr(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 Pr(e){return String(e??"").replace(/\r\n$|\n$|\r$/,"")}function _r(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 Rr(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 Ar(e){const n={...Br,...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,Rn),$=Z(null,An),B=Z(null,Fn),E=Z(null,In),L=Z(null,Hn),D=Z(null,On),j=Z(null,Wn),P=Z(0,zn),_=Z(null,Kn),R=Z(null,Vn),A=J(qn,Je,qn),F=Z(null,Un),I=Z(null,Xn),H=Z(u,Zn),O=Z(null,Yn),W=Z([],Gn),z=Z(null,Jn),V=Z(null,Qn),U=Z(!1,eo),G=Z(void 0,to),[Q,ee]=Y(!1,no),[te,ne]=Y(()=>"undefined"==typeof window,oo),[oe,re]=Y(!1,ro),[ie,le]=Y(!1,io),[ae,se]=Y(!1,lo),[ce,de]=Y(()=>o.language||"plaintext",ao),[ue,me]=Y(()=>Kt(o.language),so),[fe,he]=Y(!1,co),[pe,ye]=Y(!1,uo),[ge,be]=Y(!1,mo),[we,ve]=Y(!1,fo),[xe,ke]=Y(0,ho),{t:Se}=J(po,Ct,po);q(()=>{U.current=pe},[pe],yo);const Ce=X(()=>jr(Boolean(o.diff),u),[u,o.diff],go),[Ne,Me]=Y(()=>{const e=Number(jr(Boolean(o.diff),u)?.fontSize);return Number.isFinite(e)&&e>0?e:Er},bo),[$e,Be]=Y(Ne,wo),Ee=X(()=>!1!==N,[N],vo),Te="boolean"==typeof k?k:!0!==Ce.disableLineNumbers,Le=Z(Te,xo),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],ko);J(So,$r,()=>{const e=Number(Ce.fontSize),t=Number.isFinite(e)&&e>0?e:Er;Me(t),Be(t)},[Ce.fontSize],So);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],Co),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],No),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`)},[],Mo),Ie=K(()=>"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e())),[],$o),He=K(()=>{for(const e of W.current)try{"function"==typeof e?e():e?.dispose?.()}catch{}W.current=[],z.current?.disconnect(),z.current=null},[],Bo),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],Eo);q(()=>Xt(()=>{ke(e=>e+1)}),[],To),q(()=>{me(Kt(o.language))},[o.language],Lo);const We=Z(o,Do);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],jo),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=Lr(Ce.tabSize)??4,r=Dr(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=Rr(l)?Rr(a)?"":a:l,c=String(n?.getPropertyValue("--vscode-editor-selectionBackground")??"").trim();if(function(e,t,n,o){if(!n)return!1;const r=_r(e),i=_r(t);return o?null!=r&&r>170||null!=i&&i<110:null!=r&&r<85||null!=i&&i>190}(s,r,"plaintext"===Vt(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],Po),Ve=X(()=>r?c??m?.[0]??"vitesse-dark":d??m?.[1]??"vitesse-light",[c,r,d,m],_o),qe=K(()=>Ve,[Ve],Ro),Ue=X(()=>qe(),[qe],Ao),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],Fo),Ze=X(()=>o.diff?r?"dark":"light":Xe?"dark":"light",[r,o.diff,Xe],Io),Ye=X(()=>o.diff?"dark"===Ze:Xe,[Ze,o.diff,Xe],Ho),Ge=X(()=>o.diff?"dark"===Ze:Boolean(r),[Ze,r,o.diff],Oo),Qe=X(()=>{const e=Ce,t=Lr(e?.fontSize)??(Pe?Er:$e)??Er,n=Lr(e?.lineHeight)??(t===Er?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=Dr(e?.padding,o.diff?0:8),l=Lr(e?.tabSize)??4;return{fontFamily:r,fontSize:t,lineHeight:n,paddingBottom:i.bottom,paddingTop:i.top,tabSize:l}},[Pe,$e,o.diff,Ce],Wo),et=X(()=>!!o.diff&&"unified"===Ce.diffStyle,[o.diff,Ce],zo),tt=X(()=>({"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${Qe.lineHeight}px`,"--markstream-pre-line-number-top":`${Qe.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${Qe.fontSize}px`,lineHeight:`${Qe.lineHeight}px`,maxHeight:`${_e()}px`,overflow:"auto",paddingBottom:`${Qe.paddingBottom}px`,paddingTop:`${Qe.paddingTop}px`,tabSize:Qe.tabSize,whiteSpace:"scroll"===Ce.overflow?"pre":"pre-wrap","--markstream-code-font-family":Qe.fontFamily,fontFamily:Qe.fontFamily}),[_e,Qe,Ce.overflow],Ko),nt=K(()=>{const e=Ce.maxHeight,t={...Ce||{},...null==e?{}:{MAX_HEIGHT:e},themes:m?[...m]:void 0,stream:!1,disableFileHeader:!0,theme:Ue,disableLineNumbers:!Te,fontSize:Qe.fontSize,lineHeight:Qe.lineHeight,fontFamily:Qe.fontFamily,onThemeChange(){Ke()},themeType:r?"dark":"light"};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }","string"==typeof t.unsafeCSS?t.unsafeCSS:""].filter(Boolean).join("\n"),t},[r,Qe,Ue,Ce,Te,Ke,m],Vo),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],qo),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],Uo),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],Xo);q(()=>{ot()},[Ce,ot],Zo),q(()=>()=>{P.current+=1,E.current?.(),He(),E.current=null,L.current=null,D.current=null,j.current=null,B.current=null,I.current=null,_.current=null,R.current?.destroy?.(),R.current=null},[He],Yo),q(()=>{if("undefined"==typeof window)return;if(te)return;const e=$.current;if(!e)return;R.current?.destroy?.();const t=A(e,{rootMargin:"400px"});return R.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),R.current===t&&(R.current=null)}},[A,te],Go),q(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:B.current?(ot(),()=>{e=!1}):((async()=>{try{const t=await un();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],Jo),q(()=>{if(!o.language&&!ue&&_.current)try{const e=_.current(String(o.code??""));e&&de(e)}catch{}},[ue,o.code,o.language],Qo);const lt=X(()=>String(o.language||ue||ce||"plaintext"),[ue,ce,o.language],er),at=X(()=>Kt(lt),[lt],tr),st=X(()=>!!i&&Jt(lt),[i,lt],nr),ct=X(()=>st?"plaintext":Vt(at),[at,st],or),dt=X(()=>"plaintext"===ct,[ct],rr),ut=X(()=>Zt(at),[at,xe],ir),mt=X(()=>!!a&&("html"===at||"svg"===at),[at,a],lr),ft=X(()=>{const e=at;return e?Yt[e]||e.charAt(0).toUpperCase()+e.slice(1):Yt[""]||"Plain Text"},[at],ar),ht=X(()=>o.diff?o.updatedCode??o.code??"":o.code??"",[o.code,o.diff,o.updatedCode],sr),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],cr),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],dr),gt=X(()=>o.code.length>0||(o.originalCode?.length??0)>0||(o.updatedCode?.length??0)>0,[o.code,o.originalCode,o.updatedCode],ur),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],mr);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,Pr(n.originalCode),Pr(n.updatedCode),o)):(D.current="single",await e.createEditor(t,Pr(n.updatedCode??n.code),o)):(D.current="single",await e.createEditor(t,Pr(n.code),o)),j.current=t,P.current!==l)return;const r=Number(Ce.fontSize),i=Number.isFinite(r)&&r>0?r:Er;if(Number.isFinite(i)&&i>0){Me(i),Be(i);try{const t="diff"===D.current?e.getDiffEditorView?.():e.getEditorView?.(),n=Lr(Ce.lineHeight)??(i===Er?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],fr);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],hr),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],pr),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=Pr(o.diff?o.updatedCode??o.code:o.code);(async()=>{let n=Kt(o.language)||ue;if(!n&&_.current)try{n=Kt(_.current(t)),n&&me(n)}catch{}const r=st?"plaintext":Vt(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(Pr(o.originalCode),Pr(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],yr),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],gr),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],br),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],wr),q(()=>{Ee||Pt(!0)},[Ee],vr);const vt=K((e,t)=>{if(!Ee)return;const n=e.currentTarget;n&&!n.disabled&&jt(n,t,"top",!1,"clientX"in e&&(e.clientX,e.clientY),Ye)},[Ye,Ee],xr),xt=K(()=>{Ee&&Pt()},[Ee],kr),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],Sr),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],Cr);return x(Mr,{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(Tn,{className:"code-fallback-plain m-0",diffInline:et,node:o,showLineNumbers:Te,style:tt}):()=>x(Tr,{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(an,{code:String(o.code??""),htmlPreviewAllowScripts:n.htmlPreviewAllowScripts,htmlPreviewSandbox:n.htmlPreviewSandbox,isDark:r,onClose:()=>ve(!1)})),h8:fe?Se("common.copied")||"Copied":""})}function Fr(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=Fr(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ir(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Fr(e))&&(o&&(o+=" "),o+=t);return o}Tr.$$singleRoot=!0,Ar.$$singleRoot=!0;var Hr=0,Or=()=>import("@terrastruct/d2"),Wr=null,zr=Or;function Kr(e){zr=e,Wr=null}function Vr(e){Kr(e??Or)}function qr(){Kr(null)}function Ur(){return"function"==typeof zr}var Xr=/* @__PURE__ */W("<div><!><!></div>"),Zr=/* @__PURE__ */M(41),Yr=/* @__PURE__ */Symbol(Zr),Gr=/* @__PURE__ */Symbol(Zr+1),Jr=/* @__PURE__ */Symbol(Zr+2),Qr=/* @__PURE__ */Symbol(Zr+3),ei=/* @__PURE__ */Symbol(Zr+4),ti=/* @__PURE__ */Symbol(Zr+5),ni=/* @__PURE__ */Symbol(Zr+6),oi=/* @__PURE__ */Symbol(Zr+7),ri=/* @__PURE__ */Symbol(Zr+8),ii=/* @__PURE__ */Symbol(Zr+9),li=/* @__PURE__ */Symbol(Zr+10),ai=/* @__PURE__ */Symbol(Zr+11),si=/* @__PURE__ */Symbol(Zr+12),ci=/* @__PURE__ */Symbol(Zr+13),di=/* @__PURE__ */Symbol(Zr+14),ui=/* @__PURE__ */Symbol(Zr+15),mi=/* @__PURE__ */Symbol(Zr+16),fi=/* @__PURE__ */Symbol(Zr+17),hi=/* @__PURE__ */Symbol(Zr+18),pi=/* @__PURE__ */Symbol(Zr+19),yi=/* @__PURE__ */Symbol(Zr+20),gi=/* @__PURE__ */Symbol(Zr+21),bi=/* @__PURE__ */Symbol(Zr+22),wi=/* @__PURE__ */Symbol(Zr+23),vi=/* @__PURE__ */Symbol(Zr+24),xi=/* @__PURE__ */Symbol(Zr+25),ki=/* @__PURE__ */Symbol(Zr+26),Si=/* @__PURE__ */Symbol(Zr+27),Ci=/* @__PURE__ */Symbol(Zr+28),Ni=/* @__PURE__ */Symbol(Zr+29),Mi=/* @__PURE__ */Symbol(Zr+30),$i=/* @__PURE__ */Symbol(Zr+31),Bi=/* @__PURE__ */Symbol(Zr+32),Ei=/* @__PURE__ */Symbol(Zr+33),Ti=/* @__PURE__ */Symbol(Zr+34),Li=/* @__PURE__ */Symbol(Zr+35),Di=/* @__PURE__ */Symbol(Zr+36),ji=/* @__PURE__ */Symbol(Zr+37),Pi=/* @__PURE__ */Symbol(Zr+38),_i=/* @__PURE__ */Symbol(Zr+39),Ri=/* @__PURE__ */Symbol(Zr+40),Ai=["r","a","b"],Fi=/* @__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(Xr);{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=Ai}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)}}}),Ii={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Hi={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"},Oi=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Wi=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function zi(e){if(!e)return"";const t=e.trim();return Wi.test(t)?t:""}function Ki(e){const n={...Ii,...e},{t:o}=J(Yr,Ct,Yr),[r,i]=Y(!1,Gr),[l,a]=Y(!1,Jr),[s,c]=Y(!1,Qr),[d,u]=Y(!1,ei),[m,f]=Y(null,ti),[h,p]=Y("",ni),[y,g]=Y(null,oi),[b,w]=Y(!1,ri),[v,k]=Y(()=>"undefined"==typeof window,ii),N=Z(0,li),M=Z(null,ai),$=Z(!1,si),B=Z(!1,ci),E=Z(0,di),L=Z(null,ui),D=Z(!1,mi),j=Z(null,fi),P=Z(null,hi),_=Z(null,pi),R=Z(null,yi),A=Z(!1,gi),F=Z(()=>{},bi),I=J(wi,Je,wi),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],vi),V=X(()=>{if(O&&y)return{minHeight:`${y}px`}},[y,O],xi);q(()=>{A.current=b},[b],ki),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],Si);const U=K(()=>{const e=_.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&g(e=>e!==t?t:e)},[],Ci),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],Ni),Q=K(async()=>{if(M.current)return M.current;const e=await async function(){if(Wr)return Wr;const e=zr;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Or)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Wr=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),Wr):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)},[],Mi),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={...Hi,...e||{}}}s.salt=s.salt??function(e="markstream-octane-d2"){return`${e}-${Hr+=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(Oi.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=zi(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],$i);q(()=>{F.current=ee},[ee],Bi);const te=K(async()=>{try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(H),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[H],Ei),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],Ti),oe=K((e,t)=>{var o;(o=e.currentTarget)&&!o.disabled&&jt(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),n.isDark)},[n.isDark],Li),re=K(()=>{Pt()},[],Di);return q(()=>{G()},[H,n.loading,n.isDark,G],ji),q(()=>{n.loading||G(!0)},[n.loading,G],Pi),q(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[O,h,H,U],_i),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],Ri),x(Fi,{h0:j,h1:Ir("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:Ir("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:Ir("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:Ir("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)])))]))))})}Ki.$$singleRoot=!0;var Vi=/* @__PURE__ */W('<div class="mb-4"><dt class="definition-term font-semibold"></dt><dd class="definition-desc ml-4"></dd></div>'),qi=/* @__PURE__ */W('<dl class="definition-list"><!></dl>'),Ui=(e,t)=>`${String(indexKey??"definition")}-${t}`;function Xi(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(Vi),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?De(e.term,r,`${String(i??"definition")}-term-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.c!==n){const e=s.b;null==e||o||null===n?s.b=b(t,1,s.a,n,e):I(e,n),s.c=n}}{const n=r&&l?De(e.definition,r,`${String(i??"definition")}-desc-${a}`,l):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||s.f!==n){const e=s.e;null==e||o||null===n?s.e=b(t,2,s.d,n,e):I(e,n),s.f=n}}}var Zi=/* @__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&&(P(o.b,"data-index-key",t),o.a=t)}B(t,1,o.c,e.h1,e.h2,e.h3,Ui,Xi,18,[e.h4,e.h5,e.h6],o.d,1)});function Yi(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e,i=Array.isArray(t.items)?t.items:[];return x(Zi,{h0:r,h1:i,h2:i.map,h3:(e,t)=>S("div",{key:`${String(r??"definition")}-${t}`,className:"mb-4"},()=>T([S("dt",{className:"definition-term font-semibold"},()=>n&&o?De(e.term,n,`${String(r??"definition")}-term-${t}`,o):null),S("dd",{className:"definition-desc ml-4"},()=>n&&o?De(e.definition,n,`${String(r??"definition")}-desc-${t}`,o):null)])),h4:n,h5:r,h6:o})}Yi.$$singleRoot=!0;var Gi=/* @__PURE__ */W('<span class="emoji-node"></span>'),Ji=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Gi);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 Qi(e){const{node:t}=e;return x(Ji,{h0:t.name??t.markup})}Qi.$$singleRoot=!0;var el=/* @__PURE__ */W('<em class="emphasis-node"></em>'),tl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(el);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function nl(e){return x(tl,{h0:e.children})}nl.$$singleRoot=!0;var ol=".markdown-renderer";function rl(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(ol):null;for(;o;){const e=o.querySelector(n);if(e)return e;o=o.parentElement?.closest(ol)??null}return document.querySelector(n)}N(["click"]);var il=/* @__PURE__ */W('<a class="footnote-anchor text-sm hover:underline cursor-pointer">\n ↩︎\n </a>',3),ll=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),al=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i;const l=w(il);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 sl(e){const{node:t}=e,n=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=rl(e.currentTarget,`fnref-${String(t.id??"")}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],ll);return x(al,{h0:`#fnref-${t.id}`,h1:`返回引用 ${t.id}`,h2:n})}sl.$$singleRoot=!0;var cl=/* @__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>'),dl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(cl);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 ul(e){const{node:t,ctx:n,renderNode:o,indexKey:r}=e;return x(dl,{h0:`fnref--${t.id}`,h1:n&&o?Le(t.children,n,String(r??`footnote-${t.id}`),o):null})}ul.$$singleRoot=!0,N(["click"]);var ml=/* @__PURE__ */W('<sup class="footnote-reference"><span>\n [\n <!>\n ]\n </span></sup>'),fl=/* @__PURE__ */M(3),hl=/* @__PURE__ */Symbol(fl),pl=/* @__PURE__ */Symbol(fl+1),yl=/* @__PURE__ */Symbol(fl+2),gl=["s","h","g"],bl=/* @__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(ml);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=gl}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 wl(e){const{node:t}=e,n=X(()=>`#fnref--${t.id}`,[t.id],hl),o=X(()=>({href:n}),[n],pl),r=K(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=rl(e.currentTarget,`fnref--${t.id}`);n&&n.scrollIntoView({behavior:"smooth"})},[t.id],yl);return x(bl,{h0:`fnref-${t.id}`,h1:r,h2:o,h3:`查看脚注 ${t.id}`,h4:t.id})}wl.$$singleRoot=!0;var vl=/* @__PURE__ */W('<br class="hard-break"/>'),xl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(vl)))});function kl(e){return x(xl,{})}function Sl(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:Ir("heading-node font-semibold",`heading-${l}`,s,c),..."object"==typeof d&&null!=d?{style:d}:{},...u},()=>i??(n&&o?Le(t.children,n,String(r??`heading-${l}`),o):null))}kl.$$singleRoot=!0;var Cl=/* @__PURE__ */W('<mark class="highlight-node"></mark>'),Nl=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Cl);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 Ml(e){return x(Nl,{h0:e.children})}function $l(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Bl(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=$l(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}Ml.$$singleRoot=!0;var El=ve,Tl=ue;function Ll(e,t){return ie(e,t)}function Dl(e,t){return re(e,t)}function jl(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 Pl(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function _l(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Rl(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(Rl).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Rl(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}>${Rl(n.props.children)}</${n.type}>`}function Al(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Fl(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 Il(e,t,n){return function(e,t){return Boolean(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?te(t):t}function Hl(t,n,o,r,i,l,a,s=Fl(i)){const c=ce(t),d=l??function(e){return e.map(Rl).join("")}(o),u={type:c,tag:c,attrs:Al(n),content:d,raw:a??`${jl(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=_l(t,i);return m?e.createElement(m,{key:r,node:u}):null}var Ol=/* @__PURE__ */W("<div></div>"),Wl=/* @__PURE__ */M(22),zl=/* @__PURE__ */Symbol(Wl),Kl=/* @__PURE__ */Symbol(Wl+1),Vl=/* @__PURE__ */Symbol(Wl+2),ql=/* @__PURE__ */Symbol(Wl+3),Ul=/* @__PURE__ */Symbol(Wl+4),Xl=/* @__PURE__ */Symbol(Wl+5),Zl=/* @__PURE__ */Symbol(Wl+6),Yl=/* @__PURE__ */Symbol(Wl+7),Gl=/* @__PURE__ */Symbol(Wl+8),Jl=/* @__PURE__ */Symbol(Wl+9),Ql=/* @__PURE__ */Symbol(Wl+10),ea=/* @__PURE__ */Symbol(Wl+11),ta=/* @__PURE__ */Symbol(Wl+12),na=/* @__PURE__ */Symbol(Wl+13),oa=/* @__PURE__ */Symbol(Wl+14),ra=/* @__PURE__ */Symbol(Wl+15),ia=/* @__PURE__ */Symbol(Wl+16),la=/* @__PURE__ */Symbol(Wl+17),aa=/* @__PURE__ */Symbol(Wl+18),sa=/* @__PURE__ */Symbol(Wl+19),ca=/* @__PURE__ */Symbol(Wl+20),da=/* @__PURE__ */Symbol(Wl+21),ua=["s","e","d"],ma=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a,s;const c=w(Ol);n=e.h0,r="html-block-node",i=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=ua}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 fa(n){const{node:o,placeholder:r,customId:i}=n,l=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",a=J(zl,Je,zl),[s,c]=Y(null,Kl),d=Z(null,Vl),[u,m]=Y(()=>"undefined"==typeof window,ql),[f,h]=Y(o.content,Ul),p=Boolean(o.loading),y=G(ot,rt,rt,Xl),g=X(()=>({...n.customComponents??n.ctx?.customComponents??lt(i),...n.ctx?.htmlComponents??{}}),[i,n.ctx?.customComponents,n.ctx?.htmlComponents,n.customComponents,y],Zl),b=X(()=>({...g,...n.ctx?.streamingComponents??{}}),[g,n.ctx?.streamingComponents],Yl);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],Gl),q(()=>()=>{d.current?.destroy(),d.current=null},[],Jl),q(()=>{p&&!u||h(o.content)},[p,o.content,u],Ql);const w=X(()=>{const e=Te(fe(o.attrs??void 0,l));return e?Bl(e):void 0},[l,o.attrs],ea),v=X(()=>String(o.tag??"").trim(),[o.tag],ta),k=X(()=>ce(v),[v],na),N=X(()=>{const e=Te(fe(o.attrs??void 0,l,v));return e?Bl(e):void 0},[l,o.attrs,v],oa),M=X(()=>te(we(fe(o.attrs??void 0,l,k))),[l,o.attrs,k],ra),$=X(()=>Array.isArray(o.children)?o.children:[],[o.children],ia),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],la),L=X(()=>"escape"!==l&&Dl(o.content??"",b),[b,l,o.content],aa),D=X(()=>L&&o.content?function(t,n,o="safe",r={}){if(!t)return[];if("escape"===o)return[t];try{const i=El(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=jl(i,d,!0),m=Ll(i,n),f=Boolean(_l(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=Tl(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(Hl(i,d,[],y,r,"",u,{loading:!1,autoClosed:!1}));else if(g){const t=Il(i,h,r);b.push(e.createElement(g,{...t,key:y}))}else b.push(e.createElement(i,{...Bl(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=Ll(i,n),a=Boolean(_l(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=`${jl(t.tagName,t.attrs)}${i}</${t.tagName}>`;let m;if(t.hardBlocked)m=null;else if(t.softBlocked)m=[jl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`];else{const s=Tl(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(_l(t.tagName,r))){const e=t.tagName.toLowerCase()===d?{loading:!1,autoClosed:!1}:Fl(r);m=Hl(t.tagName,t.attrs||{},t.children,f,r,i,u,e)}else m=h?e.createElement(h,{...Il(t.tagName,s,r),key:f},...t.children):e.createElement(t.tagName,{...Bl(s),key:f,suppressHydrationWarning:!0},...t.children)}s.length>0?Pl(s[s.length-1].children,m):Pl(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=`${jl(t.tagName,t.attrs)}${i}`;if(t.softBlocked){Pl(c,[jl(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(d);continue}const u=Tl(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(_l(t.tagName,r))?Hl(t.tagName,t.attrs||{},t.children,f,r,i,d,Fl(r)):h?e.createElement(h,{...Il(t.tagName,u,r),key:f},...t.children):e.createElement(t.tagName,{...Bl(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],sa),j=X(()=>me(f??"",l),[l,f],ca),P=X(()=>B&&n.ctx&&n.renderNode?Le($,n.ctx,`${String(n.indexKey??"html-block")}-structured`,n.renderNode):null,[B,n.ctx,n.indexKey,n.renderNode,$],da),_=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(ma,{h0:c,h1:w,h2:u?L&&D?S(t,{},()=>T([D])):C(()=>x("div",{dangerouslySetInnerHTML:{__html:j}})):R})}var ha=/* @__PURE__ */W('<span class="html-inline-node"></span>'),pa=/* @__PURE__ */M(13),ya=/* @__PURE__ */Symbol(pa),ga=/* @__PURE__ */Symbol(pa+1),ba=/* @__PURE__ */Symbol(pa+2),wa=/* @__PURE__ */Symbol(pa+3),va=/* @__PURE__ */Symbol(pa+4),xa=/* @__PURE__ */Symbol(pa+5),ka=/* @__PURE__ */Symbol(pa+6),Sa=/* @__PURE__ */Symbol(pa+7),Ca=/* @__PURE__ */Symbol(pa+8),Na=/* @__PURE__ */Symbol(pa+9),Ma=/* @__PURE__ */Symbol(pa+10),$a=/* @__PURE__ */Symbol(pa+11),Ba=/* @__PURE__ */Symbol(pa+12),Ea=["r","a","b"],Ta=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(ha);{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=Ea}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)}}),La=(()=>{try{return Boolean(!1)}catch{}return!1})();function Da(e){La&&console.warn(e)}function ja(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 Pa(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function _a(e,t){for(const n of El(e)){if("tag_open"!==n.type&&"self_closing"!==n.type)continue;const e=n.tagName??"";if(Ll(e,t)&&"block"===ct(t[e]||t[e.toLowerCase()]))return!0}return!1}function Ra(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Aa(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(Aa).join("");if(!e.isValidElement(t))return"";const n=t;if("string"!=typeof n.type)return Aa(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}>${Aa(n.props.children)}</${n.type}>`}function Fa(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Ia(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 Ha(t,n,o,r,i,l,a,s,c,d){const u=Ll(t,r),m=Boolean(Ra(t,a));if(Q.has(t.toLowerCase())||!u&&!m&&ae(t,l))return null;if(!u&&!m&&le(t,l))return[ja(t,n),...o,`</${t}>`];const f=Tl(n,l,t),h=f.key,p=null!=h&&""!==h?h:i;if(m)return function(t,n,o,r,i,l,a,s=Ia(i)){const c=ce(t),d=l??function(e){return e.map(Aa).join("")}(o),u={type:c,tag:c,attrs:Fa(n),content:d,raw:a??`${ja(t,n)}${d}</${t}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);const m=Ra(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,{...Bl(f),key:p},...o)}function Oa(n){const{node:o,customId:r}=n,i=n.htmlPolicy??n.ctx?.htmlPolicy??"safe",l=Z(null,ya),[a,s]=Y(!1,ga);q(()=>{s(!0)},[],ba);const c=e.useMemo(()=>({...n.ctx?.customComponents??lt(r),...n.ctx?.htmlComponents??{}}),[r,n.ctx?.customComponents,n.ctx?.htmlComponents],wa),d=e.useMemo(()=>({...c,...n.ctx?.streamingComponents??{}}),[c,n.ctx?.streamingComponents],va),u=e.useMemo(()=>me(o.content??"",i),[i,o.content],xa),m=e.useMemo(()=>String(o.tag??"").trim(),[o.tag],ka),f=e.useMemo(()=>ce(m),[m],Sa),h=e.useMemo(()=>Array.isArray(o.children)?o.children:[],[o.children],Ca),p=e.useMemo(()=>te(we(fe(o.attrs??void 0,i,f))),[i,o.attrs,f],Na),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?Le(h,n.ctx,`${String(n.indexKey??"html-inline")}-structured`,n.renderNode):null,[g,n.ctx,n.indexKey,n.renderNode,h],Ma),w=e.useMemo(()=>{const e=o.content;if(!e)return{mode:"html",content:""};if("escape"===i)return{mode:"html",content:e};if(!Dl(e,d))return{mode:"html",content:e};const t=function(e,t,n="safe",o={}){if(!e)return[];try{return function(e,t,n="safe",o={}){let r=0;const i=o.keyPrefix??"ms-html",l=[],a=[];for(const s of e)if("text"===s.type){if(l.length>0&&l[l.length-1].hardBlocked)continue;(l.length>0?l[l.length-1].children:a).push(s.content),l.length>0&&l[l.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},c=ja(s.tagName,e,!0),d=Ll(s.tagName,t),u=Boolean(Ra(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=Ha(s.tagName,e,[],t,`${i}-${r++}`,n,o,"",c,{loading:!1,autoClosed:!1});Pa(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=Ll(s.tagName,t),i=Boolean(Ra(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=`${ja(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[ja(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const l=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Ia(o);m=Ha(s.tagName,s.attrs||{},s.children,t,`${i}-${r++}`,n,o,d,u,l)}l.length>0?Pa(l[l.length-1].children,m):Pa(a,m),l.length>0&&!s.hardBlocked&&l[l.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&l.length>c&&Da(`Auto-closing unclosed tag: <${s.tagName}>`)}else Da(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;l.length>0;){const e=l.pop(),s=e.sourceParts.join(""),c=`${ja(e.tagName,e.attrs||{})}${s}`;let d;d=e.hardBlocked?null:e.softBlocked?[ja(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Ha(e.tagName,e.attrs||{},e.children,t,`${i}-${r++}`,n,o,s,c,Ia(o)),Pa(a,d),l.length>0&&!e.hardBlocked&&l[l.length-1].sourceParts.push(c),Da(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(El(e),t,n,o)}catch(i){return r=i,La&&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:_a(e,d),nodes:t}},[c,d,i,o.autoClosed,o.content,o.loading,n.ctx,n.indexKey,n.renderNode],$a);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],Ba),!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(Ta,{h0:l,h1:{display:"inline"}}):S("span",{className:"html-inline-node html-inline-node--loading"},()=>o.content)}var Wa=/* @__PURE__ */M(5),za=/* @__PURE__ */Symbol(Wa),Ka=/* @__PURE__ */Symbol(Wa+1),Va=/* @__PURE__ */Symbol(Wa+2),qa=/* @__PURE__ */Symbol(Wa+3),Ua=/* @__PURE__ */Symbol(Wa+4),Xa={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Za(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function Ya(e){const t={...Xa,...e},n=he(t.node.src),o=he(t.fallbackSrc),r=Za(n,o,t.node.loading),[i,l]=Y(!1,za),[a,s]=Y(!1,Ka),[c,d]=Y(r.src,Va),[u,m]=Y(r.stage,qa),f=c;q(()=>{const e=Za(n,o,t.node.loading);d(e.src),m(e.stage),l(!1),s("failed"===e.stage)},[n,o,t.node.loading],Ua);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 Ga(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Ja(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 Qa(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}var es=null,ts=null,ns=/* @__PURE__ */M(42),os=/* @__PURE__ */Symbol(ns),rs=/* @__PURE__ */Symbol(ns+1),is=/* @__PURE__ */Symbol(ns+2),ls=/* @__PURE__ */Symbol(ns+3),as=/* @__PURE__ */Symbol(ns+4),ss=/* @__PURE__ */Symbol(ns+5),cs=/* @__PURE__ */Symbol(ns+6),ds=/* @__PURE__ */Symbol(ns+7),us=/* @__PURE__ */Symbol(ns+8),ms=/* @__PURE__ */Symbol(ns+9),fs=/* @__PURE__ */Symbol(ns+10),hs=/* @__PURE__ */Symbol(ns+11),ps=/* @__PURE__ */Symbol(ns+12),ys=/* @__PURE__ */Symbol(ns+13),gs=/* @__PURE__ */Symbol(ns+14),bs=/* @__PURE__ */Symbol(ns+15),ws=/* @__PURE__ */Symbol(ns+16),vs=/* @__PURE__ */Symbol(ns+17),xs=/* @__PURE__ */Symbol(ns+18),ks=/* @__PURE__ */Symbol(ns+19),Ss=/* @__PURE__ */Symbol(ns+20),Cs=/* @__PURE__ */Symbol(ns+21),Ns=/* @__PURE__ */Symbol(ns+22),Ms=/* @__PURE__ */Symbol(ns+23),$s=/* @__PURE__ */Symbol(ns+24),Bs=/* @__PURE__ */Symbol(ns+25),Es=/* @__PURE__ */Symbol(ns+26),Ts=/* @__PURE__ */Symbol(ns+27),Ls=/* @__PURE__ */Symbol(ns+28),Ds=/* @__PURE__ */Symbol(ns+29),js=/* @__PURE__ */Symbol(ns+30),Ps=/* @__PURE__ */Symbol(ns+31),_s=/* @__PURE__ */Symbol(ns+32),Rs=/* @__PURE__ */Symbol(ns+33),As=/* @__PURE__ */Symbol(ns+34),Fs=/* @__PURE__ */Symbol(ns+35),Is=/* @__PURE__ */Symbol(ns+36),Hs=/* @__PURE__ */Symbol(ns+37),Os=/* @__PURE__ */Symbol(ns+38),Ws=/* @__PURE__ */Symbol(ns+39),zs=/* @__PURE__ */Symbol(ns+40),Ks=/* @__PURE__ */Symbol(ns+41),Vs=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 Us(e){const n={...qs,...e},{t:o}=J(os,Ct,os),[r,i]=Y(!1,rs),[l,a]=Y(!1,is),[s,c]=Y(!1,ls),[d,u]=Y(!1,as),[m,f]=Y(()=>"undefined"==typeof window,ss),h=n.node.code,p=X(()=>n.maxHeight&&"none"!==n.maxHeight?Ga(n.maxHeight):null,[n.maxHeight],cs),y=X(()=>Qa(Ga(n.estimatedPreviewHeightPx)??Ja(h),void 0,p),[h,p,n.estimatedPreviewHeightPx],ds),[g,b]=Y(`${y}px`,us),[w,v]=Y(!1,ms),[N,M]=Y(!1,fs),[$,B]=Y(1,hs),[E,L]=Y({x:0,y:0},ps),[D,j]=Y(!1,ys),P=Z(null,gs),_=Z(null,bs),R=Z(null,ws),A=Z(null,vs),F=Z(null,xs),I=Z(null,ks),H=Z(null,Ss),O=Z(E,Cs);O.current=E;const W=Z($,Ns);W.current=$;const z=Z(d,Ms);z.current=d;const V=Z(w,$s);V.current=w;const U=Z(0,Bs),G=J(Es,Je,Es),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],Ts),ee=K(()=>{const e=P.current;if(!e)return;const t=e.scrollHeight;t>0&&b(Q(t))},[Q],Ls);q(()=>{s||l||b(e=>{const t=Ga(e);return null!=t&&t>=y?e:`${y}px`})},[y,l,s],Ds);const te=K(async()=>{try{await(navigator.clipboard?.writeText(h)),i(!0),n.onCopy?.(h),setTimeout(()=>i(!1),1e3)}catch{}},[h,n],js),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 ts||es||(es=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),ts=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),es)}();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],Ps);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],_s),q(()=>{!m||s||l||ne()},[h,l,ne,s,m],Rs),q(()=>()=>{U.current+=1,H.current&&(H.current.destroy?.(),H.current=null)},[],As);const oe=K(()=>{u(!1),A.current&&(A.current.innerHTML=""),F.current=null,document.body.style.overflow=""},[],Fs),re=K(()=>{u(!0),document.body.style.overflow="hidden"},[],Is);q(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&oe()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,oe],Hs),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],Os),q(()=>{d&&F.current&&(F.current.style.transform=`translate(${E.x}px, ${E.y}px) scale(${$})`)},[d,E,$],Ws);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)},[],zs);I.current||(I.current=xe({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],Ks);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:Ir("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:Ir("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([Vs,C(()=>x("span",{className:Ir("text-sm font-medium font-mono truncate",n.isDark?"text-gray-400":"text-gray-600")},"Infographic"))])),n.showModeToggle&&C(()=>S("div",{className:Ir("flex items-center gap-x-1 rounded-md p-0.5",n.isDark?"bg-gray-700":"bg-gray-100")},()=>T([C(()=>S("button",{className:Ir("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=>jt(e.currentTarget,o("common.preview")||"Preview","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},()=>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:Ir("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=>jt(e.currentTarget,o("common.source")||"Source","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},()=>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=>jt(e.currentTarget,l?o("common.expand")||"Expand":o("common.collapse")||"Collapse","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},()=>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=>jt(e.currentTarget,r?o("common.copied")||"Copied":o("common.copy")||"Copy","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},()=>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:Ir(ae,se&&"opacity-50 cursor-not-allowed"),disabled:se,onClick:ie,onMouseEnter:e=>jt(e.currentTarget,o("common.export")||"Export","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},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:Ir(ae,se&&"opacity-50 cursor-not-allowed"),disabled:se,onClick:re,onMouseEnter:e=>jt(e.currentTarget,d?o("common.minimize")||"Minimize":o("common.open")||"Open","top",!1,0,n.isDark),onMouseLeave:()=>Pt()},()=>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:Ir("p-4",n.isDark?"bg-gray-900":"bg-gray-50")},()=>C(()=>S("pre",{className:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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 Xs=/* @__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>'),Zs=/* @__PURE__ */M(6),Ys=/* @__PURE__ */Symbol(Zs),Gs=/* @__PURE__ */Symbol(Zs+1),Js=/* @__PURE__ */Symbol(Zs+2),Qs=/* @__PURE__ */Symbol(Zs+3),ec=/* @__PURE__ */Symbol(Zs+4),tc=/* @__PURE__ */Symbol(Zs+5),nc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Xs);e=n,o=d(t,n,e,null,void 0)}{const n=e.h0,r=null!==n&&("object"==typeof n||"function"==typeof n);if(r||o.c!==n){const e=o.b;null==e||r||null===n?o.b=b(t,1,o.a,n,e):I(e,n),o.c=n}}});function oc(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 rc(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}]:[],Ys),u=J(Gs,ze,Gs),m=Z(l,Js),f=Z(1,Qs),h=Z(void 0,ec);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)?oc(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],tc),x(nc,{h0:n||c.map(e=>S("span",{key:e.id,className:e.fading?Ir("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)?oc(e,t):e);var t}:void 0},()=>e.content))})}rc.$$singleRoot=!0;var ic=/* @__PURE__ */W('<ins class="insert-node"></ins>'),lc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(ic);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 ac(e){return x(lc,{h0:e.children})}ac.$$singleRoot=!0,N(["animationend"]);var sc=/* @__PURE__ */W("<span></span>"),cc=/* @__PURE__ */W("<span><!></span>"),dc=/* @__PURE__ */M(6),uc=/* @__PURE__ */Symbol(dc),mc=/* @__PURE__ */Symbol(dc+1),fc=/* @__PURE__ */Symbol(dc+2),hc=/* @__PURE__ */Symbol(dc+3),pc=/* @__PURE__ */Symbol(dc+4),yc=/* @__PURE__ */Symbol(dc+5),gc=e=>e.id;function bc(e,t,n){const[o]=n;let r=t.slots[0];if(void 0===r){let n,i,l;const a=w(sc);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?Ir("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 wc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n,r;const i=w(cc);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,gc,bc,30,[e.h4],o.d,1)});function vc(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 xc(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}]:[],uc),u=J(mc,ze,mc),m=Z(l,fc),f=Z(1,hc),h=Z(void 0,pc);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)?vc(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],yc);const p=e=>{d(t=>t.some(t=>t.id===e&&t.fading)?vc(t,e):t)};return null!=n?C(()=>S("span",{className:Ir("text-node whitespace-pre-wrap break-words",t.center&&"text-node-center")},()=>n)):x(wc,{h0:Ir("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?Ir("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 kc=/* @__PURE__ */W('<a class="link-node"></a>',3),Sc=/* @__PURE__ */M(4),Cc=/* @__PURE__ */Symbol(Sc),Nc=/* @__PURE__ */Symbol(Sc+1),Mc=/* @__PURE__ */Symbol(Sc+2),$c=/* @__PURE__ */Symbol(Sc+3),Bc=/* @__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(kc);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 Ec(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],Cc),s=X(()=>ue({href:String(t.href??"")}).href,[t.href],Nc),c="string"==typeof t.title&&t.title.trim().length>0?t.title:String(s??""),d=pe(s),u=K(e=>{i&&jt(e.currentTarget,String(t.title||s||t.text||""),"top",!1,(e.clientX,e.clientY),l)},[l,t.text,t.title,s,i],Mc),m=K(()=>{i&&Pt()},[i],$c);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(xc,{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(Bc,{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?Le(t.children,n,String(r??"link"),o):C(()=>x(xc,{node:{type:"text",content:String(t.text??"")},ctx:n,indexKey:`${String(r??"link")}-fallback`,typewriter:e.typewriter}))})}var Tc=/* @__PURE__ */W('<li class="list-item pl-1.5 my-2" dir="auto"></li>'),Lc=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(Tc);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 Dc(e){const{node:t,ctx:n,renderNode:o,value:r,indexKey:i,children:l}=e;return x(Lc,{h0:null==r?void 0:r,h1:l??(n&&o?Le(t.children,n,String(i??"list-item"),o):null)})}function jc(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&<(n.customId).list_item||Dc;return S(i,{className:Ir("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 Pc(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}Dc.$$singleRoot=!0;var _c=null,Rc=null,Ac=!1,Fc=/* @__PURE__ */new Map,Ic=/* @__PURE__ */new Map,Hc=5,Oc=/* @__PURE__ */new Set;function Wc(){if(Fc.size<Hc&&Oc.size){const e=Array.from(Oc);Oc.clear();for(const t of e)try{t()}catch{}}}function zc(e){Rc=null,(_c=e).onmessage=e=>{const{id:t,html:n,error:o}=e.data,r=Fc.get(t);if(r)if(Fc.delete(t),clearTimeout(r.timeoutId),Wc(),o)r.reject(new Error(o));else{const{content:t,displayMode:o}=e.data;if(t){const e=`${o?"d":"i"}:${t}`;if(Ic.set(e,n),Ic.size>200){const e=Ic.keys().next();e.done||Ic.delete(e.value)}}r.resolve(n)}},_c.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Fc.entries())clearTimeout(n.timeoutId),n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Fc.clear(),Wc()}}function Kc(){_c&&_c.terminate?.(),_c=null,Rc=null}function Vc(e){Ac=!!e,_c&&_c.postMessage({type:"init",debug:Ac})}var qc="WORKER_BUSY";async function Uc(e,t=!0,n=2e3,o){performance.now();const r=Pc(e);if(Rc)return Promise.reject(Rc);const i=`${t?"d":"i"}:${r}`,l=Ic.get(i);if(l)return Promise.resolve(l);const a=_c||((Rc=/* @__PURE__ */new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().")).name="WORKER_INIT_ERROR",Rc.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Rc);if(Fc.size>=Hc){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=qc,e.busy=!0,e.inFlight=Fc.size,e.max=Hc,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(()=>{Fc.delete(l);const e=/* @__PURE__ */new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),Wc()},n),c=()=>{},d=()=>{Fc.delete(l),clearTimeout(s),Oc.delete(c);const e=/* @__PURE__ */new Error("Aborted");e.name="AbortError",i(e),Wc()};o&&o.addEventListener("abort",d,{once:!0}),Fc.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:Ac})}catch(u){Fc.delete(l),clearTimeout(s),o&&o.removeEventListener("abort",d),i(u),Wc()}})}function Xc(e,t,n){const o=`${t?"d":"i"}:${Pc(e)}`;if(Ic.set(o,n),Ic.size>200){const e=Ic.keys().next();e.done||Ic.delete(e.value)}}function Zc(){Ic.clear()}function Yc(e){Hc=Math.max(1,Math.floor(e)),Wc()}function Gc(e=1500,t){return Fc.size<Hc?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(){Oc.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}),Oc.add(l)})}var Jc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Qc(e){null!=e.timeout&&(Jc.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Jc.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Jc.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Jc.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ed(){return{...Jc}}async function td(e,t=!0,n={}){const o=n.timeout??Jc.timeout,r=n.waitTimeout??Jc.waitTimeout,i=n.backoffMs??Jc.backoffMs,l=n.maxRetries??Jc.maxRetries,a=Number.isFinite(l)?Math.max(0,Math.min(Math.floor(l),8)):Jc.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 Uc(e,t,o,s)}catch(d){if("WORKER_BUSY"!==d?.code||c>=a)throw d;if(c++,await Gc(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 nd=null,od=!1;async function rd(){if(nd)return nd;if(od)return null;try{return nd=await import("katex"),await import("katex/contrib/mhchem"),nd}catch{return od=!0,null}}var id=/* @__PURE__ */W('<div class="math-block text-center overflow-x-auto relative min-h-[40px]"><div></div></div>'),ld=/* @__PURE__ */M(9),ad=/* @__PURE__ */Symbol(ld),sd=/* @__PURE__ */Symbol(ld+1),cd=/* @__PURE__ */Symbol(ld+2),dd=/* @__PURE__ */Symbol(ld+3),ud=/* @__PURE__ */Symbol(ld+4),md=/* @__PURE__ */Symbol(ld+5),fd=/* @__PURE__ */Symbol(ld+6),hd=/* @__PURE__ */Symbol(ld+7),pd=/* @__PURE__ */Symbol(ld+8),yd=["r","a","b","r","c","d"],gd=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,l,a,s;const c=w(id);{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=yd}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 bd({node:e}){const t=Z(null,ad),n=Z(null,sd),o=Z(null,cd),r=J(dd,Je,dd),[i,l]=Y(!0,ud),[a,s]=Y(()=>"undefined"==typeof window,md),c=Z(0,fd);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],hd),q(()=>{const t=Pc(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 td(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 rd();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),Xc(t,!0,a)))}catch{}}e.loading||(n.current.textContent=e.raw,l(!1))}),()=>{o=!0,r.abort()}},[e.content,e.loading,e.raw,a],pd),x(gd,{h0:t,h1:n,h2:i?"math-rendering":void 0})}bd.$$singleRoot=!0;var wd=/* @__PURE__ */W('<span class="math-inline-wrapper"><span></span><!></span>'),vd=/* @__PURE__ */M(9),xd=/* @__PURE__ */Symbol(vd),kd=/* @__PURE__ */Symbol(vd+1),Sd=/* @__PURE__ */Symbol(vd+2),Cd=/* @__PURE__ */Symbol(vd+3),Nd=/* @__PURE__ */Symbol(vd+4),Md=/* @__PURE__ */Symbol(vd+5),$d=/* @__PURE__ */Symbol(vd+6),Bd=/* @__PURE__ */Symbol(vd+7),Ed=/* @__PURE__ */Symbol(vd+8),Td=["r","a","b","r","c","d"],Ld=/* @__PURE__ */n(function(e,t,n){let r=t.slots[0];if(void 0===r){let n,i,a,s,c,d,u;const m=w(wd);{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=Td}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 Dd({node:e}){const t=Z(null,xd),n=Z(null,kd),o=Z(null,Sd),r=J(Cd,Je,Cd),[i,l]=Y(!0,Nd),[a,s]=Y(()=>"undefined"==typeof window,Md),c=Z(0,$d);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],Bd),q(()=>{const t=Pc(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 td(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 rd();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),Xc(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],Ed),x(Ld,{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 jd(e){const t="number"==typeof e?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Pd(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 _d(e,t=360,n=500){return null==n?Math.max(t,e):Math.min(Math.max(t,e),n)}function Rd(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}Dd.$$singleRoot=!0;var Ad=null,Fd=null,Id=/* @__PURE__ */new Map,Hd=5,Od=!1;function Wd(e){Od=!!e}function zd(e){Number.isFinite(e)&&e>0&&(Hd=Math.floor(e))}function Kd(){return{inFlight:Id.size,max:Hd}}var Vd="WORKER_BUSY";function qd(e){Fd=null;const t=e;(Ad=e).onmessage=e=>{if(Ad!==t)return;const{id:n,ok:o,result:r,error:i}=e.data,l=Id.get(n);l&&(!1===o||i?l.reject(new Error(i||"Unknown error")):l.resolve(r))},Ad.onerror=e=>{if(Ad===t)if(0!==Id.size){try{Od?console.error("[mermaidWorkerClient] Worker error:",e?.message||e):console.debug?.("[mermaidWorkerClient] Worker error:",e?.message||e)}catch{}for(const[t,n]of Id.entries())n.reject(/* @__PURE__ */new Error(`Worker error: ${e.message}`));Id.clear()}else console.debug?.("[mermaidWorkerClient] Worker error (no pending):",e?.message||e)},Ad.onmessageerror=e=>{if(Ad===t)if(0!==Id.size){try{Od?console.error("[mermaidWorkerClient] Worker messageerror:",e):console.debug?.("[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Id.entries())t.reject(/* @__PURE__ */new Error("Worker messageerror"));Id.clear()}else console.debug?.("[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Ud(){if(Ad)try{for(const[e,t]of Id.entries())t.reject(/* @__PURE__ */new Error("Worker cleared"));Id.clear(),Ad.terminate?.()}catch{}Ad=null,Fd=null}function Xd(e,t,n=1400){if(Fd)return Promise.reject(Fd);const o=Ad||((Fd=/* @__PURE__ */new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().")).name="WORKER_INIT_ERROR",Fd.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Fd);if(Id.size>=Hd){const e=/* @__PURE__ */new Error("Worker busy");return e.name="WorkerBusy",e.code=Vd,e.inFlight=Id.size,e.max=Hd,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),Id.delete(l))};Id.set(l,{resolve:e=>{c(),r(e)},reject:e=>{c(),i(e)}});try{o.postMessage({id:l,action:e,payload:t})}catch(d){return Id.delete(l),void i(d)}s=setTimeout(()=>{const e=/* @__PURE__ */new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",Id.get(l)?.reject(e)},n)})}async function Zd(e,t,n=1400){return Xd("canParse",{code:e,theme:t},n)}async function Yd(e,t,n=2400){return Xd("findPrefix",{code:e,theme:t},n)}function Gd(){Ad?.terminate?.(),Ad=null,Fd=null,Id.clear()}var Jd=null,Qd=!1,eu=null,tu=null;function nu(e,t){if(!e||!t)return;const n=function(e){return`${String(e?.securityLevel??"strict")}|htmlLabels:${!1===e?.flowchart?.htmlLabels?"0":"1"}`}(t);if(eu!==n)try{"function"==typeof e.initialize?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),eu=n}catch{}}var ou=/* @__PURE__ */M(69),ru=/* @__PURE__ */Symbol(ou),iu=/* @__PURE__ */Symbol(ou+1),lu=/* @__PURE__ */Symbol(ou+2),au=/* @__PURE__ */Symbol(ou+3),su=/* @__PURE__ */Symbol(ou+4),cu=/* @__PURE__ */Symbol(ou+5),du=/* @__PURE__ */Symbol(ou+6),uu=/* @__PURE__ */Symbol(ou+7),mu=/* @__PURE__ */Symbol(ou+8),fu=/* @__PURE__ */Symbol(ou+9),hu=/* @__PURE__ */Symbol(ou+10),pu=/* @__PURE__ */Symbol(ou+11),yu=/* @__PURE__ */Symbol(ou+12),gu=/* @__PURE__ */Symbol(ou+13),bu=/* @__PURE__ */Symbol(ou+14),wu=/* @__PURE__ */Symbol(ou+15),vu=/* @__PURE__ */Symbol(ou+16),xu=/* @__PURE__ */Symbol(ou+17),ku=/* @__PURE__ */Symbol(ou+18),Su=/* @__PURE__ */Symbol(ou+19),Cu=/* @__PURE__ */Symbol(ou+20),Nu=/* @__PURE__ */Symbol(ou+21),Mu=/* @__PURE__ */Symbol(ou+22),$u=/* @__PURE__ */Symbol(ou+23),Bu=/* @__PURE__ */Symbol(ou+24),Eu=/* @__PURE__ */Symbol(ou+25),Tu=/* @__PURE__ */Symbol(ou+26),Lu=/* @__PURE__ */Symbol(ou+27),Du=/* @__PURE__ */Symbol(ou+28),ju=/* @__PURE__ */Symbol(ou+29),Pu=/* @__PURE__ */Symbol(ou+30),_u=/* @__PURE__ */Symbol(ou+31),Ru=/* @__PURE__ */Symbol(ou+32),Au=/* @__PURE__ */Symbol(ou+33),Fu=/* @__PURE__ */Symbol(ou+34),Iu=/* @__PURE__ */Symbol(ou+35),Hu=/* @__PURE__ */Symbol(ou+36),Ou=/* @__PURE__ */Symbol(ou+37),Wu=/* @__PURE__ */Symbol(ou+38),zu=/* @__PURE__ */Symbol(ou+39),Ku=/* @__PURE__ */Symbol(ou+40),Vu=/* @__PURE__ */Symbol(ou+41),qu=/* @__PURE__ */Symbol(ou+42),Uu=/* @__PURE__ */Symbol(ou+43),Xu=/* @__PURE__ */Symbol(ou+44),Zu=/* @__PURE__ */Symbol(ou+45),Yu=/* @__PURE__ */Symbol(ou+46),Gu=/* @__PURE__ */Symbol(ou+47),Ju=/* @__PURE__ */Symbol(ou+48),Qu=/* @__PURE__ */Symbol(ou+49),em=/* @__PURE__ */Symbol(ou+50),tm=/* @__PURE__ */Symbol(ou+51),nm=/* @__PURE__ */Symbol(ou+52),om=/* @__PURE__ */Symbol(ou+53),rm=/* @__PURE__ */Symbol(ou+54),im=/* @__PURE__ */Symbol(ou+55),lm=/* @__PURE__ */Symbol(ou+56),am=/* @__PURE__ */Symbol(ou+57),sm=/* @__PURE__ */Symbol(ou+58),cm=/* @__PURE__ */Symbol(ou+59),dm=/* @__PURE__ */Symbol(ou+60),um=/* @__PURE__ */Symbol(ou+61),mm=/* @__PURE__ */Symbol(ou+62),fm=/* @__PURE__ */Symbol(ou+63),hm=/* @__PURE__ */Symbol(ou+64),pm=/* @__PURE__ */Symbol(ou+65),ym=/* @__PURE__ */Symbol(ou+66),gm=/* @__PURE__ */Symbol(ou+67),bm=/* @__PURE__ */Symbol(ou+68),wm="undefined"!=typeof window?U:q,vm={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function xm(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function km(e,t,n={}){if(!e)return"";const o=function(e,t){if(!e)return"";const n=be(t);return n?(xm(e),e.appendChild(n),e.innerHTML):""}(e,t);return o||n.keepPreviousOnFailure||xm(e),o}function Sm(e,t,n){if(n&&e?.querySelector("svg"))try{t?.(e)}catch{}}var Cm={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 Nm(e){const n={...Cm,...e},{t:o}=J(ru,Ct,ru),r=X(()=>Zt("mermaid"),[],iu),i=n.node?.code??"",l=X(()=>i.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[i],lu),a=n.workerTimeoutMs??Cm.workerTimeoutMs,s=n.parseTimeoutMs??Cm.parseTimeoutMs,c=n.renderTimeoutMs??Cm.renderTimeoutMs,d=n.fullRenderTimeoutMs??Cm.fullRenderTimeoutMs,u=Math.max(0,n.renderDebounceMs??Cm.renderDebounceMs),m=X(()=>n.maxHeight&&"none"!==n.maxHeight?jd(n.maxHeight):null,[n.maxHeight],au),f=X(()=>_d(jd(n.estimatedPreviewHeightPx)??Pd(l),void 0,m),[l,m,n.estimatedPreviewHeightPx],su),[h,p]=Y(!1,cu),[y,g]=Y(!1,du),[b,w]=Y(!1,uu),[v,N]=Y(!1,mu),[M,$]=Y(1,fu),[B,E]=Y({x:0,y:0},hu),[L,D]=Y(!1,pu),[j,P]=Y(!1,yu),[_,R]=Y(!1,gu),[A,F]=Y(null,bu),[I,H]=Y(!1,wu),[O,W]=Y(`${f}px`,vu),[z,V]=Y("undefined"==typeof window,xu),G=Z(null,ku),Q=Z(null,Su),ee=Z(null,Cu),te=Z(null,Nu),ne=Z(null,Mu),oe=Z(null,$u),re=Z(null,Bu),ie=Z(null,Eu),le=Z(0,Tu),ae=Z({},Lu),se=Z(null,Du),ce=Z("",ju),de=Z(!1,Pu),ue=Z(null,_u),me=Z(!1,Ru),fe=Z({zoom:1,translateX:0,translateY:0,containerHeight:O||"360px"},Au),he=Z(B,Fu);he.current=B;const pe=Z(M,Iu);pe.current=M;const ye=Z(I,Hu);ye.current=I;const ge=J(Ou,Je,Ou),be=Boolean(n.node?.loading??n.loading),we=n.isDark?"dark":"light",ve=Boolean(n.isStrict),ke=!0===n.enableMermaidInteractions,Se=X(()=>ve?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:vm,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[ve],Wu);q(()=>{me.current=_},[_],zu),q(()=>{y||b||W(e=>{const t=jd(e);return null!=t&&t>=f?e:`${f}px`})},[f,b,y],Ku),q(()=>{ae.current={}},[we,l,ve],Vu),q(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Jd)return nu(Jd,e),Jd;if(tu){const t=await tu;return t&&nu(t,e),t}if(Qd)return null;try{Qd=!0,tu=(async()=>{try{const t=await import("mermaid"),n=t?.default||t;if(!(Jd=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n))throw new Error("Mermaid module did not export expected API");return nu(Jd,e??{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Jd}catch(t){return console.warn("[markstream-octane] Failed to load mermaid:",t),null}finally{tu=null}})();const t=await tu;return t&&nu(t,e),t}catch{return null}}(Se);e||(G.current=t,p(Boolean(t)),de.current||g(!t))})(),()=>{e=!0}},[Se],qu),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],Uu),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],Xu);const Ce=K(()=>m,[m],Zu),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],Yu);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;Rd(()=>Ne(t))});return e.observe(Q.current),()=>e.disconnect()},[b,y,Ne],Gu),q(()=>{y||b||Ne()},[b,n.maxHeight,y,Ne],Ju),q(()=>()=>{Gd()},[],Qu),U(()=>{const e=ae.current[we];!y&&te.current&&e?.svg&&(km(te.current,e.svg)&&(se.current=e.bindFunctions??null,Sm(te.current,e.bindFunctions,ke)),Rd(()=>Ne()))},[ke,y,we,Ne],em);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=Bm(e,t),i=await Dm(()=>G.current.render(n,r),{timeoutMs:d,signal:o});if(!i?.svg)return!1;const l=km(te.current,i.svg);return!!l&&(se.current=i.bindFunctions??null,Sm(te.current,i.bindFunctions,ke),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)}},[ke,d,be,Ne],tm),$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=Bm(Lm(e)||e,t),i=await Dm(()=>G.current.render(o,r),{timeoutMs:c,signal:n});if(i?.svg){const e=km(te.current,i.svg,{keepPreviousOnFailure:!0});e&&(se.current=i.bindFunctions??null,Sm(te.current,i.bindFunctions,ke)),e&&Ne()}}catch{}finally{P(!1)}}},[ke,c,be,Ne],nm),Be=K(async(e,t)=>{if(!e.trim())return xm(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"===Em(e)){const i=Lm(e);if(!i.trim())return;try{if(await $m(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 $m(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 Yd(e,t,n.workerTimeout);if(o)return o}catch(r){if("AbortError"===r?.name)throw r}return Lm(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],om),Ee=K(()=>z&&!y&&!b,[b,y,z],rm);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],im);const Te=K((e,t)=>{e.clientX,e.clientY,jt(e.currentTarget,t,"top",!1,0,n.isDark)},[n.isDark],lm),Le=K(async()=>{try{await(navigator.clipboard?.writeText(l)),N(!0),n.onCopy?.(l),setTimeout(()=>N(!1),1e3)}catch{}},[l,n],am),De=K(()=>{const e=te.current?.querySelector("svg")??null;if(!e)return;const t=jm(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??jm(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],sm),je=K(()=>{re.current=null,xm(oe.current)},[],cm),Pe=K(()=>{H(!1),je()},[je],dm),_e=K(()=>{const e=te.current?.querySelector("svg")??null,t={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:e?jm(e):null};n.onOpenModal?.(t),t.defaultPrevented||H(!0)},[n],um);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],mm),J(fm,wm,()=>{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),xm(e),e.appendChild(o),Sm(e,se.current??ae.current[we]?.bindFunctions,ke)},[ke,I,we],fm),q(()=>{I&&re.current&&(re.current.style.transform=`translate(${B.x}px, ${B.y}px) scale(${M})`)},[I,B.x,B.y,M],hm);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],pm),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],ym),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=Mm(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],gm);ie.current||(ie.current=xe({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],bm);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:Ir("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:()=>Pt(),onClick:()=>$(Mm(M+.1,.5,3))},"\n +\n ")),C(()=>x("button",{type:"button",className:Ir("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:()=>Pt(),onClick:()=>$(Mm(M-.1,.5,3))},"\n −\n ")),C(()=>S("button",{type:"button",className:Ir("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:()=>Pt(),onClick:()=>{$(1),E({x:0,y:0})}},()=>T([Math.round(100*M),"\n %\n "])))]))),C(()=>S("div",{ref:Q,className:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:Ir("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:()=>Pt(),onBlur:()=>Pt()},()=>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:Ir("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:()=>Pt(),onBlur:()=>Pt()},()=>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:()=>Pt(),onBlur:()=>Pt()},()=>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:()=>Pt(),onBlur:()=>Pt()},()=>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:Ir(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:()=>Pt(),onBlur:()=>Pt()},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:Ir(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:()=>Pt(),onBlur:()=>Pt()},()=>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:Ir("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:Ir("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:Ir("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 Mm(e,t,n){return Math.min(Math.max(e,t),n)}async function $m(e,t,n){try{if(await Zd(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===l?.name)throw l}if(!n.mermaid)throw new Error("Mermaid not available");const o=Bm(e,t),r=n.mermaid;if("function"==typeof r.parse)return await Dm(()=>r.parse(o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Dm(()=>r.render(i,o),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function Bm(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function Em(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 Tm(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 Lm(e){if("gantt"===Em(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(Tm(e))break;t.pop()}else t.pop()}return t.some(Tm)?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 Dm(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 jm(e){return(new XMLSerializer).serializeToString(e)}var Pm=/* @__PURE__ */W('<div class="unknown-node text-sm text-gray-500 italic">\n Unsupported node type:\n <!><!></div>'),_m=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l;const a=w(Pm),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 Rm(e){const{node:t}=e;return x(_m,{h0:" ",h1:String(t?.type)})}function Am(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:ct(c)}}function Fm(e){return"text"===e?.type&&""===String(e?.content??"").trim()}function Im(e,t,n,o){const r=e.filter(e=>!Fm(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=>!Fm(e)):[]}(e);return 1===t.length&&"image"===t[0]?.type}(e));if(!i||r.length<=1)return Le(e,n,o,t);const l=[];for(let a=0;a<e.length;a++){const t=e[a];if(!Fm(t)){l.push(t);continue}const n=l.length>0,o=e.slice(a+1).some(e=>!Fm(e));n&&o&&l.push({...t,content:" ",raw:" "})}return l.map((e,r)=>i&&Fm(e)?String(e?.content??""):t(e,`${o}-${r}`,n))}function Hm(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??lt(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"},Im(d.slice(),r,o,`${String(i??"paragraph")}-${t}`))),d.length=0};return a.forEach((e,t)=>{const n="escape"!==(o.htmlPolicy??"safe")||"html_inline"!==e.type&&"html_block"!==e.type;Ee.has(e.type)||n&&function(e,t,n){return"block"===Am(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"},Im(a,r,o,String(i??"paragraph")))}Rm.$$singleRoot=!0,N(["click","keydown","mouseenter","mouseleave"]);var Om=/* @__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>'),Wm=/* @__PURE__ */Symbol(/* @__PURE__ */M(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(Om);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 Km(e){const{node:t}=e,n=K(n=>{e.onClick?.(n,t.id,e.messageId,e.threadId)},[t.id,e],Wm);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})}Km.$$singleRoot=!0;var Vm=/* @__PURE__ */W('<s class="strikethrough-node"></s>'),qm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Vm);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 Um(e){return x(qm,{h0:e.children})}Um.$$singleRoot=!0;var Xm=/* @__PURE__ */W('<strong class="strong-node"></strong>'),Zm=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e;const n=w(Xm);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 Ym(e){return x(Zm,{h0:e.children})}Ym.$$singleRoot=!0;var Gm=/* @__PURE__ */W('<sub class="subscript-node"></sub>'),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):I(e,n),o.c=n}}});function Qm(e){return x(Jm,{h0:e.children})}Qm.$$singleRoot=!0;var ef=/* @__PURE__ */W('<sup class="superscript-node"></sup>'),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):I(e,n),o.c=n}}});function nf(e){return x(tf,{h0:e.children})}nf.$$singleRoot=!0;var of=/* @__PURE__ */W('<th dir="auto"><!><!></th>'),rf=/* @__PURE__ */W("<tr></tr>"),lf=/* @__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>'),af=/* @__PURE__ */M(5),sf=/* @__PURE__ */Symbol(af),cf=/* @__PURE__ */Symbol(af+1),df=/* @__PURE__ */Symbol(af+2),uf=/* @__PURE__ */Symbol(af+3),mf=/* @__PURE__ */Symbol(af+4),ff=(e,t)=>`header-${t}`;function hf(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(of);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=Ir("font-semibold p-[calc(4/7*1em)]",r(e.align));m.a!==t&&(R(m.b,t),m.a=t)}{const n=i&&c?De(e.children,i,`${String(s??"table")}-th-${u}`,c):null,o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||m.f!==n){m.f=n;const e=m.e;null==e||o||null===n?m.e=z(t,1,m.c,n,m.d,!0):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 pf=(e,t)=>`row-${t}`;function yf(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(rf);e=o,n=o,d=m(t,o,void 0,e,n,null,void 0)}{const e=Ir("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:Ir("p-[calc(4/7*1em)]",l(e.align)),dir:"auto"},()=>i&&s?De(e.children,i,`${String(a??"table")}-row-${c}-${t}`,s):null)),o=null!==n&&("object"==typeof n||"function"==typeof n);if(o||d.e!==n){const e=d.d;null==e||o||null===n?d.d=b(t,1,d.c,n,e):I(e,n),d.e=n}}}var gf=["r","c","d"],bf=/* @__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(lf);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=gf}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,ff,hf,18,e.h8,r.j,1),B(t,2,r.k,e.h9,e.h10,e.h11,pf,yf,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 wf(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,sf),d=e.useRef(null,cf),u=e.useRef(null,df),[m,f]=e.useState([],uf),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],mf),x(bf,{h0:i,h1:c,h2:Ir("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:Ir("font-semibold p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>T([o&&r?De(e.children,o,`${String(i??"table")}-th-${t}`,r):null,t<l.length-1&&C(()=>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:Ir("border-[var(--table-border,#cbd5e1)]",t<s.length-1&&"border-b")},()=>e.cells?.map((e,n)=>S("td",{key:`cell-${t}-${n}`,className:Ir("p-[calc(4/7*1em)]",h(e.align)),dir:"auto"},()=>o&&r?De(e.children,o,`${String(i??"table")}-row-${t}-${n}`,r):null))),h12:s,h13:o,h14:h,h15:i,h16:r,h17:a&&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"))})}wf.$$singleRoot=!0;var vf=/* @__PURE__ */W('<hr class="hr-node thematic-break"/>'),xf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];void 0===o&&(o=r(t,w(vf)))});function kf(){return x(xf,{})}kf.$$singleRoot=!0;var Sf=/* @__PURE__ */W("<div></div>"),Cf=/* @__PURE__ */Symbol(/* @__PURE__ */M(1)),Nf=["s","d","c"],Mf=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let n,r,i,l,a;const s=w(Sf);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=Nf}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 $f(t){const{node:n,ctx:o,renderNode:r,indexKey:i}=t,l=`vmr-container vmr-container-${n.name}`,a=X(()=>{if(n.attrs)return Array.isArray(n.attrs)?Te(n.attrs):n.attrs},[n.attrs],Cf);return x(Mf,{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})}$f.$$singleRoot=!0;var Bf=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function Ef(e,t={}){const n={},o=new Set(t.omit??[]);if(!e||"object"!=typeof e)return n;const r=Object.getOwnPropertyDescriptors(e);for(const[i,l]of Object.entries(r))Bf.has(i)||o.has(i)||l.enumerable&&"value"in l&&(n[i]=l.value);return n}function Tf(t,n,o,r,...i){const l={...r,key:o,node:n};return e.createElement(t,l,...i)}function Lf(t,n,o,r,i={}){const l=Ef(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:jf,indexKey:o,typewriter:r.typewriter,fade:r.fade})}function Df(t,n,o,r,i={}){return e.createElement(t,{key:o,node:n,isDark:r.isDark,...i})}function jf(t,n,o){const r=o.customComponents??lt(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:jf,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)?Le(n.children,r,`${String(o)}-html`,jf):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:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===t.type||"html_inline"===t.type){const l=Am(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:jf,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?Tf(xc,{type:"text",content:c},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade}):Tf(Hm,{type:"paragraph",children:[{type:"text",content:c,raw:c}]},n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade})}}switch(t.type){case"text":return Tf(xc,t,n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"text_special":return Tf(xc,{type:"text",content:t.content??"",center:t.center},n,{ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"paragraph":return Tf(Hm,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"heading":return Tf(Sl,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"blockquote":return Tf(Pp,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list":return Tf(jc,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"list_item":return Tf(Dc,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"table":return Tf(wf,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"definition_list":return Tf(Yi,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote":return Tf(ul,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"footnote_reference":return Tf(wl,t,n,{});case"footnote_anchor":return Tf(sl,t,n,{});case"admonition":return Tf(He,t,n,{ctx:o,renderNode:jf,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade});case"hardbreak":return Tf(kl,t,n,{typewriter:o.typewriter,fade:o.fade});case"link":return Tf(Ec,t,n,{ctx:o,renderNode:jf,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade});case"image":return Tf(Ya,t,n,{});case"inline_code":return Tf(rc,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=Kt(i),a=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const o of[n,Kt(n),Se(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==jd(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=_d(Pd(String(e?.code??"")),void 0,"none"===n.maxHeight?null:jd(n.maxHeight)??void 0)),n}(t,o),l=a||r.mermaid;if(l)return Df(l,t,n,o,i);if(!o.renderCodeBlocksAsPre)return e.createElement(Nm,{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==Ga(n.estimatedPreviewHeightPx)&&(n.estimatedPreviewHeightPx=Qa(Ja(String(e?.code??"")),void 0,"none"===n.maxHeight?null:Ga(n.maxHeight)??void 0)),n}(t,o),l=a||r.infographic;return l?Df(l,t,n,o,i):e.createElement(Us,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...i})}if("d2"===l||"d2lang"===l){const i=a||r.d2;return i?Df(i,t,n,o,o.d2Props||{}):e.createElement(Ki,{key:n,node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}})}if(a)return Lf(a,t,n,o);const s=r.code_block;if(s)return Lf(s,t,n,o);if(o.renderCodeBlocksAsPre||"mermaid"===l){const r=Ef(o.codeBlockProps).showLineNumbers,i=o.codeBlockOptions?.disableLineNumbers,l=o.codeBlockOptions?.overflow;return e.createElement(Tn,{key:n,node:t,style:l?{whiteSpace:"scroll"===l?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof r?r:"boolean"==typeof i&&!i})}return e.createElement(Ar,{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,...Ef(o.codeBlockProps),codeBlockOptions:o.codeBlockOptions})}(t,n,o,r);case"strong":return Tf(Ym,t,n,{},Le(t.children,o,`${String(n)}-strong`,jf));case"emphasis":return Tf(nl,t,n,{},Le(t.children,o,`${String(n)}-em`,jf));case"strikethrough":return Tf(Um,t,n,{},Le(t.children,o,`${String(n)}-strike`,jf));case"highlight":return Tf(Ml,t,n,{},Le(t.children,o,`${String(n)}-highlight`,jf));case"insert":return Tf(ac,t,n,{},Le(t.children,o,`${String(n)}-insert`,jf));case"subscript":return Tf(Qm,t,n,{},Le(t.children,o,`${String(n)}-sub`,jf));case"superscript":return Tf(nf,t,n,{},Le(t.children,o,`${String(n)}-sup`,jf));case"checkbox":case"checkbox_input":return Tf(xt,t,n,{typewriter:o.typewriter,fade:o.fade});case"emoji":return Tf(Qi,t,n,{typewriter:o.typewriter,fade:o.fade});case"thematic_break":return e.createElement(kf);case"math_inline":return Tf(Dd,t,n,{});case"math_block":return Tf(bd,t,n,{});case"reference":return Tf(Km,t,n,{ctx:o,typewriter:o.typewriter,fade:o.fade});case"html_block":case"html_inline":return"html_block"===t.type?Tf(fa,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId}):Tf(Oa,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId});case"vmr_container":return Tf($f,t,n,{ctx:o,renderNode:jf,indexKey:n,typewriter:o.typewriter,fade:o.fade});case"label_open":case"label_close":return null;default:return Tf(Rm,t,n,{})}}var Pf=/* @__PURE__ */M(98),_f=/* @__PURE__ */Symbol(Pf),Rf=/* @__PURE__ */Symbol(Pf+1),Af=/* @__PURE__ */Symbol(Pf+2),Ff=/* @__PURE__ */Symbol(Pf+3),If=/* @__PURE__ */Symbol(Pf+4),Hf=/* @__PURE__ */Symbol(Pf+5),Of=/* @__PURE__ */Symbol(Pf+6),Wf=/* @__PURE__ */Symbol(Pf+7),zf=/* @__PURE__ */Symbol(Pf+8),Kf=/* @__PURE__ */Symbol(Pf+9),Vf=/* @__PURE__ */Symbol(Pf+10),qf=/* @__PURE__ */Symbol(Pf+11),Uf=/* @__PURE__ */Symbol(Pf+12),Xf=/* @__PURE__ */Symbol(Pf+13),Zf=/* @__PURE__ */Symbol(Pf+14),Yf=/* @__PURE__ */Symbol(Pf+15),Gf=/* @__PURE__ */Symbol(Pf+16),Jf=/* @__PURE__ */Symbol(Pf+17),Qf=/* @__PURE__ */Symbol(Pf+18),eh=/* @__PURE__ */Symbol(Pf+19),th=/* @__PURE__ */Symbol(Pf+20),nh=/* @__PURE__ */Symbol(Pf+21),oh=/* @__PURE__ */Symbol(Pf+22),rh=/* @__PURE__ */Symbol(Pf+23),ih=/* @__PURE__ */Symbol(Pf+24),lh=/* @__PURE__ */Symbol(Pf+25),ah=/* @__PURE__ */Symbol(Pf+26),sh=/* @__PURE__ */Symbol(Pf+27),ch=/* @__PURE__ */Symbol(Pf+28),dh=/* @__PURE__ */Symbol(Pf+29),uh=/* @__PURE__ */Symbol(Pf+30),mh=/* @__PURE__ */Symbol(Pf+31),fh=/* @__PURE__ */Symbol(Pf+32),hh=/* @__PURE__ */Symbol(Pf+33),ph=/* @__PURE__ */Symbol(Pf+34),yh=/* @__PURE__ */Symbol(Pf+35),gh=/* @__PURE__ */Symbol(Pf+36),bh=/* @__PURE__ */Symbol(Pf+37),wh=/* @__PURE__ */Symbol(Pf+38),vh=/* @__PURE__ */Symbol(Pf+39),xh=/* @__PURE__ */Symbol(Pf+40),kh=/* @__PURE__ */Symbol(Pf+41),Sh=/* @__PURE__ */Symbol(Pf+42),Ch=/* @__PURE__ */Symbol(Pf+43),Nh=/* @__PURE__ */Symbol(Pf+44),Mh=/* @__PURE__ */Symbol(Pf+45),$h=/* @__PURE__ */Symbol(Pf+46),Bh=/* @__PURE__ */Symbol(Pf+47),Eh=/* @__PURE__ */Symbol(Pf+48),Th=/* @__PURE__ */Symbol(Pf+49),Lh=/* @__PURE__ */Symbol(Pf+50),Dh=/* @__PURE__ */Symbol(Pf+51),jh=/* @__PURE__ */Symbol(Pf+52),Ph=/* @__PURE__ */Symbol(Pf+53),_h=/* @__PURE__ */Symbol(Pf+54),Rh=/* @__PURE__ */Symbol(Pf+55),Ah=/* @__PURE__ */Symbol(Pf+56),Fh=/* @__PURE__ */Symbol(Pf+57),Ih=/* @__PURE__ */Symbol(Pf+58),Hh=/* @__PURE__ */Symbol(Pf+59),Oh=/* @__PURE__ */Symbol(Pf+60),Wh=/* @__PURE__ */Symbol(Pf+61),zh=/* @__PURE__ */Symbol(Pf+62),Kh=/* @__PURE__ */Symbol(Pf+63),Vh=/* @__PURE__ */Symbol(Pf+64),qh=/* @__PURE__ */Symbol(Pf+65),Uh=/* @__PURE__ */Symbol(Pf+66),Xh=/* @__PURE__ */Symbol(Pf+67),Zh=/* @__PURE__ */Symbol(Pf+68),Yh=/* @__PURE__ */Symbol(Pf+69),Gh=/* @__PURE__ */Symbol(Pf+70),Jh=/* @__PURE__ */Symbol(Pf+71),Qh=/* @__PURE__ */Symbol(Pf+72),ep=/* @__PURE__ */Symbol(Pf+73),tp=/* @__PURE__ */Symbol(Pf+74),np=/* @__PURE__ */Symbol(Pf+75),op=/* @__PURE__ */Symbol(Pf+76),rp=/* @__PURE__ */Symbol(Pf+77),ip=/* @__PURE__ */Symbol(Pf+78),lp=/* @__PURE__ */Symbol(Pf+79),ap=/* @__PURE__ */Symbol(Pf+80),sp=/* @__PURE__ */Symbol(Pf+81),cp=/* @__PURE__ */Symbol(Pf+82),dp=/* @__PURE__ */Symbol(Pf+83),up=/* @__PURE__ */Symbol(Pf+84),mp=/* @__PURE__ */Symbol(Pf+85),fp=/* @__PURE__ */Symbol(Pf+86),hp=/* @__PURE__ */Symbol(Pf+87),pp=/* @__PURE__ */Symbol(Pf+88),yp=/* @__PURE__ */Symbol(Pf+89),gp=/* @__PURE__ */Symbol(Pf+90),bp=/* @__PURE__ */Symbol(Pf+91),wp=/* @__PURE__ */Symbol(Pf+92),vp=/* @__PURE__ */Symbol(Pf+93),xp=/* @__PURE__ */Symbol(Pf+94),kp=/* @__PURE__ */Symbol(Pf+95),Sp=/* @__PURE__ */Symbol(Pf+96),Cp=/* @__PURE__ */Symbol(Pf+97),Np={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},Mp=oe();function $p(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,o=t;return n.startLine===o.startLine&&n.endLine===o.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function Bp(e){const t=X(()=>function(e){if(!e)return{};const t={};for(const[n,o]of Object.entries(e)){const e=ce(n);e&&(t[e]=o)}return t}(e),[e],_f),n=Z(t,Rf);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 Ep=e.memo(({node:e,nodeKey:t,renderCtx:n})=>jf(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Tp=e.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:o,containerRef:r,showTypewriterCursor:i,typewriterCursorRef:l})=>{const a=J(Af,Je,Af),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],Ff),[w,v]=Y(()=>g?Math.min(t.length,u):t.length,If),k=Z(w,Hf);q(()=>{k.current=w},[w],Of);const N=g?w:t.length,[M,$]=Y(0,Wf),[B,E]=Y({start:0,end:t.length},zf),L=Z(/* @__PURE__ */new Map,Kf),[D,j]=Y(0,Vf),P=Z({},qf),_=Z(/* @__PURE__ */new Map,Uf),R=Z(/* @__PURE__ */new Map,Xf),A=Z(/* @__PURE__ */new Map,Zf),F=Z(/* @__PURE__ */new Map,Yf),I=Z(/* @__PURE__ */new Set,Gf),H=Z(w,Jf),O=Z(null,Qf),W=Z(null,eh),z=Z(null,th),V=Z(!1,nh),U=Z(null,oh),G=Z(Math.max(1,d||1),rh),Q=Z(t.length,ih),ee=Z({key:e.indexKey,total:t.length},lh),te=Z({batchSize:d,initial:u,delay:e.renderBatchDelay??16,enabled:g},ah),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],sh),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],ch);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],dh);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],uh),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},[],mh),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],fh),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],hh);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],ph),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],yh),q(()=>()=>{se();for(const e of _.current.values())e.destroy();_.current.clear()},[se],gh);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))},[],bh);q(()=>{ue(N)},[ue,N],wh),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],vh);const me=K((e,t)=>{b&&t&&(P.current[e]=!0),t&&p&&$(t=>e>t?e:t)},[b,p],xh),fe=K(e=>{const t=_.current.get(e);t&&(t.destroy(),_.current.delete(e))},[],kh),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],Sh),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],Ch),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)},[],Nh),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],Mh),be=K(e=>!(g&&e>=k.current)&&(!b||e<u||!0===P.current[e]),[b,g,u],$h),we=K(e=>t=>{e&&t.target?.closest("[data-node-index]")&&e(t)},[],Bh);q(()=>{for(const[e,t]of R.current.entries())t&&he(e,t)},[he],Eh),q(()=>{p&&w>H.current&&$(w-1),H.current=w},[w,p],Th);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(Ep,{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 Lp(t){const n={...Np,...t},o=Z(null,Lh),r=Z(/* @__PURE__ */new Map,Dh),i=Z(0,jh),l=Z(null,Ph),a=J(_h,ft,n.smoothStreamingOptions,_h),s=e.useContext(Oe),c=Z(/* @__PURE__ */new Set,Rh),[d,u]=Y(()=>!0===n.smoothStreaming,Ah);q(()=>{u(!0)},[],Fh);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],Ih),h=d&&f,p=h?a.visible:n.content??"",y=X(()=>{const e=n.parseOptions??{};return n.final??e.final},[n.final,n.parseOptions],Hh),g=n.content??"",b=m||a.source===g,w=X(()=>h&&null!=y?Boolean(y&&b&&a.caughtUp):y,[y,b,a.caughtUp,h],Oh),v=Z(null,Wh),[k,N]=Y(!1,zh),M=Z(void 0,Kh),$=Z(0,Vh),B=X(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[],qh),E=K(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&B.has(t)},[B],Uh),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},[],Xh),L=K(()=>n.nodes?.length?n.nodes.reduce((e,t)=>e+T(t),0):(n.content??"").length,[n.nodes,n.content,T],Zh),D=K(()=>{M.current&&(clearTimeout(M.current),M.current=void 0)},[],Yh),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},[],Gh),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],Jh);q(()=>{k&&requestAnimationFrame(()=>{P()})},[k,P],Qh),q(()=>()=>{D()},[D],ep);const _=m?n.nodes:p;l.current!==_&&(i.current+=1,l.current=_);const R=G(ot,rt,rt,tp),A=X(()=>lt(n.customId),[n.customId,R],np),F=J(op,Bp,n.streamingComponents,op),I=J(rp,Bp,n.htmlComponents,rp);q(()=>{c.current},[I,F],ip);const H=X(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId],lp),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],ap),W=X(()=>{const e=O;return e&&0!==e.length?oe(H,{customHtmlTags:e}):oe(H)},[H,O],sp),z=X(()=>{const e=W;return n.customMarkdownIt?n.customMarkdownIt(e):e},[W,n.customMarkdownIt],cp),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],dp),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??Mp,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],up),Q=K(()=>{const e=U[U.length-1];return!E(e)},[U,E],mp);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],fp);const ee=Z([],hp),te=V?.postTransformNodes,ne=Z(te,pp);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&&$p(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],yp),q(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!re.some(e=>"code_block"===e?.type&&"mermaid"!==Kt(String(e?.language??""))))return;const e=window.requestIdleCallback??((e,t)=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),t?.timeout??600)),t=window.cancelIdleCallback??(e=>window.clearTimeout(e)),o=e(()=>{un()},{timeout:900});return()=>t(o)},[re,n.renderCodeBlocksAsPre],gp);const ie=X(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey],bp),le=X(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips],wp),ae=X(()=>({...n.mermaidProps||{}}),[n.mermaidProps],vp),ce=X(()=>({...n.d2Props||{}}),[n.d2Props],xp),ue=X(()=>({...n.infographicProps||{}}),[n.infographicProps],kp),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],Sp);me.streamRenderVersion=i.current,me.textStreamState=r.current;const fe=Z(null,Cp);return fe.current||(fe.current={textStreamState:r.current,getStreamRenderVersion:()=>i.current}),S(We.Provider,{value:fe.current},()=>S(Oe.Provider,{value:h},()=>S(Ge,{getRoot:()=>o.current,enabled:!1!==n.viewportPriority},()=>C(()=>x(Tp,{props:n,parsedNodes:re,renderCtx:me,indexPrefix:ie,containerRef:o,showTypewriterCursor:k,typewriterCursorRef:v})))))}var Dp=/* @__PURE__ */W('<blockquote class="blockquote-node" dir="auto"></blockquote>'),jp=/* @__PURE__ */n(function(e,t,n){let o=t.slots[0];if(void 0===o){let e,n;const r=w(Dp);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 Pp(e){const{node:t,ctx:n,renderNode:o,indexKey:r,children:i}=e;return x(jp,{h0:t.cite,h1:i??(n&&o?C(()=>x(Lp,{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)})}Pp.$$singleRoot=!0;var _p=/* @__PURE__ */M(5),Rp=/* @__PURE__ */Symbol(_p),Ap=/* @__PURE__ */Symbol(_p+1),Fp=/* @__PURE__ */Symbol(_p+2),Ip=/* @__PURE__ */Symbol(_p+3),Hp=/* @__PURE__ */Symbol(_p+4);function Op(e){const t=Z(null,Rp),[n,o]=Y(!1,Ap),[r,i]=Y({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"},Fp),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],Ip);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 Ne(e.anchorEl,t.current,{placement:e.placement??"top",middleware:[$e(e.offset??8),Me(),Be({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=Ce(e.anchorEl,t.current,l),()=>{r=!0,n?.()}},[e.anchorEl,e.offset,e.placement,e.visible,n],Hp),"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{He as AdmonitionNode,Pp as BlockquoteNode,xt as CheckboxNode,Ar as CodeBlockNode,Ar as OctaneCodeBlockNode,Ki as D2BlockNode,Yi as DefinitionListNode,Qi as EmojiNode,nl as EmphasisNode,Rm as FallbackComponent,sl as FootnoteAnchorNode,ul as FootnoteNode,wl as FootnoteReferenceNode,kl as HardBreakNode,Sl as HeadingNode,Ml as HighlightNode,fa as HtmlBlockNode,Oa as HtmlInlineNode,an as HtmlPreviewFrame,Ya as ImageNode,Us as InfographicBlockNode,rc as InlineCodeNode,ac as InsertNode,Ec as LinkNode,Dc as ListItemNode,jc as ListNode,Vd as MERMAID_WORKER_BUSY_CODE,bd as MathBlockNode,Dd as MathInlineNode,Nm as MermaidBlockNode,Lp as NodeRenderer,Lp as default,Hm as ParagraphNode,Tn as PreCodeNode,Km as ReferenceNode,Um as StrikethroughNode,Ym as StrongNode,Qm as SubscriptNode,nf as SuperscriptNode,wf as TableNode,xc as TextNode,kf as ThematicBreakNode,Op as Tooltip,$f as VmrContainerNode,qc as WORKER_BUSY_CODE,Zd as canParseOffthread,st as clearGlobalCustomComponents,Zc as clearKaTeXCache,Kc as clearKaTeXWorker,Ud as clearMermaidWorker,mt as defineHtmlComponents,ut as defineStreamingComponents,qr as disableD2,Vr as enableD2,Yd as findPrefixOffthread,ct as getCustomComponentDisplay,lt as getCustomNodeComponents,ed as getKaTeXBackpressureDefaults,Zt as getLanguageIcon,Kd as getMermaidWorkerLoad,Ur as isD2Enabled,Jt as isLikelyIncompleteLanguageIdentifier,Yt as languageMap,Kt as normalizeLanguageIdentifier,Ut as preloadExtendedLanguageIcons,at as removeCustomComponents,Uc as renderKaTeXInWorker,td as renderKaTeXWithBackpressure,jf as renderNode,Vt as resolveLanguageId,it as setCustomComponents,Kr as setD2Loader,St as setDefaultI18nMap,Qc as setKaTeXBackpressureDefaults,Xc as setKaTeXCache,Yc as setKaTeXConcurrencyLimit,zc as setKaTeXWorker,Vc as setKaTeXWorkerDebug,Ht as setLanguageIconResolver,qd as setMermaidWorker,Wd as setMermaidWorkerClientDebug,zd as setMermaidWorkerMaxConcurrency,Xt as subscribeLanguageIconsRevision,Gd as terminateWorker,Ct as useSafeI18n,ft as useSmoothMarkdownStream,Gc as waitForKaTeXWorkerSlot,dt 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,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};
|