markstream-vue 0.0.12-beta.1 → 0.0.12

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/exports.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),d=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{tokenizeHtml as c,hasCustomHtmlComponents as h,sanitizeHtmlAttrs as m,BLOCKED_HTML_TAGS as f,isCustomHtmlComponentTag as p,convertHtmlAttrsToProps as v,normalizeCustomHtmlTags as g,getHtmlTagFromContent as y,shouldRenderUnknownHtmlTagAsText as w,getMarkdown as x,mergeCustomHtmlTags as k,resolveCustomHtmlTags as b,parseMarkdownToStructure as L,stripCustomHtmlWrapper as M,setDefaultMathOptions as A}from"stream-markdown-parser";import{defineComponent as _,openBlock as N,createElementBlock as B,createVNode as S,unref as C,createElementVNode as T,Fragment as E,renderList as I,toDisplayString as $,shallowRef as H,h as z,computed as W,normalizeClass as O,useAttrs as P,inject as R,ref as j,watch as F,createCommentVNode as K,nextTick as D,onBeforeUnmount as V,createBlock as U,Teleport as q,Transition as X,withCtx as G,withDirectives as Z,normalizeStyle as Y,createTextVNode as J,vShow as Q,createApp as ee,renderSlot as ne,readonly as te,defineAsyncComponent as oe,resolveDynamicComponent as le,mergeProps as re,provide as ie,withModifiers as ae,createStaticVNode as se,onMounted as ue,createSlots as de,reactive as ce,markRaw as he}from"vue";import{autoUpdate as me,offset as fe,flip as pe,shift as ve,arrow as ge,computePosition as ye}from"@floating-ui/dom";const we=["cite"],xe=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},ke=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(N(),B("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[S(C(_r),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,we))}}),[["__scopeId","data-v-07e0310e"]]);ke.install=e=>{e.component(ke.__name,ke)};const be=["aria-label"],Le={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Me={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Ae=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(N(),B("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(N(),B("svg",Me,[...t[1]||(t[1]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),T("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(N(),B("svg",Le,[...t[0]||(t[0]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,be))}),[["__scopeId","data-v-be21ab83"]]);Ae.install=e=>{e.component(Ae.__name,Ae)};const _e={class:"definition-list"},Ne={class:"definition-term"},Be={class:"definition-desc"},Se=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(N(),B("dl",_e,[(N(!0),B(E,null,I(n.node.items,(o,l)=>(N(),B(E,{key:l},[T("dt",Ne,[S(C(_r),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),T("dd",Be,[S(C(_r),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-c1b2a2e8"]]);Se.install=e=>{e.component(Se.__name,Se)};const Ce={class:"emoji-node"},Te=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(N(),B("span",Ce,$(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Te.install=e=>{e.component(Te.__name,Te)};const Ee="__global__",Ie="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",$e=(()=>{const e=globalThis;if(e[Ie])return e[Ie];const n={scopedCustomComponents:{},revision:H(0)};return e[Ie]=n,n})(),He=$e.revision;function ze(e,n){"string"==typeof e?$e.scopedCustomComponents[e]=n||{}:$e.scopedCustomComponents[Ee]=e||{},He.value++}function We(e){const n=$e.scopedCustomComponents[Ee]||{};if(!e)return n;const t=$e.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Oe(e){if(e===Ee)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete $e.scopedCustomComponents[e],He.value++}function Pe(){delete $e.scopedCustomComponents[Ee],He.value++}const Re=["id"],je=["title"],Fe=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(N(),B("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[T("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+$(e.node.id)+"]",9,je)],8,Re))}}),[["__scopeId","data-v-82cafe9f"]]);Fe.install=e=>{e.component(Fe.__name,Fe)};const Ke=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function De(e){Ke&&console.warn(e)}function Ve(e){return m(e)}function Ue(e,n,t,o,l){if(f.has(e.toLowerCase()))return null;const r=Ve(n),i=r.key,u=null!=i&&""!==i?i:l;if(function(e,n){return p(e,n)}(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){return v(e)}(r);return z(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return z(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function qe(e,n){return h(e,n)}function Xe(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],l=[];for(const r of e)if("text"===r.type)(o.length>0?o[o.length-1].children:l).push(r.content);else if("self_closing"===r.type){const e=Ue(r.tagName,r.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:l;null!=e&&i.push(e)}else if("tag_open"===r.type)o.push({tagName:r.tagName,children:[],attrs:r.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===r.type){const e=r.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const r=o.pop(),i=Ue(r.tagName,r.attrs||{},r.children,n,r.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&l.push(i),r.tagName.toLowerCase()!==e&&o.length>t&&De(`Auto-closing unclosed tag: <${r.tagName}>`)}else De(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Ue(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&l.push(t),De(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(c(e),n);return t}catch(o){return t=o,Ke&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Ge=["innerHTML"],Ze=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=W(()=>(He.value,We(n.customId))),o=_({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=W(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Xe(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!qe(e,t.value))return{mode:"html",content:e};const o=Xe(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(N(),B("span",{key:0,class:O(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[S(C(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(N(),B("span",{key:1,class:O(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},$(l.value.content),3)):(N(),B("span",{key:2,class:O(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,Ge))}}),[["__scopeId","data-v-71cd1a9f"]]);Ze.install=e=>{e.component(Ze.__name,Ze)};const Ye={class:"inline-code"},Je={key:0},Qe=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=P(),o=R("markstreamTypewriter",void 0),l=R("markstreamTextStreamState",void 0),r=W(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=W(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=W(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=j(n.node.code),u=j(""),d=j(0);function c(){return s.value+u.value}function h(e){s.value=e,u.value=""}function m(){u.value&&(s.value=c(),u.value="")}F([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,m=null!=r?r:t;return i.value?n===m?(h(n),void(o&&(null==l||l.set(o,n)))):m&&n.startsWith(m)&&n.length>m.length?(s.value=m,u.value=n.slice(m.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),F(i,e=>{e||h(c())});const f=W(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(N(),B("code",Ye,[s.value?(N(),B("span",Je,$(s.value),1)):K("",!0),u.value?(N(),B("span",{key:1,class:O(["inline-code-stream-delta",[f.value]]),onAnimationend:m},$(u.value),35)):K("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);Qe.install=e=>{e.component(Qe.__name,Qe)};const en=["id"],nn=["data-placement"],tn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){var n;const t=e,o=j(null),l=j(null),r=j({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=j({}),a=j(null!=(n=t.placement)?n:"top"),s=j(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[fe(null!=(e=t.offset)?e:6),pe(),ve({padding:6}),...l.value?[ge({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:h}=yield ye(t.anchorEl,o.value,{placement:null!=(n=t.placement)?n:"top",middleware:s,strategy:"fixed"});if(r.value.transform=`translate3d(${Math.round(u)}px, ${Math.round(d)}px, 0)`,r.value.left="0px",r.value.top="0px",a.value=c,h.arrow&&l.value){const{x:e,y:n}=h.arrow,t={top:"bottom",bottom:"top",left:"right",right:"left"}[c.split("-")[0]];i.value={left:null!=e?`${e}px`:"",top:null!=n?`${n}px`:"",[t]:"-3px"}}})}return F(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield D(),t.anchorEl&&o.value)try{const e=t.anchorEl.getBoundingClientRect();yield c();const n=r.value.transform;if(null!=t.originX&&null!=t.originY){const o=Math.abs(Number(t.originX)-e.left),l=Math.abs(Number(t.originY)-e.top);Math.hypot(o,l)>120?(r.value.transform=`translate3d(${Math.round(t.originX)}px, ${Math.round(t.originY)}px, 0)`,yield D(),s.value=!0,yield D(),r.value.transform=n):s.value=!0}else s.value=!0;u=me(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=me(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),F([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield D(),yield c())})),V(()=>{u&&u()}),(n,u)=>(N(),U(q,{to:"body"},[T("div",{class:O(["markstream-vue",{dark:e.isDark}])},[S(X,{name:"tooltip",appear:""},{default:G(()=>[Z(T("div",{id:t.id,ref_key:"tooltip",ref:o,style:Y({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[J($(e.content)+" ",1),T("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:Y(i.value)},null,12,nn)],12,en),[[Q,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),on=j(!1),ln=j(""),rn=j("top"),an=j(null),sn=j(null),un=j(null),dn=j(null),cn=j(null);let hn=null,mn=null;function fn(){hn&&(clearTimeout(hn),hn=null),mn&&(clearTimeout(mn),mn=null)}let pn=!1;function vn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!pn&&"undefined"!=typeof document)try{pn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),ee({setup:()=>()=>{var e;return z(tn,{visible:on.value,"anchor-el":an.value,content:ln.value,placement:rn.value,id:sn.value,originX:un.value,originY:dn.value,isDark:null!=(e=cn.value)?e:void 0})}}).mount(e)}catch(e){pn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),fn();const i=()=>{var o,i;sn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,an.value=e,ln.value=n,rn.value=t,un.value=null!=(o=null==l?void 0:l.x)?o:null,dn.value=null!=(i=null==l?void 0:l.y)?i:null,cn.value="boolean"==typeof r?r:null,on.value=!0;try{e.setAttribute("aria-describedby",sn.value)}catch(a){}};o?i():hn=setTimeout(i,80)}function gn(e=!1){fn();const n=()=>{if(an.value&&sn.value)try{an.value.removeAttribute("aria-describedby")}catch(e){}on.value=!1,an.value=null,sn.value=null,un.value=null,dn.value=null};e?n():mn=setTimeout(n,120)}const yn={"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.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function wn(e){Object.assign(yn,e)}function xn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return d(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=yn[e])?n: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)}}}const kn={class:"image-node-container"},bn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Ln={key:"placeholder",class:"image-placeholder"},Mn={key:1,class:"image-node__raw-text"},An={key:"error",class:"image-error"},_n=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=j(!1),r=j(!1),i=j(!1),a=W(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=W(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:h}=xn();return F(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(N(),B("span",kn,[S(X,{name:"img-switch",mode:"out-in"},{default:G(()=>{var i,m,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?K("",!0):(N(),B("span",An,[ne(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[T("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),T("span",null,$(C(h)("image.loadError")),1)],!0)])):(N(),B("span",Ln,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=T("span",{class:"image-shimmer"},null,-1))],!0):(N(),B("span",Mn,$(e.node.raw),1))])):(N(),B("img",{key:"image",src:a.value,alt:String(null!=(m=null!=(i=t.node.alt)?i:t.node.title)?m:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:O(["image-node__img",{"is-loading":!s.value&&!l.value,"is-loaded":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:C(h)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,bn))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);_n.install=e=>{e.component(_n.__name,_n)};let Nn=null,Bn=!1,Sn=En;function Cn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Tn(){try{const e=globalThis;return Cn(null==e?void 0:e.katex)}catch(e){return null}}function En(){return d(null,null,function*(){const e=Tn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Cn(n)})}function In(e){Sn=e,Nn=null,Bn=!1}function $n(e){In(null!=e?e:En)}function Hn(){In(null)}function zn(){return"function"==typeof Sn}function Wn(){var e;const n=Tn();if(n)return Nn=n,Nn;if(Nn)return Nn;const t=Sn;if(!t||t===En)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Nn=null!=(e=Cn(n))?e:n,Nn):null}catch(o){return null}}function On(){return d(this,null,function*(){var e;const n=Tn();if(n)return Nn=n,Nn;if(Nn)return Nn;if(Bn)return null;const t=Sn;if(!t)return Bn=!0,null;try{const n=yield t();if(n)return Nn=null!=(e=Cn(n))?e:n,Nn}catch(o){}return Bn=!0,null})}const Pn=H(!1);let Rn=null;const jn={key:0},Fn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Rn||(Rn=On().then(e=>{Pn.value=!!e}).catch(()=>{Pn.value=!1})),te(Pn)),o=P(),l=R("markstreamTypewriter",void 0),r=R("markstreamTextStreamState",void 0),i=R("markstreamStreamVersion",void 0),a=W(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=W(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=W(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=j(n.node.content),c=j(""),h=j(0);function m(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=m(),c.value="")}F([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=m(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),h.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),F(s,e=>{e||f(m())});const v=W(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(N(),B("span",{class:O([[C(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(N(),B("span",jn,$(d.value),1)):K("",!0),c.value?(N(),B("span",{key:1,class:O(["text-node-stream-delta",[v.value]]),onAnimationend:p},$(c.value),35)):K("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Fn.install=e=>{e.component(Fn.__name,Fn)};const Kn=oe(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return z(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield On())return(yield import("./index2.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var n,t,o,l;return z(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Dn=oe(()=>d(null,null,function*(){try{if(yield On())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t,o,l;return z(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Vn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(N(),B("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},$(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Vn.install=e=>{e.component(Vn.__name,Vn)};const Un={class:"superscript-node"},qn={key:1},Xn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,footnote_reference:Fe,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,emoji:Te,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("sup",Un,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),B(E,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(N(),U(le(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(N(),B("span",qn,$(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const Gn={class:"subscript-node"},Zn={key:1},Yn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,footnote_reference:Fe,strikethrough:nt,highlight:dt,insert:st,superscript:Xn,emoji:Te,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("sub",Gn,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),B(E,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(N(),U(le(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(N(),B("span",Zn,$(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const Jn={class:"strong-node"},Qn=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("strong",Jn,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et={class:"strikethrough-node"},nt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("del",et,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt=["href","title","aria-label","aria-hidden"],ot=["aria-hidden"],lt={class:"link-text-wrapper relative inline-flex"},rt={class:"leading-[normal] link-text"},it=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=W(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=W(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*a,a)),u={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(u["--link-color"]=n.color),u}),r={text:Fn,strong:Qn,strikethrough:nt,emphasis:ht,image:_n,html_inline:Ze,inline_code:Qe},i=W(()=>(He.value,We(n.customId))),s=P(),u=W(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const l={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(l[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,r]of Object.entries(o))n&&null!=r&&!1!==r&&(l[n]=!0===r?"":String(r));return Ve(l)}),d=W(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&gn()}const h=W(()=>{var e,t,o;const l=null==(e=n.node)?void 0:e.title;return"string"==typeof l&&l.trim().length>0?l:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var u,m;return e.node.loading?(N(),B("span",re({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},C(s),{style:l.value}),[T("span",lt,[T("span",rt,[S(C(Fn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(m=e.node.text)?m:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=T("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,ot)):(N(),B("a",re({key:0,class:"link-node",href:e.node.href,title:o.value?"":h.value,"aria-label":`Link: ${h.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(l=n.node)?void 0:l.href)||(null==(r=n.node)?void 0:r.text)||"";vn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(N(!0),B(E,null,I(e.node.children,(t,o)=>(N(),U(le(function(e){return i.value[e.type]||r[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,tt))}}}),[["__scopeId","data-v-27877c6b"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"insert-node"},st=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("ins",at,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"insert"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);st.install=e=>{e.component(st.__name,st)};const ut={class:"highlight-node"},dt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,strikethrough:nt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("mark",ut,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-36e74e6b"]]);dt.install=e=>{e.component(dt.__name,dt)};const ct={class:"emphasis-node"},ht=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),B("em",ct,[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);ht.install=e=>{e.component(ht.__name,ht)};const mt=["href","title"],ft=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(n,o)=>(N(),B("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,mt))}}),[["__scopeId","data-v-83c33a47"]]);ft.install=e=>{e.component(ft.__name,ft)};const pt=["id"],vt={class:"flex-1"},gt=/* @__PURE__ */_({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(N(),B("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[T("div",vt,[S(C(_r),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,pt))}});gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"hard-break"},wt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(N(),B("br",yt))}),[["__scopeId","data-v-50c58f70"]]);wt.install=e=>{e.component(wt.__name,wt)};const xt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=We(n.customId),o=a({text:Fn,inline_code:Qe,link:it,image:_n,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,checkbox:Ae,checkbox_input:Ae,footnote_reference:Fe,hardbreak:wt,math_inline:Kn,reference:Vn},t);return(t,l)=>(N(),U(le(`h${e.node.level}`),re({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:G(()=>[(N(!0),B(E,null,I(e.node.children,(t,l)=>(N(),U(le(o[t.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-bf120de0"]]),kt=xt;kt.install=e=>{e.component(xt.__name,xt)};const bt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=W(()=>{var e;return null!=(e=n.node)?e:n.item}),o=W(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return N(),B("li",re({class:"list-item",dir:"auto"},o.value),[S(C(_r),re({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:l[0]||(l[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])],16)}}}),[["__scopeId","data-v-b6392242"]]);bt.install=e=>{e.component(bt.__name,bt)};const Lt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=W(()=>(He.value,We(e.customId).list_item||bt));return(t,o)=>(N(),U(le(e.node.ordered?"ol":"ul"),{class:O(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:G(()=>[(N(!0),B(E,null,I(e.node.items,(l,r)=>{var i;return N(),U(le(n.value),re({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-c145570b"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const Mt=/* @__PURE__ */Symbol("ViewportPriority");function At(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?j(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let h=null;function m(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=h){try{null==a||a(h)}catch(e){}h=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),m()}}function p(){i&&null==h&&c.size&&(h=i(()=>{h=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=j(!1);let i,a=!1;const h=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:h,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v})};return ie(Mt,v),v}function _t(){var e,n;const t=R(Mt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=j(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},h=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return h?(o.set(e,{resolve:t,visible:n}),h.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const Nt={key:1,class:"html-block-node__raw"},Bt=["innerHTML"],St={key:1,class:"html-block-node__placeholder"},Ct=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=W(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=W(()=>(He.value,We(n.customId))),l=_({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=j(null),i=j("undefined"==typeof window),a=j(n.node.content),s=W(()=>{var e,t,l;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const r=null!=(t=a.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=Xe(r,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!qe(r,o.value))return{mode:"html",content:r};const s=Xe(r,o.value);return null===s?{mode:"html",content:r}:{mode:"dynamic",nodes:s}}),u=_t(),d=j(null),c=!!n.node.loading;return"undefined"!=typeof window?(F(r,e=>{var t,o;if(null==(o=null==(t=d.value)?void 0:t.destroy)||o.call(t),d.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const l=u(e,{rootMargin:"400px"});d.value=l,i.value=l.isVisible.value,l.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),F(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,V(()=>{var e,n;null==(n=null==(e=d.value)?void 0:e.destroy)||n.call(e),d.value=null}),(n,o)=>(N(),B("div",re({ref_key:"htmlRef",ref:r,class:"html-block-node"},t.value),[i.value?(N(),B(E,{key:0},["dynamic"===s.value.mode?(N(),U(C(l),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(N(),B("pre",Nt,$(s.value.content),1)):(N(),B("div",{key:2,innerHTML:a.value},null,8,Bt))],64)):(N(),B("div",St,[ne(n.$slots,"placeholder",{node:e.node},()=>[o[0]||(o[0]=T("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[1]||(o[1]=T("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[2]||(o[2]=T("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-5f7e5b65"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt={dir:"auto",class:"paragraph-node"},Et=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=We(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=W(()=>n.node.children.filter(e=>!o(e))),i=W(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=W(()=>new Set(g(n.customHtmlTags))),d=W(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function c(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":n.customHtmlTags}}const h=a({inline_code:Qe,image:_n,link:it,hardbreak:wt,emphasis:ht,strong:Qn,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,html_inline:Ze,html_block:Ct,emoji:Te,checkbox:Ae,math_inline:Kn,checkbox_input:Ae,reference:Vn,footnote_anchor:ft,footnote_reference:Fe,text:Fn},t);function m(e){var n,t,o,l;if("html_block"===e.type||"html_inline"===e.type){const r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(r&&!u.value.has(r)&&w(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");return{child:{type:"text",content:n,raw:n},component:Fn}}}return{child:e,component:h[e.type]}}return(n,t)=>(N(),B("p",Tt,[(N(!0),B(E,null,I(d.value,(n,t)=>(N(),B(E,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(N(),B(E,{key:0},[J($(l(n)),1)],64)):(N(),U(le(m(n).component),re({key:1,ref_for:!0},c(m(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Et.install=e=>{e.component(Et.__name,Et)};const It=["aria-busy","aria-label","data-language"],$t=["textContent"],Ht=/* @__PURE__ */_({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=W(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=W(()=>`language-${t.value}`),l=W(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(N(),B("pre",{class:O([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[T("code",{translate:"no",textContent:$(e.node.code)},null,8,$t)],10,It))}});Ht.install=e=>{e.component(Ht.__name,Ht)};const zt={class:"table-node-wrapper"},Wt=["aria-busy"],Ot={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Pt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=W(()=>{var e;return null!=(e=n.node.loading)&&e}),o=W(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(l,r)=>(N(),B("div",zt,[T("table",{class:O(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[T("thead",null,[T("tr",null,[(N(!0),B(E,null,I(e.node.header.cells,(e,t)=>(N(),B("th",{key:`header-${t}`,dir:"auto",class:O(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"])},[S(C(_r),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[0]||(r[0]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),T("tbody",null,[(N(!0),B(E,null,I(o.value,(e,t)=>(N(),B("tr",{key:`row-${t}`},[(N(!0),B(E,null,I(e.cells,(e,o)=>(N(),B("td",{key:`cell-${t}-${o}`,class:O(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[S(C(_r),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[1]||(r[1]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,Wt),S(X,{name:"table-node-fade"},{default:G(()=>[t.value?(N(),B("div",Ot,[ne(l.$slots,"loading",{isLoading:t.value},()=>[r[2]||(r[2]=T("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),r[3]||(r[3]=T("span",{class:"sr-only"},"Loading",-1))],!0)])):K("",!0)]),_:3})]))}}),[["__scopeId","data-v-926610d8"]]);Pt.install=e=>{e.component(Pt.__name,Pt)};const Rt={class:"hr-node"},jt=/* @__PURE__ */xe({},[["render",function(e,n){return N(),B("hr",Rt)}],["__scopeId","data-v-39b2349c"]]);jt.install=e=>{e.component(jt.__name,jt)};const Ft={class:"unknown-node"},Kt=/* @__PURE__ */_({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(N(),B("div",Ft,$(e.node.raw),1))}),Dt=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=W(()=>`vmr-container vmr-container-${n.node.name}`),o=We(n.customId),l=a({text:Fn,paragraph:Et,heading:kt,inline_code:Qe,link:it,image:_n,strong:Qn,emphasis:ht,strikethrough:nt,insert:st,subscript:Yn,superscript:Xn,checkbox:Ae,checkbox_input:Ae,hardbreak:wt,math_inline:Kn,reference:Vn,list:Lt,math_block:Dn,table:Pt},o);return(o,r)=>(N(),B("div",re({class:t.value},e.node.attrs),[(N(!0),B(E,null,I(e.node.children,(t,o)=>{return N(),U(le((r=t.type,l[r]||Kt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]);var r}),128))],16))}}),[["__scopeId","data-v-b0a43820"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Vt=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","ON","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Ut=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"];function qt(e){return e<=255?Vt[e]:1424<=e&&e<=1524?"R":1536<=e&&e<=1791?Ut[255&e]:1792<=e&&e<=2220?"AL":"L"}const Xt=/[ \t\n\r\f]+/g,Gt=/[\t\n\r\f]| {2,}|^ | $/;let Zt=null;const Yt=new RegExp("\\p{Script=Arabic}","u"),Jt=new RegExp("\\p{M}","u"),Qt=new RegExp("\\p{Nd}","u");function eo(e){return Yt.test(e)}function no(e){for(const n of e){const e=n.codePointAt(0);if(e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=196608&&e<=201551||e>=63744&&e<=64255||e>=194560&&e<=195103||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519)return!0}return!1}const to=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),oo=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),lo=/* @__PURE__ */new Set(["'","’"]),ro=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),io=/* @__PURE__ */new Set([":",".","،","؛"]),ao=/* @__PURE__ */new Set(["၏"]),so=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function uo(e){if(mo(e))return!0;let n=!1;for(const t of e)if(ro.has(t))n=!0;else if(!n||!Jt.test(t))return!1;return n}function co(e){for(const n of e)if(!to.has(n)&&!ro.has(n))return!1;return e.length>0}function ho(e){if(mo(e))return!0;for(const n of e)if(!oo.has(n)&&!lo.has(n)&&!Jt.test(n))return!1;return e.length>0}function mo(e){let n=!1;for(const t of e)if("\\"!==t&&!Jt.test(t)){if(!(oo.has(t)||ro.has(t)||lo.has(t)))return!1;n=!0}return n}function fo(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Jt.test(e))t--;else{if(!oo.has(e)&&!lo.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function po(e,n){if(0===e.length)return!1;for(const t of e)if(t!==n)return!1;return!0}function vo(e){return!(!eo(e)||0===e.length)&&io.has(e[e.length-1])}function go(e){return 0!==e.length&&ao.has(e[e.length-1])}function yo(e){if(e.length<2||" "!==e[0])return null;const n=e.slice(1);return new RegExp("^\\p{M}+$","u").test(n)?{space:" ",marks:n}:null}function wo(e){for(let n=e.length-1;n>=0;n--){const t=e[n];if(so.has(t))return!0;if(!ro.has(t))return!1}return!1}function xo(e,n){if(n.preserveOrdinarySpaces||n.preserveHardBreaks){if(" "===e)return"preserved-space";if("\t"===e)return"tab";if(n.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||"⁠"===e||"\ufeff"===e?"glue":"​"===e?"zero-width-break":"­"===e?"soft-hyphen":"text"}function ko(e,n,t,o){const l=[];let r=null,i="",a=t,s=!1,u=0;for(const d of e){const e=xo(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),r=e,i=d,a=t+u,s=c,u+=d.length):(i+=d,u+=d.length)}return null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),l}function bo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Lo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Mo(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Lo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Ao(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const _o=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),No=/^[A-Za-z0-9_]+[,:;]*$/,Bo=/[,:;]+$/;function So(e){for(const n of e)if(Qt.test(n))return!0;return!1}function Co(e){if(0===e.length)return!1;for(const n of e)if(!Qt.test(n)&&!_o.has(n))return!1;return!0}function To(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}function Eo(e,n,t="normal"){const o=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),l="pre-wrap"===o.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!Gt.test(e))return e;let n=e.replace(Xt," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===l.length)return{normalized:l,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=function(e,n,t){var o;const l=(null===Zt&&(Zt=new Intl.Segmenter(void 0,{granularity:"word"})),Zt);let r=0;const i=[],a=[],s=[],u=[];for(const h of l.segment(e))for(const e of ko(h.segment,null!=(o=h.isWordLike)&&o,h.index,t)){const t="text"===e.kind;n.carryCJKAfterClosingQuote&&t&&r>0&&"text"===s[r-1]&&no(e.text)&&no(i[r-1])&&wo(i[r-1])||t&&r>0&&"text"===s[r-1]&&co(e.text)&&no(i[r-1])||t&&r>0&&"text"===s[r-1]&&go(i[r-1])?(i[r-1]+=e.text,a[r-1]=a[r-1]||e.isWordLike):t&&r>0&&"text"===s[r-1]&&e.isWordLike&&eo(e.text)&&vo(i[r-1])?(i[r-1]+=e.text,a[r-1]=!0):t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&1===e.text.length&&"-"!==e.text&&"—"!==e.text&&po(i[r-1],e.text)||t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&(uo(e.text)||"-"===e.text&&a[r-1])?i[r-1]+=e.text:(i[r]=e.text,a[r]=e.isWordLike,s[r]=e.kind,u[r]=e.start,r++)}for(let h=1;h<r;h++)"text"===s[h]&&!a[h]&&mo(i[h])&&"text"===s[h-1]&&(i[h-1]+=i[h],a[h-1]=a[h-1]||a[h],i[h]="");for(let h=r-2;h>=0;h--)if("text"===s[h]&&!a[h]&&ho(i[h])){let e=h+1;for(;e<r&&""===i[e];)e++;e<r&&"text"===s[e]&&(i[e]=i[h]+i[e],u[e]=u[h],i[h]="")}let d=0;for(let h=0;h<r;h++){const e=i[h];0!==e.length&&(d!==h&&(i[d]=e,a[d]=a[h],s[d]=s[h],u[d]=u[h]),d++)}i.length=d,a.length=d,s.length=d,u.length=d;const c=function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let r=0;r<n.length-1;r++){if("text"!==o[r]||"text"!==o[r+1])continue;if(!no(n[r])||!no(n[r+1]))continue;const e=fo(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&No.test(i)){let a=i,s=r+1;for(;Bo.test(a)&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&No.test(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&So(n)&&Co(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&Co(i)&&So(i)){let a=i,s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Co(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!Ao(i))continue;const a=r+1;if(a>=e.len||bo(e.kinds[a]))continue;let s="";const u=e.starts[a];let d=a;for(;d<e.len&&!bo(e.kinds[d]);)s+=e.texts[d],d++;s.length>0&&(n.push(s),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!Mo(e,i))continue;let l=i+1;for(;l<e.len&&!bo(o[l]);){n[i]+=n[l],t[i]=!0;const e=n[l].includes("?");if(o[l]="text",n[l]="",l++,e)break}}let r=0;for(let i=0;i<n.length;i++){const e=n[i];0!==e.length&&(r!==i&&(n[r]=e,t[r]=t[i],o[r]=o[i],l[r]=l[i]),r++)}return n.length=r,t.length=r,o.length=r,l.length=r,{len:r,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){let i=e.texts[r],a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){let d=i;const c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d+=e.texts[r],r++;if(!(r<e.len&&"text"===e.kinds[r])){n.push(d),t.push(!1),o.push("glue"),l.push(c);continue}i=d+e.texts[r],a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){let n="";for(;r<e.len&&"glue"===e.kinds[r];)n+=e.texts[r],r++;r<e.len&&"text"===e.kinds[r]?(i+=n+e.texts[r],a=a||e.isWordLike[r],r++):i+=n}n.push(i),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:d,texts:i,isWordLike:a,kinds:s,starts:u})))))));for(let h=0;h<c.len-1;h++){const e=yo(c.texts[h]);null!==e&&("space"!==c.kinds[h]&&"preserved-space"!==c.kinds[h]||"text"!==c.kinds[h+1]||!eo(c.texts[h+1])||(c.texts[h]=e.space,c.isWordLike[h]=!1,c.kinds[h]="preserved-space"===c.kinds[h]?"preserved-space":"space",c.texts[h+1]=e.marks+c.texts[h+1],c.starts[h+1]=c.starts[h]+e.space.length))}return c}(l,n,o);return a({normalized:l,chunks:To(r,o)},r)}let Io=null;const $o=/* @__PURE__ */new Map;let Ho=null;const zo=new RegExp("\\p{Emoji_Presentation}","u"),Wo=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Oo=null;const Po=/* @__PURE__ */new Map;function Ro(){if(null!==Io)return Io;if("undefined"!=typeof OffscreenCanvas)return Io=new OffscreenCanvas(1,1).getContext("2d"),Io;if("undefined"!=typeof document)return Io=document.createElement("canvas").getContext("2d"),Io;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function jo(e,n){let t=n.get(e);return void 0===t&&(t={width:Ro().measureText(e).width,containsCJK:no(e)},n.set(e,t)),t}function Fo(){if(null!==Ho)return Ho;if("undefined"==typeof navigator)return Ho={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ho;const e=navigator.userAgent,n="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),t=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Ho={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Ho}function Ko(){return null===Oo&&(Oo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Oo}function Do(e){return zo.test(e)||e.includes("️")}function Vo(e,n,t){return 0===t?n.width:n.width-function(e,n){return void 0===n.emojiCount&&(n.emojiCount=function(e){let n=0;const t=Ko();for(const o of t.segment(e))Do(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Uo(e,n,t,o){if(void 0!==n.graphemeWidths)return n.graphemeWidths;const l=[],r=Ko();for(const i of r.segment(e)){const e=jo(i.segment,t);l.push(Vo(i.segment,e,o))}return n.graphemeWidths=l.length>1?l:null,n.graphemeWidths}function qo(e,n,t,o){if(void 0!==n.graphemePrefixWidths)return n.graphemePrefixWidths;const l=[],r=Ko();let i="";for(const a of r.segment(e)){i+=a.segment;const e=jo(i,t);l.push(Vo(i,e,o))}return n.graphemePrefixWidths=l.length>1?l:null,n.graphemePrefixWidths}function Xo(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Go(e){return"space"===e}function Zo(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function Yo(e,n,t,o){return o&&null!==n?n[t]-(t>0?n[t-1]:0):e[t]}function Jo(e,n){return e.simpleLineWalkFastPath?function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Fo(),a=i.lineFitEpsilon;let s=0,u=0,d=!1;function c(e){var o;const c=t[e];if(c>n&&null!==l[e]){const t=l[e],d=null!=(o=r[e])?o:null;u=0;for(let e=0;e<t.length;e++){const o=Yo(t,d,e,i.preferPrefixWidthsForBreakableRuns);u>0&&u+o>n+a?(s++,u=o):(0===u&&s++,u+=o)}}else u=c,s++;d=!0}for(let h=0;h<t.length;h++){const e=t[h],l=o[h];if(!d){c(h);continue}const r=u+e;if(r>n+a){if(Go(l))continue;u=0,d=!1,c(h)}else u=r}return d?s:s+1}(e,n):function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Fo(),a=i.lineFitEpsilon;let s=0,u=0,d=!1,c=0,h=0,m=-1,f=0;function p(e=c,n=h,t=u){s++,u=0,d=!1,m=-1,f=0}function v(e,n){d=!0,c=e+1,h=0,u=n}function g(e,n,t){d=!0,c=e,h=n+1,u=t}function y(e,n){d?(u+=n,c=e+1,h=0):v(e,n)}function w(e,n){Xo(o[e])&&(m=e+1,f=u-n)}function x(e){!function(e,t){var o;const s=l[e],m=null!=(o=r[e])?o:null;for(let l=t;l<s.length;l++){const t=Yo(s,m,l,i.preferPrefixWidthsForBreakableRuns);d?u+t>n+a?(p(),g(e,l,t)):(u+=t,c=e,h=l+1):g(e,l,t)}d&&c===e&&h===s.length&&(c=e+1,h=0)}(e,0)}let k=0;for(;k<t.length;){const e=t[k],r=o[k];if(d)if(u+e>n+a){if(Xo(r)){y(k,e),p(k+1,0,u-e),k++;continue}if(m>=0){p(m,0,f);continue}if(e>n&&null!==l[k]){p(),x(k),k++;continue}p()}else y(k,e),w(k,e),k++;else e>n&&null!==l[k]?x(k):v(k,e),w(k,e),k++}return d&&p(),s}(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableWidths:i,breakablePrefixWidths:a,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(0===t.length||0===d.length)return 0;const c=Fo(),h=c.lineFitEpsilon;let m=0,f=0,p=!1,v=0,g=0,y=-1,w=0,x=0,k=null;function b(){y=-1,w=0,x=0,k=null}function L(e=v,n=g,t=f){m++,f=0,p=!1,b()}function M(e,n){p=!0,v=e+1,g=0,f=n}function A(e,n,t){p=!0,v=e,g=n+1,f=t}function _(e,n){p?(f+=n,v=e+1,g=0):M(e,n)}function N(e,n){if(!Xo(r[e]))return;const t="tab"===r[e]?0:o[e],i="tab"===r[e]?n:l[e];y=e+1,w=f-n+t,x=f-n+i,k=r[e]}function B(e){S(e,0)}function S(e,t){var o;const l=i[e],r=null!=(o=a[e])?o:null;for(let i=t;i<l.length;i++){const t=Yo(l,r,i,c.preferPrefixWidthsForBreakableRuns);p?f+t>n+h?(L(),A(e,i,t)):(f+=t,v=e,g=i+1):A(e,i,t)}p&&v===e&&g===l.length&&(v=e+1,g=0)}function C(e){var t;if("soft-hyphen"!==k)return!1;const o=i[e];if(null===o)return!1;const l=c.preferPrefixWidthsForBreakableRuns&&null!=(t=a[e])?t:o,r=l!==o,{fitCount:u,fittedWidth:d}=function(e,n,t,o,l,r){let i=0,a=n;for(;i<e.length;){const s=r?n+e[i]:a+e[i];if((i+1<e.length?s+l:s)>t+o)break;a=s,i++}return{fitCount:i,fittedWidth:a}}(l,f,n,h,s,r);return 0!==u&&(f=d,v=e,g=u,b(),u===o.length?(v=e+1,g=0,!0):(L(e,u,d+s),S(e,u),!0))}function T(e){m++,b()}for(let E=0;E<d.length;E++){const e=d[E];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,b();let a=e.startSegmentIndex;for(;a<e.endSegmentIndex;){const e=r[a],d="tab"===e?Zo(f,u):t[a];if("soft-hyphen"!==e)if(p){if(f+d>n+h){const t=f+("tab"===e?0:o[a]),r=f+("tab"===e?d:l[a]);if("soft-hyphen"===k&&c.preferEarlySoftHyphenBreak&&w<=n+h){L(y,0,x);continue}if("soft-hyphen"===k&&C(a)){a++;continue}if(Xo(e)&&t<=n+h){_(a,d),L(a+1,0,r),a++;continue}if(y>=0&&w<=n+h){L(y,0,x);continue}if(d>n&&null!==i[a]){L(),B(a),a++;continue}L();continue}_(a,d),N(a,d),a++}else d>n&&null!==i[a]?B(a):M(a,d),N(a,d),a++;else p&&(v=a+1,g=0,y=a+1,w=f+s,x=f+s,k=e),a++}if(p){const n=y===e.consumedEndSegmentIndex?x:f;L(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}let Qo=null;function el(e,n,t){const o=(null===Qo&&(Qo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Qo),l=Fo(),{cache:r,emojiCorrection:i}=function(e,n){Ro().font=e;const t=function(e){let n=$o.get(e);return n||(n=/* @__PURE__ */new Map,$o.set(e,n)),n}(e),o=function(e){const n=e.match(/(\d+(?:\.\d+)?)\s*px/);return n?parseFloat(n[1]):16}(e),l=n?function(e,n){let t=Po.get(e);if(void 0!==t)return t;const o=Ro();o.font=e;const l=o.measureText("😀").width;if(t=0,l>n+.5&&"undefined"!=typeof document&&null!==document.body){const n=document.createElement("span");n.style.font=e,n.style.display="inline-block",n.style.visibility="hidden",n.style.position="absolute",n.textContent="😀",document.body.appendChild(n);const o=n.getBoundingClientRect().width;document.body.removeChild(n),l-o>.5&&(t=l-o)}return Po.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,Wo.test(a)));var a;const s=Vo("-",jo("-",r),i),u=8*Vo(" ",jo(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],h=[],m=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=[],y=t?[]:null,w=Array.from({length:e.len}),x=Array.from({length:e.len});function k(e,n,t,o,l,r,i,a){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),h.push(o),m.push(l),null==p||p.push(r),v.push(i),g.push(a),null!==y&&y.push(e)}for(let M=0;M<e.len;M++){w[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],a=e.kinds[M],u=e.starts[M];if("soft-hyphen"===a){k(n,0,s,s,a,u,null,null),x[M]=d.length;continue}if("hard-break"===a){k(n,0,0,0,a,u,null,null),x[M]=d.length;continue}if("tab"===a){k(n,0,0,0,a,u,null,null),x[M]=d.length;continue}const c=jo(n,r);if("text"===a&&c.containsCJK){let e="",t=0;for(const a of o.segment(n)){const n=a.segment;if(0===e.length){e=n,t=a.index;continue}if(oo.has(e)||to.has(n)||ro.has(n)||l.carryCJKAfterClosingQuote&&no(n)&&wo(e)){e+=n;continue}const o=Vo(e,jo(e,r),i);k(e,o,o,o,"text",u+t,null,null),e=n,t=a.index}if(e.length>0){const n=Vo(e,jo(e,r),i);k(e,n,n,n,"text",u+t,null,null)}x[M]=d.length;continue}const h=Vo(n,c,i),m="space"===a||"preserved-space"===a||"zero-width-break"===a?0:h,f="space"===a||"zero-width-break"===a?0:h;t&&n.length>1?k(n,h,m,f,a,u,Uo(n,c,r,i),l.preferPrefixWidthsForBreakableRuns?qo(n,c,r,i):null):k(n,h,m,f,a,u,null,null),x[M]=d.length}const b=function(e,n,t){var o,l,r;const i=[];for(let a=0;a<e.length;a++){const s=e[a],u=s.startSegmentIndex<n.length?n[s.startSegmentIndex]:null!=(o=t[t.length-1])?o:0,d=s.endSegmentIndex<n.length?n[s.endSegmentIndex]:null!=(l=t[t.length-1])?l:0,c=s.consumedEndSegmentIndex<n.length?n[s.consumedEndSegmentIndex]:null!=(r=t[t.length-1])?r:0;i.push({startSegmentIndex:u,endSegmentIndex:d,consumedEndSegmentIndex:c})}return i}(e.chunks,w,x),L=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=0;for(let u=0;u<n;u++){const n=qt(e.charCodeAt(u));"R"!==n&&"AL"!==n&&"AN"!==n||o++,t[u]=n}if(0===o)return null;const l=n/o<.3?0:1,r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==y?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b,segments:y}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b}}const nl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",tl=(()=>{const e=globalThis;if(e[nl])return e[nl];const n={configs:{},controllers:{},revision:H(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[nl]=n,n})();let ol=null;const ll=tl.revision;function rl(e){var n;return e&&null!=(n=tl.configs[e])?n:null}function il(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function al(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function sl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!al(r))return null;"text"===r.type?l+=String(null!=(n=r.content)?n:""):"emoji"===r.type?l+=String(null!=(o=null!=(t=r.name)?t:r.raw)?o:""):"hardbreak"===r.type&&(l+="\n")}return l.length>0?l:null}function ul(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=ol)return ol;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return ol=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),ol}catch(n){return ol=!1,!1}}())return null;try{const r=Math.round(100*n)/100,i=[null!=(o=t.whiteSpace)?o:"pre-wrap",t.font,t.lineHeight,t.wrapperOverhead,t.widthAdjustment,r,e].join("\0"),a=tl.blockEstimateCache.get(i);if(a)return tl.blockEstimateCache.delete(i),tl.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=tl.preparedCache.get(o);if(l)return tl.preparedCache.delete(o),tl.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){return el(Eo(e,Fo(),null==o?void 0:o.whiteSpace),n,!1)}(e,n,0,t)}(e,n,{whiteSpace:t});for(tl.preparedCache.set(o,{prepared:r});tl.preparedCache.size>240;){const e=tl.preparedCache.keys().next().value;if(!e)break;tl.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=Jo(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),h=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(tl.blockEstimateCache.set(i,{height:h,contentHeight:Math.round(c)});tl.blockEstimateCache.size>4e3;){const e=tl.blockEstimateCache.keys().next().value;if(!e)break;tl.blockEstimateCache.delete(e)}return{kind:"simple-text",height:h,contentHeight:Math.round(c)}}catch(r){return null}}function dl(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=sl(e.children);return o&&t.paragraph?ul(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=sl(e.children),r=t.headings[o];return l&&r?ul(l,n,r):null}if("list_item"===e.type){const r=Array.isArray(e.children)?e.children:[];if(1!==r.length||"paragraph"!==(null==(o=r[0])?void 0:o.type)||!t.listItem)return null;const i=sl(null==(l=r[0])?void 0:l.children);return i?ul(i,n,t.listItem):null}if("list"===e.type){const o=Array.isArray(e.items)?e.items:[];if(!o.length)return null;let l=Math.max(0,t.listWrapperOverhead);for(const e of o){const o=dl(e,n,t);if(!o)return null;l+=o.height}return{kind:"simple-text",height:Math.max(1,Math.round(l)),contentHeight:Math.max(1,Math.round(l))}}return null}function cl(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function hl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function ml(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=il(o.lineHeight,1.5*il(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:hl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let fl=!1,pl=null,vl=!1,gl=null;function yl(){return d(this,null,function*(){return pl||gl||(vl?null:(gl=d(null,null,function*(){try{return pl=yield import("stream-monaco"),yield function(e){return d(this,null,function*(){if(fl)return;fl=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(pl),pl}catch(e){return vl=!0,null}finally{gl=null}}),gl))})}function wl({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function xl(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function kl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function bl(e,n){var t,o;let l=0;for(const r of e){const e=kl(xl(r));e>l&&(l=e)}return wl({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const Ll='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',Ml='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',Al={id:"material",core:{"":Ml,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:Ml,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:Ll,csharp:Ll,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(e=>e.materialExtendedMap)},_l=/* @__PURE__ */new Map;let Nl="material";const Bl=/* @__PURE__ */new Map,Sl=/* @__PURE__ */new Map;let Cl=null;function Tl(e){_l.set(e.id,e)}function El(e){if(!_l.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[..._l.keys()].join(", ")}`);Nl=e,null==Cl||Cl();const n=_l.get(e);n.loadExtended&&!Bl.has(e)&&$l(n)}function Il(){return[..._l.keys()]}function $l(e){return d(this,null,function*(){var n,t,o;if(Bl.has(e.id))return null!=(n=Bl.get(e.id))?n:null;let l=Sl.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(Bl.set(e.id,n),null==Cl||Cl(),n)).catch(()=>(Bl.set(e.id,null),null)),Sl.set(e.id,l)),l})}let Hl=null;const zl=H(0);Cl=()=>{zl.value++},Tl(Al);const Wl={"":"",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",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function Ol(e){Hl=null!=e?e:null}function Pl(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=Wl[t])?n:t}function Rl(e){const n=Pl(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function jl(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=_l.get(Nl);(null==e?void 0:e.loadExtended)&&(yield $l(e))})}()})}function Fl(e){if(Hl){const n=Hl(e);if(null!=n&&""!==n)return n}return function(e){const n=_l.get(Nl);if(!n)return;const t=n.core[e];if(t)return t;const o=Bl.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!Bl.has(n.id)&&$l(n)}(Pl(e))||(null!=(t=null==(n=_l.get(Nl))?void 0:n.fallback)?t:"");var n,t}const Kl={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},Dl=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,l=t.length,r=l/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,u=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function Vl(){Dl.enable()}function Ul(){Dl.disable()}function ql(){return Dl.printReport()}function Xl(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Gl(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=ql,window.__katexPerfMonitor=Dl);const Zl={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},Yl={class:"flex items-center gap-0.5"},Jl=["aria-label"],Ql={class:"code-diff-stat removed"},er={class:"code-diff-stat added"},nr=["aria-label"],tr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},or={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},lr=["aria-pressed"],rr={key:3,class:"relative"},ir=["aria-expanded"],ar=["disabled"],sr=["disabled"],ur=["disabled"],dr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},cr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},hr={class:"code-block-shell-content"},mr={class:"code-loading-placeholder"},fr={class:"sr-only","aria-live":"polite",role:"status"},pr=/* @__PURE__ */_({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:n}){const t=j(!1),o=j(null),l=j(null),r=j({});function i(){t.value=!t.value,t.value&&(function(){const e=l.value;if(!e)return;const n=e.getBoundingClientRect(),t=getComputedStyle(e),o={position:"absolute",top:`${n.bottom+window.scrollY+4}px`,right:document.body.scrollWidth-n.right-window.scrollX+"px",zIndex:"9999"};for(const l of a){const e=t.getPropertyValue(l).trim();e&&(o[l]=e)}r.value=o}(),document.addEventListener("click",s,{once:!0,capture:!0}))}const a=["--ms-popover","--ms-popover-foreground","--code-border","--code-action-fg","--code-action-hover-bg","--code-action-hover-fg","--ms-shadow-popover","--ms-duration-fast","--ms-ease-standard","--ms-radius"];function s(e){var n,r;const i=e.target;(null==(n=o.value)?void 0:n.contains(i))||(null==(r=l.value)?void 0:r.contains(i))?document.addEventListener("click",s,{once:!0,capture:!0}):t.value=!1}const u=W(()=>d.showFontSizeButtons&&d.enableFontSizeControl||d.showExpandButton||d.isPreviewable&&d.showPreviewButton),d=e,c=n,{t:h}=xn(),m=W(()=>!1!==d.showTooltips);function f(e,n){m.value&&vn(e.currentTarget,n,"top",!1,void 0,d.isDark)}function p(){m.value&&gn()}function v(e){f(e,d.copyText?h("common.copied")||"Copied":h("common.copy")||"Copy")}const g=W(()=>{var e,n;return!!Number.isFinite(d.codeFontSize)&&(null!=(e=d.codeFontSize)?e:0)<=(null!=(n=d.codeFontMin)?n:0)}),y=W(()=>!d.fontBaselineReady||d.codeFontSize===d.defaultCodeFontSize),w=W(()=>{var e,n;return!!Number.isFinite(d.codeFontSize)&&(null!=(e=d.codeFontSize)?e:0)>=(null!=(n=d.codeFontMax)?n:100)});return(n,a)=>(N(),B(E,null,[d.showHeader?(N(),B("div",Zl,[ne(n.$slots,"header-left"),ne(n.$slots,"header-right",{},()=>[T("div",Yl,[e.diffStats?(N(),B("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[T("span",Ql,"-"+$(e.diffStats.removed),1),T("span",er,"+"+$(e.diffStats.added),1)],8,Jl)):K("",!0),d.showCopyButton?(N(),B("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?C(h)("common.copied")||"Copied":C(h)("common.copy")||"Copy",onClick:a[0]||(a[0]=e=>c("copy")),onMouseenter:a[1]||(a[1]=e=>v(e)),onFocus:a[2]||(a[2]=e=>v(e)),onMouseleave:p,onBlur:p},[e.copyText?(N(),B("svg",or,[...a[14]||(a[14]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(N(),B("svg",tr,[...a[13]||(a[13]=[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),T("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,nr)):K("",!0),d.showCollapseButton?(N(),B("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:a[3]||(a[3]=e=>c("toggleCollapse")),onMouseenter:a[4]||(a[4]=n=>f(n,e.isCollapsed?C(h)("common.expand")||"Expand":C(h)("common.collapse")||"Collapse")),onFocus:a[5]||(a[5]=n=>f(n,e.isCollapsed?C(h)("common.expand")||"Expand":C(h)("common.collapse")||"Collapse")),onMouseleave:p,onBlur:p},[(N(),B("svg",{style:Y({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...a[15]||(a[15]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,lr)):K("",!0),u.value?(N(),B("div",rr,[T("button",{ref_key:"moreBtnRef",ref:l,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":t.value,"aria-haspopup":"true",onClick:ae(i,["stop"]),onMouseenter:a[6]||(a[6]=e=>f(e,C(h)("common.more")||"More")),onFocus:a[7]||(a[7]=e=>f(e,C(h)("common.more")||"More")),onMouseleave:p,onBlur:p},[...a[16]||(a[16]=[se('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,ir),(N(),U(q,{to:"body"},[S(X,{name:"code-menu"},{default:G(()=>[t.value?(N(),B("div",{key:0,ref_key:"moreMenuRef",ref:o,style:Y([r.value,{"border-radius":"var(--ms-radius)"}]),class:"min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[d.showFontSizeButtons&&d.enableFontSizeControl?(N(),B(E,{key:0},[T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:g.value,onClick:a[8]||(a[8]=e=>c("decreaseFont"))},[a[17]||(a[17]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),T("span",null,$(C(h)("common.fontSmaller")||"Font size −"),1)],8,ar),T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:y.value,onClick:a[9]||(a[9]=e=>c("resetFont"))},[a[18]||(a[18]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),T("path",{d:"M3 3v5h5"})])],-1)),T("span",null,$(C(h)("common.fontReset")||"Font size reset"),1)],8,sr),T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:w.value,onClick:a[10]||(a[10]=e=>c("increaseFont"))},[a[19]||(a[19]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),T("span",null,$(C(h)("common.fontLarger")||"Font size +"),1)],8,ur)],64)):K("",!0),d.showExpandButton?(N(),B("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:a[11]||(a[11]=e=>{c("toggleExpand",e),t.value=!1})},[e.isExpanded?(N(),B("svg",dr,[...a[20]||(a[20]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(N(),B("svg",cr,[...a[21]||(a[21]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),T("span",null,$(e.isExpanded?C(h)("common.collapse")||"Collapse":C(h)("common.expand")||"Expand"),1)])):K("",!0),e.isPreviewable&&d.showPreviewButton?(N(),B("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:a[12]||(a[12]=e=>{c("preview"),t.value=!1})},[a[22]||(a[22]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),T("circle",{cx:"12",cy:"12",r:"3"})])],-1)),T("span",null,$(C(h)("common.preview")||"Preview"),1)])):K("",!0)],4)):K("",!0)]),_:1})]))])):K("",!0)])])])):K("",!0),Z(T("div",hr,[ne(n.$slots,"default")],512),[[Q,!(e.isCollapsed||!e.stream&&e.loading)]]),Z(T("div",mr,[ne(n.$slots,"loading",{},()=>[a[23]||(a[23]=T("div",{class:"loading-skeleton"},[T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line short"})],-1))])],512),[[Q,!e.stream&&e.loading]]),T("span",fr,$(e.copyText?C(h)("common.copied")||"Copied":""),1)],64))}}),vr={class:"code-header-main"},gr=["innerHTML"],yr={class:"code-header-copy"},wr={class:"code-header-title"},xr=["innerHTML"],kr=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=xn(),r=j(Pl(t.node.language)),i=j(!1),s=j(!1),u=j(!1),c=j(null),h=j(null),m=j(null),f=j(""),p=j(!1);let v;const g=_t(),y=j(null),w=j("undefined"==typeof window);"undefined"!=typeof window&&F(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const x=j(!0),k=j(0),b=j(14),L=j(b.value),M=W(()=>{const e=b.value,n=L.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),A=W(()=>{const e=r.value.trim().toLowerCase();return Kl[e]||e.charAt(0).toUpperCase()+e.slice(1)}),_=W(()=>(zl.value,Fl(r.value.trim().toLowerCase().split(":")[0]))),C=W(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),E=W(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),I=W(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),H=W(()=>null!=I.value&&!p.value),z=W(()=>a({fontSize:`${L.value}px`},H.value?{minHeight:`${I.value}px`}:{}));W(()=>{if(null!=I.value)return{minHeight:`${I.value}px`}});const P=W(()=>!1!==t.showTooltips);function R(){return t.isDark?t.darkTheme:t.lightTheme}function U(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`,p.value=!1}function q(){f.value="",p.value=!0}function X(){var e;const n=m.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function Z(){return d(this,null,function*(){if(yield D(),X())return void q();const e=m.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{X()&&(q(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let J,Q,ee,te,oe=null;const le=/* @__PURE__ */new Set,re=/* @__PURE__ */new Set,ie=void 0!==import.meta&&Boolean(!1);let ae=null;function se(e,n){return d(this,null,function*(){if(!J)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),l=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return l?!te||te.has(l)?l:(n&&ie&&!le.has(l)&&(le.add(l),console.warn(`[MarkdownCodeBlockNode] Language "${l}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield J.updateCode(e,t)}catch(o){"plaintext"!==t?(ie&&!re.has(t)&&(re.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield J.updateCode(e,"plaintext")):ie&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function ce(e){if(!ee)return;const n=Array.isArray(e)?e.join("\0"):"";oe!==n&&(ee({themes:e}),oe=n)}function he(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!Q)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");Q=e.createShikiStreamRenderer,ee=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;te=n?new Set(n.map(e=>e.toLowerCase())):void 0,ce(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),h.value&&m.value?(ce(t.themes),!J&&Q&&(J=Q(m.value,{theme:R()}),p.value=!0),J?!1===t.stream&&t.loading?U(t.node.code):(U(t.node.code),yield se(t.node.code,r.value),yield Z()):U(t.node.code)):U(t.node.code)):U(t.node.code)})}function me(){const e=h.value;if(!e||s.value)return;const n=e.scrollTop;n<k.value?x.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(x.value=!0),k.value=n}function fe(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function pe(e){if(s.value=!s.value,e&&P.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&vn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=h.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="",n.style.overflow="auto",x.value=!0,D(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}function ve(){u.value=!u.value}function ge(){const e=Math.min(36,L.value+1);L.value=e}function ye(){const e=Math.max(10,L.value-1);L.value=e}function we(){L.value=b.value}function xe(){if(!C.value)return;const e=(r.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return ue(()=>{w.value?he():U(t.node.code)}),V(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),F(()=>t.themes,()=>d(null,null,function*(){ce(t.themes)})),F(()=>t.loading,e=>{e||(w.value?he():U(t.node.code))}),F(()=>w.value,e=>{e&&he()}),F(P,e=>{e||gn()}),F(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=Pl(n);o!==r.value&&(r.value=o),w.value&&h.value&&m.value?(J||(U(e),yield he()),J&&e&&(!1===t.stream&&t.loading||(U(e),yield se(e,n),yield Z()))):U(e)})),F(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&h.value&&m.value&&(J||(yield he()),null==J||J.setTheme(R()))})),F(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!x.value)return;yield D();const e=h.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(N(),B("div",{ref_key:"container",ref:c,style:Y(E.value),class:O(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[S(pr,{"show-header":t.showHeader,"show-collapse-button":t.showCollapseButton,"show-font-size-buttons":t.showFontSizeButtons,"enable-font-size-control":t.enableFontSizeControl,"show-copy-button":t.showCopyButton,"show-expand-button":t.showExpandButton,"show-preview-button":t.showPreviewButton,"show-tooltips":t.showTooltips,"is-dark":t.isDark,loading:t.loading,stream:t.stream,"is-collapsed":u.value,"is-expanded":s.value,"copy-text":i.value,"is-previewable":C.value,"code-font-size":L.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":b.value,"font-baseline-ready":M.value,onToggleCollapse:ve,onDecreaseFont:ye,onResetFont:we,onIncreaseFont:ge,onCopy:fe,onToggleExpand:pe,onPreview:xe},de({"header-left":G(()=>[ne(n.$slots,"header-left",{},()=>[T("div",vr,[T("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:_.value},null,8,gr),T("div",yr,[T("div",wr,$(A.value),1)])])],!0)]),loading:G(()=>[ne(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=T("div",{class:"loading-skeleton"},[T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line short"})],-1))],!0)]),default:G(()=>[T("div",{ref_key:"codeBlockContent",ref:h,class:"code-block-content",style:Y(z.value),onScroll:me},[T("div",{ref_key:"rendererTarget",ref:m,class:"code-block-render"},null,512),p.value?K("",!0):(N(),B("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,xr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:G(()=>[ne(n.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready"])],6))}}),[["__scopeId","data-v-fb3160fa"]]);kr.install=e=>{e.component(kr.__name,kr)};const br=["data-custom-id"],Lr={class:"m-0 p-0"},Mr=["data-probe"],Ar=["data-node-index","data-node-type"],_r=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=j(),u=j(null),c=j(null),h=j(null),m=ce({1:null,2:null,3:null,4:null,5:null,6:null}),f=j(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=W(()=>l.debugPerformance&&v&&"undefined"!=typeof console),A=P(),_=/* @__PURE__ */new Map,$=j(0),H=j(0),z=j({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),R=W(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=A.showTooltips)?e:A["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function q(e,n){g.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function Z(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function J(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function Q(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let l=n;for(;l&&l!==t.body&&l!==o;){if(Z(window.getComputedStyle(l))&&J(l))return l;l=l.parentElement}return null}ie("markstreamShowTooltips",R),ie("markstreamTypewriter",W(()=>!1!==l.typewriter)),ie("markstreamTextStreamState",_),ie("markstreamStreamVersion",$),F([()=>l.content,()=>l.nodes],()=>{$.value+=1},{immediate:!0});const ee=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,ne=x(ee),te=/* @__PURE__ */new Map,ae=W(()=>(He.value,We(l.customId))),se=W(()=>{var e;return k(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ue=W(()=>{const{key:e,tags:n}=b(se.value);if(!e)return ne;const t=te.get(e);if(t)return t;const o=x(ee,{customHtmlTags:n});return te.set(e,o),o}),de=W(()=>{const e=ue.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),me=W(()=>{var e,n;const t=null!=(e=l.parseOptions)?e:{},o=null!=(n=l.final)?n:t.final,r=se.value,i=null!=o,s=r.length>0;return i||s?a(a(a({},t),i?{final:o}:{}),s?{customHtmlTags:r}:{}):t}),fe=W(()=>{var e;const n=null!=(e=me.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),pe=W(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return he(l.nodes.slice());if(l.content){const e=g.value?performance.now():0,n=L(l.content,de.value,me.value);return g.value&&q("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),he(n)}return[]}),ve=j(null),ge=j(null),ye=j(null),we=j(null),xe=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),be=!xe&&l.customId?rl(l.customId):null,Le=W(()=>be?(ll.value,rl(l.customId)):null),Me=W(()=>{var e;return Boolean(v&&l.customId&&!xe&&(null==(e=Le.value)?void 0:e.enabled))}),_e=W(()=>{var e;return Me.value&&!1!==(null==(e=Le.value)?void 0:e.textEstimation)}),Ne=W(()=>{var e;return Me.value&&!1!==(null==(e=Le.value)?void 0:e.codeBlockEstimation)}),Be=W(()=>{var e;return Math.max(320,H.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ce=W(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Ee=W(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&pe.value.length>Ce.value}),Ie=W(()=>Ee.value||Me.value),$e=W(()=>!1!==l.viewportPriority&&!f.value),ze=At(e=>{var n;return Q(null!=(n=null!=e?e:i.value)?n:null)},$e),Oe=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,Pe=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,Re="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,je="test"===(null==Re?void 0:Re.NODE_ENV),Ke=v&&"function"==typeof window.requestIdleCallback,De=W(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Ve=W(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:De.value);return Number.isFinite(n)?Math.max(0,n):De.value}),Ue=W(()=>!1!==l.batchRendering&&De.value>0&&v&&!je),qe=j(0),Xe=j({key:l.indexKey,total:0}),Ge=j(Math.max(1,De.value||1)),Ye=j(/* @__PURE__ */new Set),Je=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map,nn=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new WeakMap,rn=j(0),an=W(()=>(rn.value,Array.from(tn.entries()).sort((e,n)=>e[0]-n[0]))),sn=j(0),un=j([]),dn=j([]),cn=j(null),hn=j(null);let mn=null,fn=[],pn=null,vn=null;const gn=W(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Ee.value&&!(pe.value.length>900)&&$e.value}),yn=W(()=>{var e;return Ue.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),wn=j({batchSize:De.value,initial:Ve.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:yn.value}),xn=W(()=>!!ze&&(gn.value||Ee.value)),kn=W(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),bn=j(0),Ln=ce({start:0,end:0}),Mn=/* @__PURE__ */new Map,An=/* @__PURE__ */new Map,Nn=W(()=>{if(!Ee.value)return pe.value.length;const e=kn.value,n=Math.max(Ln.end+e,Ve.value),t=Math.min(pe.value.length,n);return Math.max(qe.value,t)});function Bn(e){var n,t;return null!=(t=null==(n=we.value)?void 0:n[e])?t:null}function Sn(e){var n,t,o,l;const r=Q(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Cn(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Tn(e,n,t){var o,l,r,i,a,s;if(t)return null!=(i=null!=(r=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?r:null==(l=null==n?void 0:n.body)?void 0:l.scrollTop)?i:0;const u=e.scrollTop;if(!Cn(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function En(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function In(){pn&&(pn(),pn=null),cn.value=null}function $n(){if(!v||!Ee.value)return;const e=Sn();if(!e||cn.value===e)return;In();const n=()=>zn();e.addEventListener("scroll",n,{passive:!0}),cn.value=e,pn=()=>{e.removeEventListener("scroll",n)}}function Hn(){var e,n,t;if(!vn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;vn.viaTimeout?o?o.clearTimeout(vn.id):clearTimeout(vn.id):null==Pe||Pe(vn.id),vn=null}function zn(e={}){var n,t,o;if(!Ee.value)return;if(!v)return void Wn(!0);if(e.immediate)return Hn(),void Wn(!0);if(vn)return;const l=()=>{vn=null,Wn()};if(Oe)vn={id:Oe(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);vn={id:r,viaTimeout:!0}}}function Wn(e=!1){var n,t,o,l,r,a,s;if(!Ee.value)return;const u=cn.value||Sn();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),h=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),m=pe.value.length;if(!h&&m>0&&Cn(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=pe.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Me.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=pt(e);if(n<=t)return e;n-=t}return 0}if(sn.value===t.length){const n=Tt(0,t.length);return Ot(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Pn[l])?n:Jn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=On(l,0,Math.max(0,m-1));return void((e||Math.abs(r-bn.value)>1)&&(bn.value=r))}const f=h?null:u.getBoundingClientRect(),p=h?0:f.top,v=h?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=an.value;let y=null,w=null;for(const[i,k]of g){if(!k)continue;const e=k.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=h?{top:0}:u.getBoundingClientRect(),t=Tn(u,d,h),o=h?(()=>{const t=e.getBoundingClientRect(),o=(h?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=En(e,u);return Math.max(0,t-n)})(),m=h?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=Ot(o+.5*Math.max(0,m));return void(bn.value=On(f,0,Math.max(0,pe.value.length-1)))}const x=Math.round((y+w)/2);!e&&Math.abs(x-bn.value)<=1||(bn.value=On(x,0,Math.max(0,pe.value.length-1)))}function On(e,n,t){return Math.min(Math.max(e,n),t)}const Pn=ce({}),Rn=ce({total:0,count:0});function jn(){for(const e of Object.keys(Pn))delete Pn[Number(e)];Rn.total=0,Rn.count=0,sn.value=0,un.value=[],dn.value=[]}function Un(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function qn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Gn(e,n,t){if(t<=n)return 0;const o=qn(e,t-1);return n<=0?o:o-qn(e,n-1)}function Zn(e){sn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Pn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(Un(n,r,i),Un(t,r,1))}un.value=n,dn.value=t}const Jn=W(()=>Rn.count>0?Math.max(12,Rn.total/Rn.count):32);function et(e){return null==e?void 0:e.firstElementChild}function tt(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function ot(){var e,n;if(!Me.value)return void(H.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;H.value=t>0?t:0}let lt=null;function rt(){null==lt||lt.disconnect(),lt=null}const at=oe(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),Ht}})),ut=W(()=>l.renderCodeBlocksAsPre?Ht:at);function ct(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const mt=W(()=>{var e;const n=pe.value;if(!n.length||!Me.value)return n.map(()=>null);const t=H.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=Pn[n],r="number"==typeof o&&o>0;if(_e.value&&!r){const n=dl(e,t,z.value);if(n)return n}if(Ne.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=xo(e,wo(e));return n===kr?"markdown":n===Ht?"pre":n===ut.value||n===at?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(cl(String(null!=(n=e.originalCode)?n:"")),cl(String(null!=(t=e.updatedCode)?t:"")),cl(String(null!=(o=e.code)?o:""))):cl(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:ct()})}return null})});function pt(e){var n,t,o;return null!=(o=null!=(t=Pn[e])?t:null==(n=mt.value[e])?void 0:n.height)?o:Jn.value}function vt(){const e=cn.value||Sn(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,Tn(e,t,!1)-En(n,e))}function yt(e){return Tt(0,On(e.nodeIndex,0,Math.max(0,pe.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function xt(){if(null!=mn&&(null==Pe||Pe(mn),mn=null),v)for(const e of fn)window.clearTimeout(e);fn=[]}function Mt(e){!function(e){var n;const t=cn.value||Sn(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=Tn(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=En(o,t)+l}(yt(e))}function _t(){hn.value&&v&&null==mn&&(mn=Oe?Oe(()=>{mn=null,hn.value&&Mt(hn.value)}):null,null==mn&&hn.value&&Mt(hn.value))}function Nt(){const e=vt(),n=pe.value.length;if(null==e||n<=0)return null;const t=On(Ot(e+1),0,n-1),o=Tt(0,t),l=pt(t);return{nodeIndex:t,offsetWithinNodePx:On(e-o,0,Math.max(0,l-1))}}function Bt(e){if(hn.value={nodeIndex:On(e.nodeIndex,0,Math.max(0,pe.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},xt(),Mt(hn.value),v)for(const n of[0,120,280,480])fn.push(window.setTimeout(()=>{hn.value&&Mt(hn.value)},n))}function St(e){const n=vt();return null==n?null:n-yt(e)}function Tt(e,n){var t,o;if(e>=n)return 0;if(Me.value){let t=0;for(let o=e;o<n;o++)t+=pt(o);return t}if(sn.value!==pe.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Pn[l])?t:Jn.value;return o}const l=un.value,r=dn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Pn[l])?o:Jn.value;return t}return Gn(l,e,n)+(n-e-Gn(r,e,n))*Jn.value}F(()=>pe.value.length,e=>{e<=0?jn():(e<sn.value&&function(e){if(e<=0)return void jn();let n=0,t=0;for(const[o,l]of Object.entries(Pn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Pn[r]:(n+=i,t++)}Rn.total=n,Rn.count=t}(e),e!==sn.value&&Zn(e))},{immediate:!0});const It=W(()=>{if(!Ee.value)return pe.value.map((e,n)=>({node:e,index:n}));const e=pe.value.length,n=On(Ln.start,0,e),t=On(Ln.end,n,e);return pe.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),$t=W(()=>Ee.value?Tt(0,Math.min(Ln.start,pe.value.length)):0),zt=W(()=>{if(!Ee.value)return 0;const e=pe.value.length;return Tt(Math.min(Ln.end,e),e)});function Wt(){var e;const n=pe.value;return{totalNodes:n.length,measuredCount:Rn.count,estimatedCount:mt.value.filter(Boolean).length,averageNodeHeight:Jn.value,topSpacerHeight:$t.value,bottomSpacerHeight:zt.value,estimatedTotalHeight:Tt(0,n.length),width:H.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(z.value.paragraph),listItemReady:Boolean(z.value.listItem),listWrapperOverhead:z.value.listWrapperOverhead,headingReadyLevels:Object.entries(z.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=mt.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=mt.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=mt.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=mt.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Pn[n])?d:null}})}}function Ot(e){var n;if(e<=0)return 0;const t=pe.value;if(Me.value){let n=e;for(let e=0;e<t.length;e++){const t=pt(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(sn.value===t.length&&un.value.length&&dn.value.length){const n=Jn.value,o=un.value,l=dn.value,r=e=>e<=0?0:qn(o,e-1)+(e-qn(l,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Pn[l])?n:Jn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Rt(){rn.value+=1}function Ft(e,n){const t=Ye.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ye.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ye.value=l}function Vt(){0!==Ye.value.size&&(Ye.value=/* @__PURE__ */new Set)}function Ut(e){if(!Je.size)return;if(!Ee.value)return;let n=!1;for(const[t,o]of Je)t>=e&&(o.destroy(),Je.delete(t),gn.value&&Ft(t,!1),to(t),tn.delete(t)&&(n=!0));n&&Rt()}function qt(e,n){gn.value&&Ft(e,n),n&&(Ee.value?zn():bn.value=On(e,0,Math.max(0,pe.value.length-1)))}function Xt(e){const n=en.get(e);n&&(n(),en.delete(e));const t=Je.get(e);t&&(t.destroy(),Je.delete(e)),to(e)}function Gt(e,n){let t=!1;if(n){const o=tn.get(e);tn.set(e,n),o!==n&&(t=!0)}else tn.delete(e)&&(t=!0);if(t&&Rt(),n||to(e),!xn.value||!ze)return Xt(e),void(n&&qt(e,!0));if(!Ee.value&&gn.value&&!f.value&&Je.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Je.values())e.destroy();if(Je.clear(),v)for(const e of nn.values())window.clearTimeout(e);nn.clear(),Vt()}}(),!xn.value||!ze))return Xt(e),void(n&&qt(e,!0));if(e<Ve.value&&!Ee.value)return Xt(e),void qt(e,!0);if(Ye.value.has(e))return Xt(e),void qt(e,!0);if(!n)return void Xt(e);Xt(e);const o=ze(n,{rootMargin:"400px"});if(!o)return;Je.set(e,o),qt(e,o.isVisible.value),gn.value&&function(e){if(!v||!gn.value)return;to(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(nn.delete(e),!gn.value)return;if(Ye.value.has(e))return;const o=tn.get(e);if(!o)return;const l=Sn(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&qt(e,!0)},1800+n);nn.set(e,t)}(e);let l=null;l=F(()=>o.isVisible.value,n=>{if(n){to(e),qt(e,!0),null==l||l(),en.delete(e),Je.get(e)===o&&Je.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),en.set(e,l),Ee.value&&zn()}F(()=>Ie.value,e=>{if(!e){for(const e of on.values())e.disconnect();on.clear();for(const e of An.values())for(const n of e)window.clearTimeout(n);An.clear()}},{immediate:!0});let Zt=null,Yt=null,Jt=!1,Qt=null,eo=null;function no(){v&&(null!=Zt&&(null==Pe||Pe(Zt),Zt=null),null!=Yt&&(window.clearTimeout(Yt),Yt=null),null!=eo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(eo),eo=null),Jt=!1,Qt=null)}function to(e){if(!v)return;const n=nn.get(e);null!=n&&(window.clearTimeout(n),nn.delete(e))}function oo(e,n={}){var t,o;if(!yn.value)return;const r=Nn.value;if(qe.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Zt=null,Yt=null,eo=null,Jt=!1;const t=null!=Qt?Qt:i;Qt=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();qe.value=Math.min(r,qe.value+Math.max(1,e)),Ut(qe.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!yn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,De.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Ge.value=Math.max(r,Math.floor(.7*Ge.value)):e<.5*t&&Ge.value<o&&(Ge.value=Math.min(o,Math.ceil(1.2*Ge.value)))}(t),t};let s=t;for(;(a(s),!(qe.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Ge.value));qe.value<r&&lo()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Qt=null!=Qt?Math.max(Qt,i):i,!Jt){if(Jt=!0,!je&&Ke&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(eo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}Oe&&!je?Zt=Oe(()=>{0!==s?Yt=window.setTimeout(()=>a(),s):a()}):Yt=window.setTimeout(()=>a(),s)}}function lo(){yn.value&&oo(Ue.value?Math.max(1,Math.round(Ge.value)):Math.max(1,De.value))}F([()=>pe.value,()=>pe.value.length,()=>yn.value,()=>De.value,()=>Ve.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=pe.value.length,t=Xe.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Xe.value={key:o,total:n};const s=wn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==De.value||s.initial!==Ve.value||s.delay!==u||s.enabled!==yn.value;wn.value={batchSize:De.value,initial:Ve.value,delay:u,enabled:yn.value},r&&(jn(),n>0&&Zn(n)),(a||d||!yn.value)&&no(),(a||d)&&(Ge.value=Math.max(1,De.value||1)),a&&Ee.value&&zn({immediate:!0});const c=Nn.value;if(!n)return qe.value=0,void Ut(0);if(!yn.value)return qe.value=c,void Ut(qe.value);const h=r||0===t.total;qe.value=h||d?Math.min(c,Ve.value):Math.min(qe.value,c);const m=Math.max(1,Ve.value||De.value||n);qe.value<c?oo(m,{immediate:!v}):Ut(qe.value)},{immediate:!0}),F(()=>Ee.value,e=>{if(!e)return In(),void Hn();$n(),zn({immediate:!0})},{immediate:!0}),F([()=>pe.value.length,()=>Ee.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield D(),zn({immediate:!0}))}),{flush:"post"}),F(()=>i.value,()=>{Ee.value&&($n(),zn({immediate:!0}))}),F(Me,e=>{e&&function(){var e;if(ve.value&&ge.value&&ye.value&&(null==(e=we.value)?void 0:e[1]))return;const n=he({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=he({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=he({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});ve.value=n,ge.value=t,ye.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=he({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});we.value=l}()},{immediate:!0}),F([()=>i.value,Me],()=>{if(!Me.value)return rt(),void(H.value=0);ot(),rt(),Me.value&&i.value&&"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(()=>{ot(),hn.value&&_t()}),lt.observe(i.value))},{immediate:!0}),F([Me,Be],()=>d(null,null,function*(){Me.value?(yield D(),function(){var e,n,t,o;if(!Me.value||"undefined"==typeof window)return void(z.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=tt(et(u.value),".paragraph-node");l.paragraph=ml(u.value,r,"pre-wrap");const i=et(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=ml(c.value,a,"pre-wrap");const s=null!=(n=null==(e=h.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=tt(et(m[u]),`h${u}`);l.headings[u]=ml(m[u],e,"pre-wrap")}z.value=l}()):z.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),F(()=>pe.value.length,()=>{Ee.value&&zn({immediate:!0})}),F([Me,H],()=>{Ee.value&&zn({immediate:!0}),hn.value&&_t()},{immediate:!1}),F(()=>gn.value,e=>{if(e)for(const[n,t]of tn)Gt(n,t);else{for(const e of Je.values())e.destroy();Je.clear();for(const e of Array.from(nn.keys()))to(e);Vt();for(const[e,n]of tn)n&&qt(e,!0)}},{immediate:!1}),F([()=>l.viewportPriority,()=>pe.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),F(()=>qe.value,()=>{Ee.value&&zn({immediate:!0})}),F([bn,Ce,kn,()=>pe.value.length,Ee],()=>{!function(){const e=pe.value.length;if(!Ee.value||0===e)return Ln.start=0,void(Ln.end=e);const n=Math.min(Ce.value,e),t=kn.value,o=On(bn.value-t,0,Math.max(0,e-n));Ln.start=o,Ln.end=Math.min(e,o+n)}()},{immediate:!0}),F([()=>pe.value.length,Ee,Ce,kn,()=>Ln.start,()=>Ln.end],([e,n,t,o,l,r])=>{g.value&&q("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:bn.value,scroll:n?(()=>{const e=cn.value||Sn();return e?{reverse:Cn(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:qe.value})}),F(()=>Nn.value,(e,n)=>{yn.value&&("number"==typeof n&&e<=n||e>qe.value&&lo())}),F([()=>l.customId],([e],n,t)=>{if(!e||xe)return;const o=function(e,n){return e?(tl.controllers[e]=n,()=>{tl.controllers[e]===n&&delete tl.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Nt,restoreAnchor:Bt,getAnchorDrift:St,getReport:Wt});t(()=>{o()})},{immediate:!0}),V(()=>{no();for(const e of Je.values())e.destroy();Je.clear();for(const e of on.values())e.disconnect();on.clear();for(const e of An.values())for(const n of e)window.clearTimeout(n);An.clear();for(const e of en.values())e();en.clear();for(const e of Array.from(nn.keys()))to(e);rt(),xt(),In(),Hn()});const ro=oe(()=>d(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),Ht}})),io=oe(()=>d(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),Ht}})),ao=oe(()=>d(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),Ht}})),so={text:Fn,paragraph:Et,heading:kt,code_block:at,list:Lt,list_item:bt,blockquote:ke,table:Pt,definition_list:Se,footnote:gt,footnote_reference:Fe,footnote_anchor:ft,admonition:$r,vmr_container:Dt,hardbreak:wt,link:it,image:_n,thematic_break:jt,math_inline:Kn,math_block:Dn,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,checkbox:Ae,checkbox_input:Ae,inline_code:Qe,html_inline:Ze,reference:Vn,html_block:Ct},uo=W(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),co=W(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof R.value?{showTooltips:R.value}:{}),l.codeBlockProps||{})),ho=W(()=>a({},l.mermaidProps||{})),mo=W(()=>a({},l.d2Props||{})),fo=W(()=>a({},l.infographicProps||{})),po=W(()=>({typewriter:l.typewriter,customHtmlTags:me.value.customHtmlTags})),vo=W(()=>a(a({},po.value),"boolean"==typeof R.value?{showTooltip:R.value}:{})),go=W(()=>a(a({},po.value),"boolean"==typeof R.value?{showTooltips:R.value}:{})),yo=W(()=>It.value.map(e=>{var n,t,o,l;let r=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=ln.get(u);if(c&&c.signature===d)return c.node;const h=a({},u);return ln.set(u,{signature:d,node:h}),h}(e.node);const i=wo(r);let u=xo(r,i);if(("html_block"===r.type||"html_inline"===r.type)&&u===so[r.type]){const e=r,i=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(i){const n=ae.value[i];if(fe.value.has(i)&&n)u=n,r=s(a({},e),{type:i,tag:i,content:M(e.content,i)});else if(w(null!=(t=e.content)?t:e.raw,i)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===r.type?(u=Fn,r={type:"text",content:n,raw:n}):(u=Et,r={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let d=a({},function(e,n){const t=null!=n?n:wo(e);return"mermaid"===t?ho.value:"infographic"===t?fo.value:"d2"===t||"d2lang"===t?mo.value:"link"===e.type?vo.value:"list"===e.type?go.value:"code_block"===e.type?co.value:po.value}(r,i));const c=mt.value[e.index];return"code_block"===r.type&&"code-block"===(null==c?void 0:c.kind)&&(d=s(a({},d),{estimatedHeightPx:c.height,estimatedContentHeightPx:c.contentHeight})),s(a({},e),{node:r,component:u,bindings:d,isCodeBlock:"code_block"===r.type,indexKey:`${uo.value}-${e.index}`})}));function wo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function xo(e,n){if(!e)return Kt;const t=ae.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:wo(e);if("mermaid"===l)return t.mermaid||ro;if("infographic"===l)return t.infographic||io;if("d2"===l||"d2lang"===l)return t.d2||ao;if(o)return o;return t.code_block||ut.value}return o||so[String(e.type)]||Kt}function ko(e){r("click",e)}function bo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Lo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}return(e,n)=>(N(),B("div",{ref_key:"containerRef",ref:i,class:O(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Ee.value}]]),"data-custom-id":l.customId,onClick:ko,onMouseover:bo,onMouseout:Lo},[Me.value||Ee.value?(N(),B(E,{key:0},[Me.value?(N(),B("div",{key:0,class:"height-estimation-probes",style:Y({width:`${Be.value}px`}),"aria-hidden":"true"},[T("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[S(C(Et),{node:ve.value,"index-key":"probe-paragraph"},null,8,["node"])],512),T("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[T("ul",Lr,[S(C(bt),{node:ge.value,"index-key":"probe-list-item"},null,8,["node"])])],512),T("div",{ref_key:"listProbeWrapperRef",ref:h,class:"node-content","data-probe":"list"},[S(C(Lt),{node:ye.value,"index-key":"probe-list"},null,8,["node"])],512),(N(),B(E,null,I(6,e=>T("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(m[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[S(C(kt),{node:Bn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,Mr)),64))],4)):K("",!0),Ee.value?(N(),B("div",{key:1,class:"node-spacer",style:Y({height:`${$t.value}px`}),"aria-hidden":"true"},null,4)):K("",!0)],64)):K("",!0),(N(!0),B(E,null,I(yo.value,e=>{return N(),B("div",{key:e.index,ref_for:!0,ref:n=>Gt(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,yn.value&&t>=qe.value||!(!gn.value||t<Ve.value||Ye.value.has(t))?(N(),B("div",{key:1,class:"node-placeholder",style:Y({height:`${pt(e.index)}px`})},null,4)):(N(),B("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=An.get(e);if(o){for(const e of o)window.clearTimeout(e);An.delete(e)}const l=on.get(e);if(l&&(l.disconnect(),on.delete(e)),!n||!Ie.value)return void Mn.delete(e);Mn.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Pn[e];if(Pn[e]=n,t?Rn.total+=n-t:(Rn.total+=n,Rn.count++),sn.value>e){const o=un.value,l=dn.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&Un(o,e,l)}else Un(o,e,n),Un(l,e,1)}hn.value&&_t()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),on.set(e,t)}"code_block"===(null==(t=pe.value[e])?void 0:t.type)&&"undefined"!=typeof window&&An.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(N(),U(le(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(N(),U(X,{key:0,name:"typewriter",appear:""},{default:G(()=>[(N(),U(le(e.component),re({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,Ar);var t}),128)),Ee.value?(N(),B("div",{key:1,class:"node-spacer",style:Y({height:`${zt.value}px`}),"aria-hidden":"true"},null,4)):K("",!0)],42,br))}}),[["__scopeId","data-v-69906e93"]]);_r.install=e=>{var n,t;const o=null!=(t=null!=(n=_r.__name)?n:_r.name)?t:"NodeRenderer";e.component(o,_r)};const Nr={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Br={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Sr={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Cr={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Tr={class:"admonition-title"},Er=["aria-expanded","aria-controls"],Ir=["id"],$r=/* @__PURE__ */xe(/* @__PURE__ */_({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=W(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),i=j(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const s=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(N(),B("div",{class:O(["admonition",[`admonition-${o.node.kind}`]])},[T("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(N(),B("svg",Nr,[...t[1]||(t[1]=[T("circle",{cx:"12",cy:"12",r:"10"},null,-1),T("path",{d:"M12 16v-4"},null,-1),T("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(N(),B("svg",Br,[...t[2]||(t[2]=[T("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),T("path",{d:"M9 18h6"},null,-1),T("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(N(),B("svg",Sr,[...t[3]||(t[3]=[T("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),T("path",{d:"M12 9v4"},null,-1),T("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(N(),B("svg",Cr,[...t[4]||(t[4]=[T("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),T("path",{d:"M12 8v4"},null,-1),T("path",{d:"M12 16h.01"},null,-1)])])):K("",!0),T("span",Tr,$(r.value),1),o.node.collapsible?(N(),B("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(N(),B("svg",{style:Y({rotate:i.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...t[5]||(t[5]=[T("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Er)):K("",!0)]),Z(T("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[S(C(_r),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,Ir),[[Q,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);$r.install=e=>{e.component($r.__name,$r)};const Hr=()=>import("@terrastruct/d2");let zr=null,Wr=Hr;function Or(e){Wr=e,zr=null}function Pr(e){Or(null!=e?e:Hr)}function Rr(){Or(null)}function jr(){return"function"==typeof Wr}function Fr(){return d(this,null,function*(){if(zr)return zr;const e=Wr;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Hr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(zr=function(e){var n;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=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),zr):null})}const Kr=()=>import("mermaid");let Dr=null,Vr=Kr;function Ur(e){Vr=e,Dr=null}function qr(e){Ur(null!=e?e:Kr)}function Xr(){Ur(null)}function Gr(){return"function"==typeof Vr}function Zr(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function Yr(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function Jr(){return d(this,null,function*(){if(Dr)return Dr;const e=function(){try{const e=globalThis;return Zr(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return Dr=e,Yr(Dr),Dr;const n=Vr;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Kr)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(Dr=Zr(t),Yr(Dr),Dr):null})}function Qr(e){return JSON.stringify(e)}function ei(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=Qr(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=Qr(o),s=l?Qr(l):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function ni(e){var n,t;const o=ei(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}tn.install=e=>{e.component(tn.__name,tn)};let ti=null,oi=null,li=!1;const ri=/* @__PURE__ */new Map,ii=/* @__PURE__ */new Map;let ai=5;const si=/* @__PURE__ */new Set;function ui(){if(ri.size<ai&&si.size){const n=Array.from(si);si.clear();for(const t of n)try{t()}catch(e){}}}function di(e){ti=e,oi=null,ti.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=ri.get(n);if(l)if(ri.delete(n),clearTimeout(l.timeoutId),ui(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(ii.set(e,t),ii.size>200){const e=ii.keys().next().value;ii.delete(e)}}l.resolve(t)}},ti.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of ri.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));ri.clear(),ui()}}function ci(){var e;ti&&(null==(e=ti.terminate)||e.call(ti)),ti=null,oi=null}function hi(e){li=!!e,ti&&ti.postMessage({type:"init",debug:li})}function mi(e,n=!0,t=2e3,o){return d(this,null,function*(){if(performance.now(),!zn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(oi)return Promise.reject(oi);const l=`${n?"d":"i"}:${e}`,r=ii.get(l);if(r)return Promise.resolve(r);const i=ti||(oi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),oi.name="WorkerInitError",oi.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(oi);if(ri.size>=ai){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=ri.size,e.max=ai,Promise.reject(e)}return new Promise((l,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{ri.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),ui()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),ri.has(a)&&ri.delete(a);const e=new Error("Aborted");e.name="AbortError",r(e),ui()},{once:!0});const u=l,d=r;ri.set(a,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function fi(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(ii.set(o,t),ii.size>200){const e=ii.keys().next().value;ii.delete(e)}}function pi(){return{inFlight:ri.size,max:ai}}function vi(e){Number.isFinite(e)&&e>0&&(ai=Math.floor(e))}const gi="WORKER_BUSY";function yi(){return ri.size>=ai}function wi(e=2e3,n){return ri.size<ai?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),si.delete(i),t())};if(si.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,si.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>ui()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),si.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const xi={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function ki(e){null!=e.timeout&&(xi.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(xi.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(xi.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(xi.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function bi(){return a({},xi)}function Li(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!zn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:xi.timeout,s=null!=(l=t.waitTimeout)?l:xi.waitTimeout,u=null!=(r=t.backoffMs)?r:xi.backoffMs,d=null!=(i=t.maxRetries)?i:xi.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):xi.maxRetries,h=t.signal;let m=0;for(;;){if(null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield mi(e,n,a,h)}catch(f){if((null==f?void 0:f.code)!==gi||m>=c)throw f;if(m++,yield wi(s,h).catch(()=>{}),null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*m)))}}})}function Mi(e){return JSON.stringify(e)}function Ai(e){var n;const t=null!=(n=e.mode)?n:"module",o=Mi(e.mermaidUrl),l=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${Mi(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${l}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${l}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function _i(e){var n,t;const o=Ai(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let Ni=null,Bi=null;const Si=/* @__PURE__ */new Map;let Ci=5,Ti=!1;function Ei(e){Ti=!!e}function Ii(e){Number.isFinite(e)&&e>0&&(Ci=Math.floor(e))}function $i(){return{inFlight:Si.size,max:Ci}}const Hi="WORKER_BUSY",zi="MERMAID_DISABLED";function Wi(e){Ni=e,Bi=null;const n=e;Ni.onmessage=e=>{if(Ni!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=Si.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},Ni.onerror=e=>{var t,o;if(Ni===n)if(0!==Si.size){try{Ti?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(l){}for(const[n,t]of Si.entries())t.reject(new Error(`Worker error: ${e.message}`));Si.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Ni.onmessageerror=e=>{var t,o;if(Ni===n)if(0!==Si.size){try{Ti?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of Si.entries())n.reject(new Error("Worker messageerror"));Si.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Oi(){var e;if(Ni)try{for(const[e,n]of Si.entries())n.reject(new Error("Worker cleared"));Si.clear(),null==(e=Ni.terminate)||e.call(Ni)}catch(n){}Ni=null,Bi=null}function Pi(e,n,t=1400){if(!Gr()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=zi,Promise.reject(e)}if(Bi)return Promise.reject(Bi);const o=Ni||(Bi=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Bi.name="WorkerInitError",Bi.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Bi);if(Si.size>=Ci){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Hi,e.inFlight=Si.size,e.max=Ci,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Si.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};Si.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Si.delete(i),void r(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=Si.get(i);n&&n.reject(e)},t)})}function Ri(e,n,t=1400){return d(this,null,function*(){try{return yield Pi("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function ji(e,n,t=1400){return d(this,null,function*(){try{return yield Pi("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Fi(){if(Ni)try{for(const[e,n]of Si.entries())n.reject(new Error("Worker terminated"));Si.clear(),Ni.terminate()}finally{Ni=null}}const Ki=oe(()=>import("./index7.js")),Di=oe(()=>import("./index3.js")),Vi=oe(()=>import("./index2.js")),Ui=oe(()=>import("./index4.js")),qi=oe(()=>import("./index5.js")),Xi=oe(()=>import("./index6.js")),Gi={AdmonitionNode:$r,BlockquoteNode:ke,CheckboxNode:Ae,CodeBlockNode:Ki,DefinitionListNode:Se,EmojiNode:Te,EmphasisNode:ht,FootnoteNode:gt,FootnoteReferenceNode:Fe,FootnoteAnchorNode:ft,HardBreakNode:wt,HeadingNode:kt,HtmlBlockNode:Ct,HtmlInlineNode:Ze,HighlightNode:dt,ImageNode:_n,D2BlockNode:Xi,InfographicBlockNode:qi,InlineCodeNode:Qe,PreCodeNode:Ht,InsertNode:st,LinkNode:it,ListItemNode:bt,ListNode:Lt,MathBlockNode:Di,MathInlineNode:Vi,MermaidBlockNode:Ui,ParagraphNode:Et,StrikethroughNode:nt,StrongNode:Qn,SubscriptNode:Yn,SuperscriptNode:Xn,TableNode:Pt,TextNode:Fn,ThematicBreakNode:jt,VmrContainerNode:Dt,ReferenceNode:Vn,MarkdownCodeBlockNode:kr},Zi={install(e,n){Object.entries(Gi).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&El(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&Ol(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions)}};export{Vi as $,$r as A,ke as B,Ae as C,Xi as D,Te as E,ft as F,gt as G,Fe as H,wt as I,kt as J,dt as K,Ct as L,Ze as M,_n as N,qi as O,Qe as P,st as Q,it as R,bt as S,Lt as T,zi as U,Hi as V,gi as W,kr as X,_r as Y,Di as Z,xe as _,On as a,Ui as a0,Et as a1,Vn as a2,nt as a3,Qn as a4,Yn as a5,Xn as a6,Pt as a7,Fn as a8,jt as a9,jr as aA,yi as aB,zn as aC,Gr as aD,Dl as aE,jl as aF,bl as aG,wl as aH,Tl as aI,Oe as aJ,mi as aK,ze as aL,Or as aM,wn as aN,El as aO,ki as aP,di as aQ,hi as aR,vi as aS,In as aT,Ol as aU,Ur as aV,Wi as aW,Ei as aX,Ii as aY,wi as aZ,tn as aa,Dt as ab,Zi as ac,ei as ad,Ai as ae,Pe as af,ci as ag,Oi as ah,ni as ai,_i as aj,kl as ak,Rr as al,Hn as am,Xr as an,Ul as ao,Pr as ap,$n as aq,qr as ar,Vl as as,xl as at,We as au,bi as av,pi as aw,$i as ax,ql as ay,Il as az,xn as b,Xl as c,Jr as d,vn as e,Ri as f,Wn as g,gn as h,ji as i,Fr as j,Rl as k,yl as l,Kl as m,Pl as n,zl as o,Fl as p,Ht as q,Li as r,fi as s,Fi as t,_t as u,pr as v,Gl as w,Ki as x,Se as y,ht as z};
1
+ var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),d=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{tokenizeHtml as c,hasCustomHtmlComponents as h,sanitizeHtmlAttrs as m,BLOCKED_HTML_TAGS as f,isCustomHtmlComponentTag as p,convertHtmlAttrsToProps as v,normalizeCustomHtmlTags as g,getHtmlTagFromContent as y,shouldRenderUnknownHtmlTagAsText as w,getMarkdown as N,mergeCustomHtmlTags as x,resolveCustomHtmlTags as k,parseMarkdownToStructure as M,stripCustomHtmlWrapper as b,setDefaultMathOptions as S}from"stream-markdown-parser";import{defineComponent as _,openBlock as B,createElementBlock as O,createVNode as L,unref as C,createElementVNode as T,Fragment as E,renderList as I,toDisplayString as A,shallowRef as $,h as H,computed as z,normalizeClass as R,useAttrs as W,inject as P,ref as j,watch as F,createCommentVNode as K,nextTick as D,onBeforeUnmount as V,createBlock as U,Teleport as q,Transition as X,withCtx as G,withDirectives as Z,normalizeStyle as Y,createTextVNode as J,vShow as Q,createApp as ee,renderSlot as ne,readonly as te,defineAsyncComponent as oe,resolveDynamicComponent as le,mergeProps as re,provide as ie,withModifiers as ae,createStaticVNode as se,onMounted as ue,createSlots as de,reactive as ce,markRaw as he}from"vue";import{autoUpdate as me,offset as fe,flip as pe,shift as ve,arrow as ge,computePosition as ye}from"@floating-ui/dom";const we=["cite"],Ne=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},xe=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(B(),O("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[L(C($r),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,we))}}),[["__scopeId","data-v-07e0310e"]]);xe.install=e=>{e.component(xe.__name,xe)};const ke=["aria-label"],Me={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},be={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Se=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(B(),O("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(B(),O("svg",be,[...t[1]||(t[1]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),T("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(B(),O("svg",Me,[...t[0]||(t[0]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,ke))}),[["__scopeId","data-v-be21ab83"]]);Se.install=e=>{e.component(Se.__name,Se)};const _e={class:"definition-list"},Be={class:"definition-term"},Oe={class:"definition-desc"},Le=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(B(),O("dl",_e,[(B(!0),O(E,null,I(n.node.items,(o,l)=>(B(),O(E,{key:l},[T("dt",Be,[L(C($r),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),T("dd",Oe,[L(C($r),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-c1b2a2e8"]]);Le.install=e=>{e.component(Le.__name,Le)};const Ce={class:"emoji-node"},Te=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(B(),O("span",Ce,A(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Te.install=e=>{e.component(Te.__name,Te)};const Ee="__global__",Ie="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Ae=(()=>{const e=globalThis;if(e[Ie])return e[Ie];const n={scopedCustomComponents:{},revision:$(0)};return e[Ie]=n,n})(),$e=Ae.revision;function He(e,n){"string"==typeof e?Ae.scopedCustomComponents[e]=n||{}:Ae.scopedCustomComponents[Ee]=e||{},$e.value++}function ze(e){const n=Ae.scopedCustomComponents[Ee]||{};if(!e)return n;const t=Ae.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Re(e){if(e===Ee)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete Ae.scopedCustomComponents[e],$e.value++}function We(){delete Ae.scopedCustomComponents[Ee],$e.value++}const Pe=["id"],je=["title"],Fe=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(B(),O("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[T("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+A(e.node.id)+"]",9,je)],8,Pe))}}),[["__scopeId","data-v-82cafe9f"]]);Fe.install=e=>{e.component(Fe.__name,Fe)};const Ke=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function De(e){Ke&&console.warn(e)}function Ve(e){return m(e)}function Ue(e,n,t,o,l){if(f.has(e.toLowerCase()))return null;const r=Ve(n),i=r.key,u=null!=i&&""!==i?i:l;if(function(e,n){return p(e,n)}(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){return v(e)}(r);return H(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return H(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function qe(e,n){return h(e,n)}function Xe(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],l=[];for(const r of e)if("text"===r.type)(o.length>0?o[o.length-1].children:l).push(r.content);else if("self_closing"===r.type){const e=Ue(r.tagName,r.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:l;null!=e&&i.push(e)}else if("tag_open"===r.type)o.push({tagName:r.tagName,children:[],attrs:r.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===r.type){const e=r.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const r=o.pop(),i=Ue(r.tagName,r.attrs||{},r.children,n,r.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&l.push(i),r.tagName.toLowerCase()!==e&&o.length>t&&De(`Auto-closing unclosed tag: <${r.tagName}>`)}else De(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Ue(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&l.push(t),De(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(c(e),n);return t}catch(o){return t=o,Ke&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Ge=["innerHTML"],Ze=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=z(()=>($e.value,ze(n.customId))),o=_({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=z(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Xe(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!qe(e,t.value))return{mode:"html",content:e};const o=Xe(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(B(),O("span",{key:0,class:R(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[L(C(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(B(),O("span",{key:1,class:R(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},A(l.value.content),3)):(B(),O("span",{key:2,class:R(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,Ge))}}),[["__scopeId","data-v-71cd1a9f"]]);Ze.install=e=>{e.component(Ze.__name,Ze)};const Ye={class:"inline-code"},Je={key:0},Qe=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=W(),o=P("markstreamTypewriter",void 0),l=P("markstreamTextStreamState",void 0),r=z(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=z(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=z(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=j(n.node.code),u=j(""),d=j(0);function c(){return s.value+u.value}function h(e){s.value=e,u.value=""}function m(){u.value&&(s.value=c(),u.value="")}F([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,m=null!=r?r:t;return i.value?n===m?(h(n),void(o&&(null==l||l.set(o,n)))):m&&n.startsWith(m)&&n.length>m.length?(s.value=m,u.value=n.slice(m.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),F(i,e=>{e||h(c())});const f=z(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(B(),O("code",Ye,[s.value?(B(),O("span",Je,A(s.value),1)):K("",!0),u.value?(B(),O("span",{key:1,class:R(["inline-code-stream-delta",[f.value]]),onAnimationend:m},A(u.value),35)):K("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);Qe.install=e=>{e.component(Qe.__name,Qe)};const en=["id"],nn=["data-placement"],tn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){var n;const t=e,o=j(null),l=j(null),r=j({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=j({}),a=j(null!=(n=t.placement)?n:"top"),s=j(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[fe(null!=(e=t.offset)?e:6),pe(),ve({padding:6}),...l.value?[ge({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:h}=yield ye(t.anchorEl,o.value,{placement:null!=(n=t.placement)?n:"top",middleware:s,strategy:"fixed"});if(r.value.transform=`translate3d(${Math.round(u)}px, ${Math.round(d)}px, 0)`,r.value.left="0px",r.value.top="0px",a.value=c,h.arrow&&l.value){const{x:e,y:n}=h.arrow,t={top:"bottom",bottom:"top",left:"right",right:"left"}[c.split("-")[0]];i.value={left:null!=e?`${e}px`:"",top:null!=n?`${n}px`:"",[t]:"-3px"}}})}return F(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield D(),t.anchorEl&&o.value)try{const e=t.anchorEl.getBoundingClientRect();yield c();const n=r.value.transform;if(null!=t.originX&&null!=t.originY){const o=Math.abs(Number(t.originX)-e.left),l=Math.abs(Number(t.originY)-e.top);Math.hypot(o,l)>120?(r.value.transform=`translate3d(${Math.round(t.originX)}px, ${Math.round(t.originY)}px, 0)`,yield D(),s.value=!0,yield D(),r.value.transform=n):s.value=!0}else s.value=!0;u=me(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=me(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),F([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield D(),yield c())})),V(()=>{u&&u()}),(n,u)=>(B(),U(q,{to:"body"},[T("div",{class:R(["markstream-vue",{dark:e.isDark}])},[L(X,{name:"tooltip",appear:""},{default:G(()=>[Z(T("div",{id:t.id,ref_key:"tooltip",ref:o,style:Y({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[J(A(e.content)+" ",1),T("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:Y(i.value)},null,12,nn)],12,en),[[Q,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),on=j(!1),ln=j(""),rn=j("top"),an=j(null),sn=j(null),un=j(null),dn=j(null),cn=j(null);let hn=null,mn=null;function fn(){hn&&(clearTimeout(hn),hn=null),mn&&(clearTimeout(mn),mn=null)}let pn=!1;function vn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!pn&&"undefined"!=typeof document)try{pn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),ee({setup:()=>()=>{var e;return H(tn,{visible:on.value,"anchor-el":an.value,content:ln.value,placement:rn.value,id:sn.value,originX:un.value,originY:dn.value,isDark:null!=(e=cn.value)?e:void 0})}}).mount(e)}catch(e){pn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),fn();const i=()=>{var o,i;sn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,an.value=e,ln.value=n,rn.value=t,un.value=null!=(o=null==l?void 0:l.x)?o:null,dn.value=null!=(i=null==l?void 0:l.y)?i:null,cn.value="boolean"==typeof r?r:null,on.value=!0;try{e.setAttribute("aria-describedby",sn.value)}catch(a){}};o?i():hn=setTimeout(i,80)}function gn(e=!1){fn();const n=()=>{if(an.value&&sn.value)try{an.value.removeAttribute("aria-describedby")}catch(e){}on.value=!1,an.value=null,sn.value=null,un.value=null,dn.value=null};e?n():mn=setTimeout(n,120)}const yn={"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.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function wn(e){Object.assign(yn,e)}function Nn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return d(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=yn[e])?n: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)}}}const xn={class:"image-node-container"},kn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Mn={key:"placeholder",class:"image-placeholder"},bn={key:1,class:"image-node__raw-text"},Sn={key:"error",class:"image-error"},_n=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=j(!1),r=j(!1),i=j(!1),a=z(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=z(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:h}=Nn();return F(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(B(),O("span",xn,[L(X,{name:"img-switch",mode:"out-in"},{default:G(()=>{var i,m,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?K("",!0):(B(),O("span",Sn,[ne(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[T("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),T("span",null,A(C(h)("image.loadError")),1)],!0)])):(B(),O("span",Mn,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=T("span",{class:"image-shimmer"},null,-1))],!0):(B(),O("span",bn,A(e.node.raw),1))])):(B(),O("img",{key:"image",src:a.value,alt:String(null!=(m=null!=(i=t.node.alt)?i:t.node.title)?m:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:R(["image-node__img",{"is-loading":!s.value&&!l.value,"is-loaded":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:C(h)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,kn))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);_n.install=e=>{e.component(_n.__name,_n)};let Bn=null,On=!1,Ln=En;function Cn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Tn(){try{const e=globalThis;return Cn(null==e?void 0:e.katex)}catch(e){return null}}function En(){return d(null,null,function*(){const e=Tn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Cn(n)})}function In(e){Ln=e,Bn=null,On=!1}function An(e){In(null!=e?e:En)}function $n(){In(null)}function Hn(){return"function"==typeof Ln}function zn(){var e;const n=Tn();if(n)return Bn=n,Bn;if(Bn)return Bn;const t=Ln;if(!t||t===En)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Bn=null!=(e=Cn(n))?e:n,Bn):null}catch(o){return null}}function Rn(){return d(this,null,function*(){var e;const n=Tn();if(n)return Bn=n,Bn;if(Bn)return Bn;if(On)return null;const t=Ln;if(!t)return On=!0,null;try{const n=yield t();if(n)return Bn=null!=(e=Cn(n))?e:n,Bn}catch(o){}return On=!0,null})}const Wn=$(!1);let Pn=null;const jn={key:0},Fn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Pn||(Pn=Rn().then(e=>{Wn.value=!!e}).catch(()=>{Wn.value=!1})),te(Wn)),o=W(),l=P("markstreamTypewriter",void 0),r=P("markstreamTextStreamState",void 0),i=P("markstreamStreamVersion",void 0),a=z(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=z(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=z(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=j(n.node.content),c=j(""),h=j(0);function m(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=m(),c.value="")}F([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=m(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),h.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),F(s,e=>{e||f(m())});const v=z(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(B(),O("span",{class:R([[C(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(B(),O("span",jn,A(d.value),1)):K("",!0),c.value?(B(),O("span",{key:1,class:R(["text-node-stream-delta",[v.value]]),onAnimationend:p},A(c.value),35)):K("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Fn.install=e=>{e.component(Fn.__name,Fn)};const Kn=oe(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return H(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield Rn())return(yield import("./index2.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var n,t,o,l;return H(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Dn=oe(()=>d(null,null,function*(){try{if(yield Rn())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t,o,l;return H(Fn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Vn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(B(),O("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},A(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Vn.install=e=>{e.component(Vn.__name,Vn)};const Un={class:"superscript-node"},qn={key:1},Xn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,footnote_reference:Fe,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,emoji:Te,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("sup",Un,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),O(E,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(B(),U(le(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(B(),O("span",qn,A(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const Gn={class:"subscript-node"},Zn={key:1},Yn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,footnote_reference:Fe,strikethrough:nt,highlight:dt,insert:st,superscript:Xn,emoji:Te,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("sub",Gn,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),O(E,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(B(),U(le(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(B(),O("span",Zn,A(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const Jn={class:"strong-node"},Qn=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("strong",Jn,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et={class:"strikethrough-node"},nt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("del",et,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt=["href","title","aria-label","aria-hidden"],ot=["aria-hidden"],lt={class:"link-text-wrapper relative inline-flex"},rt={class:"leading-[normal] link-text"},it=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=P("markstreamShowTooltips",void 0),o=z(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=z(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*a,a)),u={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(u["--link-color"]=n.color),u}),r={text:Fn,strong:Qn,strikethrough:nt,emphasis:ht,image:_n,html_inline:Ze,inline_code:Qe},i=z(()=>($e.value,ze(n.customId))),s=W(),u=z(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const l={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(l[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,r]of Object.entries(o))n&&null!=r&&!1!==r&&(l[n]=!0===r?"":String(r));return Ve(l)}),d=z(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&gn()}const h=z(()=>{var e,t,o;const l=null==(e=n.node)?void 0:e.title;return"string"==typeof l&&l.trim().length>0?l:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var u,m;return e.node.loading?(B(),O("span",re({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},C(s),{style:l.value}),[T("span",lt,[T("span",rt,[L(C(Fn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(m=e.node.text)?m:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=T("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,ot)):(B(),O("a",re({key:0,class:"link-node",href:e.node.href,title:o.value?"":h.value,"aria-label":`Link: ${h.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(l=n.node)?void 0:l.href)||(null==(r=n.node)?void 0:r.text)||"";vn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(B(!0),O(E,null,I(e.node.children,(t,o)=>(B(),U(le(function(e){return i.value[e.type]||r[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,tt))}}}),[["__scopeId","data-v-27877c6b"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"insert-node"},st=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("ins",at,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"insert"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);st.install=e=>{e.component(st.__name,st)};const ut={class:"highlight-node"},dt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,emphasis:ht,strikethrough:nt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("mark",ut,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-36e74e6b"]]);dt.install=e=>{e.component(dt.__name,dt)};const ct={class:"emphasis-node"},ht=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,html_inline:Ze,strong:Qn,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,footnote_reference:Fe,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),O("em",ct,[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);ht.install=e=>{e.component(ht.__name,ht)};const mt=["href","title"],ft=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(n,o)=>(B(),O("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,mt))}}),[["__scopeId","data-v-83c33a47"]]);ft.install=e=>{e.component(ft.__name,ft)};const pt=["id"],vt={class:"flex-1"},gt=/* @__PURE__ */_({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(B(),O("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[T("div",vt,[L(C($r),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,pt))}});gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"hard-break"},wt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(B(),O("br",yt))}),[["__scopeId","data-v-50c58f70"]]);wt.install=e=>{e.component(wt.__name,wt)};const Nt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ze(n.customId),o=a({text:Fn,inline_code:Qe,link:it,image:_n,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,checkbox:Se,checkbox_input:Se,footnote_reference:Fe,hardbreak:wt,math_inline:Kn,reference:Vn},t);return(t,l)=>(B(),U(le(`h${e.node.level}`),re({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:G(()=>[(B(!0),O(E,null,I(e.node.children,(t,l)=>(B(),U(le(o[t.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-bf120de0"]]),xt=Nt;xt.install=e=>{e.component(Nt.__name,Nt)};const kt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=z(()=>{var e;return null!=(e=n.node)?e:n.item}),o=z(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return B(),O("li",re({class:"list-item",dir:"auto"},o.value),[L(C($r),re({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:l[0]||(l[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])],16)}}}),[["__scopeId","data-v-b6392242"]]);kt.install=e=>{e.component(kt.__name,kt)};const Mt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=z(()=>($e.value,ze(e.customId).list_item||kt));return(t,o)=>(B(),U(le(e.node.ordered?"ol":"ul"),{class:R(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:G(()=>[(B(!0),O(E,null,I(e.node.items,(l,r)=>{var i;return B(),U(le(n.value),re({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-c145570b"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const bt=/* @__PURE__ */Symbol("ViewportPriority");function St(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?j(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let h=null;function m(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=h){try{null==a||a(h)}catch(e){}h=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),m()}}function p(){i&&null==h&&c.size&&(h=i(()=>{h=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=j(!1);let i,a=!1;const h=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:h,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v})};return ie(bt,v),v}function _t(){var e,n;const t=P(bt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=j(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},h=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return h?(o.set(e,{resolve:t,visible:n}),h.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const Bt={key:1,class:"html-block-node__raw"},Ot=["innerHTML"],Lt={key:1,class:"html-block-node__placeholder"},Ct=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=z(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=z(()=>($e.value,ze(n.customId))),l=_({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=j(null),i=j("undefined"==typeof window),a=j(n.node.content),s=z(()=>{var e,t,l;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const r=null!=(t=a.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=Xe(r,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!qe(r,o.value))return{mode:"html",content:r};const s=Xe(r,o.value);return null===s?{mode:"html",content:r}:{mode:"dynamic",nodes:s}}),u=_t(),d=j(null),c=!!n.node.loading;return"undefined"!=typeof window?(F(r,e=>{var t,o;if(null==(o=null==(t=d.value)?void 0:t.destroy)||o.call(t),d.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const l=u(e,{rootMargin:"400px"});d.value=l,i.value=l.isVisible.value,l.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),F(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,V(()=>{var e,n;null==(n=null==(e=d.value)?void 0:e.destroy)||n.call(e),d.value=null}),(n,o)=>(B(),O("div",re({ref_key:"htmlRef",ref:r,class:"html-block-node"},t.value),[i.value?(B(),O(E,{key:0},["dynamic"===s.value.mode?(B(),U(C(l),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(B(),O("pre",Bt,A(s.value.content),1)):(B(),O("div",{key:2,innerHTML:a.value},null,8,Ot))],64)):(B(),O("div",Lt,[ne(n.$slots,"placeholder",{node:e.node},()=>[o[0]||(o[0]=T("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[1]||(o[1]=T("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[2]||(o[2]=T("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-5f7e5b65"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt={dir:"auto",class:"paragraph-node"},Et=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=ze(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=z(()=>n.node.children.filter(e=>!o(e))),i=z(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=z(()=>new Set(g(n.customHtmlTags))),d=z(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function c(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":n.customHtmlTags}}const h=a({inline_code:Qe,image:_n,link:it,hardbreak:wt,emphasis:ht,strong:Qn,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,html_inline:Ze,html_block:Ct,emoji:Te,checkbox:Se,math_inline:Kn,checkbox_input:Se,reference:Vn,footnote_anchor:ft,footnote_reference:Fe,text:Fn},t);function m(e){var n,t,o,l;if("html_block"===e.type||"html_inline"===e.type){const r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(r&&!u.value.has(r)&&w(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");return{child:{type:"text",content:n,raw:n},component:Fn}}}return{child:e,component:h[e.type]}}return(n,t)=>(B(),O("p",Tt,[(B(!0),O(E,null,I(d.value,(n,t)=>(B(),O(E,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(B(),O(E,{key:0},[J(A(l(n)),1)],64)):(B(),U(le(m(n).component),re({key:1,ref_for:!0},c(m(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Et.install=e=>{e.component(Et.__name,Et)};const It=["aria-busy","aria-label","data-language"],At=["textContent"],$t=/* @__PURE__ */_({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=z(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=z(()=>`language-${t.value}`),l=z(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(B(),O("pre",{class:R([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[T("code",{translate:"no",textContent:A(e.node.code)},null,8,At)],10,It))}});$t.install=e=>{e.component($t.__name,$t)};const Ht={class:"table-node-wrapper"},zt=["aria-busy"],Rt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Wt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=z(()=>{var e;return null!=(e=n.node.loading)&&e}),o=z(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(l,r)=>(B(),O("div",Ht,[T("table",{class:R(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[T("thead",null,[T("tr",null,[(B(!0),O(E,null,I(e.node.header.cells,(e,t)=>(B(),O("th",{key:`header-${t}`,dir:"auto",class:R(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"])},[L(C($r),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[0]||(r[0]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),T("tbody",null,[(B(!0),O(E,null,I(o.value,(e,t)=>(B(),O("tr",{key:`row-${t}`},[(B(!0),O(E,null,I(e.cells,(e,o)=>(B(),O("td",{key:`cell-${t}-${o}`,class:R(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[L(C($r),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[1]||(r[1]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,zt),L(X,{name:"table-node-fade"},{default:G(()=>[t.value?(B(),O("div",Rt,[ne(l.$slots,"loading",{isLoading:t.value},()=>[r[2]||(r[2]=T("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),r[3]||(r[3]=T("span",{class:"sr-only"},"Loading",-1))],!0)])):K("",!0)]),_:3})]))}}),[["__scopeId","data-v-926610d8"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const Pt={class:"hr-node"},jt=/* @__PURE__ */Ne({},[["render",function(e,n){return B(),O("hr",Pt)}],["__scopeId","data-v-39b2349c"]]);jt.install=e=>{e.component(jt.__name,jt)};const Ft={class:"unknown-node"},Kt=/* @__PURE__ */_({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(B(),O("div",Ft,A(e.node.raw),1))}),Dt=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=z(()=>`vmr-container vmr-container-${n.node.name}`),o=ze(n.customId),l=a({text:Fn,paragraph:Et,heading:xt,inline_code:Qe,link:it,image:_n,strong:Qn,emphasis:ht,strikethrough:nt,insert:st,subscript:Yn,superscript:Xn,checkbox:Se,checkbox_input:Se,hardbreak:wt,math_inline:Kn,reference:Vn,list:Mt,math_block:Dn,table:Wt},o);return(o,r)=>(B(),O("div",re({class:t.value},e.node.attrs),[(B(!0),O(E,null,I(e.node.children,(t,o)=>{return B(),U(le((r=t.type,l[r]||Kt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]);var r}),128))],16))}}),[["__scopeId","data-v-b0a43820"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Vt=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Ut=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function qt(e){if(e<=255)return Vt[e];let n=0,t=Ut.length-1;for(;n<=t;){const o=n+t>>1,l=Ut[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const Xt=/[ \t\n\r\f]+/g,Gt=/[\t\n\r\f]| {2,}|^ | $/;let Zt=null;const Yt=new RegExp("\\p{Script=Arabic}","u"),Jt=new RegExp("\\p{M}","u"),Qt=new RegExp("\\p{Nd}","u");function eo(e){return Yt.test(e)}function no(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function to(e){for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(!(t<12288)){if(t>=55296&&t<=56319&&n+1<e.length){const o=e.charCodeAt(n+1);if(o>=56320&&o<=57343){if(no(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(no(t))return!0}}return!1}const oo=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]);function lo(e){return to(e)}function ro(e){return!function(e){const n=wo(e);return null!==n&&(io.has(n)||uo.has(n))}(e)&&!function(e){const n=wo(e);return null!==n&&oo.has(n)}(e)}const io=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),ao=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),so=/* @__PURE__ */new Set(["'","’"]),uo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),co=/* @__PURE__ */new Set([":",".","،","؛"]),ho=/* @__PURE__ */new Set(["၏"]),mo=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function fo(e){if(go(e))return!0;let n=!1;for(const t of e)if(uo.has(t))n=!0;else if(!n||!Jt.test(t))return!1;return n}function po(e){for(const n of e)if(!io.has(n)&&!uo.has(n))return!1;return e.length>0}function vo(e){if(go(e))return!0;for(const n of e)if(!ao.has(n)&&!so.has(n)&&!Jt.test(n))return!1;return e.length>0}function go(e){let n=!1;for(const t of e)if("\\"!==t&&!Jt.test(t)){if(!(ao.has(t)||uo.has(t)||so.has(t)))return!1;n=!0}return n}function yo(e,n){const t=n-1;if(t<=0)return Math.max(t,0);const o=e.charCodeAt(t);if(o<56320||o>57343)return t;const l=t-1;if(l<0)return t;const r=e.charCodeAt(l);return r>=55296&&r<=56319?l:t}function wo(e){if(0===e.length)return null;const n=yo(e,e.length);return e.slice(n)}function No(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Jt.test(e))t--;else{if(!ao.has(e)&&!so.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function xo(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function ko(e,n,t,o){const l=n[o],r=e[o];if(null==l)return r;const i=t[o];if(r.length===i)return r;const a=l.repeat(i);return e[o]=a,a}function Mo(e,n){return e&&null!==n&&co.has(n)}function bo(e){const n=wo(e);return null!==n&&ho.has(n)}function So(e){if(e.length<2||" "!==e[0])return null;const n=e.slice(1);return new RegExp("^\\p{M}+$","u").test(n)?{space:" ",marks:n}:null}function _o(e){let n=e.length;for(;n>0;){const t=yo(e,n),o=e.slice(t,n);if(mo.has(o))return!0;if(!uo.has(o))return!1;n=t}return!1}function Bo(e,n){if(n.preserveOrdinarySpaces||n.preserveHardBreaks){if(" "===e)return"preserved-space";if("\t"===e)return"tab";if(n.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||"⁠"===e||"\ufeff"===e?"glue":"​"===e?"zero-width-break":"­"===e?"soft-hyphen":"text"}const Oo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Lo(e){return 1===e.length?e[0]:e.join("")}function Co(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Lo(t)}function To(e,n,t,o){if(!Oo.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,s=!1,u=0;for(const d of e){const e=Bo(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:Lo(i),isWordLike:s,kind:r,start:a}),r=e,i=[d],a=t+u,s=c,u+=d.length):(i.push(d),u+=d.length)}return null!==r&&l.push({text:Lo(i),isWordLike:s,kind:r,start:a}),l}function Eo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Io=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Ao(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Io.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function $o(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Ho=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),zo=/^[A-Za-z0-9_]+[,:;]*$/,Ro=/[,:;]+$/;function Wo(e){for(const n of e)if(Qt.test(n))return!0;return!1}function Po(e){if(0===e.length)return!1;for(const n of e)if(!Qt.test(n)&&!Ho.has(n))return!1;return!0}function jo(e,n,t){var o,l,r;const i=(null===Zt&&(Zt=new Intl.Segmenter(void 0,{granularity:"word"})),Zt);let a=0;const s=[],u=[],d=[],c=[],h=[],m=[],f=[],p=[],v=[],g=[],y=[],w=[];for(const b of i.segment(e))for(const e of To(b.segment,null!=(o=b.isWordLike)&&o,b.index,t)){let t=function(){null!==m[b]&&(u[b]=[ko(s,m,f,b)],m[b]=null),u[b].push(e.text),d[b]=d[b]||e.isWordLike,p[b]=p[b]||i,v[b]=v[b]||N,g[b]=k,y[b]=M,w[b]=Mo(v[b],x)};const o="text"===e.kind,r=xo(e.text,e.isWordLike,e.kind),i=to(e.text),N=eo(e.text),x=wo(e.text),k=_o(e.text),M=bo(e.text),b=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===c[b]&&i&&p[b]&&g[b]||o&&a>0&&"text"===c[b]&&po(e.text)&&p[b]||o&&a>0&&"text"===c[b]&&y[b]?t():o&&a>0&&"text"===c[b]&&e.isWordLike&&N&&w[b]?(t(),d[b]=!0):null!==r&&a>0&&"text"===c[b]&&m[b]===r?f[b]=(null!=(l=f[b])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===c[b]&&(fo(e.text)||"-"===e.text&&d[b])?t():(s[a]=e.text,u[a]=[e.text],d[a]=e.isWordLike,c[a]=e.kind,h[a]=e.start,m[a]=r,f[a]=null===r?0:1,p[a]=i,v[a]=N,g[a]=k,y[a]=M,w[a]=Mo(N,x),a++)}for(let b=0;b<a;b++)null===m[b]?s[b]=Lo(u[b]):s[b]=ko(s,m,f,b);for(let b=1;b<a;b++)"text"===c[b]&&!d[b]&&go(s[b])&&"text"===c[b-1]&&(s[b-1]+=s[b],d[b-1]=d[b-1]||d[b],s[b]="");const N=Array.from({length:a},()=>null);let x=-1;for(let b=a-1;b>=0;b--){const e=s[b];if(0!==e.length){if("text"===c[b]&&!d[b]&&vo(e)&&x>=0&&"text"===c[x]){const n=null!=(r=N[x])?r:[];n.push(e),N[x]=n,h[x]=h[b],s[b]="";continue}x=b}}for(let b=0;b<a;b++){const e=N[b];null!=e&&(s[b]=Co(e,s[b]))}let k=0;for(let b=0;b<a;b++){const e=s[b];0!==e.length&&(k!==b&&(s[k]=e,d[k]=d[b],c[k]=c[b],h[k]=h[b]),k++)}s.length=k,d.length=k,c.length=k,h.length=k;const M=function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let r=0;r<n.length-1;r++){if("text"!==o[r]||"text"!==o[r+1])continue;if(!to(n[r])||!to(n[r+1]))continue;const e=No(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&zo.test(i)){const a=[i];let s=Ro.test(i),u=r+1;for(;s&&u<e.len&&"text"===e.kinds[u]&&e.isWordLike[u]&&zo.test(e.texts[u]);){const n=e.texts[u];a.push(n),s=Ro.test(n),u++}n.push(Lo(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&Wo(n)&&Po(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&Po(i)&&Wo(i)){const a=[i];let s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Po(e.texts[s]);)a.push(e.texts[s]),s++;n.push(Lo(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!$o(i))continue;const a=r+1;if(a>=e.len||Eo(e.kinds[a]))continue;const s=[],u=e.starts[a];let d=a;for(;d<e.len&&!Eo(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(n.push(Lo(s)),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!Ao(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Eo(o[r]);){l.push(n[r]),t[i]=!0;const e=n[r].includes("?");if(o[r]="text",n[r]="",r++,e)break}n[i]=Lo(l)}let r=0;for(let i=0;i<n.length;i++){const e=n[i];0!==e.length&&(r!==i&&(n[r]=e,t[r]=t[i],o[r]=o[i],l[r]=l[i]),r++)}return n.length=r,t.length=r,o.length=r,l.length=r,{len:r,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){const i=[e.texts[r]];let a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){const d=[i[0]],c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d.push(e.texts[r]),r++;const h=Lo(d);if(!(r<e.len&&"text"===e.kinds[r])){n.push(h),t.push(!1),o.push("glue"),l.push(c);continue}i[0]=h,i.push(e.texts[r]),a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){const n=[];for(;r<e.len&&"glue"===e.kinds[r];)n.push(e.texts[r]),r++;const t=Lo(n);r<e.len&&"text"===e.kinds[r]?(i.push(t,e.texts[r]),a=a||e.isWordLike[r],r++):i.push(t)}n.push(Lo(i)),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:k,texts:s,isWordLike:d,kinds:c,starts:h})))))));for(let b=0;b<M.len-1;b++){const e=So(M.texts[b]);null!==e&&("space"!==M.kinds[b]&&"preserved-space"!==M.kinds[b]||"text"!==M.kinds[b+1]||!eo(M.texts[b+1])||(M.texts[b]=e.space,M.isWordLike[b]=!1,M.kinds[b]="preserved-space"===M.kinds[b]?"preserved-space":"space",M.texts[b+1]=e.marks+M.texts[b+1],M.starts[b+1]=M.starts[b]+e.space.length))}return M}function Fo(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}let Ko=null;const Do=/* @__PURE__ */new Map;let Vo=null;const Uo=new RegExp("\\p{Emoji_Presentation}","u"),qo=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Xo=null;const Go=/* @__PURE__ */new Map;function Zo(){if(null!==Ko)return Ko;if("undefined"!=typeof OffscreenCanvas)return Ko=new OffscreenCanvas(1,1).getContext("2d"),Ko;if("undefined"!=typeof document)return Ko=document.createElement("canvas").getContext("2d"),Ko;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Yo(e,n){let t=n.get(e);return void 0===t&&(t={width:Zo().measureText(e).width,containsCJK:to(e)},n.set(e,t)),t}function Jo(){if(null!==Vo)return Vo;if("undefined"==typeof navigator)return Vo={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Vo;const e=navigator.userAgent,n="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),t=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Vo={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Vo}function Qo(){return null===Xo&&(Xo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Xo}function el(e){return Uo.test(e)||e.includes("️")}function nl(e,n,t){return 0===t?n.width:n.width-function(e,n){return void 0===n.emojiCount&&(n.emojiCount=function(e){let n=0;const t=Qo();for(const o of t.segment(e))el(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function tl(e,n){for(;n<e.widths.length;){const t=e.kinds[n];if("space"!==t&&"zero-width-break"!==t&&"soft-hyphen"!==t)break;n++}return n}function ol(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function ll(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+Jo().lineFitEpsilon;let a=0,s=0,u=!1,d=0,c=0,h=-1,m=0;function f(e=d,n=c,t=s){a++,s=0,u=!1,h=-1,m=0}function p(e,n){u=!0,d=e+1,c=0,s=n}function v(e,n,t){u=!0,d=e,c=n+1,s=t}function g(e,n){u?(s+=n,d=e+1,c=0):p(e,n)}function y(e,n){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];u?s+n>i?(f(),v(e,o,n)):(s+=n,d=e,c=o+1):v(e,o,n)}u&&d===e&&c===t.length&&(d=e+1,c=0)}let w=0;for(;w<o.length&&(u||(w=tl(e,w),!(w>=o.length)));){const e=o[w],t=l[w],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(u)if(s+e>i){if(a){g(w,e),f(w+1,0,s-e),w++;continue}if(h>=0){if(d>h||d===h&&c>0){f();continue}f(h,0,m);continue}if(e>n&&null!==r[w]){f(),y(w,0),w++;continue}f()}else g(w,e),a&&(h=w+1,m=s-e),w++;else e>n&&null!==r[w]?y(w,0):p(w,e),a&&(h=w+1,m=s-e),w++}return u&&f(),a}let rl=null;function il(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function s(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function u(e,n,t){o=[e],l=n,r=t,i=_o(e),a=ao.has(e)}function d(e,n){o.push(e),r=r||n;const t=_o(e);i=1===e.length&&uo.has(e)&&i||t,a=!1}for(const c of(null===rl&&(rl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),rl).segment(e)){const e=c.segment,t=to(e);0!==o.length?a||io.has(e)||uo.has(e)||n.carryCJKAfterClosingQuote&&t&&i?d(e,t):r||t?(s(),u(e,c.index,t)):d(e,t):u(e,c.index,t)}return s(),t}function al(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=to(e[0].text),r=ro(e[0].text);function i(){n.push({text:1===t.length?t[0]:t.join(""),start:o})}for(let a=1;a<e.length;a++){const n=e[a],s=to(n.text),u=ro(n.text);l&&r?(t.push(n.text),l=l||s,r=u):(i(),t=[n.text],o=n.start,l=s,r=u)}return i(),n}function sl(e,n,t,o){const l=Jo(),{cache:r,emojiCorrection:i}=function(e,n){Zo().font=e;const t=function(e){let n=Do.get(e);return n||(n=/* @__PURE__ */new Map,Do.set(e,n)),n}(e),o=function(e){const n=e.match(/(\d+(?:\.\d+)?)\s*px/);return n?parseFloat(n[1]):16}(e),l=n?function(e,n){let t=Go.get(e);if(void 0!==t)return t;const o=Zo();o.font=e;const l=o.measureText("😀").width;if(t=0,l>n+.5&&"undefined"!=typeof document&&null!==document.body){const n=document.createElement("span");n.style.font=e,n.style.display="inline-block",n.style.visibility="hidden",n.style.position="absolute",n.textContent="😀",document.body.appendChild(n);const o=n.getBoundingClientRect().width;document.body.removeChild(n),l-o>.5&&(t=l-o)}return Go.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,qo.test(a)));var a;const s=nl("-",Yo("-",r),i),u=8*nl(" ",Yo(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],h=[],m=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=t?[]:null,y=Array.from({length:e.len});function w(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),h.push(o),m.push(l),null==p||p.push(r),v.push(i),null!==g&&g.push(e)}function N(e,n,t,o,a){const s=Yo(e,r),u=nl(e,s,i),d="space"===n||"preserved-space"===n||"zero-width-break"===n?0:u,c="space"===n||"zero-width-break"===n?0:u;if(a&&o&&e.length>1){let o="sum-graphemes";Po(e)?o="pair-context":l.preferPrefixWidthsForBreakableRuns&&(o="segment-prefixes");const a=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances)return n.breakableFitAdvances;const r=Qo(),i=[];for(const d of r.segment(e))i.push(d.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=Yo(n,t);e.push(nl(n,l,o))}return n.breakableFitAdvances=e,n.breakableFitAdvances}if("pair-context"===l||i.length>96){const e=[];let l=null,r=0;for(const n of i){const i=nl(n,Yo(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Yo(i,t);e.push(nl(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let s="",u=0;for(const d of i){s+=d;const e=nl(s,Yo(s,t),o);a.push(e-u),u=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,s,r,i,o);return void w(e,u,d,c,n,t,a)}w(e,u,d,c,n,t,null)}for(let M=0;M<e.len;M++){y[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],i=e.kinds[M],a=e.starts[M];if("soft-hyphen"===i){w(n,0,s,s,i,a,null);continue}if("hard-break"===i){w(n,0,0,0,i,a,null);continue}if("tab"===i){w(n,0,0,0,i,a,null);continue}const u=Yo(n,r);if("text"===i&&u.containsCJK){const e=il(n,l),r="keep-all"===o?al(e):e;for(let n=0;n<r.length;n++){const e=r[n];N(e.text,"text",a+e.start,t,"keep-all"===o||!to(e.text))}continue}N(n,i,a,t,!0)}const x=function(e,n,t){const o=[];for(let l=0;l<e.length;l++){const r=e[l],i=r.startSegmentIndex<n.length?n[r.startSegmentIndex]:t,a=r.endSegmentIndex<n.length?n[r.endSegmentIndex]:t,s=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:s})}return o}(e.chunks,y,d.length),k=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=!1;for(let u=0;u<n;){const l=e.charCodeAt(u);let r=l,i=1;if(l>=55296&&l<=56319&&u+1<n){const n=e.charCodeAt(u+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=qt(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[u+e]=a;u+=i}if(!o)return null;let l=0;for(let u=0;u<n;u++){const e=t[u];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==g?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:x,segments:g}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:x}}function ul(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return sl(function(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!Gt.test(e))return e;let n=e.replace(Xt," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i="keep-all"===o?function(e){if(e.len<=1)return e;const n=[],t=[],o=[],l=[];let r=null,i=!1,a=0,s=!1,u=!1;function d(){null!==r&&(n.push(Lo(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let c=0;c<e.len;c++){const h=e.texts[c],m=e.kinds[c],f=e.isWordLike[c],p=e.starts[c];if("text"===m){const e=lo(h),n=ro(h);if(null!==r&&s&&u){r.push(h),i=i||f,s=s||e,u=n;continue}d(),r=[h],i=f,a=p,s=e,u=n;continue}d(),n.push(h),t.push(f),o.push(m),l.push(p)}return d(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(jo(r,n,l)):jo(r,n,l);return a({normalized:r,chunks:Fo(i,l)},i)}(e,Jo(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const dl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",cl=(()=>{const e=globalThis;if(e[dl])return e[dl];const n={configs:{},controllers:{},revision:$(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[dl]=n,n})();let hl=null;const ml=cl.revision;function fl(e){var n;return e&&null!=(n=cl.configs[e])?n:null}function pl(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function vl(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function gl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!vl(r))return null;"text"===r.type?l+=String(null!=(n=r.content)?n:""):"emoji"===r.type?l+=String(null!=(o=null!=(t=r.name)?t:r.raw)?o:""):"hardbreak"===r.type&&(l+="\n")}return l.length>0?l:null}function yl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=hl)return hl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return hl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),hl}catch(n){return hl=!1,!1}}())return null;try{const r=Math.round(100*n)/100,i=[null!=(o=t.whiteSpace)?o:"pre-wrap",t.font,t.lineHeight,t.wrapperOverhead,t.widthAdjustment,r,e].join("\0"),a=cl.blockEstimateCache.get(i);if(a)return cl.blockEstimateCache.delete(i),cl.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=cl.preparedCache.get(o);if(l)return cl.preparedCache.delete(o),cl.preparedCache.set(o,l),l.prepared;const r=ul(e,n,{whiteSpace:t});for(cl.preparedCache.set(o,{prepared:r});cl.preparedCache.size>240;){const e=cl.preparedCache.keys().next().value;if(!e)break;cl.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?ll(e,n):function(e,n){if(e.simpleLineWalkFastPath)return ll(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:s,chunks:u}=e;if(0===t.length||0===u.length)return 0;const d=Jo(),c=d.lineFitEpsilon,h=n+c;let m=0,f=0,p=!1,v=0,g=0,y=-1,w=0,N=0,x=null;function k(){y=-1,w=0,N=0,x=null}function M(e=v,n=g,t=f){m++,f=0,p=!1,k()}function b(e,n){p=!0,v=e+1,g=0,f=n}function S(e,n,t){p=!0,v=e,g=n+1,f=t}function _(e,n){p?(f+=n,v=e+1,g=0):b(e,n)}function B(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,w=f-r+i,N=f-r+a,x=e}function O(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];p?f+n>h?(M(),S(e,o,n)):(f+=n,v=e,g=o+1):S(e,o,n)}p&&v===e&&g===t.length&&(v=e+1,g=0)}function L(e){if("soft-hyphen"!==x)return!1;const t=i[e];if(null==t)return!1;const{fitCount:o,fittedWidth:l}=function(e,n,t,o,l){let r=0,i=n;for(;r<e.length;){const n=i+e[r];if((r+1<e.length?n+l:n)>t+o)break;i=n,r++}return{fitCount:r,fittedWidth:i}}(t,f,n,c,a);return 0!==o&&(f=l,v=e,g=o,k(),o===t.length?(v=e+1,g=0,!0):(M(e,o,l+a),O(e,o),!0))}function C(e){m++,k()}for(let T=0;T<u.length;T++){const e=u[T];if(e.startSegmentIndex===e.endSegmentIndex){C();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,k();let c=e.startSegmentIndex;for(;c<e.endSegmentIndex;){const e=r[c],u="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?ol(f,s):t[c];if("soft-hyphen"!==e)if(p){if(f+m>h){const t=f+("tab"===e?0:o[c]),r=f+("tab"===e?m:l[c]);if("soft-hyphen"===x&&d.preferEarlySoftHyphenBreak&&w<=h){M(y,0,N);continue}if("soft-hyphen"===x&&L(c)){c++;continue}if(u&&t<=h){_(c,m),M(c+1,0,r),c++;continue}if(y>=0&&w<=h){if(v>y||v===y&&g>0){M();continue}const e=y;M(e,0,N),c=e;continue}if(m>n&&null!==i[c]){M(),O(c,0),c++;continue}M();continue}_(c,m),B(e,u,c,m),c++}else m>n&&null!==i[c]?O(c,0):b(c,m),B(e,u,c,m),c++;else p&&(v=c+1,g=0,y=c+1,w=f+a,N=f+a,x=e),c++}if(p){const n=y===e.consumedEndSegmentIndex?N:f;M(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),h=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(cl.blockEstimateCache.set(i,{height:h,contentHeight:Math.round(c)});cl.blockEstimateCache.size>4e3;){const e=cl.blockEstimateCache.keys().next().value;if(!e)break;cl.blockEstimateCache.delete(e)}return{kind:"simple-text",height:h,contentHeight:Math.round(c)}}catch(r){return null}}function wl(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=gl(e.children);return o&&t.paragraph?yl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=gl(e.children),r=t.headings[o];return l&&r?yl(l,n,r):null}if("list_item"===e.type){const r=Array.isArray(e.children)?e.children:[];if(1!==r.length||"paragraph"!==(null==(o=r[0])?void 0:o.type)||!t.listItem)return null;const i=gl(null==(l=r[0])?void 0:l.children);return i?yl(i,n,t.listItem):null}if("list"===e.type){const o=Array.isArray(e.items)?e.items:[];if(!o.length)return null;let l=Math.max(0,t.listWrapperOverhead);for(const e of o){const o=wl(e,n,t);if(!o)return null;l+=o.height}return{kind:"simple-text",height:Math.max(1,Math.round(l)),contentHeight:Math.max(1,Math.round(l))}}return null}function Nl(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function xl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function kl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=pl(o.lineHeight,1.5*pl(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:xl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let Ml=!1,bl=null,Sl=!1,_l=null;function Bl(){return d(this,null,function*(){return bl||_l||(Sl?null:(_l=d(null,null,function*(){try{return bl=yield import("stream-monaco"),yield function(e){return d(this,null,function*(){if(Ml)return;Ml=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(bl),bl}catch(e){return Sl=!0,null}finally{_l=null}}),_l))})}function Ol({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function Ll(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function Cl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function Tl(e,n){var t,o;let l=0;for(const r of e){const e=Cl(Ll(r));e>l&&(l=e)}return Ol({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const El='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',Il='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',Al={id:"material",core:{"":Il,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:Il,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:El,csharp:El,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(e=>e.materialExtendedMap)},$l=/* @__PURE__ */new Map;let Hl="material";const zl=/* @__PURE__ */new Map,Rl=/* @__PURE__ */new Map;let Wl=null;function Pl(e){$l.set(e.id,e)}function jl(e){if(!$l.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[...$l.keys()].join(", ")}`);Hl=e,null==Wl||Wl();const n=$l.get(e);n.loadExtended&&!zl.has(e)&&Kl(n)}function Fl(){return[...$l.keys()]}function Kl(e){return d(this,null,function*(){var n,t,o;if(zl.has(e.id))return null!=(n=zl.get(e.id))?n:null;let l=Rl.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(zl.set(e.id,n),null==Wl||Wl(),n)).catch(()=>(zl.set(e.id,null),null)),Rl.set(e.id,l)),l})}let Dl=null;const Vl=$(0);Wl=()=>{Vl.value++},Pl(Al);const Ul={"":"",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",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function ql(e){Dl=null!=e?e:null}function Xl(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=Ul[t])?n:t}function Gl(e){const n=Xl(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function Zl(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=$l.get(Hl);(null==e?void 0:e.loadExtended)&&(yield Kl(e))})}()})}function Yl(e){if(Dl){const n=Dl(e);if(null!=n&&""!==n)return n}return function(e){const n=$l.get(Hl);if(!n)return;const t=n.core[e];if(t)return t;const o=zl.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!zl.has(n.id)&&Kl(n)}(Xl(e))||(null!=(t=null==(n=$l.get(Hl))?void 0:n.fallback)?t:"");var n,t}const Jl={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},Ql=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,l=t.length,r=l/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,u=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function er(){Ql.enable()}function nr(){Ql.disable()}function tr(){return Ql.printReport()}function or(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function lr(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=tr,window.__katexPerfMonitor=Ql);const rr={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},ir={class:"flex items-center gap-0.5"},ar=["aria-label"],sr={class:"code-diff-stat removed"},ur={class:"code-diff-stat added"},dr=["aria-label"],cr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},hr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},mr=["aria-pressed"],fr={key:3,class:"relative"},pr=["aria-expanded"],vr=["disabled"],gr=["disabled"],yr=["disabled"],wr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Nr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},xr={class:"code-block-shell-content"},kr={class:"code-loading-placeholder"},Mr={class:"sr-only","aria-live":"polite",role:"status"},br=/* @__PURE__ */_({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:n}){const t=j(!1),o=j(null),l=j(null),r=j({});function i(){t.value=!t.value,t.value&&(function(){const e=l.value;if(!e)return;const n=e.getBoundingClientRect(),t=getComputedStyle(e),o={position:"absolute",top:`${n.bottom+window.scrollY+4}px`,right:document.body.scrollWidth-n.right-window.scrollX+"px",zIndex:"9999"};for(const l of a){const e=t.getPropertyValue(l).trim();e&&(o[l]=e)}r.value=o}(),document.addEventListener("click",s,{once:!0,capture:!0}))}const a=["--ms-popover","--ms-popover-foreground","--code-border","--code-action-fg","--code-action-hover-bg","--code-action-hover-fg","--ms-shadow-popover","--ms-duration-fast","--ms-ease-standard","--ms-radius"];function s(e){var n,r;const i=e.target;(null==(n=o.value)?void 0:n.contains(i))||(null==(r=l.value)?void 0:r.contains(i))?document.addEventListener("click",s,{once:!0,capture:!0}):t.value=!1}const u=z(()=>d.showFontSizeButtons&&d.enableFontSizeControl||d.showExpandButton||d.isPreviewable&&d.showPreviewButton),d=e,c=n,{t:h}=Nn(),m=z(()=>!1!==d.showTooltips);function f(e,n){m.value&&vn(e.currentTarget,n,"top",!1,void 0,d.isDark)}function p(){m.value&&gn()}function v(e){f(e,d.copyText?h("common.copied")||"Copied":h("common.copy")||"Copy")}const g=z(()=>{var e,n;return!!Number.isFinite(d.codeFontSize)&&(null!=(e=d.codeFontSize)?e:0)<=(null!=(n=d.codeFontMin)?n:0)}),y=z(()=>!d.fontBaselineReady||d.codeFontSize===d.defaultCodeFontSize),w=z(()=>{var e,n;return!!Number.isFinite(d.codeFontSize)&&(null!=(e=d.codeFontSize)?e:0)>=(null!=(n=d.codeFontMax)?n:100)});return(n,a)=>(B(),O(E,null,[d.showHeader?(B(),O("div",rr,[ne(n.$slots,"header-left"),ne(n.$slots,"header-right",{},()=>[T("div",ir,[e.diffStats?(B(),O("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[T("span",sr,"-"+A(e.diffStats.removed),1),T("span",ur,"+"+A(e.diffStats.added),1)],8,ar)):K("",!0),d.showCopyButton?(B(),O("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?C(h)("common.copied")||"Copied":C(h)("common.copy")||"Copy",onClick:a[0]||(a[0]=e=>c("copy")),onMouseenter:a[1]||(a[1]=e=>v(e)),onFocus:a[2]||(a[2]=e=>v(e)),onMouseleave:p,onBlur:p},[e.copyText?(B(),O("svg",hr,[...a[14]||(a[14]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(B(),O("svg",cr,[...a[13]||(a[13]=[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),T("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,dr)):K("",!0),d.showCollapseButton?(B(),O("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:a[3]||(a[3]=e=>c("toggleCollapse")),onMouseenter:a[4]||(a[4]=n=>f(n,e.isCollapsed?C(h)("common.expand")||"Expand":C(h)("common.collapse")||"Collapse")),onFocus:a[5]||(a[5]=n=>f(n,e.isCollapsed?C(h)("common.expand")||"Expand":C(h)("common.collapse")||"Collapse")),onMouseleave:p,onBlur:p},[(B(),O("svg",{style:Y({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...a[15]||(a[15]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,mr)):K("",!0),u.value?(B(),O("div",fr,[T("button",{ref_key:"moreBtnRef",ref:l,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":t.value,"aria-haspopup":"true",onClick:ae(i,["stop"]),onMouseenter:a[6]||(a[6]=e=>f(e,C(h)("common.more")||"More")),onFocus:a[7]||(a[7]=e=>f(e,C(h)("common.more")||"More")),onMouseleave:p,onBlur:p},[...a[16]||(a[16]=[se('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,pr),(B(),U(q,{to:"body"},[L(X,{name:"code-menu"},{default:G(()=>[t.value?(B(),O("div",{key:0,ref_key:"moreMenuRef",ref:o,style:Y([r.value,{"border-radius":"var(--ms-radius)"}]),class:"min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[d.showFontSizeButtons&&d.enableFontSizeControl?(B(),O(E,{key:0},[T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:g.value,onClick:a[8]||(a[8]=e=>c("decreaseFont"))},[a[17]||(a[17]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),T("span",null,A(C(h)("common.fontSmaller")||"Font size −"),1)],8,vr),T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:y.value,onClick:a[9]||(a[9]=e=>c("resetFont"))},[a[18]||(a[18]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),T("path",{d:"M3 3v5h5"})])],-1)),T("span",null,A(C(h)("common.fontReset")||"Font size reset"),1)],8,gr),T("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:w.value,onClick:a[10]||(a[10]=e=>c("increaseFont"))},[a[19]||(a[19]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),T("span",null,A(C(h)("common.fontLarger")||"Font size +"),1)],8,yr)],64)):K("",!0),d.showExpandButton?(B(),O("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:a[11]||(a[11]=e=>{c("toggleExpand",e),t.value=!1})},[e.isExpanded?(B(),O("svg",wr,[...a[20]||(a[20]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(B(),O("svg",Nr,[...a[21]||(a[21]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),T("span",null,A(e.isExpanded?C(h)("common.collapse")||"Collapse":C(h)("common.expand")||"Expand"),1)])):K("",!0),e.isPreviewable&&d.showPreviewButton?(B(),O("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:a[12]||(a[12]=e=>{c("preview"),t.value=!1})},[a[22]||(a[22]=T("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),T("circle",{cx:"12",cy:"12",r:"3"})])],-1)),T("span",null,A(C(h)("common.preview")||"Preview"),1)])):K("",!0)],4)):K("",!0)]),_:1})]))])):K("",!0)])])])):K("",!0),Z(T("div",xr,[ne(n.$slots,"default")],512),[[Q,!(e.isCollapsed||!e.stream&&e.loading)]]),Z(T("div",kr,[ne(n.$slots,"loading",{},()=>[a[23]||(a[23]=T("div",{class:"loading-skeleton"},[T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line short"})],-1))])],512),[[Q,!e.stream&&e.loading]]),T("span",Mr,A(e.copyText?C(h)("common.copied")||"Copied":""),1)],64))}}),Sr={class:"code-header-main"},_r=["innerHTML"],Br={class:"code-header-copy"},Or={class:"code-header-title"},Lr=["innerHTML"],Cr=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=Nn(),r=j(Xl(t.node.language)),i=j(!1),s=j(!1),u=j(!1),c=j(null),h=j(null),m=j(null),f=j(""),p=j(!1);let v;const g=_t(),y=j(null),w=j("undefined"==typeof window);"undefined"!=typeof window&&F(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const N=j(!0),x=j(0),k=j(14),M=j(k.value),b=z(()=>{const e=k.value,n=M.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),S=z(()=>{const e=r.value.trim().toLowerCase();return Jl[e]||e.charAt(0).toUpperCase()+e.slice(1)}),_=z(()=>(Vl.value,Yl(r.value.trim().toLowerCase().split(":")[0]))),C=z(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),E=z(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),I=z(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),$=z(()=>null!=I.value&&!p.value),H=z(()=>a({fontSize:`${M.value}px`},$.value?{minHeight:`${I.value}px`}:{}));z(()=>{if(null!=I.value)return{minHeight:`${I.value}px`}});const W=z(()=>!1!==t.showTooltips);function P(){return t.isDark?t.darkTheme:t.lightTheme}function U(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`,p.value=!1}function q(){f.value="",p.value=!0}function X(){var e;const n=m.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function Z(){return d(this,null,function*(){if(yield D(),X())return void q();const e=m.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{X()&&(q(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let J,Q,ee,te,oe=null;const le=/* @__PURE__ */new Set,re=/* @__PURE__ */new Set,ie=void 0!==import.meta&&Boolean(!1);let ae=null;function se(e,n){return d(this,null,function*(){if(!J)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),l=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return l?!te||te.has(l)?l:(n&&ie&&!le.has(l)&&(le.add(l),console.warn(`[MarkdownCodeBlockNode] Language "${l}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield J.updateCode(e,t)}catch(o){"plaintext"!==t?(ie&&!re.has(t)&&(re.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield J.updateCode(e,"plaintext")):ie&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function ce(e){if(!ee)return;const n=Array.isArray(e)?e.join("\0"):"";oe!==n&&(ee({themes:e}),oe=n)}function he(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!Q)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");Q=e.createShikiStreamRenderer,ee=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;te=n?new Set(n.map(e=>e.toLowerCase())):void 0,ce(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),h.value&&m.value?(ce(t.themes),!J&&Q&&(J=Q(m.value,{theme:P()}),p.value=!0),J?!1===t.stream&&t.loading?U(t.node.code):(U(t.node.code),yield se(t.node.code,r.value),yield Z()):U(t.node.code)):U(t.node.code)):U(t.node.code)})}function me(){const e=h.value;if(!e||s.value)return;const n=e.scrollTop;n<x.value?N.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(N.value=!0),x.value=n}function fe(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function pe(e){if(s.value=!s.value,e&&W.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&vn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=h.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="",n.style.overflow="auto",N.value=!0,D(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}function ve(){u.value=!u.value}function ge(){const e=Math.min(36,M.value+1);M.value=e}function ye(){const e=Math.max(10,M.value-1);M.value=e}function we(){M.value=k.value}function Ne(){if(!C.value)return;const e=(r.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return ue(()=>{w.value?he():U(t.node.code)}),V(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),F(()=>t.themes,()=>d(null,null,function*(){ce(t.themes)})),F(()=>t.loading,e=>{e||(w.value?he():U(t.node.code))}),F(()=>w.value,e=>{e&&he()}),F(W,e=>{e||gn()}),F(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=Xl(n);o!==r.value&&(r.value=o),w.value&&h.value&&m.value?(J||(U(e),yield he()),J&&e&&(!1===t.stream&&t.loading||(U(e),yield se(e,n),yield Z()))):U(e)})),F(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&h.value&&m.value&&(J||(yield he()),null==J||J.setTheme(P()))})),F(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!N.value)return;yield D();const e=h.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(B(),O("div",{ref_key:"container",ref:c,style:Y(E.value),class:R(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[L(br,{"show-header":t.showHeader,"show-collapse-button":t.showCollapseButton,"show-font-size-buttons":t.showFontSizeButtons,"enable-font-size-control":t.enableFontSizeControl,"show-copy-button":t.showCopyButton,"show-expand-button":t.showExpandButton,"show-preview-button":t.showPreviewButton,"show-tooltips":t.showTooltips,"is-dark":t.isDark,loading:t.loading,stream:t.stream,"is-collapsed":u.value,"is-expanded":s.value,"copy-text":i.value,"is-previewable":C.value,"code-font-size":M.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":k.value,"font-baseline-ready":b.value,onToggleCollapse:ve,onDecreaseFont:ye,onResetFont:we,onIncreaseFont:ge,onCopy:fe,onToggleExpand:pe,onPreview:Ne},de({"header-left":G(()=>[ne(n.$slots,"header-left",{},()=>[T("div",Sr,[T("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:_.value},null,8,_r),T("div",Br,[T("div",Or,A(S.value),1)])])],!0)]),loading:G(()=>[ne(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=T("div",{class:"loading-skeleton"},[T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line short"})],-1))],!0)]),default:G(()=>[T("div",{ref_key:"codeBlockContent",ref:h,class:"code-block-content",style:Y(H.value),onScroll:me},[T("div",{ref_key:"rendererTarget",ref:m,class:"code-block-render"},null,512),p.value?K("",!0):(B(),O("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,Lr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:G(()=>[ne(n.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready"])],6))}}),[["__scopeId","data-v-fb3160fa"]]);Cr.install=e=>{e.component(Cr.__name,Cr)};const Tr=["data-custom-id"],Er={class:"m-0 p-0"},Ir=["data-probe"],Ar=["data-node-index","data-node-type"],$r=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=j(),u=j(null),c=j(null),h=j(null),m=ce({1:null,2:null,3:null,4:null,5:null,6:null}),f=j(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=z(()=>l.debugPerformance&&v&&"undefined"!=typeof console),S=W(),_=/* @__PURE__ */new Map,A=j(0),$=j(0),H=j({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),P=z(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=S.showTooltips)?e:S["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function q(e,n){g.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function Z(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function J(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function Q(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let l=n;for(;l&&l!==t.body&&l!==o;){if(Z(window.getComputedStyle(l))&&J(l))return l;l=l.parentElement}return null}ie("markstreamShowTooltips",P),ie("markstreamTypewriter",z(()=>!1!==l.typewriter)),ie("markstreamTextStreamState",_),ie("markstreamStreamVersion",A),F([()=>l.content,()=>l.nodes],()=>{A.value+=1},{immediate:!0});const ee=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,ne=N(ee),te=/* @__PURE__ */new Map,ae=z(()=>($e.value,ze(l.customId))),se=z(()=>{var e;return x(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ue=z(()=>{const{key:e,tags:n}=k(se.value);if(!e)return ne;const t=te.get(e);if(t)return t;const o=N(ee,{customHtmlTags:n});return te.set(e,o),o}),de=z(()=>{const e=ue.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),me=z(()=>{var e,n;const t=null!=(e=l.parseOptions)?e:{},o=null!=(n=l.final)?n:t.final,r=se.value,i=null!=o,s=r.length>0;return i||s?a(a(a({},t),i?{final:o}:{}),s?{customHtmlTags:r}:{}):t}),fe=z(()=>{var e;const n=null!=(e=me.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),pe=z(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return he(l.nodes.slice());if(l.content){const e=g.value?performance.now():0,n=M(l.content,de.value,me.value);return g.value&&q("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),he(n)}return[]}),ve=j(null),ge=j(null),ye=j(null),we=j(null),Ne=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),ke=!Ne&&l.customId?fl(l.customId):null,Me=z(()=>ke?(ml.value,fl(l.customId)):null),be=z(()=>{var e;return Boolean(v&&l.customId&&!Ne&&(null==(e=Me.value)?void 0:e.enabled))}),_e=z(()=>{var e;return be.value&&!1!==(null==(e=Me.value)?void 0:e.textEstimation)}),Be=z(()=>{var e;return be.value&&!1!==(null==(e=Me.value)?void 0:e.codeBlockEstimation)}),Oe=z(()=>{var e;return Math.max(320,$.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ce=z(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Ee=z(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&pe.value.length>Ce.value}),Ie=z(()=>Ee.value||be.value),Ae=z(()=>!1!==l.viewportPriority&&!f.value),He=St(e=>{var n;return Q(null!=(n=null!=e?e:i.value)?n:null)},Ae),Re=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,We=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,Pe="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,je="test"===(null==Pe?void 0:Pe.NODE_ENV),Ke=v&&"function"==typeof window.requestIdleCallback,De=z(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Ve=z(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:De.value);return Number.isFinite(n)?Math.max(0,n):De.value}),Ue=z(()=>!1!==l.batchRendering&&De.value>0&&v&&!je),qe=j(0),Xe=j({key:l.indexKey,total:0}),Ge=j(Math.max(1,De.value||1)),Ye=j(/* @__PURE__ */new Set),Je=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map,nn=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new WeakMap,rn=j(0),an=z(()=>(rn.value,Array.from(tn.entries()).sort((e,n)=>e[0]-n[0]))),sn=j(0),un=j([]),dn=j([]),cn=j(null),hn=j(null);let mn=null,fn=[],pn=null,vn=null;const gn=z(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Ee.value&&!(pe.value.length>900)&&Ae.value}),yn=z(()=>{var e;return Ue.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),wn=j({batchSize:De.value,initial:Ve.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:yn.value}),Nn=z(()=>!!He&&(gn.value||Ee.value)),xn=z(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),kn=j(0),Mn=ce({start:0,end:0}),bn=/* @__PURE__ */new Map,Sn=/* @__PURE__ */new Map,Bn=z(()=>{if(!Ee.value)return pe.value.length;const e=xn.value,n=Math.max(Mn.end+e,Ve.value),t=Math.min(pe.value.length,n);return Math.max(qe.value,t)});function On(e){var n,t;return null!=(t=null==(n=we.value)?void 0:n[e])?t:null}function Ln(e){var n,t,o,l;const r=Q(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Cn(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Tn(e,n,t){var o,l,r,i,a,s;if(t)return null!=(i=null!=(r=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?r:null==(l=null==n?void 0:n.body)?void 0:l.scrollTop)?i:0;const u=e.scrollTop;if(!Cn(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function En(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function In(){pn&&(pn(),pn=null),cn.value=null}function An(){if(!v||!Ee.value)return;const e=Ln();if(!e||cn.value===e)return;In();const n=()=>Hn();e.addEventListener("scroll",n,{passive:!0}),cn.value=e,pn=()=>{e.removeEventListener("scroll",n)}}function $n(){var e,n,t;if(!vn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;vn.viaTimeout?o?o.clearTimeout(vn.id):clearTimeout(vn.id):null==We||We(vn.id),vn=null}function Hn(e={}){var n,t,o;if(!Ee.value)return;if(!v)return void zn(!0);if(e.immediate)return $n(),void zn(!0);if(vn)return;const l=()=>{vn=null,zn()};if(Re)vn={id:Re(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);vn={id:r,viaTimeout:!0}}}function zn(e=!1){var n,t,o,l,r,a,s;if(!Ee.value)return;const u=cn.value||Ln();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),h=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),m=pe.value.length;if(!h&&m>0&&Cn(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=pe.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(be.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=pt(e);if(n<=t)return e;n-=t}return 0}if(sn.value===t.length){const n=Tt(0,t.length);return Rt(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Wn[l])?n:Jn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Rn(l,0,Math.max(0,m-1));return void((e||Math.abs(r-kn.value)>1)&&(kn.value=r))}const f=h?null:u.getBoundingClientRect(),p=h?0:f.top,v=h?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=an.value;let y=null,w=null;for(const[i,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=h?{top:0}:u.getBoundingClientRect(),t=Tn(u,d,h),o=h?(()=>{const t=e.getBoundingClientRect(),o=(h?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=En(e,u);return Math.max(0,t-n)})(),m=h?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=Rt(o+.5*Math.max(0,m));return void(kn.value=Rn(f,0,Math.max(0,pe.value.length-1)))}const N=Math.round((y+w)/2);!e&&Math.abs(N-kn.value)<=1||(kn.value=Rn(N,0,Math.max(0,pe.value.length-1)))}function Rn(e,n,t){return Math.min(Math.max(e,n),t)}const Wn=ce({}),Pn=ce({total:0,count:0});function jn(){for(const e of Object.keys(Wn))delete Wn[Number(e)];Pn.total=0,Pn.count=0,sn.value=0,un.value=[],dn.value=[]}function Un(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function qn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Gn(e,n,t){if(t<=n)return 0;const o=qn(e,t-1);return n<=0?o:o-qn(e,n-1)}function Zn(e){sn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Wn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(Un(n,r,i),Un(t,r,1))}un.value=n,dn.value=t}const Jn=z(()=>Pn.count>0?Math.max(12,Pn.total/Pn.count):32);function et(e){return null==e?void 0:e.firstElementChild}function tt(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function ot(){var e,n;if(!be.value)return void($.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;$.value=t>0?t:0}let lt=null;function rt(){null==lt||lt.disconnect(),lt=null}const at=oe(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),$t}})),ut=z(()=>l.renderCodeBlocksAsPre?$t:at);function ct(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const mt=z(()=>{var e;const n=pe.value;if(!n.length||!be.value)return n.map(()=>null);const t=$.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=Wn[n],r="number"==typeof o&&o>0;if(_e.value&&!r){const n=wl(e,t,H.value);if(n)return n}if(Be.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=No(e,wo(e));return n===Cr?"markdown":n===$t?"pre":n===ut.value||n===at?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(Nl(String(null!=(n=e.originalCode)?n:"")),Nl(String(null!=(t=e.updatedCode)?t:"")),Nl(String(null!=(o=e.code)?o:""))):Nl(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:ct()})}return null})});function pt(e){var n,t,o;return null!=(o=null!=(t=Wn[e])?t:null==(n=mt.value[e])?void 0:n.height)?o:Jn.value}function vt(){const e=cn.value||Ln(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,Tn(e,t,!1)-En(n,e))}function yt(e){return Tt(0,Rn(e.nodeIndex,0,Math.max(0,pe.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function Nt(){if(null!=mn&&(null==We||We(mn),mn=null),v)for(const e of fn)window.clearTimeout(e);fn=[]}function bt(e){!function(e){var n;const t=cn.value||Ln(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=Tn(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=En(o,t)+l}(yt(e))}function _t(){hn.value&&v&&null==mn&&(mn=Re?Re(()=>{mn=null,hn.value&&bt(hn.value)}):null,null==mn&&hn.value&&bt(hn.value))}function Bt(){const e=vt(),n=pe.value.length;if(null==e||n<=0)return null;const t=Rn(Rt(e+1),0,n-1),o=Tt(0,t),l=pt(t);return{nodeIndex:t,offsetWithinNodePx:Rn(e-o,0,Math.max(0,l-1))}}function Ot(e){if(hn.value={nodeIndex:Rn(e.nodeIndex,0,Math.max(0,pe.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},Nt(),bt(hn.value),v)for(const n of[0,120,280,480])fn.push(window.setTimeout(()=>{hn.value&&bt(hn.value)},n))}function Lt(e){const n=vt();return null==n?null:n-yt(e)}function Tt(e,n){var t,o;if(e>=n)return 0;if(be.value){let t=0;for(let o=e;o<n;o++)t+=pt(o);return t}if(sn.value!==pe.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Wn[l])?t:Jn.value;return o}const l=un.value,r=dn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Wn[l])?o:Jn.value;return t}return Gn(l,e,n)+(n-e-Gn(r,e,n))*Jn.value}F(()=>pe.value.length,e=>{e<=0?jn():(e<sn.value&&function(e){if(e<=0)return void jn();let n=0,t=0;for(const[o,l]of Object.entries(Wn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Wn[r]:(n+=i,t++)}Pn.total=n,Pn.count=t}(e),e!==sn.value&&Zn(e))},{immediate:!0});const It=z(()=>{if(!Ee.value)return pe.value.map((e,n)=>({node:e,index:n}));const e=pe.value.length,n=Rn(Mn.start,0,e),t=Rn(Mn.end,n,e);return pe.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),At=z(()=>Ee.value?Tt(0,Math.min(Mn.start,pe.value.length)):0),Ht=z(()=>{if(!Ee.value)return 0;const e=pe.value.length;return Tt(Math.min(Mn.end,e),e)});function zt(){var e;const n=pe.value;return{totalNodes:n.length,measuredCount:Pn.count,estimatedCount:mt.value.filter(Boolean).length,averageNodeHeight:Jn.value,topSpacerHeight:At.value,bottomSpacerHeight:Ht.value,estimatedTotalHeight:Tt(0,n.length),width:$.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(H.value.paragraph),listItemReady:Boolean(H.value.listItem),listWrapperOverhead:H.value.listWrapperOverhead,headingReadyLevels:Object.entries(H.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=mt.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=mt.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=mt.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=mt.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Wn[n])?d:null}})}}function Rt(e){var n;if(e<=0)return 0;const t=pe.value;if(be.value){let n=e;for(let e=0;e<t.length;e++){const t=pt(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(sn.value===t.length&&un.value.length&&dn.value.length){const n=Jn.value,o=un.value,l=dn.value,r=e=>e<=0?0:qn(o,e-1)+(e-qn(l,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Wn[l])?n:Jn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Pt(){rn.value+=1}function Ft(e,n){const t=Ye.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ye.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ye.value=l}function Vt(){0!==Ye.value.size&&(Ye.value=/* @__PURE__ */new Set)}function Ut(e){if(!Je.size)return;if(!Ee.value)return;let n=!1;for(const[t,o]of Je)t>=e&&(o.destroy(),Je.delete(t),gn.value&&Ft(t,!1),to(t),tn.delete(t)&&(n=!0));n&&Pt()}function qt(e,n){gn.value&&Ft(e,n),n&&(Ee.value?Hn():kn.value=Rn(e,0,Math.max(0,pe.value.length-1)))}function Xt(e){const n=en.get(e);n&&(n(),en.delete(e));const t=Je.get(e);t&&(t.destroy(),Je.delete(e)),to(e)}function Gt(e,n){let t=!1;if(n){const o=tn.get(e);tn.set(e,n),o!==n&&(t=!0)}else tn.delete(e)&&(t=!0);if(t&&Pt(),n||to(e),!Nn.value||!He)return Xt(e),void(n&&qt(e,!0));if(!Ee.value&&gn.value&&!f.value&&Je.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Je.values())e.destroy();if(Je.clear(),v)for(const e of nn.values())window.clearTimeout(e);nn.clear(),Vt()}}(),!Nn.value||!He))return Xt(e),void(n&&qt(e,!0));if(e<Ve.value&&!Ee.value)return Xt(e),void qt(e,!0);if(Ye.value.has(e))return Xt(e),void qt(e,!0);if(!n)return void Xt(e);Xt(e);const o=He(n,{rootMargin:"400px"});if(!o)return;Je.set(e,o),qt(e,o.isVisible.value),gn.value&&function(e){if(!v||!gn.value)return;to(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(nn.delete(e),!gn.value)return;if(Ye.value.has(e))return;const o=tn.get(e);if(!o)return;const l=Ln(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&qt(e,!0)},1800+n);nn.set(e,t)}(e);let l=null;l=F(()=>o.isVisible.value,n=>{if(n){to(e),qt(e,!0),null==l||l(),en.delete(e),Je.get(e)===o&&Je.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),en.set(e,l),Ee.value&&Hn()}F(()=>Ie.value,e=>{if(!e){for(const e of on.values())e.disconnect();on.clear();for(const e of Sn.values())for(const n of e)window.clearTimeout(n);Sn.clear()}},{immediate:!0});let Zt=null,Yt=null,Jt=!1,Qt=null,eo=null;function no(){v&&(null!=Zt&&(null==We||We(Zt),Zt=null),null!=Yt&&(window.clearTimeout(Yt),Yt=null),null!=eo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(eo),eo=null),Jt=!1,Qt=null)}function to(e){if(!v)return;const n=nn.get(e);null!=n&&(window.clearTimeout(n),nn.delete(e))}function oo(e,n={}){var t,o;if(!yn.value)return;const r=Bn.value;if(qe.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Zt=null,Yt=null,eo=null,Jt=!1;const t=null!=Qt?Qt:i;Qt=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();qe.value=Math.min(r,qe.value+Math.max(1,e)),Ut(qe.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!yn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,De.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Ge.value=Math.max(r,Math.floor(.7*Ge.value)):e<.5*t&&Ge.value<o&&(Ge.value=Math.min(o,Math.ceil(1.2*Ge.value)))}(t),t};let s=t;for(;(a(s),!(qe.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Ge.value));qe.value<r&&lo()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Qt=null!=Qt?Math.max(Qt,i):i,!Jt){if(Jt=!0,!je&&Ke&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(eo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}Re&&!je?Zt=Re(()=>{0!==s?Yt=window.setTimeout(()=>a(),s):a()}):Yt=window.setTimeout(()=>a(),s)}}function lo(){yn.value&&oo(Ue.value?Math.max(1,Math.round(Ge.value)):Math.max(1,De.value))}F([()=>pe.value,()=>pe.value.length,()=>yn.value,()=>De.value,()=>Ve.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=pe.value.length,t=Xe.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Xe.value={key:o,total:n};const s=wn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==De.value||s.initial!==Ve.value||s.delay!==u||s.enabled!==yn.value;wn.value={batchSize:De.value,initial:Ve.value,delay:u,enabled:yn.value},r&&(jn(),n>0&&Zn(n)),(a||d||!yn.value)&&no(),(a||d)&&(Ge.value=Math.max(1,De.value||1)),a&&Ee.value&&Hn({immediate:!0});const c=Bn.value;if(!n)return qe.value=0,void Ut(0);if(!yn.value)return qe.value=c,void Ut(qe.value);const h=r||0===t.total;qe.value=h||d?Math.min(c,Ve.value):Math.min(qe.value,c);const m=Math.max(1,Ve.value||De.value||n);qe.value<c?oo(m,{immediate:!v}):Ut(qe.value)},{immediate:!0}),F(()=>Ee.value,e=>{if(!e)return In(),void $n();An(),Hn({immediate:!0})},{immediate:!0}),F([()=>pe.value.length,()=>Ee.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield D(),Hn({immediate:!0}))}),{flush:"post"}),F(()=>i.value,()=>{Ee.value&&(An(),Hn({immediate:!0}))}),F(be,e=>{e&&function(){var e;if(ve.value&&ge.value&&ye.value&&(null==(e=we.value)?void 0:e[1]))return;const n=he({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=he({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=he({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});ve.value=n,ge.value=t,ye.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=he({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});we.value=l}()},{immediate:!0}),F([()=>i.value,be],()=>{if(!be.value)return rt(),void($.value=0);ot(),rt(),be.value&&i.value&&"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(()=>{ot(),hn.value&&_t()}),lt.observe(i.value))},{immediate:!0}),F([be,Oe],()=>d(null,null,function*(){be.value?(yield D(),function(){var e,n,t,o;if(!be.value||"undefined"==typeof window)return void(H.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=tt(et(u.value),".paragraph-node");l.paragraph=kl(u.value,r,"pre-wrap");const i=et(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=kl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=h.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=tt(et(m[u]),`h${u}`);l.headings[u]=kl(m[u],e,"pre-wrap")}H.value=l}()):H.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),F(()=>pe.value.length,()=>{Ee.value&&Hn({immediate:!0})}),F([be,$],()=>{Ee.value&&Hn({immediate:!0}),hn.value&&_t()},{immediate:!1}),F(()=>gn.value,e=>{if(e)for(const[n,t]of tn)Gt(n,t);else{for(const e of Je.values())e.destroy();Je.clear();for(const e of Array.from(nn.keys()))to(e);Vt();for(const[e,n]of tn)n&&qt(e,!0)}},{immediate:!1}),F([()=>l.viewportPriority,()=>pe.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),F(()=>qe.value,()=>{Ee.value&&Hn({immediate:!0})}),F([kn,Ce,xn,()=>pe.value.length,Ee],()=>{!function(){const e=pe.value.length;if(!Ee.value||0===e)return Mn.start=0,void(Mn.end=e);const n=Math.min(Ce.value,e),t=xn.value,o=Rn(kn.value-t,0,Math.max(0,e-n));Mn.start=o,Mn.end=Math.min(e,o+n)}()},{immediate:!0}),F([()=>pe.value.length,Ee,Ce,xn,()=>Mn.start,()=>Mn.end],([e,n,t,o,l,r])=>{g.value&&q("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:kn.value,scroll:n?(()=>{const e=cn.value||Ln();return e?{reverse:Cn(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:qe.value})}),F(()=>Bn.value,(e,n)=>{yn.value&&("number"==typeof n&&e<=n||e>qe.value&&lo())}),F([()=>l.customId],([e],n,t)=>{if(!e||Ne)return;const o=function(e,n){return e?(cl.controllers[e]=n,()=>{cl.controllers[e]===n&&delete cl.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Bt,restoreAnchor:Ot,getAnchorDrift:Lt,getReport:zt});t(()=>{o()})},{immediate:!0}),V(()=>{no();for(const e of Je.values())e.destroy();Je.clear();for(const e of on.values())e.disconnect();on.clear();for(const e of Sn.values())for(const n of e)window.clearTimeout(n);Sn.clear();for(const e of en.values())e();en.clear();for(const e of Array.from(nn.keys()))to(e);rt(),Nt(),In(),$n()});const ro=oe(()=>d(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),$t}})),io=oe(()=>d(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),$t}})),ao=oe(()=>d(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),$t}})),so={text:Fn,paragraph:Et,heading:xt,code_block:at,list:Mt,list_item:kt,blockquote:xe,table:Wt,definition_list:Le,footnote:gt,footnote_reference:Fe,footnote_anchor:ft,admonition:Kr,vmr_container:Dt,hardbreak:wt,link:it,image:_n,thematic_break:jt,math_inline:Kn,math_block:Dn,strong:Qn,emphasis:ht,strikethrough:nt,highlight:dt,insert:st,subscript:Yn,superscript:Xn,emoji:Te,checkbox:Se,checkbox_input:Se,inline_code:Qe,html_inline:Ze,reference:Vn,html_block:Ct},uo=z(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),co=z(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof P.value?{showTooltips:P.value}:{}),l.codeBlockProps||{})),ho=z(()=>a({},l.mermaidProps||{})),mo=z(()=>a({},l.d2Props||{})),fo=z(()=>a({},l.infographicProps||{})),po=z(()=>({typewriter:l.typewriter,customHtmlTags:me.value.customHtmlTags})),vo=z(()=>a(a({},po.value),"boolean"==typeof P.value?{showTooltip:P.value}:{})),go=z(()=>a(a({},po.value),"boolean"==typeof P.value?{showTooltips:P.value}:{})),yo=z(()=>It.value.map(e=>{var n,t,o,l;let r=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=ln.get(u);if(c&&c.signature===d)return c.node;const h=a({},u);return ln.set(u,{signature:d,node:h}),h}(e.node);const i=wo(r);let u=No(r,i);if(("html_block"===r.type||"html_inline"===r.type)&&u===so[r.type]){const e=r,i=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(i){const n=ae.value[i];if(fe.value.has(i)&&n)u=n,r=s(a({},e),{type:i,tag:i,content:b(e.content,i)});else if(w(null!=(t=e.content)?t:e.raw,i)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===r.type?(u=Fn,r={type:"text",content:n,raw:n}):(u=Et,r={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let d=a({},function(e,n){const t=null!=n?n:wo(e);return"mermaid"===t?ho.value:"infographic"===t?fo.value:"d2"===t||"d2lang"===t?mo.value:"link"===e.type?vo.value:"list"===e.type?go.value:"code_block"===e.type?co.value:po.value}(r,i));const c=mt.value[e.index];return"code_block"===r.type&&"code-block"===(null==c?void 0:c.kind)&&(d=s(a({},d),{estimatedHeightPx:c.height,estimatedContentHeightPx:c.contentHeight})),s(a({},e),{node:r,component:u,bindings:d,isCodeBlock:"code_block"===r.type,indexKey:`${uo.value}-${e.index}`})}));function wo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function No(e,n){if(!e)return Kt;const t=ae.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:wo(e);if("mermaid"===l)return t.mermaid||ro;if("infographic"===l)return t.infographic||io;if("d2"===l||"d2lang"===l)return t.d2||ao;if(o)return o;return t.code_block||ut.value}return o||so[String(e.type)]||Kt}function xo(e){r("click",e)}function ko(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Mo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}return(e,n)=>(B(),O("div",{ref_key:"containerRef",ref:i,class:R(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Ee.value}]]),"data-custom-id":l.customId,onClick:xo,onMouseover:ko,onMouseout:Mo},[be.value||Ee.value?(B(),O(E,{key:0},[be.value?(B(),O("div",{key:0,class:"height-estimation-probes",style:Y({width:`${Oe.value}px`}),"aria-hidden":"true"},[T("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[L(C(Et),{node:ve.value,"index-key":"probe-paragraph"},null,8,["node"])],512),T("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[T("ul",Er,[L(C(kt),{node:ge.value,"index-key":"probe-list-item"},null,8,["node"])])],512),T("div",{ref_key:"listProbeWrapperRef",ref:h,class:"node-content","data-probe":"list"},[L(C(Mt),{node:ye.value,"index-key":"probe-list"},null,8,["node"])],512),(B(),O(E,null,I(6,e=>T("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(m[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[L(C(xt),{node:On(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,Ir)),64))],4)):K("",!0),Ee.value?(B(),O("div",{key:1,class:"node-spacer",style:Y({height:`${At.value}px`}),"aria-hidden":"true"},null,4)):K("",!0)],64)):K("",!0),(B(!0),O(E,null,I(yo.value,e=>{return B(),O("div",{key:e.index,ref_for:!0,ref:n=>Gt(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,yn.value&&t>=qe.value||!(!gn.value||t<Ve.value||Ye.value.has(t))?(B(),O("div",{key:1,class:"node-placeholder",style:Y({height:`${pt(e.index)}px`})},null,4)):(B(),O("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=Sn.get(e);if(o){for(const e of o)window.clearTimeout(e);Sn.delete(e)}const l=on.get(e);if(l&&(l.disconnect(),on.delete(e)),!n||!Ie.value)return void bn.delete(e);bn.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Wn[e];if(Wn[e]=n,t?Pn.total+=n-t:(Pn.total+=n,Pn.count++),sn.value>e){const o=un.value,l=dn.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&Un(o,e,l)}else Un(o,e,n),Un(l,e,1)}hn.value&&_t()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),on.set(e,t)}"code_block"===(null==(t=pe.value[e])?void 0:t.type)&&"undefined"!=typeof window&&Sn.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(B(),U(le(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(B(),U(X,{key:0,name:"typewriter",appear:""},{default:G(()=>[(B(),U(le(e.component),re({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,Ar);var t}),128)),Ee.value?(B(),O("div",{key:1,class:"node-spacer",style:Y({height:`${Ht.value}px`}),"aria-hidden":"true"},null,4)):K("",!0)],42,Tr))}}),[["__scopeId","data-v-69906e93"]]);$r.install=e=>{var n,t;const o=null!=(t=null!=(n=$r.__name)?n:$r.name)?t:"NodeRenderer";e.component(o,$r)};const Hr={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},zr={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Rr={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Wr={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Pr={class:"admonition-title"},jr=["aria-expanded","aria-controls"],Fr=["id"],Kr=/* @__PURE__ */Ne(/* @__PURE__ */_({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=z(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),i=j(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const s=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(B(),O("div",{class:R(["admonition",[`admonition-${o.node.kind}`]])},[T("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(B(),O("svg",Hr,[...t[1]||(t[1]=[T("circle",{cx:"12",cy:"12",r:"10"},null,-1),T("path",{d:"M12 16v-4"},null,-1),T("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(B(),O("svg",zr,[...t[2]||(t[2]=[T("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),T("path",{d:"M9 18h6"},null,-1),T("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(B(),O("svg",Rr,[...t[3]||(t[3]=[T("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),T("path",{d:"M12 9v4"},null,-1),T("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(B(),O("svg",Wr,[...t[4]||(t[4]=[T("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),T("path",{d:"M12 8v4"},null,-1),T("path",{d:"M12 16h.01"},null,-1)])])):K("",!0),T("span",Pr,A(r.value),1),o.node.collapsible?(B(),O("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(B(),O("svg",{style:Y({rotate:i.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...t[5]||(t[5]=[T("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,jr)):K("",!0)]),Z(T("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[L(C($r),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,Fr),[[Q,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);Kr.install=e=>{e.component(Kr.__name,Kr)};const Dr=()=>import("@terrastruct/d2");let Vr=null,Ur=Dr;function qr(e){Ur=e,Vr=null}function Xr(e){qr(null!=e?e:Dr)}function Gr(){qr(null)}function Zr(){return"function"==typeof Ur}function Yr(){return d(this,null,function*(){if(Vr)return Vr;const e=Ur;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Dr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(Vr=function(e){var n;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=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),Vr):null})}const Jr=()=>import("mermaid");let Qr=null,ei=Jr;function ni(e){ei=e,Qr=null}function ti(e){ni(null!=e?e:Jr)}function oi(){ni(null)}function li(){return"function"==typeof ei}function ri(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function ii(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function ai(){return d(this,null,function*(){if(Qr)return Qr;const e=function(){try{const e=globalThis;return ri(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return Qr=e,ii(Qr),Qr;const n=ei;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Jr)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(Qr=ri(t),ii(Qr),Qr):null})}function si(e){return JSON.stringify(e)}function ui(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=si(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=si(o),s=l?si(l):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function di(e){var n,t;const o=ui(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}tn.install=e=>{e.component(tn.__name,tn)};let ci=null,hi=null,mi=!1;const fi=/* @__PURE__ */new Map,pi=/* @__PURE__ */new Map;let vi=5;const gi=/* @__PURE__ */new Set;function yi(){if(fi.size<vi&&gi.size){const n=Array.from(gi);gi.clear();for(const t of n)try{t()}catch(e){}}}function wi(e){ci=e,hi=null,ci.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=fi.get(n);if(l)if(fi.delete(n),clearTimeout(l.timeoutId),yi(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(pi.set(e,t),pi.size>200){const e=pi.keys().next().value;pi.delete(e)}}l.resolve(t)}},ci.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of fi.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));fi.clear(),yi()}}function Ni(){var e;ci&&(null==(e=ci.terminate)||e.call(ci)),ci=null,hi=null}function xi(e){mi=!!e,ci&&ci.postMessage({type:"init",debug:mi})}function ki(e,n=!0,t=2e3,o){return d(this,null,function*(){if(performance.now(),!Hn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(hi)return Promise.reject(hi);const l=`${n?"d":"i"}:${e}`,r=pi.get(l);if(r)return Promise.resolve(r);const i=ci||(hi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),hi.name="WorkerInitError",hi.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(hi);if(fi.size>=vi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=fi.size,e.max=vi,Promise.reject(e)}return new Promise((l,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{fi.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),yi()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),fi.has(a)&&fi.delete(a);const e=new Error("Aborted");e.name="AbortError",r(e),yi()},{once:!0});const u=l,d=r;fi.set(a,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Mi(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(pi.set(o,t),pi.size>200){const e=pi.keys().next().value;pi.delete(e)}}function bi(){return{inFlight:fi.size,max:vi}}function Si(e){Number.isFinite(e)&&e>0&&(vi=Math.floor(e))}const _i="WORKER_BUSY";function Bi(){return fi.size>=vi}function Oi(e=2e3,n){return fi.size<vi?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),gi.delete(i),t())};if(gi.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,gi.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>yi()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),gi.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const Li={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Ci(e){null!=e.timeout&&(Li.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Li.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Li.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Li.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ti(){return a({},Li)}function Ei(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!Hn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:Li.timeout,s=null!=(l=t.waitTimeout)?l:Li.waitTimeout,u=null!=(r=t.backoffMs)?r:Li.backoffMs,d=null!=(i=t.maxRetries)?i:Li.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Li.maxRetries,h=t.signal;let m=0;for(;;){if(null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield ki(e,n,a,h)}catch(f){if((null==f?void 0:f.code)!==_i||m>=c)throw f;if(m++,yield Oi(s,h).catch(()=>{}),null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*m)))}}})}function Ii(e){return JSON.stringify(e)}function Ai(e){var n;const t=null!=(n=e.mode)?n:"module",o=Ii(e.mermaidUrl),l=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${Ii(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${l}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${l}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function $i(e){var n,t;const o=Ai(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let Hi=null,zi=null;const Ri=/* @__PURE__ */new Map;let Wi=5,Pi=!1;function ji(e){Pi=!!e}function Fi(e){Number.isFinite(e)&&e>0&&(Wi=Math.floor(e))}function Ki(){return{inFlight:Ri.size,max:Wi}}const Di="WORKER_BUSY",Vi="MERMAID_DISABLED";function Ui(e){Hi=e,zi=null;const n=e;Hi.onmessage=e=>{if(Hi!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=Ri.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},Hi.onerror=e=>{var t,o;if(Hi===n)if(0!==Ri.size){try{Pi?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(l){}for(const[n,t]of Ri.entries())t.reject(new Error(`Worker error: ${e.message}`));Ri.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Hi.onmessageerror=e=>{var t,o;if(Hi===n)if(0!==Ri.size){try{Pi?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of Ri.entries())n.reject(new Error("Worker messageerror"));Ri.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function qi(){var e;if(Hi)try{for(const[e,n]of Ri.entries())n.reject(new Error("Worker cleared"));Ri.clear(),null==(e=Hi.terminate)||e.call(Hi)}catch(n){}Hi=null,zi=null}function Xi(e,n,t=1400){if(!li()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=Vi,Promise.reject(e)}if(zi)return Promise.reject(zi);const o=Hi||(zi=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),zi.name="WorkerInitError",zi.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(zi);if(Ri.size>=Wi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Di,e.inFlight=Ri.size,e.max=Wi,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Ri.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};Ri.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Ri.delete(i),void r(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=Ri.get(i);n&&n.reject(e)},t)})}function Gi(e,n,t=1400){return d(this,null,function*(){try{return yield Xi("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Zi(e,n,t=1400){return d(this,null,function*(){try{return yield Xi("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Yi(){if(Hi)try{for(const[e,n]of Ri.entries())n.reject(new Error("Worker terminated"));Ri.clear(),Hi.terminate()}finally{Hi=null}}const Ji=oe(()=>import("./index7.js")),Qi=oe(()=>import("./index3.js")),ea=oe(()=>import("./index2.js")),na=oe(()=>import("./index4.js")),ta=oe(()=>import("./index5.js")),oa=oe(()=>import("./index6.js")),la={AdmonitionNode:Kr,BlockquoteNode:xe,CheckboxNode:Se,CodeBlockNode:Ji,DefinitionListNode:Le,EmojiNode:Te,EmphasisNode:ht,FootnoteNode:gt,FootnoteReferenceNode:Fe,FootnoteAnchorNode:ft,HardBreakNode:wt,HeadingNode:xt,HtmlBlockNode:Ct,HtmlInlineNode:Ze,HighlightNode:dt,ImageNode:_n,D2BlockNode:oa,InfographicBlockNode:ta,InlineCodeNode:Qe,PreCodeNode:$t,InsertNode:st,LinkNode:it,ListItemNode:kt,ListNode:Mt,MathBlockNode:Qi,MathInlineNode:ea,MermaidBlockNode:na,ParagraphNode:Et,StrikethroughNode:nt,StrongNode:Qn,SubscriptNode:Yn,SuperscriptNode:Xn,TableNode:Wt,TextNode:Fn,ThematicBreakNode:jt,VmrContainerNode:Dt,ReferenceNode:Vn,MarkdownCodeBlockNode:Cr},ra={install(e,n){Object.entries(la).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&jl(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&ql(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&S(n.mathOptions)}};export{ea as $,Kr as A,xe as B,Se as C,oa as D,Te as E,ft as F,gt as G,Fe as H,wt as I,xt as J,dt as K,Ct as L,Ze as M,_n as N,ta as O,Qe as P,st as Q,it as R,kt as S,Mt as T,Vi as U,Di as V,_i as W,Cr as X,$r as Y,Qi as Z,Ne as _,Rn as a,na as a0,Et as a1,Vn as a2,nt as a3,Qn as a4,Yn as a5,Xn as a6,Wt as a7,Fn as a8,jt as a9,Zr as aA,Bi as aB,Hn as aC,li as aD,Ql as aE,Zl as aF,Tl as aG,Ol as aH,Pl as aI,Re as aJ,ki as aK,He as aL,qr as aM,wn as aN,jl as aO,Ci as aP,wi as aQ,xi as aR,Si as aS,In as aT,ql as aU,ni as aV,Ui as aW,ji as aX,Fi as aY,Oi as aZ,tn as aa,Dt as ab,ra as ac,ui as ad,Ai as ae,We as af,Ni as ag,qi as ah,di as ai,$i as aj,Cl as ak,Gr as al,$n as am,oi as an,nr as ao,Xr as ap,An as aq,ti as ar,er as as,Ll as at,ze as au,Ti as av,bi as aw,Ki as ax,tr as ay,Fl as az,Nn as b,or as c,ai as d,vn as e,Gi as f,zn as g,gn as h,Zi as i,Yr as j,Gl as k,Bl as l,Jl as m,Xl as n,Vl as o,Yl as p,$t as q,Ei as r,Mi as s,Yi as t,_t as u,br as v,lr as w,Ji as x,Le as y,ht as z};
package/dist/tailwind.ts CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-vue",
3
3
  "type": "module",
4
- "version": "0.0.12-beta.1",
4
+ "version": "0.0.12",
5
5
  "description": "Streaming-friendly Vue 3 Markdown renderer for docs sites, AI chat UIs, and large documents.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -160,9 +160,9 @@
160
160
  }
161
161
  },
162
162
  "dependencies": {
163
- "@chenglou/pretext": "^0.0.3",
163
+ "@chenglou/pretext": "^0.0.5",
164
164
  "@floating-ui/dom": "^1.7.6",
165
- "stream-markdown-parser": "0.0.82"
165
+ "stream-markdown-parser": "0.0.83"
166
166
  },
167
167
  "devDependencies": {
168
168
  "@antfu/eslint-config": "^5.4.1",