markstream-vue 0.0.14-beta.3 → 0.0.14-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 m,sanitizeHtmlAttrs as h,BLOCKED_HTML_TAGS as f,isHtmlTagHardBlocked as p,isHtmlTagBlocked as v,isCustomHtmlComponentTag as g,convertHtmlAttrsToProps as y,sanitizeHtmlContent as w,sanitizeHtmlTokenAttrs as x,tokenAttrsToRecord as N,NON_STRUCTURING_HTML_TAGS as k,normalizeCustomHtmlTags as b,getHtmlTagFromContent as M,shouldRenderUnknownHtmlTagAsText as S,getMarkdown as _,mergeCustomHtmlTags as B,resolveCustomHtmlTags as O,parseMarkdownToStructure as L,stripCustomHtmlWrapper as C,setDefaultMathOptions as T}from"stream-markdown-parser";import{defineComponent as E,openBlock as I,createElementBlock as A,createVNode as H,unref as $,createElementVNode as z,Fragment as R,renderList as P,toDisplayString as W,shallowRef as j,h as F,inject as K,computed as D,normalizeClass as V,useAttrs as U,ref as q,watch as X,createCommentVNode as G,nextTick as Z,onBeforeUnmount as Y,createBlock as J,Teleport as Q,Transition as ee,withCtx as ne,withDirectives as te,normalizeStyle as oe,createTextVNode as le,vShow as re,createApp as ie,getCurrentInstance as ae,renderSlot as se,readonly as ue,defineAsyncComponent as de,resolveDynamicComponent as ce,mergeProps as me,provide as he,withModifiers as fe,createStaticVNode as pe,onMounted as ve,createSlots as ge,reactive as ye,markRaw as we}from"vue";import{autoUpdate as xe,offset as Ne,flip as ke,shift as be,arrow as Me,computePosition as Se}from"@floating-ui/dom";const _e=["cite"],Be=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},Oe=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(I(),A("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[H($(ai),{"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,_e))}}),[["__scopeId","data-v-07e0310e"]]);Oe.install=e=>{e.component(Oe.__name,Oe)};const Le=["aria-label"],Ce={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"},Te={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"},Ee=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(I(),A("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(I(),A("svg",Te,[...t[1]||(t[1]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),z("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(I(),A("svg",Ce,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Le))}),[["__scopeId","data-v-be21ab83"]]);Ee.install=e=>{e.component(Ee.__name,Ee)};const Ie={class:"definition-list"},Ae={class:"definition-term"},He={class:"definition-desc"},$e=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(I(),A("dl",Ie,[(I(!0),A(R,null,P(n.node.items,(o,l)=>(I(),A(R,{key:l},[z("dt",Ae,[H($(ai),{"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"])]),z("dd",He,[H($(ai),{"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"]]);$e.install=e=>{e.component($e.__name,$e)};const ze={class:"emoji-node"},Re=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(I(),A("span",ze,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Re.install=e=>{e.component(Re.__name,Re)};const Pe="__global__",We="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",je=(()=>{const e=globalThis;if(e[We])return e[We];const n={scopedCustomComponents:{},revision:j(0)};return e[We]=n,n})(),Fe=je.revision;function Ke(e,n){"string"==typeof e?je.scopedCustomComponents[e]=n||{}:je.scopedCustomComponents[Pe]=e||{},Fe.value++}function De(e){const n=je.scopedCustomComponents[Pe]||{};if(!e)return n;const t=je.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ve(e){if(e===Pe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete je.scopedCustomComponents[e],Fe.value++}function Ue(){delete je.scopedCustomComponents[Pe],Fe.value++}const qe=["id"],Xe=["title"],Ge=/* @__PURE__ */Be(/* @__PURE__ */E({__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)=>(I(),A("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[z("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+W(e.node.id)+"]",9,Xe)],8,qe))}}),[["__scopeId","data-v-82cafe9f"]]);Ge.install=e=>{e.component(Ge.__name,Ge)};const Ze=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Ye(e){Ze&&console.warn(e)}function Je(e){return h(e)}function Qe(e,n,t=!1){const o=Object.entries(null!=n?n:{}),l=o.length>0?o.map(([e,n])=>""===n?` ${e}`:` ${e}="${n}"`).join(""):"";return t?`<${e}${l} />`:`<${e}${l}>`}function en(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function nn(e,n,t,o,l,r,i=!1){const u=function(e,n){return g(e,n)}(e,o);if(f.has(e.toLowerCase())||!u&&p(e,r))return null;if(!u&&v(e,r))return i?[Qe(e,n,!0)]:[Qe(e,n),...t,`</${e}>`];const d=h(n,r,e),c=d.key,m=null!=c&&""!==c?c:l;if(u){const n=o[e]||o[e.toLowerCase()],l=function(e){return y(e)}(d);return F(n,s(a({},l),{key:m}),t.length>0?t:void 0)}return F(e,s(a({},d),{innerHTML:void 0,key:m}),t.length>0?t:void 0)}function tn(e,n){return m(e,n)}function on(e,n,t="safe"){if(!e)return[];try{const o=function(e,n,t="safe"){let o=0;const l=[],r=[];for(const i of e)if("text"===i.type)(l.length>0?l[l.length-1].children:r).push(i.content);else if("self_closing"===i.type){const e=nn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);en(l.length>0?l[l.length-1].children:r,e)}else if("tag_open"===i.type)l.push({tagName:i.tagName,children:[],attrs:i.attrs,autoKey:"ms-html-"+o++});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let o=-1;for(let n=l.length-1;n>=0;n--)if(l[n].tagName.toLowerCase()===e){o=n;break}if(-1!==o)for(;l.length>o;){const i=l.pop(),a=nn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?en(l[l.length-1].children,a):en(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&Ye(`Auto-closing unclosed tag: <${i.tagName}>`)}else Ye(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=nn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?en(l[l.length-1].children,o):en(r,o),Ye(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(c(e),n,t);return o}catch(l){return o=l,Ze&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const ln=["innerHTML"],rn=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=K("markstreamHtmlPolicy",void 0),o=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=D(()=>(Fe.value,De(n.customId))),r=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=D(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:w(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=on(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!tn(e,l.value))return{mode:"html",content:w(e,o.value)};const t=on(e,l.value,o.value);return null===t?{mode:"html",content:w(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(I(),A("span",{key:0,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[H($(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(I(),A("span",{key:1,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(I(),A("span",{key:2,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,ln))}}),[["__scopeId","data-v-d7e17280"]]);rn.install=e=>{e.component(rn.__name,rn)};const an={class:"inline-code"},sn={key:0},un=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=K("markstreamTypewriter",void 0),l=K("markstreamTextStreamState",void 0),r=D(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=D(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=D(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=q(n.node.code),u=q(""),d=q(0);function c(){return s.value+u.value}function m(e){s.value=e,u.value=""}function h(){u.value&&(s.value=c(),u.value="")}X([()=>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,h=null!=r?r:t;return i.value?n===h?(m(n),void(o&&(null==l||l.set(o,n)))):h&&n.startsWith(h)&&n.length>h.length?(s.value=h,u.value=n.slice(h.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),X(i,e=>{e||m(c())});const f=D(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(I(),A("code",an,[s.value?(I(),A("span",sn,W(s.value),1)):G("",!0),u.value?(I(),A("span",{key:1,class:V(["inline-code-stream-delta",[f.value]]),onAnimationend:h},W(u.value),35)):G("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);un.install=e=>{e.component(un.__name,un)};const dn=["id"],cn=["data-placement"],mn=/* @__PURE__ */Be(/* @__PURE__ */E({__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=q(null),l=q(null),r=q({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=q({}),a=q(null!=(n=t.placement)?n:"top"),s=q(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[Ne(null!=(e=t.offset)?e:6),ke(),be({padding:6}),...l.value?[Me({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:m}=yield Se(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,m.arrow&&l.value){const{x:e,y:n}=m.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 X(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield Z(),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 Z(),s.value=!0,yield Z(),r.value.transform=n):s.value=!0}else s.value=!0;u=xe(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=xe(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),X([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield Z(),yield c())})),Y(()=>{u&&u()}),(n,u)=>(I(),J(Q,{to:"body"},[z("div",{class:V(["markstream-vue",{dark:e.isDark}])},[H(ee,{name:"tooltip",appear:""},{default:ne(()=>[te(z("div",{id:t.id,ref_key:"tooltip",ref:o,style:oe({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[le(W(e.content)+" ",1),z("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:oe(i.value)},null,12,cn)],12,dn),[[re,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),hn=q(!1),fn=q(""),pn=q("top"),vn=q(null),gn=q(null),yn=q(null),wn=q(null),xn=q(null);let Nn=null,kn=null;function bn(){Nn&&(clearTimeout(Nn),Nn=null),kn&&(clearTimeout(kn),kn=null)}let Mn=!1;function Sn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!Mn&&"undefined"!=typeof document)try{Mn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),ie({setup:()=>()=>{var e;return F(mn,{visible:hn.value,"anchor-el":vn.value,content:fn.value,placement:pn.value,id:gn.value,originX:yn.value,originY:wn.value,isDark:null!=(e=xn.value)?e:void 0})}}).mount(e)}catch(e){Mn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),bn();const i=()=>{var o,i;gn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,vn.value=e,fn.value=n,pn.value=t,yn.value=null!=(o=null==l?void 0:l.x)?o:null,wn.value=null!=(i=null==l?void 0:l.y)?i:null,xn.value="boolean"==typeof r?r:null,hn.value=!0;try{e.setAttribute("aria-describedby",gn.value)}catch(a){}};o?i():Nn=setTimeout(i,80)}function _n(e=!1){bn();const n=()=>{if(vn.value&&gn.value)try{vn.value.removeAttribute("aria-describedby")}catch(e){}hn.value=!1,vn.value=null,gn.value=null,yn.value=null,wn.value=null};e?n():kn=setTimeout(n,120)}const Bn={"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.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function On(e){Object.assign(Bn,e)}const Ln=e=>{var n;return null!=(n=Bn[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)};function Cn(e){return{t(n){if(e.te&&Bn[n]&&!e.te(n))return Ln(n);const t=e.t(n);return t===n&&Bn[n]?Ln(n):t}}}function Tn(){const e=function(){var e,n;try{const t=ae(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(e)return Cn(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return Cn({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:Ln}}const En={class:"image-node-container"},In=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],An={key:"placeholder",class:"image-placeholder"},Hn={key:1,class:"image-node__raw-text"},$n={key:"error",class:"image-error"},zn=/* @__PURE__ */Be(/* @__PURE__ */E({__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=q(!1),r=q(!1),i=q(!1),a=D(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=D(()=>!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:m}=Tn();return X(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(I(),A("span",En,[H(ee,{name:"img-switch",mode:"out-in"},{default:ne(()=>{var i,h,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?G("",!0):(I(),A("span",$n,[se(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]=z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[z("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)),z("span",null,W($(m)("image.loadError")),1)],!0)])):(I(),A("span",An,[t.usePlaceholder?se(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]=z("span",{class:"image-shimmer"},null,-1))],!0):(I(),A("span",Hn,W(e.node.raw),1))])):(I(),A("img",{key:"image",src:a.value,alt:String(null!=(h=null!=(i=t.node.alt)?i:t.node.title)?h:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:V(["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:$(m)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,In))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);zn.install=e=>{e.component(zn.__name,zn)};let Rn=null,Pn=!1,Wn=Kn;function jn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Fn(){try{const e=globalThis;return jn(null==e?void 0:e.katex)}catch(e){return null}}function Kn(){return d(null,null,function*(){const e=Fn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return jn(n)})}function Dn(e){Wn=e,Rn=null,Pn=!1}function Vn(e){Dn(null!=e?e:Kn)}function Un(){Dn(null)}function qn(){return"function"==typeof Wn}function Xn(){var e;const n=Fn();if(n)return Rn=n,Rn;if(Rn)return Rn;const t=Wn;if(!t||t===Kn)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Rn=null!=(e=jn(n))?e:n,Rn):null}catch(o){return null}}function Gn(){return d(this,null,function*(){var e;const n=Fn();if(n)return Rn=n,Rn;if(Rn)return Rn;if(Pn)return null;const t=Wn;if(!t)return Pn=!0,null;try{const n=yield t();if(n)return Rn=null!=(e=jn(n))?e:n,Rn}catch(o){}return Pn=!0,null})}const Zn=j(!1);let Yn=null;const Jn={key:0},Qn=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Yn||(Yn=Gn().then(e=>{Zn.value=!!e}).catch(()=>{Zn.value=!1})),ue(Zn)),o=U(),l=K("markstreamTypewriter",void 0),r=K("markstreamTextStreamState",void 0),i=K("markstreamStreamVersion",void 0),a=D(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=D(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=D(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=q(n.node.content),c=q(""),m=q(0);function h(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=h(),c.value="")}X([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=h(),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),m.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}),X(s,e=>{e||f(h())});const v=D(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(I(),A("span",{class:V([[$(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(I(),A("span",Jn,W(d.value),1)):G("",!0),c.value?(I(),A("span",{key:1,class:V(["text-node-stream-delta",[v.value]]),onAnimationend:p},W(c.value),35)):G("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et=de(()=>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 F(Qn,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 Gn())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 F(Qn,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:""}$`}}))}})),nt=de(()=>d(null,null,function*(){try{if(yield Gn())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 F(Qn,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:""}$$`}}))}})),tt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(I(),A("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))},W(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);tt.install=e=>{e.component(tt.__name,tt)};const ot={class:"superscript-node"},lt={key:1},rt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,footnote_reference:Ge,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,emoji:Re,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("sup",ot,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),A(R,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(I(),J(ce(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(I(),A("span",lt,W(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);rt.install=e=>{e.component(rt.__name,rt)};const it={class:"subscript-node"},at={key:1},st=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,footnote_reference:Ge,strikethrough:mt,highlight:Nt,insert:wt,superscript:rt,emoji:Re,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("sub",it,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),A(R,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(I(),J(ce(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(I(),A("span",at,W(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);st.install=e=>{e.component(st.__name,st)};const ut={class:"strong-node"},dt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("strong",ut,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);dt.install=e=>{e.component(dt.__name,dt)};const ct={class:"strikethrough-node"},mt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("del",ct,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);mt.install=e=>{e.component(mt.__name,mt)};const ht=["href","title","aria-label","aria-hidden","target","rel"],ft=["aria-hidden"],pt={class:"link-text-wrapper relative inline-flex"},vt={class:"leading-[normal] link-text"},gt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=K("markstreamShowTooltips",void 0),o=D(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=D(()=>{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:Qn,strong:dt,strikethrough:mt,emphasis:bt,image:zn,html_inline:rn,inline_code:un},i=D(()=>(Fe.value,De(n.customId))),s=U(),u=D(()=>{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 Je(l)}),d=D(()=>a(a({},s),u.value)),c=D(()=>{const e=d.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||"_blank"}),m=D(()=>"_blank"===c.value.trim().toLowerCase()),h=D(()=>{const e=d.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),f=D(()=>{const e=a({},d.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e}),p=D(()=>{var e,t;return Je({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")}).href});function v(){o.value&&_n()}const g=D(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=p.value)?t:"")});return(t,a)=>{var u,d;return e.node.loading?(I(),A("span",me({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},$(s),{style:l.value}),[z("span",pt,[z("span",vt,[H($(Qn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(d=e.node.text)?d:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,ft)):(I(),A("a",me({key:0,class:"link-node",href:p.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:c.value,rel:h.value},f.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,s=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,u=(null==(t=n.node)?void 0:t.title)||((null==(l=p.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:p.value)||"";Sn(e.currentTarget,u,"top",!1,s)}(e)),onMouseleave:v}),[(I(!0),A(R,null,P(e.node.children,(t,o)=>(I(),J(ce(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,ht))}}}),[["__scopeId","data-v-8992f408"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"insert-node"},wt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("ins",yt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);wt.install=e=>{e.component(wt.__name,wt)};const xt={class:"highlight-node"},Nt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,strikethrough:mt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("mark",xt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);Nt.install=e=>{e.component(Nt.__name,Nt)};const kt={class:"emphasis-node"},bt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("em",kt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);bt.install=e=>{e.component(bt.__name,bt)};const Mt=["href","title"],St=/* @__PURE__ */Be(/* @__PURE__ */E({__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)=>(I(),A("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"]]);St.install=e=>{e.component(St.__name,St)};const _t=["id"],Bt={class:"flex-1"},Ot=/* @__PURE__ */E({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(I(),A("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",Bt,[H($(ai),{"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,_t))}});Ot.install=e=>{e.component(Ot.__name,Ot)};const Lt={class:"hard-break"},Ct=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(I(),A("br",Lt))}),[["__scopeId","data-v-50c58f70"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,image:zn,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,checkbox:Ee,checkbox_input:Ee,footnote_reference:Ge,hardbreak:Ct,math_inline:et,reference:tt},t);return(t,l)=>(I(),J(ce(`h${e.node.level}`),me({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:ne(()=>[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]),Et=Tt;Et.install=e=>{e.component(Tt.__name,Tt)};const It=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node)?e:n.item}),o=D(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return I(),A("li",me({class:"list-item",dir:"auto"},o.value),[H($(ai),me({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-fdeabeb1"]]);It.install=e=>{e.component(It.__name,It)};const At=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=D(()=>(Fe.value,De(e.customId).list_item||It));return(t,o)=>(I(),J(ce(e.node.ordered?"ol":"ul"),{class:V(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:ne(()=>[(I(!0),A(R,null,P(e.node.items,(l,r)=>{var i;return I(),J(ce(n.value),me({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"]]);At.install=e=>{e.component(At.__name,At)};const Ht=/* @__PURE__ */Symbol("ViewportPriority");function $t(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?q(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 m=null;function h(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=m){try{null==a||a(m)}catch(e){}m=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),h()}}function p(){i&&null==m&&c.size&&(m=i(()=>{m=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=q(!1);let i,a=!1;const m=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),h()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:m,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:m,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v})};return he(Ht,v),v}function zt(){var e,n;const t=K(Ht,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=q(!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()},m=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 m?(o.set(e,{resolve:t,visible:n}),m.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const Rt={key:2,class:"html-block-node__raw"},Pt=["innerHTML"],Wt={key:1,class:"html-block-node__placeholder"},jt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=K("markstreamHtmlPolicy",void 0),o=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=de({loader:()=>Promise.resolve().then(()=>si),suspensible:!1}),r=D(()=>{const e=x(n.node.attrs,o.value);if(!e)return;const t=N(e);return Object.keys(t).length>0?t:void 0}),i=D(()=>{const e=String(n.node.tag||"").trim(),t=x(n.node.attrs,o.value,e);if(!t)return;const l=N(t);return Object.keys(l).length>0?l:void 0}),a=D(()=>(Fe.value,De(n.customId))),s=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),u=q(null),d=q("undefined"==typeof window),c=q(n.node.content),m=D(()=>Array.isArray(n.node.children)?n.node.children:[]),h=D(()=>String(n.node.tag||"div")),f=D(()=>{const e=h.value.trim().toLowerCase();return k.has(e)||v(e,o.value)}),p=D(()=>m.value.length>0&&!!n.node.tag&&!f.value),g=D(()=>{var e,t,l;if(p.value)return{mode:"structured"};if(!d.value)return{mode:"html",content:null!=(e=c.value)?e:""};const r=null!=(t=c.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:w(r,o.value)};if(n.node.loading){const e=on(r,a.value,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!tn(r,a.value))return{mode:"html",content:w(r,o.value)};const i=on(r,a.value,o.value);return null===i?{mode:"html",content:w(r,o.value)}:{mode:"dynamic",nodes:i}}),y=zt(),b=q(null),M=!!n.node.loading;return"undefined"!=typeof window?(X(u,e=>{var t,o;if(null==(o=null==(t=b.value)?void 0:t.destroy)||o.call(t),b.value=null,!M)return d.value=!0,void(c.value=n.node.content);if(!e)return void(d.value=!1);const l=y(e,{rootMargin:"400px"});b.value=l,d.value=l.isVisible.value,l.whenVisible.then(()=>{d.value=!0})},{immediate:!0}),X(()=>n.node.content,e=>{M&&!d.value||(c.value=e)})):d.value=!0,Y(()=>{var e,n;null==(n=null==(e=b.value)?void 0:e.destroy)||n.call(e),b.value=null}),(n,t)=>(I(),J(ce(p.value?h.value:"div"),me({ref_key:"htmlRef",ref:u,class:"html-block-node"},p.value?i.value:void 0),{default:ne(()=>[d.value?(I(),A(R,{key:0},["structured"===g.value.mode?(I(),J($(l),{key:0,nodes:m.value,"custom-id":e.customId,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,"html-policy":o.value},null,8,["nodes","custom-id","html-policy"])):"dynamic"===g.value.mode?(I(),J($(s),{key:1,nodes:g.value.nodes},null,8,["nodes"])):"text"===g.value.mode?(I(),A("pre",Rt,W(g.value.content),1)):(I(),A("div",me({key:3},r.value,{innerHTML:g.value.content}),null,16,Pt))],64)):(I(),A("div",Wt,[se(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=z("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=z("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=z("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-4d8bb24b"]]);jt.install=e=>{e.component(jt.__name,jt)};const Ft={dir:"auto",class:"paragraph-node"},Kt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=De(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=D(()=>n.node.children.filter(e=>!o(e))),i=D(()=>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=D(()=>new Set(b(n.customHtmlTags))),d=D(()=>{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 m=a({inline_code:un,image:zn,link:gt,hardbreak:Ct,emphasis:bt,strong:dt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,html_inline:rn,html_block:jt,emoji:Re,checkbox:Ee,math_inline:et,checkbox_input:Ee,reference:tt,footnote_anchor:St,footnote_reference:Ge,text:Qn},t);function h(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()||M(e.content);if(r&&!u.value.has(r)&&S(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:Qn}}}return{child:e,component:m[e.type]}}return(n,t)=>(I(),A("p",Ft,[(I(!0),A(R,null,P(d.value,(n,t)=>(I(),A(R,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(I(),A(R,{key:0},[le(W(l(n)),1)],64)):(I(),J(ce(h(n).component),me({key:1,ref_for:!0},c(h(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Kt.install=e=>{e.component(Kt.__name,Kt)};const Dt=["aria-busy","aria-label","data-language"],Vt=["textContent"],Ut=/* @__PURE__ */E({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=D(()=>{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=D(()=>`language-${t.value}`),l=D(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(I(),A("pre",{class:V([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[z("code",{translate:"no",textContent:W(e.node.code)},null,8,Vt)],10,Dt))}});Ut.install=e=>{e.component(Ut.__name,Ut)};const qt={class:"table-node-wrapper"},Xt=["aria-busy"],Gt={key:0},Zt=["aria-label","onPointerdown"],Yt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Jt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node.loading)&&e}),o=D(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=q(null),r=q([]);let i=null;const a=D(()=>r.value.map(e=>e>0?{width:`${e}px`}:void 0)),s=D(()=>r.value.length>0);function u(e){if(!i)return;e.preventDefault();const n=i.startWidth+i.nextStartWidth,t=Math.min(48,Math.floor(n/2)),o=Math.max(t,Math.min(n-t,Math.round(i.startWidth+e.clientX-i.startX))),l=[...i.widths];l[i.index]=o,l[i.index+1]=n-o,r.value=l}function d(){i&&(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),i=null)}return X(()=>n.node.header.cells.length,()=>{d(),r.value=[]}),Y(d),(c,m)=>(I(),A("div",qt,[z("table",{ref_key:"tableRef",ref:l,class:V(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[s.value?(I(),A("colgroup",Gt,[(I(!0),A(R,null,P(e.node.header.cells,(e,n)=>(I(),A("col",{key:`col-${n}`,style:oe(a.value[n])},null,4))),128))])):G("",!0),z("thead",null,[z("tr",null,[(I(!0),A(R,null,P(e.node.header.cells,(t,o)=>(I(),A("th",{key:`header-${o}`,dir:"auto",class:V(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[H($(ai),{nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:m[0]||(m[0]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"]),o<e.node.header.cells.length-1?(I(),A("button",{key:0,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",u),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d))}(o,e)},null,40,Zt)):G("",!0)],2))),128))])]),z("tbody",null,[(I(!0),A(R,null,P(o.value,(e,t)=>(I(),A("tr",{key:`row-${t}`},[(I(!0),A(R,null,P(e.cells,(e,o)=>(I(),A("td",{key:`cell-${t}-${o}`,class:V(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[H($(ai),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:m[1]||(m[1]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,Xt),H(ee,{name:"table-node-fade"},{default:ne(()=>[t.value?(I(),A("div",Yt,[se(c.$slots,"loading",{isLoading:t.value},()=>[m[2]||(m[2]=z("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),m[3]||(m[3]=z("span",{class:"sr-only"},"Loading",-1))],!0)])):G("",!0)]),_:3})]))}}),[["__scopeId","data-v-7a6d3bf6"]]);Jt.install=e=>{e.component(Jt.__name,Jt)};const Qt={class:"hr-node"},eo=/* @__PURE__ */Be({},[["render",function(e,n){return I(),A("hr",Qt)}],["__scopeId","data-v-39b2349c"]]);eo.install=e=>{e.component(eo.__name,eo)};const no={class:"unknown-node"},to=/* @__PURE__ */E({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(I(),A("div",no,W(e.node.raw),1))}),oo=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=D(()=>`vmr-container vmr-container-${n.node.name}`),o=De(n.customId),l=a({text:Qn,paragraph:Kt,heading:Et,inline_code:un,link:gt,image:zn,strong:dt,emphasis:bt,strikethrough:mt,insert:wt,subscript:st,superscript:rt,checkbox:Ee,checkbox_input:Ee,hardbreak:Ct,math_inline:et,reference:tt,list:At,math_block:nt,table:Jt},o);return(o,r)=>(I(),A("div",me({class:t.value},e.node.attrs),[(I(!0),A(R,null,P(e.node.children,(t,o)=>{return I(),J(ce((r=t.type,l[r]||to)),{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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["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"],ro=[[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 io(e){if(e<=255)return lo[e];let n=0,t=ro.length-1;for(;n<=t;){const o=n+t>>1,l=ro[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const ao=/[ \t\n\r\f]+/g,so=/[\t\n\r\f]| {2,}|^ | $/;let uo=null;const co=new RegExp("\\p{Script=Arabic}","u"),mo=new RegExp("\\p{M}","u"),ho=new RegExp("\\p{Nd}","u");function fo(e){return co.test(e)}function po(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 vo(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(po(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(po(t))return!0}}return!1}const go=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]);function yo(e){return vo(e)}function wo(e){return!function(e){const n=Eo(e);return null!==n&&(xo.has(n)||bo.has(n))}(e)&&!function(e){const n=Eo(e);return null!==n&&go.has(n)}(e)}const xo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),No=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),ko=/* @__PURE__ */new Set(["'","’"]),bo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Mo=/* @__PURE__ */new Set([":",".","،","؛"]),So=/* @__PURE__ */new Set(["၏"]),_o=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Bo(e){if(Co(e))return!0;let n=!1;for(const t of e)if(bo.has(t))n=!0;else if(!n||!mo.test(t))return!1;return n}function Oo(e){for(const n of e)if(!xo.has(n)&&!bo.has(n))return!1;return e.length>0}function Lo(e){if(Co(e))return!0;for(const n of e)if(!No.has(n)&&!ko.has(n)&&!mo.test(n))return!1;return e.length>0}function Co(e){let n=!1;for(const t of e)if("\\"!==t&&!mo.test(t)){if(!(No.has(t)||bo.has(t)||ko.has(t)))return!1;n=!0}return n}function To(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 Eo(e){if(0===e.length)return null;const n=To(e,e.length);return e.slice(n)}function Io(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(mo.test(e))t--;else{if(!No.has(e)&&!ko.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Ao(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ho(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 $o(e,n){return e&&null!==n&&Mo.has(n)}function zo(e){const n=Eo(e);return null!==n&&So.has(n)}function Ro(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 Po(e){let n=e.length;for(;n>0;){const t=To(e,n),o=e.slice(t,n);if(_o.has(o))return!0;if(!bo.has(o))return!1;n=t}return!1}function Wo(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 jo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Fo(e){return 1===e.length?e[0]:e.join("")}function Ko(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Fo(t)}function Do(e,n,t,o){if(!jo.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=Wo(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:Fo(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:Fo(i),isWordLike:s,kind:r,start:a}),l}function Vo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Uo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function qo(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Uo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Xo(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Go=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Zo=/^[A-Za-z0-9_]+[,:;]*$/,Yo=/[,:;]+$/;function Jo(e){for(const n of e)if(ho.test(n))return!0;return!1}function Qo(e){if(0===e.length)return!1;for(const n of e)if(!ho.test(n)&&!Go.has(n))return!1;return!0}function el(e,n,t){var o,l,r;const i=(null===uo&&(uo=new Intl.Segmenter(void 0,{granularity:"word"})),uo);let a=0;const s=[],u=[],d=[],c=[],m=[],h=[],f=[],p=[],v=[],g=[],y=[],w=[];for(const M of i.segment(e))for(const e of Do(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==h[M]&&(u[M]=[Ho(s,h,f,M)],h[M]=null),u[M].push(e.text),d[M]=d[M]||e.isWordLike,p[M]=p[M]||i,v[M]=v[M]||x,g[M]=k,y[M]=b,w[M]=$o(v[M],N)};const o="text"===e.kind,r=Ao(e.text,e.isWordLike,e.kind),i=vo(e.text),x=fo(e.text),N=Eo(e.text),k=Po(e.text),b=zo(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===c[M]&&i&&p[M]&&g[M]||o&&a>0&&"text"===c[M]&&Oo(e.text)&&p[M]||o&&a>0&&"text"===c[M]&&y[M]?t():o&&a>0&&"text"===c[M]&&e.isWordLike&&x&&w[M]?(t(),d[M]=!0):null!==r&&a>0&&"text"===c[M]&&h[M]===r?f[M]=(null!=(l=f[M])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===c[M]&&(Bo(e.text)||"-"===e.text&&d[M])?t():(s[a]=e.text,u[a]=[e.text],d[a]=e.isWordLike,c[a]=e.kind,m[a]=e.start,h[a]=r,f[a]=null===r?0:1,p[a]=i,v[a]=x,g[a]=k,y[a]=b,w[a]=$o(x,N),a++)}for(let M=0;M<a;M++)null===h[M]?s[M]=Fo(u[M]):s[M]=Ho(s,h,f,M);for(let M=1;M<a;M++)"text"===c[M]&&!d[M]&&Co(s[M])&&"text"===c[M-1]&&(s[M-1]+=s[M],d[M-1]=d[M-1]||d[M],s[M]="");const x=Array.from({length:a},()=>null);let N=-1;for(let M=a-1;M>=0;M--){const e=s[M];if(0!==e.length){if("text"===c[M]&&!d[M]&&Lo(e)&&N>=0&&"text"===c[N]){const n=null!=(r=x[N])?r:[];n.push(e),x[N]=n,m[N]=m[M],s[M]="";continue}N=M}}for(let M=0;M<a;M++){const e=x[M];null!=e&&(s[M]=Ko(e,s[M]))}let k=0;for(let M=0;M<a;M++){const e=s[M];0!==e.length&&(k!==M&&(s[k]=e,d[k]=d[M],c[k]=c[M],m[k]=m[M]),k++)}s.length=k,d.length=k,c.length=k,m.length=k;const b=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(!vo(n[r])||!vo(n[r+1]))continue;const e=Io(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=Yo.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=Yo.test(n),u++}n.push(Fo(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&&Jo(n)&&Qo(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&&Qo(i)&&Jo(i)){const a=[i];let s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Qo(e.texts[s]);)a.push(e.texts[s]),s++;n.push(Fo(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]),!Xo(i))continue;const a=r+1;if(a>=e.len||Vo(e.kinds[a]))continue;const s=[],u=e.starts[a];let d=a;for(;d<e.len&&!Vo(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(n.push(Fo(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]||!qo(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Vo(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]=Fo(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 m=Fo(d);if(!(r<e.len&&"text"===e.kinds[r])){n.push(m),t.push(!1),o.push("glue"),l.push(c);continue}i[0]=m,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=Fo(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(Fo(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:m})))))));for(let M=0;M<b.len-1;M++){const e=Ro(b.texts[M]);null!==e&&("space"!==b.kinds[M]&&"preserved-space"!==b.kinds[M]||"text"!==b.kinds[M+1]||!fo(b.texts[M+1])||(b.texts[M]=e.space,b.isWordLike[M]=!1,b.kinds[M]="preserved-space"===b.kinds[M]?"preserved-space":"space",b.texts[M+1]=e.marks+b.texts[M+1],b.starts[M+1]=b.starts[M]+e.space.length))}return b}function nl(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 tl=null;const ol=/* @__PURE__ */new Map;let ll=null;const rl=new RegExp("\\p{Emoji_Presentation}","u"),il=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let al=null;const sl=/* @__PURE__ */new Map;function ul(){if(null!==tl)return tl;if("undefined"!=typeof OffscreenCanvas)return tl=new OffscreenCanvas(1,1).getContext("2d"),tl;if("undefined"!=typeof document)return tl=document.createElement("canvas").getContext("2d"),tl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function dl(e,n){let t=n.get(e);return void 0===t&&(t={width:ul().measureText(e).width,containsCJK:vo(e)},n.set(e,t)),t}function cl(){if(null!==ll)return ll;if("undefined"==typeof navigator)return ll={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ll;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 ll={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},ll}function ml(){return null===al&&(al=new Intl.Segmenter(void 0,{granularity:"grapheme"})),al}function hl(e){return rl.test(e)||e.includes("️")}function fl(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=ml();for(const o of t.segment(e))hl(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function pl(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 vl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function gl(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+cl().lineFitEpsilon;let a=0,s=0,u=!1,d=0,c=0,m=-1,h=0;function f(e=d,n=c,t=s){a++,s=0,u=!1,m=-1,h=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=pl(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(m>=0){if(d>m||d===m&&c>0){f();continue}f(m,0,h);continue}if(e>n&&null!==r[w]){f(),y(w,0),w++;continue}f()}else g(w,e),a&&(m=w+1,h=s-e),w++;else e>n&&null!==r[w]?y(w,0):p(w,e),a&&(m=w+1,h=s-e),w++}return u&&f(),a}let yl=null;function wl(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=Po(e),a=No.has(e)}function d(e,n){o.push(e),r=r||n;const t=Po(e);i=1===e.length&&bo.has(e)&&i||t,a=!1}for(const c of(null===yl&&(yl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),yl).segment(e)){const e=c.segment,t=vo(e);0!==o.length?a||xo.has(e)||bo.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 xl(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=vo(e[0].text),r=wo(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=vo(n.text),u=wo(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 Nl(e,n,t,o){const l=cl(),{cache:r,emojiCorrection:i}=function(e,n){ul().font=e;const t=function(e){let n=ol.get(e);return n||(n=/* @__PURE__ */new Map,ol.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=sl.get(e);if(void 0!==t)return t;const o=ul();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 sl.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,il.test(a)));var a;const s=fl("-",dl("-",r),i),u=8*fl(" ",dl(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],m=[],h=[];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),m.push(o),h.push(l),null==p||p.push(r),v.push(i),null!==g&&g.push(e)}function x(e,n,t,o,a){const s=dl(e,r),u=fl(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";Qo(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=ml(),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=dl(n,t);e.push(fl(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=fl(n,dl(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=dl(i,t);e.push(fl(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=fl(s,dl(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 b=0;b<e.len;b++){y[b]=d.length;const n=e.texts[b],t=e.isWordLike[b],i=e.kinds[b],a=e.starts[b];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=dl(n,r);if("text"===i&&u.containsCJK){const e=wl(n,l),r="keep-all"===o?xl(e):e;for(let n=0;n<r.length;n++){const e=r[n];x(e.text,"text",a+e.start,t,"keep-all"===o||!vo(e.text))}continue}x(n,i,a,t,!0)}const N=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=io(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:m,kinds:h,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:N,segments:g}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:N}}function kl(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return Nl(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(!so.test(e))return e;let n=e.replace(ao," ");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(Fo(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let c=0;c<e.len;c++){const m=e.texts[c],h=e.kinds[c],f=e.isWordLike[c],p=e.starts[c];if("text"===h){const e=yo(m),n=wo(m);if(null!==r&&s&&u){r.push(m),i=i||f,s=s||e,u=n;continue}d(),r=[m],i=f,a=p,s=e,u=n;continue}d(),n.push(m),t.push(f),o.push(h),l.push(p)}return d(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(el(r,n,l)):el(r,n,l);return a({normalized:r,chunks:nl(i,l)},i)}(e,cl(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const bl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Ml=(()=>{const e=globalThis;if(e[bl])return e[bl];const n={configs:{},controllers:{},revision:j(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[bl]=n,n})();let Sl=null;const _l=Ml.revision;function Bl(e){var n;return e&&null!=(n=Ml.configs[e])?n:null}function Ol(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Ll(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Cl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Ll(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 Tl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Sl)return Sl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Sl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Sl}catch(n){return Sl=!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=Ml.blockEstimateCache.get(i);if(a)return Ml.blockEstimateCache.delete(i),Ml.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=Ml.preparedCache.get(o);if(l)return Ml.preparedCache.delete(o),Ml.preparedCache.set(o,l),l.prepared;const r=kl(e,n,{whiteSpace:t});for(Ml.preparedCache.set(o,{prepared:r});Ml.preparedCache.size>240;){const e=Ml.preparedCache.keys().next().value;if(!e)break;Ml.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?gl(e,n):function(e,n){if(e.simpleLineWalkFastPath)return gl(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=cl(),c=d.lineFitEpsilon,m=n+c;let h=0,f=0,p=!1,v=0,g=0,y=-1,w=0,x=0,N=null;function k(){y=-1,w=0,x=0,N=null}function b(e=v,n=g,t=f){h++,f=0,p=!1,k()}function M(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):M(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,x=f-r+a,N=e}function O(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];p?f+n>m?(b(),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"!==N)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):(b(e,o,l+a),O(e,o),!0))}function C(e){h++,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,h="tab"===e?vl(f,s):t[c];if("soft-hyphen"!==e)if(p){if(f+h>m){const t=f+("tab"===e?0:o[c]),r=f+("tab"===e?h:l[c]);if("soft-hyphen"===N&&d.preferEarlySoftHyphenBreak&&w<=m){b(y,0,x);continue}if("soft-hyphen"===N&&L(c)){c++;continue}if(u&&t<=m){_(c,h),b(c+1,0,r),c++;continue}if(y>=0&&w<=m){if(v>y||v===y&&g>0){b();continue}const e=y;b(e,0,x),c=e;continue}if(h>n&&null!==i[c]){b(),O(c,0),c++;continue}b();continue}_(c,h),B(e,u,c,h),c++}else h>n&&null!==i[c]?O(c,0):M(c,h),B(e,u,c,h),c++;else p&&(v=c+1,g=0,y=c+1,w=f+a,x=f+a,N=e),c++}if(p){const n=y===e.consumedEndSegmentIndex?x:f;b(e.consumedEndSegmentIndex,0,n)}}return h}(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),m=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(Ml.blockEstimateCache.set(i,{height:m,contentHeight:Math.round(c)});Ml.blockEstimateCache.size>4e3;){const e=Ml.blockEstimateCache.keys().next().value;if(!e)break;Ml.blockEstimateCache.delete(e)}return{kind:"simple-text",height:m,contentHeight:Math.round(c)}}catch(r){return null}}function El(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Cl(e.children);return o&&t.paragraph?Tl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Cl(e.children),r=t.headings[o];return l&&r?Tl(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=Cl(null==(l=r[0])?void 0:l.children);return i?Tl(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=El(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 Il(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Al(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Hl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Ol(o.lineHeight,1.5*Ol(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Al(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}function $l(e){const n="number"==typeof e?e:Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:null}function zl(e){var n;for(const t of e.split(/\r?\n/)){const e=t.trim();if(!e||e.startsWith("%%"))continue;const o=e.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==o?void 0:o[1])?void 0:n.toLowerCase())||""}return""}function Rl(e){const n=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),t=Math.max(1,n.length),o=zl(e);return"gantt"===o?220+28*t:"sequencediagram"===o?180+26*t:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*t:"flowchart"===o||"graph"===o?170+28*t:200+22*t}function Pl(e){const n=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return n>=3?500:n>0?280+60*n:360}function Wl(e,n=360,t=500){return null==t?Math.max(n,e):Math.min(Math.max(n,e),t)}function jl(e,n=360,t=500){return Wl(e,n,t)}function Fl(e,n=360,t=500){return Wl(e,n,t)}let Kl=!1,Dl=null,Vl=!1;function Ul(){return Vl}let ql=null,Xl=!1,Gl=null;function Zl(){return d(this,null,function*(){return!!(yield Yl())})}function Yl(){return d(this,null,function*(){if(Gl)return Gl;Gl=d(null,null,function*(){if(!ql){if(Xl)return null;try{ql=yield import("stream-monaco")}catch(e){return Xl=!0,null}}try{return yield function(e){return d(this,null,function*(){if(Kl)return;if(Dl)return Dl;const n=d(null,null,function*(){const n=null==globalThis?void 0:globalThis.MonacoEnvironment;n&&("function"==typeof n.getWorker||"function"==typeof n.getWorkerUrl)||"function"!=typeof(null==e?void 0:e.preloadMonacoWorkers)||(yield e.preloadMonacoWorkers()),Kl=!0});return Dl=n.finally(()=>{Dl=null}),Dl})}(ql),Vl=!0,ql}catch(e){return null}});try{return yield Gl}finally{Gl=null}})}const Jl=/* @__PURE__ */new Map;let Ql="material";const er=/* @__PURE__ */new Map,nr=/* @__PURE__ */new Map;let tr=null;function or(e){Jl.set(e.id,e)}function lr(e){if(!Jl.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[...Jl.keys()].join(", ")}`);Ql=e,null==tr||tr();const n=Jl.get(e);n.loadExtended&&!er.has(e)&&ir(n)}function rr(){return[...Jl.keys()]}function ir(e){return d(this,null,function*(){var n,t,o;if(er.has(e.id))return null!=(n=er.get(e.id))?n:null;let l=nr.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(er.set(e.id,n),null==tr||tr(),n)).catch(()=>(er.set(e.id,null),null)),nr.set(e.id,l)),l})}function ar({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function sr(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function ur(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function dr(e,n){var t,o;let l=0;for(const r of e){const e=ur(sr(r));e>l&&(l=e)}return ar({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 cr='<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>',mr='<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>',hr={id:"material",core:{"":mr,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:mr,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:cr,csharp:cr,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)};let fr=null;const pr=j(0);tr=()=>{pr.value++},or(hr);const vr={"":"",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 gr(e){fr=null!=e?e:null}function yr(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=vr[t])?n:t}function wr(e){const n=yr(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function xr(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=Jl.get(Ql);(null==e?void 0:e.loadExtended)&&(yield ir(e))})}()})}function Nr(e){if(fr){const n=fr(e);if(null!=n&&""!==n)return n}return function(e){const n=Jl.get(Ql);if(!n)return;const t=n.core[e];if(t)return t;const o=er.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!er.has(n.id)&&ir(n)}(yr(e))||(null!=(t=null==(n=Jl.get(Ql))?void 0:n.fallback)?t:"");var n,t}const kr={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"},br=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 Mr(){br.enable()}function Sr(){br.disable()}function _r(){return br.printReport()}function Br(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Or(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=_r,window.__katexPerfMonitor=br);const Lr={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)]"},Cr={class:"flex items-center gap-0.5"},Tr=["aria-label"],Er={class:"code-diff-stat removed"},Ir={class:"code-diff-stat added"},Ar=["aria-label"],Hr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},$r={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zr=["aria-pressed"],Rr={key:3,class:"relative"},Pr=["aria-expanded"],Wr=["disabled"],jr=["disabled"],Fr=["disabled"],Kr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Dr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Vr={class:"code-block-shell-content"},Ur={class:"code-loading-placeholder"},qr={class:"sr-only","aria-live":"polite",role:"status"},Xr=/* @__PURE__ */E({__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=e,o=n,l=q(!1),r=q(null),i=q(null);function a(){l.value=!l.value,l.value&&document.addEventListener("click",s,{once:!0,capture:!0})}function s(e){var n,t;const o=e.target;(null==(n=r.value)?void 0:n.contains(o))||(null==(t=i.value)?void 0:t.contains(o))?document.addEventListener("click",s,{once:!0,capture:!0}):l.value=!1}const u=D(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:d}=Tn(),c=D(()=>!1!==t.showTooltips);function m(e,n){c.value&&Sn(e.currentTarget,n,"top",!1,void 0,t.isDark)}function h(){c.value&&_n()}function f(e){m(e,t.copyText?d("common.copied")||"Copied":d("common.copy")||"Copy")}const p=D(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(n=t.codeFontMin)?n:0)}),v=D(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),g=D(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(n=t.codeFontMax)?n:100)});return(n,s)=>(I(),A(R,null,[t.showHeader?(I(),A("div",Lr,[se(n.$slots,"header-left"),se(n.$slots,"header-right",{},()=>[z("div",Cr,[e.diffStats?(I(),A("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[z("span",Er,"-"+W(e.diffStats.removed),1),z("span",Ir,"+"+W(e.diffStats.added),1)],8,Tr)):G("",!0),t.showCopyButton?(I(),A("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?$(d)("common.copied")||"Copied":$(d)("common.copy")||"Copy",onClick:s[0]||(s[0]=e=>o("copy")),onMouseenter:s[1]||(s[1]=e=>f(e)),onFocus:s[2]||(s[2]=e=>f(e)),onMouseleave:h,onBlur:h},[e.copyText?(I(),A("svg",$r,[...s[14]||(s[14]=[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(I(),A("svg",Hr,[...s[13]||(s[13]=[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),z("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,Ar)):G("",!0),t.showCollapseButton?(I(),A("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:s[3]||(s[3]=e=>o("toggleCollapse")),onMouseenter:s[4]||(s[4]=n=>m(n,e.isCollapsed?$(d)("common.expand")||"Expand":$(d)("common.collapse")||"Collapse")),onFocus:s[5]||(s[5]=n=>m(n,e.isCollapsed?$(d)("common.expand")||"Expand":$(d)("common.collapse")||"Collapse")),onMouseleave:h,onBlur:h},[(I(),A("svg",{style:oe({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"},[...s[15]||(s[15]=[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,zr)):G("",!0),u.value?(I(),A("div",Rr,[z("button",{ref_key:"moreBtnRef",ref:i,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":l.value,"aria-haspopup":"true",onClick:fe(a,["stop"]),onMouseenter:s[6]||(s[6]=e=>m(e,$(d)("common.more")||"More")),onFocus:s[7]||(s[7]=e=>m(e,$(d)("common.more")||"More")),onMouseleave:h,onBlur:h},[...s[16]||(s[16]=[pe('<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),H(ee,{name:"code-menu"},{default:ne(()=>[l.value?(I(),A("div",{key:0,ref_key:"moreMenuRef",ref:r,class:"code-more-menu 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"},[t.showFontSizeButtons&&t.enableFontSizeControl?(I(),A(R,{key:0},[z("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:p.value,onClick:s[8]||(s[8]=e=>o("decreaseFont"))},[s[17]||(s[17]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),z("span",null,W($(d)("common.fontSmaller")||"Font size −"),1)],8,Wr),z("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:v.value,onClick:s[9]||(s[9]=e=>o("resetFont"))},[s[18]||(s[18]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),z("path",{d:"M3 3v5h5"})])],-1)),z("span",null,W($(d)("common.fontReset")||"Font size reset"),1)],8,jr),z("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:s[10]||(s[10]=e=>o("increaseFont"))},[s[19]||(s[19]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),z("span",null,W($(d)("common.fontLarger")||"Font size +"),1)],8,Fr)],64)):G("",!0),t.showExpandButton?(I(),A("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:s[11]||(s[11]=e=>{o("toggleExpand",e),l.value=!1})},[e.isExpanded?(I(),A("svg",Kr,[...s[20]||(s[20]=[z("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)])])):(I(),A("svg",Dr,[...s[21]||(s[21]=[z("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)])])),z("span",null,W(e.isExpanded?$(d)("common.collapse")||"Collapse":$(d)("common.expand")||"Expand"),1)])):G("",!0),e.isPreviewable&&t.showPreviewButton?(I(),A("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:s[12]||(s[12]=e=>{o("preview"),l.value=!1})},[s[22]||(s[22]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("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"}),z("circle",{cx:"12",cy:"12",r:"3"})])],-1)),z("span",null,W($(d)("common.preview")||"Preview"),1)])):G("",!0)],512)):G("",!0)]),_:1})])):G("",!0)])])])):G("",!0),te(z("div",Vr,[se(n.$slots,"default")],512),[[re,!(e.isCollapsed||!e.stream&&e.loading)]]),te(z("div",Ur,[se(n.$slots,"loading",{},()=>[s[23]||(s[23]=z("div",{class:"loading-skeleton"},[z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line short"})],-1))])],512),[[re,!e.stream&&e.loading]]),z("span",qr,W(e.copyText?$(d)("common.copied")||"Copied":""),1)],64))}}),Gr={class:"code-header-main"},Zr=["innerHTML"],Yr={class:"code-header-copy"},Jr={class:"code-header-title"},Qr=["innerHTML"],ei=/* @__PURE__ */Be(/* @__PURE__ */E({__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},autoScrollOnUpdate:{type:Boolean,default:!0},autoScrollInitial:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=Tn(),r=q(yr(t.node.language)),i=q(!1),s=q(!1),u=q(!1),c=q(null),m=q(null),h=q(null),f=q(""),p=q(!1);let v;const g=zt(),y=q(null),w=q("undefined"==typeof window);"undefined"!=typeof window&&X(()=>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=q(!1!==t.autoScrollInitial),N=q(0),k=D(()=>!1!==t.autoScrollOnUpdate),b=q(14),M=q(b.value),S=D(()=>{const e=b.value,n=M.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),_=D(()=>{const e=r.value.trim().toLowerCase();return kr[e]||e.charAt(0).toUpperCase()+e.slice(1)}),B=D(()=>(pr.value,Nr(r.value.trim().toLowerCase().split(":")[0]))),O=D(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),L=D(()=>{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}),C=D(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),T=D(()=>null!=C.value&&!p.value),E=D(()=>a({fontSize:`${M.value}px`},T.value?{minHeight:`${C.value}px`}:{})),$=D(()=>!1!==t.showTooltips);function R(){return t.isDark?t.darkTheme:t.lightTheme}function P(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 j(){f.value="",p.value=!0}function F(){var e;const n=h.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function K(){return d(this,null,function*(){if(yield Z(),F())return void j();const e=h.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{F()&&(j(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let U,J,Q,ee,te=null;const le=/* @__PURE__ */new Set,re=/* @__PURE__ */new Set,ie=void 0!==import.meta&&Boolean(!1);let ae=null;function ue(e,n){return d(this,null,function*(){if(!U)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?!ee||ee.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 U.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 U.updateCode(e,"plaintext")):ie&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function de(e){if(!Q)return;const n=Array.isArray(e)?e.join("\0"):"";te!==n&&(Q({themes:e}),te=n)}function ce(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!J)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");J=e.createShikiStreamRenderer,Q=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;ee=n?new Set(n.map(e=>e.toLowerCase())):void 0,de(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),m.value&&h.value?(de(t.themes),!U&&J&&(U=J(h.value,{theme:R()}),p.value=!0),U?!1===t.stream&&t.loading?P(t.node.code):(P(t.node.code),yield ue(t.node.code,r.value),yield K()):P(t.node.code)):P(t.node.code)):P(t.node.code)})}function me(){const e=m.value;if(!e||s.value||!k.value)return;const n=e.scrollTop;n<N.value?x.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(x.value=!0),N.value=n}function he(){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 fe(e){if(s.value=!s.value,e&&$.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&Sn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=m.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",k.value&&(x.value=!0,Z(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)}))))}function pe(){u.value=!u.value}function ye(){const e=Math.min(36,M.value+1);M.value=e}function we(){const e=Math.max(10,M.value-1);M.value=e}function xe(){M.value=b.value}function Ne(){if(!O.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 ve(()=>{w.value?ce():P(t.node.code)}),Y(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),X(()=>t.themes,()=>d(null,null,function*(){de(t.themes)})),X(()=>t.loading,e=>{e||(w.value?ce():P(t.node.code))}),X(()=>w.value,e=>{e&&ce()}),X($,e=>{e||_n()}),X(()=>t.autoScrollInitial,e=>{x.value=!1!==e}),X(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=yr(n);o!==r.value&&(r.value=o),w.value&&m.value&&h.value?(U||(P(e),yield ce()),U&&e&&(!1===t.stream&&t.loading||(P(e),yield ue(e,n),yield K()))):P(e)})),X(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&m.value&&h.value&&(U||(yield ce()),null==U||U.setTheme(R()))})),X(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!k.value||!x.value)return;yield Z();const e=m.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(I(),A("div",{ref_key:"container",ref:c,style:oe(L.value),class:V(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[H(Xr,{"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":O.value,"code-font-size":M.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":b.value,"font-baseline-ready":S.value,onToggleCollapse:pe,onDecreaseFont:we,onResetFont:xe,onIncreaseFont:ye,onCopy:he,onToggleExpand:fe,onPreview:Ne},ge({"header-left":ne(()=>[se(n.$slots,"header-left",{},()=>[z("div",Gr,[z("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:B.value},null,8,Zr),z("div",Yr,[z("div",Jr,W(_.value),1)])])],!0)]),loading:ne(()=>[se(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=z("div",{class:"loading-skeleton"},[z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line short"})],-1))],!0)]),default:ne(()=>[z("div",{ref_key:"codeBlockContent",ref:m,class:"code-block-content",style:oe(E.value),onScroll:me},[z("div",{ref_key:"rendererTarget",ref:h,class:"code-block-render"},null,512),p.value?G("",!0):(I(),A("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,Qr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:ne(()=>[se(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-68b63065"]]);ei.install=e=>{e.component(ei.__name,ei)};const ni=E({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return Fl(null!=(t=$l(e.estimatedPreviewHeightPx))?t:Pl(String(null!=(n=e.node.code)?n:"")))});return()=>F("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?F("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[F("div",{class:"flex items-center gap-x-2 overflow-hidden"},[F("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),F("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),F("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>F("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,F("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[F("div",{class:"absolute inset-0"},[F("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),ti=E({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return jl(null!=(t=$l(e.estimatedPreviewHeightPx))?t:Rl(String(null!=(n=e.node.code)?n:"")))});return()=>F("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?F("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[F("div",{class:"flex items-center gap-x-2 overflow-hidden"},[F("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),F("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>F("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[F("span",{class:"action-icon block"})])))]):null,F("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[F("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}),oi=["data-custom-id"],li={class:"m-0 p-0"},ri=["data-probe"],ii=["data-node-index","data-node-type"],ai=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},htmlPolicy:{},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},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=q(),u=q(null),c=q(null),m=q(null),h=ye({1:null,2:null,3:null,4:null,5:null,6:null}),f=q(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=D(()=>!0===l.renderAsFragment),y=D(()=>l.debugPerformance&&v&&"undefined"!=typeof console),w=U(),x=/* @__PURE__ */new Map,N=q(0),k=q(0),b=q({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),T=D(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=w.showTooltips)?e:w["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0}),E=K("markstreamHtmlPolicy",void 0),W=D(()=>{var e,n;return null!=(n=null!=(e=l.htmlPolicy)?e:null==E?void 0:E.value)?n:"safe"});function j(e,n){y.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function F(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function Q(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 te(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(F(window.getComputedStyle(l))&&Q(l))return l;l=l.parentElement}return null}he("markstreamShowTooltips",T),he("markstreamHtmlPolicy",W),he("markstreamTypewriter",D(()=>!1!==l.typewriter)),he("markstreamTextStreamState",x),he("markstreamStreamVersion",N),X([()=>l.content,()=>l.nodes],()=>{N.value+=1},{immediate:!0});const le=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,re=_(le),ie=/* @__PURE__ */new Map,ae=D(()=>(Fe.value,De(l.customId))),se=D(()=>{var e;return B(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ue=D(()=>{const{key:e,tags:n}=O(se.value);if(!e)return re;const t=ie.get(e);if(t)return t;const o=_(le,{customHtmlTags:n});return ie.set(e,o),o}),fe=D(()=>{const e=ue.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),pe=D(()=>{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}),ve=D(()=>{var e;const n=null!=(e=pe.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),ge=D(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return we(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=L(l.content,fe.value,pe.value);return y.value&&j("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),we(n)}return[]}),xe=q(null),Ne=q(null),ke=q(null),be=q(null),Me=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),Se=!Me&&l.customId?Bl(l.customId):null,_e=D(()=>Se?(_l.value,Bl(l.customId)):null),Be=D(()=>{var e;return Boolean(v&&!g.value&&l.customId&&!Me&&(null==(e=_e.value)?void 0:e.enabled))}),Le=D(()=>{var e;return Be.value&&!1!==(null==(e=_e.value)?void 0:e.textEstimation)}),Ce=D(()=>{var e;return Be.value&&!1!==(null==(e=_e.value)?void 0:e.codeBlockEstimation)}),Te=D(()=>{var e;return Math.max(320,k.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ie=D(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Ae=D(()=>{var e;return!g.value&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&ge.value.length>Ie.value}),He=D(()=>Ae.value||Be.value),ze=D(()=>!1!==l.viewportPriority&&!f.value),Pe=$t(e=>{var n;return te(null!=(n=null!=e?e:i.value)?n:null)},ze),We=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,je=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,Ke="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,Ve="test"===(null==Ke?void 0:Ke.NODE_ENV),Ue=v&&"function"==typeof window.requestIdleCallback,qe=D(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Xe=D(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:qe.value);return Number.isFinite(n)?Math.max(0,n):qe.value}),Ze=D(()=>!g.value&&!1!==l.batchRendering&&qe.value>0&&v&&!Ve),Ye=q(0),Je=q({key:l.indexKey,total:0}),Qe=q(Math.max(1,qe.value||1)),en=q(/* @__PURE__ */new Set),nn=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new Map,an=/* @__PURE__ */new Map,sn=/* @__PURE__ */new WeakMap,dn=q(0),cn=D(()=>(dn.value,Array.from(ln.entries()).sort((e,n)=>e[0]-n[0]))),mn=q(0),hn=q([]),fn=q([]),pn=q(null),vn=q(null);let gn=null,yn=[],wn=null,xn=null;const Nn=D(()=>{var e;return!g.value&&!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Ae.value&&!(ge.value.length>900)&&ze.value}),kn=D(()=>{var e;return Ze.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),bn=q({batchSize:qe.value,initial:Xe.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:kn.value}),Mn=D(()=>!!Pe&&(Nn.value||Ae.value)),Sn=D(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),_n=q(0),Bn=ye({start:0,end:0}),On=/* @__PURE__ */new Map,Ln=/* @__PURE__ */new Map,Cn=D(()=>{if(!Ae.value)return ge.value.length;const e=Sn.value,n=Math.max(Bn.end+e,Xe.value),t=Math.min(ge.value.length,n);return Math.max(Ye.value,t)});function Tn(e){var n,t;return null!=(t=null==(n=be.value)?void 0:n[e])?t:null}function En(e){var n,t,o,l;const r=te(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 In(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 An(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(!In(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 Hn(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 $n(){wn&&(wn(),wn=null),pn.value=null}function Rn(){if(!v||!Ae.value)return;const e=En();if(!e||pn.value===e)return;$n();const n=()=>Wn();e.addEventListener("scroll",n,{passive:!0}),pn.value=e,wn=()=>{e.removeEventListener("scroll",n)}}function Pn(){var e,n,t;if(!xn)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;xn.viaTimeout?o?o.clearTimeout(xn.id):clearTimeout(xn.id):null==je||je(xn.id),xn=null}function Wn(e={}){var n,t,o;if(!Ae.value)return;if(!v)return void jn(!0);if(e.immediate)return Pn(),void jn(!0);if(xn)return;const l=()=>{xn=null,jn()};if(We)xn={id:We(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);xn={id:r,viaTimeout:!0}}}function jn(e=!1){var n,t,o,l,r,a,s;if(!Ae.value)return;const u=pn.value||En();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),m=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),h=ge.value.length;if(!m&&h>0&&In(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=ge.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=ft(e);if(n<=t)return e;n-=t}return 0}if(mn.value===t.length){const n=Lt(0,t.length);return Pt(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Kn[l])?n:Zn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Fn(l,0,Math.max(0,h-1));return void((e||Math.abs(r-_n.value)>1)&&(_n.value=r))}const f=m?null:u.getBoundingClientRect(),p=m?0:f.top,v=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=cn.value;let y=null,w=null;for(const[i,N]of g){if(!N)continue;const e=N.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=m?{top:0}:u.getBoundingClientRect(),t=An(u,d,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Hn(e,u);return Math.max(0,t-n)})(),h=m?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=Pt(o+.5*Math.max(0,h));return void(_n.value=Fn(f,0,Math.max(0,ge.value.length-1)))}const x=Math.round((y+w)/2);!e&&Math.abs(x-_n.value)<=1||(_n.value=Fn(x,0,Math.max(0,ge.value.length-1)))}function Fn(e,n,t){return Math.min(Math.max(e,n),t)}const Kn=ye({}),Dn=ye({total:0,count:0});function Vn(){for(const e of Object.keys(Kn))delete Kn[Number(e)];Dn.total=0,Dn.count=0,mn.value=0,hn.value=[],fn.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 Xn(e,n,t){if(t<=n)return 0;const o=qn(e,t-1);return n<=0?o:o-qn(e,n-1)}function Gn(e){mn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Kn)){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))}hn.value=n,fn.value=t}const Zn=D(()=>Dn.count>0?Math.max(12,Dn.total/Dn.count):32);function Yn(e){return null==e?void 0:e.firstElementChild}function Jn(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(k.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;k.value=t>0?t:0}let lt=null;function it(){null==lt||lt.disconnect(),lt=null}const at=de(()=>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),Ut}})),ut=D(()=>l.renderCodeBlocksAsPre?Ut:at);function ct(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const ht=D(()=>{var e;const n=ge.value;if(!n.length||!Be.value)return n.map(()=>null);const t=k.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=Kn[n],r="number"==typeof o&&o>0;if(Le.value&&!r){const n=El(e,t,b.value);if(n)return n}if(Ce.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Mo(e,bo(e));return n===ei?"markdown":n===Ut?"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(Il(String(null!=(n=e.originalCode)?n:"")),Il(String(null!=(t=e.updatedCode)?t:"")),Il(String(null!=(o=e.code)?o:""))):Il(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 ft(e){var n,t,o;return null!=(o=null!=(t=Kn[e])?t:null==(n=ht.value[e])?void 0:n.height)?o:Zn.value}function pt(){const e=pn.value||En(),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,An(e,t,!1)-Hn(n,e))}function vt(e){return Lt(0,Fn(e.nodeIndex,0,Math.max(0,ge.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function yt(){if(null!=gn&&(null==je||je(gn),gn=null),v)for(const e of yn)window.clearTimeout(e);yn=[]}function xt(e){!function(e){var n;const t=pn.value||En(),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=An(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=Hn(o,t)+l}(vt(e))}function kt(){vn.value&&v&&null==gn&&(gn=We?We(()=>{gn=null,vn.value&&xt(vn.value)}):null,null==gn&&vn.value&&xt(vn.value))}function Mt(){const e=pt(),n=ge.value.length;if(null==e||n<=0)return null;const t=Fn(Pt(e+1),0,n-1),o=Lt(0,t),l=ft(t);return{nodeIndex:t,offsetWithinNodePx:Fn(e-o,0,Math.max(0,l-1))}}function _t(e){if(vn.value={nodeIndex:Fn(e.nodeIndex,0,Math.max(0,ge.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},yt(),xt(vn.value),v)for(const n of[0,120,280,480])yn.push(window.setTimeout(()=>{vn.value&&xt(vn.value)},n))}function Bt(e){const n=pt();return null==n?null:n-vt(e)}function Lt(e,n){var t,o;if(e>=n)return 0;if(Be.value){let t=0;for(let o=e;o<n;o++)t+=ft(o);return t}if(mn.value!==ge.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Kn[l])?t:Zn.value;return o}const l=hn.value,r=fn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Kn[l])?o:Zn.value;return t}return Xn(l,e,n)+(n-e-Xn(r,e,n))*Zn.value}X(()=>ge.value.length,e=>{e<=0?Vn():(e<mn.value&&function(e){if(e<=0)return void Vn();let n=0,t=0;for(const[o,l]of Object.entries(Kn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Kn[r]:(n+=i,t++)}Dn.total=n,Dn.count=t}(e),e!==mn.value&&Gn(e))},{immediate:!0});const Tt=D(()=>{if(!Ae.value)return ge.value.map((e,n)=>({node:e,index:n}));const e=ge.value.length,n=Fn(Bn.start,0,e),t=Fn(Bn.end,n,e);return ge.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Ht=D(()=>Ae.value?Lt(0,Math.min(Bn.start,ge.value.length)):0),zt=D(()=>{if(!Ae.value)return 0;const e=ge.value.length;return Lt(Math.min(Bn.end,e),e)});function Rt(){var e;const n=ge.value;return{totalNodes:n.length,measuredCount:Dn.count,estimatedCount:ht.value.filter(Boolean).length,averageNodeHeight:Zn.value,topSpacerHeight:Ht.value,bottomSpacerHeight:zt.value,estimatedTotalHeight:Lt(0,n.length),width:k.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(b.value.paragraph),listItemReady:Boolean(b.value.listItem),listWrapperOverhead:b.value.listWrapperOverhead,headingReadyLevels:Object.entries(b.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=ht.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=ht.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=ht.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=ht.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Kn[n])?d:null}})}}function Pt(e){var n;if(e<=0)return 0;const t=ge.value;if(Be.value){let n=e;for(let e=0;e<t.length;e++){const t=ft(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(mn.value===t.length&&hn.value.length&&fn.value.length){const n=Zn.value,o=hn.value,l=fn.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=Kn[l])?n:Zn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Wt(){dn.value+=1}function Ft(e,n){const t=en.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(en.value=n)}if(!o)return;const l=new Set(t);l.delete(e),en.value=l}function Dt(){0!==en.value.size&&(en.value=/* @__PURE__ */new Set)}function Vt(e){if(!nn.size)return;if(!Ae.value)return;let n=!1;for(const[t,o]of nn)t>=e&&(o.destroy(),nn.delete(t),Nn.value&&Ft(t,!1),io(t),ln.delete(t)&&(n=!0));n&&Wt()}function qt(e,n){Nn.value&&Ft(e,n),n&&(Ae.value?Wn():_n.value=Fn(e,0,Math.max(0,ge.value.length-1)))}function Xt(e){const n=tn.get(e);n&&(n(),tn.delete(e));const t=nn.get(e);t&&(t.destroy(),nn.delete(e)),io(e)}function Gt(e,n){let t=!1;if(n){const o=ln.get(e);ln.set(e,n),o!==n&&(t=!0)}else ln.delete(e)&&(t=!0);if(t&&Wt(),n||io(e),!Mn.value||!Pe)return Xt(e),void(n&&qt(e,!0));if(!Ae.value&&Nn.value&&!f.value&&nn.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of nn.values())e.destroy();if(nn.clear(),v)for(const e of on.values())window.clearTimeout(e);on.clear(),Dt()}}(),!Mn.value||!Pe))return Xt(e),void(n&&qt(e,!0));if(e<Xe.value&&!Ae.value)return Xt(e),void qt(e,!0);if(en.value.has(e))return Xt(e),void qt(e,!0);if(!n)return void Xt(e);Xt(e);const o=Pe(n,{rootMargin:"400px"});if(!o)return;nn.set(e,o),qt(e,o.isVisible.value),Nn.value&&function(e){if(!v||!Nn.value)return;io(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(on.delete(e),!Nn.value)return;if(en.value.has(e))return;const o=ln.get(e);if(!o)return;const l=En(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);on.set(e,t)}(e);let l=null;l=X(()=>o.isVisible.value,n=>{if(n){io(e),qt(e,!0),null==l||l(),tn.delete(e),nn.get(e)===o&&nn.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),tn.set(e,l),Ae.value&&Wn()}X(()=>He.value,e=>{if(!e){for(const e of an.values())e.disconnect();an.clear();for(const e of Ln.values())for(const n of e)window.clearTimeout(n);Ln.clear()}},{immediate:!0});let Zt=null,Yt=null,Qt=!1,no=null,lo=null;function ro(){v&&(null!=Zt&&(null==je||je(Zt),Zt=null),null!=Yt&&(window.clearTimeout(Yt),Yt=null),null!=lo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(lo),lo=null),Qt=!1,no=null)}function io(e){if(!v)return;const n=on.get(e);null!=n&&(window.clearTimeout(n),on.delete(e))}function ao(e,n={}){var t,o;if(!kn.value)return;const r=Cn.value;if(Ye.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Zt=null,Yt=null,lo=null,Qt=!1;const t=null!=no?no:i;no=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();Ye.value=Math.min(r,Ye.value+Math.max(1,e)),Vt(Ye.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!kn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,qe.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Qe.value=Math.max(r,Math.floor(.7*Qe.value)):e<.5*t&&Qe.value<o&&(Qe.value=Math.min(o,Math.ceil(1.2*Qe.value)))}(t),t};let s=t;for(;(a(s),!(Ye.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Qe.value));Ye.value<r&&so()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(no=null!=no?Math.max(no,i):i,!Qt){if(Qt=!0,!Ve&&Ue&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(lo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}We&&!Ve?Zt=We(()=>{0!==s?Yt=window.setTimeout(()=>a(),s):a()}):Yt=window.setTimeout(()=>a(),s)}}function so(){kn.value&&ao(Ze.value?Math.max(1,Math.round(Qe.value)):Math.max(1,qe.value))}X([()=>ge.value,()=>ge.value.length,()=>kn.value,()=>qe.value,()=>Xe.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=ge.value.length,t=Je.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Je.value={key:o,total:n};const s=bn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==qe.value||s.initial!==Xe.value||s.delay!==u||s.enabled!==kn.value;bn.value={batchSize:qe.value,initial:Xe.value,delay:u,enabled:kn.value},r&&(Vn(),n>0&&Gn(n)),(a||d||!kn.value)&&ro(),(a||d)&&(Qe.value=Math.max(1,qe.value||1)),a&&Ae.value&&Wn({immediate:!0});const c=Cn.value;if(!n)return Ye.value=0,void Vt(0);if(!kn.value)return Ye.value=c,void Vt(Ye.value);const m=r||0===t.total;Ye.value=m||d?Math.min(c,Xe.value):Math.min(Ye.value,c);const h=Math.max(1,Xe.value||qe.value||n);Ye.value<c?ao(h,{immediate:!v}):Vt(Ye.value)},{immediate:!0}),X(()=>Ae.value,e=>{if(!e)return $n(),void Pn();Rn(),Wn({immediate:!0})},{immediate:!0}),X([()=>ge.value.length,()=>Ae.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield Z(),Wn({immediate:!0}))}),{flush:"post"}),X(()=>i.value,()=>{Ae.value&&(Rn(),Wn({immediate:!0}))}),X(Be,e=>{e&&function(){var e;if(xe.value&&Ne.value&&ke.value&&(null==(e=be.value)?void 0:e[1]))return;const n=we({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=we({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=we({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});xe.value=n,Ne.value=t,ke.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]=we({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});be.value=l}()},{immediate:!0}),X([()=>i.value,Be],()=>{if(!Be.value)return it(),void(k.value=0);ot(),it(),Be.value&&i.value&&"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(()=>{ot(),vn.value&&kt()}),lt.observe(i.value))},{immediate:!0}),X([Be,Te],()=>d(null,null,function*(){Be.value?(yield Z(),function(){var e,n,t,o;if(!Be.value||"undefined"==typeof window)return void(b.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=Jn(Yn(u.value),".paragraph-node");l.paragraph=Hl(u.value,r,"pre-wrap");const i=Yn(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=Hl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=m.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=Jn(Yn(h[u]),`h${u}`);l.headings[u]=Hl(h[u],e,"pre-wrap")}b.value=l}()):b.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),X(()=>ge.value.length,()=>{Ae.value&&Wn({immediate:!0})}),X([Be,k],()=>{Ae.value&&Wn({immediate:!0}),vn.value&&kt()},{immediate:!1}),X(()=>Nn.value,e=>{if(e)for(const[n,t]of ln)Gt(n,t);else{for(const e of nn.values())e.destroy();nn.clear();for(const e of Array.from(on.keys()))io(e);Dt();for(const[e,n]of ln)n&&qt(e,!0)}},{immediate:!1}),X([()=>l.viewportPriority,()=>ge.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),X(()=>Ye.value,()=>{Ae.value&&Wn({immediate:!0})}),X([_n,Ie,Sn,()=>ge.value.length,Ae],()=>{!function(){const e=ge.value.length;if(!Ae.value||0===e)return Bn.start=0,void(Bn.end=e);const n=Math.min(Ie.value,e),t=Sn.value,o=Fn(_n.value-t,0,Math.max(0,e-n));Bn.start=o,Bn.end=Math.min(e,o+n)}()},{immediate:!0}),X([()=>ge.value.length,Ae,Ie,Sn,()=>Bn.start,()=>Bn.end],([e,n,t,o,l,r])=>{y.value&&j("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:_n.value,scroll:n?(()=>{const e=pn.value||En();return e?{reverse:In(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:Ye.value})}),X(()=>Cn.value,(e,n)=>{kn.value&&("number"==typeof n&&e<=n||e>Ye.value&&so())}),X([()=>l.customId],([e],n,t)=>{if(!e||Me)return;const o=function(e,n){return e?(Ml.controllers[e]=n,()=>{Ml.controllers[e]===n&&delete Ml.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Mt,restoreAnchor:_t,getAnchorDrift:Bt,getReport:Rt});t(()=>{o()})},{immediate:!0}),Y(()=>{ro();for(const e of nn.values())e.destroy();nn.clear();for(const e of an.values())e.disconnect();an.clear();for(const e of Ln.values())for(const n of e)window.clearTimeout(n);Ln.clear();for(const e of tn.values())e();tn.clear();for(const e of Array.from(on.keys()))io(e);it(),yt(),$n(),Pn()});const uo=de({loader:()=>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),Ut}}),loadingComponent:ti,delay:0}),co=de({loader:()=>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),Ut}}),loadingComponent:ni,delay:0}),mo=de(()=>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),Ut}})),ho={text:Qn,paragraph:Kt,heading:Et,code_block:at,list:At,list_item:It,blockquote:Oe,table:Jt,definition_list:$e,footnote:Ot,footnote_reference:Ge,footnote_anchor:St,admonition:vi,vmr_container:oo,hardbreak:Ct,link:gt,image:zn,thematic_break:eo,math_inline:et,math_block:nt,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,checkbox:Ee,checkbox_input:Ee,inline_code:un,html_inline:rn,reference:tt,html_block:jt},fo=D(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),po=D(()=>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 T.value?{showTooltips:T.value}:{}),l.codeBlockProps||{})),vo=D(()=>a({},l.mermaidProps||{})),go=D(()=>a({},l.d2Props||{})),yo=D(()=>a({},l.infographicProps||{})),wo=D(()=>({typewriter:l.typewriter,customHtmlTags:pe.value.customHtmlTags})),xo=D(()=>a(a({},wo.value),"boolean"==typeof T.value?{showTooltip:T.value}:{})),No=D(()=>a(a({},wo.value),"boolean"==typeof T.value?{showTooltips:T.value}:{})),ko=D(()=>Tt.value.map(e=>{var n,t,o,l,r,i;let u=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=sn.get(u);if(c&&c.signature===d)return c.node;const m=a({},u);return sn.set(u,{signature:d,node:m}),m}(e.node);const d=bo(u);let c=Mo(u,d);if(("html_block"===u.type||"html_inline"===u.type)&&c===ho[u.type]){const e=u,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||M(e.content);if(r){const n=ae.value[r];if(ve.value.has(r)&&n)c=n,u=s(a({},e),{type:r,tag:r,content:C(e.content,r)});else if(S(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===u.type?(c=Qn,u={type:"text",content:n,raw:n}):(c=Kt,u={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let m=a({},function(e,n){const t=null!=n?n:bo(e);return"mermaid"===t?vo.value:"infographic"===t?yo.value:"d2"===t||"d2lang"===t?go.value:"link"===e.type?xo.value:"list"===e.type?No.value:"code_block"===e.type?po.value:wo.value}(u,d));const h=ht.value[e.index];return"code_block"===u.type&&"code-block"===(null==h?void 0:h.kind)&&(m=s(a({},m),{estimatedHeightPx:h.height,estimatedContentHeightPx:h.contentHeight})),"code_block"===u.type&&"mermaid"===d&&null==$l(m.estimatedPreviewHeightPx)&&(m=s(a({},m),{estimatedPreviewHeightPx:jl(Rl(String(null!=(r=u.code)?r:"")))})),"code_block"===u.type&&"infographic"===d&&null==$l(m.estimatedPreviewHeightPx)&&(m=s(a({},m),{estimatedPreviewHeightPx:Fl(Pl(String(null!=(i=u.code)?i:"")))})),s(a({},e),{node:u,component:c,bindings:m,isCodeBlock:"code_block"===u.type,indexKey:`${fo.value}-${e.index}`})}));function bo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Mo(e,n){if(!e)return to;const t=ae.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:bo(e),r=l?t[l]:void 0;if(r)return r;if("mermaid"===l)return t.mermaid||uo;if("infographic"===l)return t.infographic||co;if("d2"===l||"d2lang"===l)return t.d2||mo;if(o)return o;return t.code_block||ut.value}return o||ho[String(e.type)]||to}function So(e){r("click",e)}function _o(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Bo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}function Oo(e){r("mouseover",e)}function Lo(e){r("mouseout",e)}return(e,n)=>g.value?(I(!0),A(R,{key:0},P(ko.value,e=>(I(),J(ce(e.component),me({key:e.index,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onClick:So,onMouseover:Oo,onMouseout:Lo,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"]))),128)):(I(),A("div",{key:1,ref_key:"containerRef",ref:i,class:V(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Ae.value}]]),"data-custom-id":l.customId,onClick:So,onMouseover:_o,onMouseout:Bo},[Be.value||Ae.value?(I(),A(R,{key:0},[Be.value?(I(),A("div",{key:0,class:"height-estimation-probes",style:oe({width:`${Te.value}px`}),"aria-hidden":"true"},[z("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[H($(Kt),{node:xe.value,"index-key":"probe-paragraph"},null,8,["node"])],512),z("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[z("ul",li,[H($(It),{node:Ne.value,"index-key":"probe-list-item"},null,8,["node"])])],512),z("div",{ref_key:"listProbeWrapperRef",ref:m,class:"node-content","data-probe":"list"},[H($(At),{node:ke.value,"index-key":"probe-list"},null,8,["node"])],512),(I(),A(R,null,P(6,e=>z("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(h[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[H($(Et),{node:Tn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,ri)),64))],4)):G("",!0),Ae.value?(I(),A("div",{key:1,class:"node-spacer",style:oe({height:`${Ht.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],64)):G("",!0),(I(!0),A(R,null,P(ko.value,e=>{return I(),A("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,kn.value&&t>=Ye.value||!(!Nn.value||t<Xe.value||en.value.has(t))?(I(),A("div",{key:1,class:"node-placeholder",style:oe({height:`${ft(e.index)}px`})},null,4)):(I(),A("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=Ln.get(e);if(o){for(const e of o)window.clearTimeout(e);Ln.delete(e)}const l=an.get(e);if(l&&(l.disconnect(),an.delete(e)),!n||!He.value)return void On.delete(e);On.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Kn[e];if(Kn[e]=n,t?Dn.total+=n-t:(Dn.total+=n,Dn.count++),mn.value>e){const o=hn.value,l=fn.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)}vn.value&&kt()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),an.set(e,t)}"code_block"===(null==(t=ge.value[e])?void 0:t.type)&&"undefined"!=typeof window&&Ln.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?(I(),J(ce(e.component),me({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[4]||(n[4]=e=>r("copy",e)),onHandleArtifactClick:n[5]||(n[5]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(I(),J(ee,{key:0,name:"typewriter",appear:""},{default:ne(()=>[(I(),J(ce(e.component),me({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"]))]),_:2},1024))],512)))],8,ii);var t}),128)),Ae.value?(I(),A("div",{key:1,class:"node-spacer",style:oe({height:`${zt.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],42,oi))}}),[["__scopeId","data-v-1c8a9515"]]);ai.install=e=>{var n,t;const o=null!=(t=null!=(n=ai.__name)?n:ai.name)?t:"NodeRenderer";e.component(o,ai)};const si=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ai},Symbol.toStringTag,{value:"Module"})),ui={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"},di={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"},ci={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"},mi={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"},hi={class:"admonition-title"},fi=["aria-expanded","aria-controls"],pi=["id"],vi=/* @__PURE__ */Be(/* @__PURE__ */E({__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=D(()=>{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=q(!!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)=>(I(),A("div",{class:V(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(I(),A("svg",ui,[...t[1]||(t[1]=[z("circle",{cx:"12",cy:"12",r:"10"},null,-1),z("path",{d:"M12 16v-4"},null,-1),z("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(I(),A("svg",di,[...t[2]||(t[2]=[z("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),z("path",{d:"M9 18h6"},null,-1),z("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(I(),A("svg",ci,[...t[3]||(t[3]=[z("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),z("path",{d:"M12 9v4"},null,-1),z("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(I(),A("svg",mi,[...t[4]||(t[4]=[z("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),z("path",{d:"M12 8v4"},null,-1),z("path",{d:"M12 16h.01"},null,-1)])])):G("",!0),z("span",hi,W(r.value),1),o.node.collapsible?(I(),A("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(I(),A("svg",{style:oe({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]=[z("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,fi)):G("",!0)]),te(z("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[H($(ai),{"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,pi),[[re,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);vi.install=e=>{e.component(vi.__name,vi)};const gi=()=>import("@terrastruct/d2");let yi=null,wi=gi;function xi(e){wi=e,yi=null}function Ni(e){xi(null!=e?e:gi)}function ki(){xi(null)}function bi(){return"function"==typeof wi}function Mi(){return d(this,null,function*(){if(yi)return yi;const e=wi;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===gi)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(yi=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),yi):null})}const Si=()=>import("mermaid");let _i=null,Bi=Si;function Oi(e){Bi=e,_i=null}function Li(e){Oi(null!=e?e:Si)}function Ci(){Oi(null)}function Ti(){return"function"==typeof Bi}function Ei(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(_i)return _i;const e=function(){try{const e=globalThis;return Ei(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return _i=e,Ii(_i),_i;const n=Bi;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Si)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(_i=Ei(t),Ii(_i),_i):null})}function Hi(e){return JSON.stringify(e)}function $i(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=Hi(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=Hi(o),s=l?Hi(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 zi(e){var n,t;const o=$i(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}}function Ri(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}mn.install=e=>{e.component(mn.__name,mn)};let Pi=null,Wi=null,ji=!1;const Fi=/* @__PURE__ */new Map,Ki=/* @__PURE__ */new Map;let Di=5;const Vi=/* @__PURE__ */new Set;function Ui(){if(Fi.size<Di&&Vi.size){const n=Array.from(Vi);Vi.clear();for(const t of n)try{t()}catch(e){}}}function qi(e){Pi=e,Wi=null,Pi.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=Fi.get(n);if(l)if(Fi.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(Ki.set(e,t),Ki.size>200){const e=Ki.keys().next().value;Ki.delete(e)}}l.resolve(t)}},Pi.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(),Ui()}}function Xi(){var e;Pi&&(null==(e=Pi.terminate)||e.call(Pi)),Pi=null,Wi=null}function Gi(e){ji=!!e,Pi&&Pi.postMessage({type:"init",debug:ji})}function Zi(e,n=!0,t=2e3,o){return d(this,null,function*(){performance.now();const l=Ri(e);if(!qn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(Wi)return Promise.reject(Wi);const r=`${n?"d":"i"}:${l}`,i=Ki.get(r);if(i)return Promise.resolve(i);const a=Pi||(Wi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Wi.name="WorkerInitError",Wi.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Wi);if(Fi.size>=Di){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=Fi.size,e.max=Di,Promise.reject(e)}return new Promise((e,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const i=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{Fi.delete(i);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),Fi.has(i)&&Fi.delete(i);const e=new Error("Aborted");e.name="AbortError",r(e),Ui()},{once:!0});const u=e,d=r;Fi.set(i,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),a.postMessage({id:i,content:l,displayMode:n})})})}function Yi(e,n=!0,t){const o=`${n?"d":"i"}:${Ri(e)}`;if(Ki.set(o,t),Ki.size>200){const e=Ki.keys().next().value;Ki.delete(e)}}function Ji(){return{inFlight:Fi.size,max:Di}}function Qi(e){Number.isFinite(e)&&e>0&&(Di=Math.floor(e))}const ea="WORKER_BUSY";function na(){return Fi.size>=Di}function ta(e=2e3,n){return Fi.size<Di?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Vi.delete(i),t())};if(Vi.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Vi.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),Vi.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const oa={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function la(e){null!=e.timeout&&(oa.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(oa.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(oa.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(oa.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ra(){return a({},oa)}function ia(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!qn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:oa.timeout,s=null!=(l=t.waitTimeout)?l:oa.waitTimeout,u=null!=(r=t.backoffMs)?r:oa.backoffMs,d=null!=(i=t.maxRetries)?i:oa.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):oa.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Zi(e,n,a,m)}catch(f){if((null==f?void 0:f.code)!==ea||h>=c)throw f;if(h++,yield ta(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*h)))}}})}function aa(e){return JSON.stringify(e)}function sa(e){var n;const t=null!=(n=e.mode)?n:"module",o=aa(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(${aa(a({startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}},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 ua(e){var n,t;const o=sa(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 da=null,ca=null;const ma=/* @__PURE__ */new Map;let ha=5,fa=!1;function pa(e){fa=!!e}function va(e){Number.isFinite(e)&&e>0&&(ha=Math.floor(e))}function ga(){return{inFlight:ma.size,max:ha}}const ya="WORKER_BUSY",wa="MERMAID_DISABLED";function xa(e){da=e,ca=null;const n=e;da.onmessage=e=>{if(da!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=ma.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},da.onerror=e=>{var t,o;if(da===n)if(0!==ma.size){try{fa?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 ma.entries())t.reject(new Error(`Worker error: ${e.message}`));ma.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},da.onmessageerror=e=>{var t,o;if(da===n)if(0!==ma.size){try{fa?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of ma.entries())n.reject(new Error("Worker messageerror"));ma.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Na(){var e;if(da)try{for(const[e,n]of ma.entries())n.reject(new Error("Worker cleared"));ma.clear(),null==(e=da.terminate)||e.call(da)}catch(n){}da=null,ca=null}function ka(e,n,t=1400){if(!Ti()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=wa,Promise.reject(e)}if(ca)return Promise.reject(ca);const o=da||(ca=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),ca.name="WorkerInitError",ca.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(ca);if(ma.size>=ha){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=ya,e.inFlight=ma.size,e.max=ha,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),ma.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};ma.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return ma.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=ma.get(i);n&&n.reject(e)},t)})}function ba(e,n,t=1400){return d(this,null,function*(){try{return yield ka("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Ma(e,n,t=1400){return d(this,null,function*(){try{return yield ka("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Sa(){if(da)try{for(const[e,n]of ma.entries())n.reject(new Error("Worker terminated"));ma.clear(),da.terminate()}finally{da=null}}const _a=de(()=>import("./index7.js")),Ba=de(()=>import("./index3.js")),Oa=de(()=>import("./index2.js")),La=de(()=>import("./index4.js")),Ca=de(()=>import("./index5.js")),Ta=de(()=>import("./index6.js")),Ea={AdmonitionNode:vi,BlockquoteNode:Oe,CheckboxNode:Ee,CodeBlockNode:_a,DefinitionListNode:$e,EmojiNode:Re,EmphasisNode:bt,FootnoteNode:Ot,FootnoteReferenceNode:Ge,FootnoteAnchorNode:St,HardBreakNode:Ct,HeadingNode:Et,HtmlBlockNode:jt,HtmlInlineNode:rn,HighlightNode:Nt,ImageNode:zn,D2BlockNode:Ta,InfographicBlockNode:Ca,InlineCodeNode:un,PreCodeNode:Ut,InsertNode:wt,LinkNode:gt,ListItemNode:It,ListNode:At,MathBlockNode:Ba,MathInlineNode:Oa,MermaidBlockNode:La,ParagraphNode:Kt,StrikethroughNode:mt,StrongNode:dt,SubscriptNode:st,SuperscriptNode:rt,TableNode:Jt,TextNode:Qn,ThematicBreakNode:eo,VmrContainerNode:oo,ReferenceNode:tt,MarkdownCodeBlockNode:ei},Ia={install(e,n){Object.entries(Ea).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&lr(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&gr(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&T(n.mathOptions)}};export{wt as $,pr as A,Nr as B,Ut as C,Xr as D,Or as E,Ul as F,vi as G,Oe as H,Ee as I,_a as J,Ta as K,$e as L,Re as M,bt as N,St as O,Ot as P,Ge as Q,Ct as R,Et as S,Nt as T,jt as U,rn as V,ea as W,zn as X,Ca as Y,un as Z,Be as _,Gn as a,Qi as a$,gt as a0,It as a1,At as a2,wa as a3,ya as a4,ei as a5,ai as a6,Ba as a7,Oa as a8,La as a9,Li as aA,Mr as aB,sr as aC,De as aD,ra as aE,Ji as aF,ga as aG,_r as aH,rr as aI,bi as aJ,na as aK,qn as aL,br as aM,Zl as aN,xr as aO,dr as aP,ar as aQ,or as aR,Ve as aS,Zi as aT,Ke as aU,xi as aV,On as aW,lr as aX,la as aY,qi as aZ,Gi as a_,Kt as aa,tt as ab,mt as ac,dt as ad,st as ae,rt as af,Jt as ag,Qn as ah,eo as ai,mn as aj,oo as ak,Ia as al,$i as am,sa as an,Ue as ao,Xi as ap,Na as aq,zi as ar,ua as as,ur as at,ki as au,Un as av,Ci as aw,Sr as ax,Ni as ay,Vn as az,Tn as b,Dn as b0,gr as b1,Oi as b2,xa as b3,pa as b4,va as b5,ta as b6,Br as c,Ai as d,Rl as e,Sn as f,Xn as g,_n as h,Ti as i,ba as j,jl as k,zl as l,Ma as m,Ri as n,Pl as o,$l as p,Fl as q,ia as r,Yi as s,Sa as t,zt as u,Mi as v,yr as w,wr as x,Yl as y,kr 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 m,sanitizeHtmlAttrs as h,BLOCKED_HTML_TAGS as f,isHtmlTagHardBlocked as p,isHtmlTagBlocked as v,isCustomHtmlComponentTag as g,convertHtmlAttrsToProps as y,sanitizeHtmlContent as w,sanitizeHtmlTokenAttrs as x,tokenAttrsToRecord as N,NON_STRUCTURING_HTML_TAGS as k,normalizeCustomHtmlTags as b,getHtmlTagFromContent as M,shouldRenderUnknownHtmlTagAsText as S,getMarkdown as _,mergeCustomHtmlTags as B,resolveCustomHtmlTags as O,parseMarkdownToStructure as L,stripCustomHtmlWrapper as C,setDefaultMathOptions as T}from"stream-markdown-parser";import{defineComponent as E,openBlock as I,createElementBlock as A,createVNode as H,unref as $,createElementVNode as z,Fragment as R,renderList as P,toDisplayString as W,shallowRef as j,h as F,inject as K,computed as D,normalizeClass as V,useAttrs as U,ref as q,watch as X,createCommentVNode as G,nextTick as Z,onBeforeUnmount as Y,createBlock as J,Teleport as Q,Transition as ee,withCtx as ne,withDirectives as te,normalizeStyle as oe,createTextVNode as le,vShow as re,createApp as ie,getCurrentInstance as ae,renderSlot as se,readonly as ue,defineAsyncComponent as de,resolveDynamicComponent as ce,mergeProps as me,provide as he,withModifiers as fe,createStaticVNode as pe,onMounted as ve,createSlots as ge,reactive as ye,markRaw as we}from"vue";import{autoUpdate as xe,offset as Ne,flip as ke,shift as be,arrow as Me,computePosition as Se}from"@floating-ui/dom";const _e=["cite"],Be=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},Oe=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(I(),A("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[H($(ai),{"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,_e))}}),[["__scopeId","data-v-07e0310e"]]);Oe.install=e=>{e.component(Oe.__name,Oe)};const Le=["aria-label"],Ce={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"},Te={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"},Ee=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(I(),A("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(I(),A("svg",Te,[...t[1]||(t[1]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),z("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(I(),A("svg",Ce,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Le))}),[["__scopeId","data-v-be21ab83"]]);Ee.install=e=>{e.component(Ee.__name,Ee)};const Ie={class:"definition-list"},Ae={class:"definition-term"},He={class:"definition-desc"},$e=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(I(),A("dl",Ie,[(I(!0),A(R,null,P(n.node.items,(o,l)=>(I(),A(R,{key:l},[z("dt",Ae,[H($(ai),{"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"])]),z("dd",He,[H($(ai),{"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"]]);$e.install=e=>{e.component($e.__name,$e)};const ze={class:"emoji-node"},Re=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(I(),A("span",ze,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Re.install=e=>{e.component(Re.__name,Re)};const Pe="__global__",We="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",je=(()=>{const e=globalThis;if(e[We])return e[We];const n={scopedCustomComponents:{},revision:j(0)};return e[We]=n,n})(),Fe=je.revision;function Ke(e,n){"string"==typeof e?je.scopedCustomComponents[e]=n||{}:je.scopedCustomComponents[Pe]=e||{},Fe.value++}function De(e){const n=je.scopedCustomComponents[Pe]||{};if(!e)return n;const t=je.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ve(e){if(e===Pe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete je.scopedCustomComponents[e],Fe.value++}function Ue(){delete je.scopedCustomComponents[Pe],Fe.value++}const qe=["id"],Xe=["title"],Ge=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${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)=>(I(),A("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[z("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+W(e.node.id)+"]",9,Xe)],8,qe))}}),[["__scopeId","data-v-c1463a29"]]);Ge.install=e=>{e.component(Ge.__name,Ge)};const Ze=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Ye(e){Ze&&console.warn(e)}function Je(e){return h(e)}function Qe(e,n,t=!1){const o=Object.entries(null!=n?n:{}),l=o.length>0?o.map(([e,n])=>""===n?` ${e}`:` ${e}="${n}"`).join(""):"";return t?`<${e}${l} />`:`<${e}${l}>`}function en(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function nn(e,n,t,o,l,r,i=!1){const u=function(e,n){return g(e,n)}(e,o);if(f.has(e.toLowerCase())||!u&&p(e,r))return null;if(!u&&v(e,r))return i?[Qe(e,n,!0)]:[Qe(e,n),...t,`</${e}>`];const d=h(n,r,e),c=d.key,m=null!=c&&""!==c?c:l;if(u){const n=o[e]||o[e.toLowerCase()],l=function(e){return y(e)}(d);return F(n,s(a({},l),{key:m}),t.length>0?t:void 0)}return F(e,s(a({},d),{innerHTML:void 0,key:m}),t.length>0?t:void 0)}function tn(e,n){return m(e,n)}function on(e,n,t="safe"){if(!e)return[];try{const o=function(e,n,t="safe"){let o=0;const l=[],r=[];for(const i of e)if("text"===i.type)(l.length>0?l[l.length-1].children:r).push(i.content);else if("self_closing"===i.type){const e=nn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);en(l.length>0?l[l.length-1].children:r,e)}else if("tag_open"===i.type)l.push({tagName:i.tagName,children:[],attrs:i.attrs,autoKey:"ms-html-"+o++});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let o=-1;for(let n=l.length-1;n>=0;n--)if(l[n].tagName.toLowerCase()===e){o=n;break}if(-1!==o)for(;l.length>o;){const i=l.pop(),a=nn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?en(l[l.length-1].children,a):en(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&Ye(`Auto-closing unclosed tag: <${i.tagName}>`)}else Ye(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=nn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?en(l[l.length-1].children,o):en(r,o),Ye(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(c(e),n,t);return o}catch(l){return o=l,Ze&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const ln=["innerHTML"],rn=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=K("markstreamHtmlPolicy",void 0),o=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=D(()=>(Fe.value,De(n.customId))),r=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=D(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:w(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=on(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!tn(e,l.value))return{mode:"html",content:w(e,o.value)};const t=on(e,l.value,o.value);return null===t?{mode:"html",content:w(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(I(),A("span",{key:0,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[H($(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(I(),A("span",{key:1,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(I(),A("span",{key:2,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,ln))}}),[["__scopeId","data-v-d7e17280"]]);rn.install=e=>{e.component(rn.__name,rn)};const an={class:"inline-code"},sn={key:0},un=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=K("markstreamTypewriter",void 0),l=K("markstreamTextStreamState",void 0),r=D(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=D(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=D(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=q(n.node.code),u=q(""),d=q(0);function c(){return s.value+u.value}function m(e){s.value=e,u.value=""}function h(){u.value&&(s.value=c(),u.value="")}X([()=>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,h=null!=r?r:t;return i.value?n===h?(m(n),void(o&&(null==l||l.set(o,n)))):h&&n.startsWith(h)&&n.length>h.length?(s.value=h,u.value=n.slice(h.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),X(i,e=>{e||m(c())});const f=D(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(I(),A("code",an,[s.value?(I(),A("span",sn,W(s.value),1)):G("",!0),u.value?(I(),A("span",{key:1,class:V(["inline-code-stream-delta",[f.value]]),onAnimationend:h},W(u.value),35)):G("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);un.install=e=>{e.component(un.__name,un)};const dn=["id"],cn=["data-placement"],mn=/* @__PURE__ */Be(/* @__PURE__ */E({__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=q(null),l=q(null),r=q({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=q({}),a=q(null!=(n=t.placement)?n:"top"),s=q(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[Ne(null!=(e=t.offset)?e:6),ke(),be({padding:6}),...l.value?[Me({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:m}=yield Se(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,m.arrow&&l.value){const{x:e,y:n}=m.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 X(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield Z(),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 Z(),s.value=!0,yield Z(),r.value.transform=n):s.value=!0}else s.value=!0;u=xe(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=xe(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),X([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield Z(),yield c())})),Y(()=>{u&&u()}),(n,u)=>(I(),J(Q,{to:"body"},[z("div",{class:V(["markstream-vue",{dark:e.isDark}])},[H(ee,{name:"tooltip",appear:""},{default:ne(()=>[te(z("div",{id:t.id,ref_key:"tooltip",ref:o,style:oe({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[le(W(e.content)+" ",1),z("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:oe(i.value)},null,12,cn)],12,dn),[[re,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),hn=q(!1),fn=q(""),pn=q("top"),vn=q(null),gn=q(null),yn=q(null),wn=q(null),xn=q(null);let Nn=null,kn=null;function bn(){Nn&&(clearTimeout(Nn),Nn=null),kn&&(clearTimeout(kn),kn=null)}let Mn=!1;function Sn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!Mn&&"undefined"!=typeof document)try{Mn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),ie({setup:()=>()=>{var e;return F(mn,{visible:hn.value,"anchor-el":vn.value,content:fn.value,placement:pn.value,id:gn.value,originX:yn.value,originY:wn.value,isDark:null!=(e=xn.value)?e:void 0})}}).mount(e)}catch(e){Mn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),bn();const i=()=>{var o,i;gn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,vn.value=e,fn.value=n,pn.value=t,yn.value=null!=(o=null==l?void 0:l.x)?o:null,wn.value=null!=(i=null==l?void 0:l.y)?i:null,xn.value="boolean"==typeof r?r:null,hn.value=!0;try{e.setAttribute("aria-describedby",gn.value)}catch(a){}};o?i():Nn=setTimeout(i,80)}function _n(e=!1){bn();const n=()=>{if(vn.value&&gn.value)try{vn.value.removeAttribute("aria-describedby")}catch(e){}hn.value=!1,vn.value=null,gn.value=null,yn.value=null,wn.value=null};e?n():kn=setTimeout(n,120)}const Bn={"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.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function On(e){Object.assign(Bn,e)}const Ln=e=>{var n;return null!=(n=Bn[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)};function Cn(e){return{t(n){if(e.te&&Bn[n]&&!e.te(n))return Ln(n);const t=e.t(n);return t===n&&Bn[n]?Ln(n):t}}}function Tn(){const e=function(){var e,n;try{const t=ae(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(e)return Cn(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return Cn({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:Ln}}const En={class:"image-node-container"},In=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],An={key:"placeholder",class:"image-placeholder"},Hn={key:1,class:"image-node__raw-text"},$n={key:"error",class:"image-error"},zn=/* @__PURE__ */Be(/* @__PURE__ */E({__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=q(!1),r=q(!1),i=q(!1),a=D(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=D(()=>!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:m}=Tn();return X(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(I(),A("span",En,[H(ee,{name:"img-switch",mode:"out-in"},{default:ne(()=>{var i,h,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?G("",!0):(I(),A("span",$n,[se(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]=z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[z("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)),z("span",null,W($(m)("image.loadError")),1)],!0)])):(I(),A("span",An,[t.usePlaceholder?se(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]=z("span",{class:"image-shimmer"},null,-1))],!0):(I(),A("span",Hn,W(e.node.raw),1))])):(I(),A("img",{key:"image",src:a.value,alt:String(null!=(h=null!=(i=t.node.alt)?i:t.node.title)?h:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:V(["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:$(m)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,In))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);zn.install=e=>{e.component(zn.__name,zn)};let Rn=null,Pn=!1,Wn=Kn;function jn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Fn(){try{const e=globalThis;return jn(null==e?void 0:e.katex)}catch(e){return null}}function Kn(){return d(null,null,function*(){const e=Fn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return jn(n)})}function Dn(e){Wn=e,Rn=null,Pn=!1}function Vn(e){Dn(null!=e?e:Kn)}function Un(){Dn(null)}function qn(){return"function"==typeof Wn}function Xn(){var e;const n=Fn();if(n)return Rn=n,Rn;if(Rn)return Rn;const t=Wn;if(!t||t===Kn)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Rn=null!=(e=jn(n))?e:n,Rn):null}catch(o){return null}}function Gn(){return d(this,null,function*(){var e;const n=Fn();if(n)return Rn=n,Rn;if(Rn)return Rn;if(Pn)return null;const t=Wn;if(!t)return Pn=!0,null;try{const n=yield t();if(n)return Rn=null!=(e=jn(n))?e:n,Rn}catch(o){}return Pn=!0,null})}const Zn=j(!1);let Yn=null;const Jn={key:0},Qn=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Yn||(Yn=Gn().then(e=>{Zn.value=!!e}).catch(()=>{Zn.value=!1})),ue(Zn)),o=U(),l=K("markstreamTypewriter",void 0),r=K("markstreamTextStreamState",void 0),i=K("markstreamStreamVersion",void 0),a=D(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=D(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=D(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=q(n.node.content),c=q(""),m=q(0);function h(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=h(),c.value="")}X([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=h(),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),m.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}),X(s,e=>{e||f(h())});const v=D(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(I(),A("span",{class:V([[$(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(I(),A("span",Jn,W(d.value),1)):G("",!0),c.value?(I(),A("span",{key:1,class:V(["text-node-stream-delta",[v.value]]),onAnimationend:p},W(c.value),35)):G("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et=de(()=>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 F(Qn,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 Gn())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 F(Qn,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:""}$`}}))}})),nt=de(()=>d(null,null,function*(){try{if(yield Gn())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 F(Qn,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:""}$$`}}))}})),tt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(I(),A("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))},W(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);tt.install=e=>{e.component(tt.__name,tt)};const ot={class:"superscript-node"},lt={key:1},rt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,footnote_reference:Ge,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,emoji:Re,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("sup",ot,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),A(R,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(I(),J(ce(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(I(),A("span",lt,W(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);rt.install=e=>{e.component(rt.__name,rt)};const it={class:"subscript-node"},at={key:1},st=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,footnote_reference:Ge,strikethrough:mt,highlight:Nt,insert:wt,superscript:rt,emoji:Re,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("sub",it,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),A(R,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(I(),J(ce(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(I(),A("span",at,W(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);st.install=e=>{e.component(st.__name,st)};const ut={class:"strong-node"},dt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("strong",ut,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);dt.install=e=>{e.component(dt.__name,dt)};const ct={class:"strikethrough-node"},mt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("del",ct,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);mt.install=e=>{e.component(mt.__name,mt)};const ht=["href","title","aria-label","aria-hidden","target","rel"],ft=["aria-hidden"],pt={class:"link-text-wrapper relative inline-flex"},vt={class:"leading-[normal] link-text"},gt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=K("markstreamShowTooltips",void 0),o=D(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=D(()=>{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:Qn,strong:dt,strikethrough:mt,emphasis:bt,image:zn,html_inline:rn,inline_code:un},i=D(()=>(Fe.value,De(n.customId))),s=U(),u=D(()=>{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 Je(l)}),d=D(()=>a(a({},s),u.value)),c=D(()=>{const e=d.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||"_blank"}),m=D(()=>"_blank"===c.value.trim().toLowerCase()),h=D(()=>{const e=d.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),f=D(()=>{const e=a({},d.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e}),p=D(()=>{var e,t;return Je({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")}).href});function v(){o.value&&_n()}const g=D(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=p.value)?t:"")});return(t,a)=>{var u,d;return e.node.loading?(I(),A("span",me({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},$(s),{style:l.value}),[z("span",pt,[z("span",vt,[H($(Qn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(d=e.node.text)?d:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,ft)):(I(),A("a",me({key:0,class:"link-node",href:p.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:c.value,rel:h.value},f.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,s=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,u=(null==(t=n.node)?void 0:t.title)||((null==(l=p.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:p.value)||"";Sn(e.currentTarget,u,"top",!1,s)}(e)),onMouseleave:v}),[(I(!0),A(R,null,P(e.node.children,(t,o)=>(I(),J(ce(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,ht))}}}),[["__scopeId","data-v-8992f408"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"insert-node"},wt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("ins",yt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);wt.install=e=>{e.component(wt.__name,wt)};const xt={class:"highlight-node"},Nt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,emphasis:bt,strikethrough:mt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("mark",xt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);Nt.install=e=>{e.component(Nt.__name,Nt)};const kt={class:"emphasis-node"},bt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,html_inline:rn,strong:dt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,footnote_reference:Ge,math_inline:et,reference:tt},t);return(t,l)=>(I(),A("em",kt,[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]);bt.install=e=>{e.component(bt.__name,bt)};const Mt=["href","title"],St=/* @__PURE__ */Be(/* @__PURE__ */E({__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)=>(I(),A("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"]]);St.install=e=>{e.component(St.__name,St)};const _t=["id"],Bt={class:"flex-1"},Ot=/* @__PURE__ */E({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(I(),A("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",Bt,[H($(ai),{"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,_t))}});Ot.install=e=>{e.component(Ot.__name,Ot)};const Lt={class:"hard-break"},Ct=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(I(),A("br",Lt))}),[["__scopeId","data-v-50c58f70"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=De(n.customId),o=a({text:Qn,inline_code:un,link:gt,image:zn,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,checkbox:Ee,checkbox_input:Ee,footnote_reference:Ge,hardbreak:Ct,math_inline:et,reference:tt},t);return(t,l)=>(I(),J(ce(`h${e.node.level}`),me({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:ne(()=>[(I(!0),A(R,null,P(e.node.children,(t,l)=>(I(),J(ce(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"]]),Et=Tt;Et.install=e=>{e.component(Tt.__name,Tt)};const It=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node)?e:n.item}),o=D(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return I(),A("li",me({class:"list-item",dir:"auto"},o.value),[H($(ai),me({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-fdeabeb1"]]);It.install=e=>{e.component(It.__name,It)};const At=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=D(()=>(Fe.value,De(e.customId).list_item||It));return(t,o)=>(I(),J(ce(e.node.ordered?"ol":"ul"),{class:V(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:ne(()=>[(I(!0),A(R,null,P(e.node.items,(l,r)=>{var i;return I(),J(ce(n.value),me({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"]]);At.install=e=>{e.component(At.__name,At)};const Ht=/* @__PURE__ */Symbol("ViewportPriority");function $t(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?q(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 m=null;function h(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=m){try{null==a||a(m)}catch(e){}m=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),h()}}function p(){i&&null==m&&c.size&&(m=i(()=>{m=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=q(!1);let i,a=!1;const m=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),h()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:m,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:m,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v})};return he(Ht,v),v}function zt(){var e,n;const t=K(Ht,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=q(!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()},m=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 m?(o.set(e,{resolve:t,visible:n}),m.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const Rt={key:2,class:"html-block-node__raw"},Pt=["innerHTML"],Wt={key:1,class:"html-block-node__placeholder"},jt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=K("markstreamHtmlPolicy",void 0),o=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=de({loader:()=>Promise.resolve().then(()=>si),suspensible:!1}),r=D(()=>{const e=x(n.node.attrs,o.value);if(!e)return;const t=N(e);return Object.keys(t).length>0?t:void 0}),i=D(()=>{const e=String(n.node.tag||"").trim(),t=x(n.node.attrs,o.value,e);if(!t)return;const l=N(t);return Object.keys(l).length>0?l:void 0}),a=D(()=>(Fe.value,De(n.customId))),s=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),u=q(null),d=q("undefined"==typeof window),c=q(n.node.content),m=D(()=>Array.isArray(n.node.children)?n.node.children:[]),h=D(()=>String(n.node.tag||"div")),f=D(()=>{const e=h.value.trim().toLowerCase();return k.has(e)||v(e,o.value)}),p=D(()=>m.value.length>0&&!!n.node.tag&&!f.value),g=D(()=>{var e,t,l;if(p.value)return{mode:"structured"};if(!d.value)return{mode:"html",content:null!=(e=c.value)?e:""};const r=null!=(t=c.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:w(r,o.value)};if(n.node.loading){const e=on(r,a.value,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!tn(r,a.value))return{mode:"html",content:w(r,o.value)};const i=on(r,a.value,o.value);return null===i?{mode:"html",content:w(r,o.value)}:{mode:"dynamic",nodes:i}}),y=zt(),b=q(null),M=!!n.node.loading;return"undefined"!=typeof window?(X(u,e=>{var t,o;if(null==(o=null==(t=b.value)?void 0:t.destroy)||o.call(t),b.value=null,!M)return d.value=!0,void(c.value=n.node.content);if(!e)return void(d.value=!1);const l=y(e,{rootMargin:"400px"});b.value=l,d.value=l.isVisible.value,l.whenVisible.then(()=>{d.value=!0})},{immediate:!0}),X(()=>n.node.content,e=>{M&&!d.value||(c.value=e)})):d.value=!0,Y(()=>{var e,n;null==(n=null==(e=b.value)?void 0:e.destroy)||n.call(e),b.value=null}),(n,t)=>(I(),J(ce(p.value?h.value:"div"),me({ref_key:"htmlRef",ref:u,class:"html-block-node"},p.value?i.value:void 0),{default:ne(()=>[d.value?(I(),A(R,{key:0},["structured"===g.value.mode?(I(),J($(l),{key:0,nodes:m.value,"custom-id":e.customId,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,"html-policy":o.value},null,8,["nodes","custom-id","html-policy"])):"dynamic"===g.value.mode?(I(),J($(s),{key:1,nodes:g.value.nodes},null,8,["nodes"])):"text"===g.value.mode?(I(),A("pre",Rt,W(g.value.content),1)):(I(),A("div",me({key:3},r.value,{innerHTML:g.value.content}),null,16,Pt))],64)):(I(),A("div",Wt,[se(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=z("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=z("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=z("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-4d8bb24b"]]);jt.install=e=>{e.component(jt.__name,jt)};const Ft={dir:"auto",class:"paragraph-node"},Kt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=De(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=D(()=>n.node.children.filter(e=>!o(e))),i=D(()=>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=D(()=>new Set(b(n.customHtmlTags))),d=D(()=>{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 m=a({inline_code:un,image:zn,link:gt,hardbreak:Ct,emphasis:bt,strong:dt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,html_inline:rn,html_block:jt,emoji:Re,checkbox:Ee,math_inline:et,checkbox_input:Ee,reference:tt,footnote_anchor:St,footnote_reference:Ge,text:Qn},t);function h(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()||M(e.content);if(r&&!u.value.has(r)&&S(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:Qn}}}return{child:e,component:m[e.type]}}return(n,t)=>(I(),A("p",Ft,[(I(!0),A(R,null,P(d.value,(n,t)=>(I(),A(R,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(I(),A(R,{key:0},[le(W(l(n)),1)],64)):(I(),J(ce(h(n).component),me({key:1,ref_for:!0},c(h(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Kt.install=e=>{e.component(Kt.__name,Kt)};const Dt=["aria-busy","aria-label","data-language"],Vt=["textContent"],Ut=/* @__PURE__ */E({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=D(()=>{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=D(()=>`language-${t.value}`),l=D(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(I(),A("pre",{class:V([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[z("code",{translate:"no",textContent:W(e.node.code)},null,8,Vt)],10,Dt))}});Ut.install=e=>{e.component(Ut.__name,Ut)};const qt={class:"table-node-wrapper"},Xt=["aria-busy"],Gt={key:0},Zt=["aria-label","onPointerdown"],Yt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Jt=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node.loading)&&e}),o=D(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=q(null),r=q([]);let i=null;const a=D(()=>r.value.map(e=>e>0?{width:`${e}px`}:void 0)),s=D(()=>r.value.length>0);function u(e){if(!i)return;e.preventDefault();const n=i.startWidth+i.nextStartWidth,t=Math.min(48,Math.floor(n/2)),o=Math.max(t,Math.min(n-t,Math.round(i.startWidth+e.clientX-i.startX))),l=[...i.widths];l[i.index]=o,l[i.index+1]=n-o,r.value=l}function d(){i&&(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),i=null)}return X(()=>n.node.header.cells.length,()=>{d(),r.value=[]}),Y(d),(c,m)=>(I(),A("div",qt,[z("table",{ref_key:"tableRef",ref:l,class:V(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[s.value?(I(),A("colgroup",Gt,[(I(!0),A(R,null,P(e.node.header.cells,(e,n)=>(I(),A("col",{key:`col-${n}`,style:oe(a.value[n])},null,4))),128))])):G("",!0),z("thead",null,[z("tr",null,[(I(!0),A(R,null,P(e.node.header.cells,(t,o)=>(I(),A("th",{key:`header-${o}`,dir:"auto",class:V(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[H($(ai),{nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:m[0]||(m[0]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"]),o<e.node.header.cells.length-1?(I(),A("button",{key:0,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",u),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d))}(o,e)},null,40,Zt)):G("",!0)],2))),128))])]),z("tbody",null,[(I(!0),A(R,null,P(o.value,(e,t)=>(I(),A("tr",{key:`row-${t}`},[(I(!0),A(R,null,P(e.cells,(e,o)=>(I(),A("td",{key:`cell-${t}-${o}`,class:V(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[H($(ai),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:m[1]||(m[1]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,Xt),H(ee,{name:"table-node-fade"},{default:ne(()=>[t.value?(I(),A("div",Yt,[se(c.$slots,"loading",{isLoading:t.value},()=>[m[2]||(m[2]=z("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),m[3]||(m[3]=z("span",{class:"sr-only"},"Loading",-1))],!0)])):G("",!0)]),_:3})]))}}),[["__scopeId","data-v-7a6d3bf6"]]);Jt.install=e=>{e.component(Jt.__name,Jt)};const Qt={class:"hr-node"},eo=/* @__PURE__ */Be({},[["render",function(e,n){return I(),A("hr",Qt)}],["__scopeId","data-v-39b2349c"]]);eo.install=e=>{e.component(eo.__name,eo)};const no={class:"unknown-node"},to=/* @__PURE__ */E({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(I(),A("div",no,W(e.node.raw),1))}),oo=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=D(()=>`vmr-container vmr-container-${n.node.name}`),o=De(n.customId),l=a({text:Qn,paragraph:Kt,heading:Et,inline_code:un,link:gt,image:zn,strong:dt,emphasis:bt,strikethrough:mt,insert:wt,subscript:st,superscript:rt,checkbox:Ee,checkbox_input:Ee,hardbreak:Ct,math_inline:et,reference:tt,list:At,math_block:nt,table:Jt},o);return(o,r)=>(I(),A("div",me({class:t.value},e.node.attrs),[(I(!0),A(R,null,P(e.node.children,(t,o)=>{return I(),J(ce((r=t.type,l[r]||to)),{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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["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"],ro=[[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 io(e){if(e<=255)return lo[e];let n=0,t=ro.length-1;for(;n<=t;){const o=n+t>>1,l=ro[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const ao=/[ \t\n\r\f]+/g,so=/[\t\n\r\f]| {2,}|^ | $/;let uo=null;const co=new RegExp("\\p{Script=Arabic}","u"),mo=new RegExp("\\p{M}","u"),ho=new RegExp("\\p{Nd}","u");function fo(e){return co.test(e)}function po(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 vo(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(po(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(po(t))return!0}}return!1}const go=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]);function yo(e){return vo(e)}function wo(e){return!function(e){const n=Eo(e);return null!==n&&(xo.has(n)||bo.has(n))}(e)&&!function(e){const n=Eo(e);return null!==n&&go.has(n)}(e)}const xo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),No=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),ko=/* @__PURE__ */new Set(["'","’"]),bo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Mo=/* @__PURE__ */new Set([":",".","،","؛"]),So=/* @__PURE__ */new Set(["၏"]),_o=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Bo(e){if(Co(e))return!0;let n=!1;for(const t of e)if(bo.has(t))n=!0;else if(!n||!mo.test(t))return!1;return n}function Oo(e){for(const n of e)if(!xo.has(n)&&!bo.has(n))return!1;return e.length>0}function Lo(e){if(Co(e))return!0;for(const n of e)if(!No.has(n)&&!ko.has(n)&&!mo.test(n))return!1;return e.length>0}function Co(e){let n=!1;for(const t of e)if("\\"!==t&&!mo.test(t)){if(!(No.has(t)||bo.has(t)||ko.has(t)))return!1;n=!0}return n}function To(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 Eo(e){if(0===e.length)return null;const n=To(e,e.length);return e.slice(n)}function Io(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(mo.test(e))t--;else{if(!No.has(e)&&!ko.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Ao(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ho(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 $o(e,n){return e&&null!==n&&Mo.has(n)}function zo(e){const n=Eo(e);return null!==n&&So.has(n)}function Ro(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 Po(e){let n=e.length;for(;n>0;){const t=To(e,n),o=e.slice(t,n);if(_o.has(o))return!0;if(!bo.has(o))return!1;n=t}return!1}function Wo(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 jo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Fo(e){return 1===e.length?e[0]:e.join("")}function Ko(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Fo(t)}function Do(e,n,t,o){if(!jo.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=Wo(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:Fo(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:Fo(i),isWordLike:s,kind:r,start:a}),l}function Vo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Uo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function qo(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Uo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Xo(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Go=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Zo=/^[A-Za-z0-9_]+[,:;]*$/,Yo=/[,:;]+$/;function Jo(e){for(const n of e)if(ho.test(n))return!0;return!1}function Qo(e){if(0===e.length)return!1;for(const n of e)if(!ho.test(n)&&!Go.has(n))return!1;return!0}function el(e,n,t){var o,l,r;const i=(null===uo&&(uo=new Intl.Segmenter(void 0,{granularity:"word"})),uo);let a=0;const s=[],u=[],d=[],c=[],m=[],h=[],f=[],p=[],v=[],g=[],y=[],w=[];for(const M of i.segment(e))for(const e of Do(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==h[M]&&(u[M]=[Ho(s,h,f,M)],h[M]=null),u[M].push(e.text),d[M]=d[M]||e.isWordLike,p[M]=p[M]||i,v[M]=v[M]||x,g[M]=k,y[M]=b,w[M]=$o(v[M],N)};const o="text"===e.kind,r=Ao(e.text,e.isWordLike,e.kind),i=vo(e.text),x=fo(e.text),N=Eo(e.text),k=Po(e.text),b=zo(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===c[M]&&i&&p[M]&&g[M]||o&&a>0&&"text"===c[M]&&Oo(e.text)&&p[M]||o&&a>0&&"text"===c[M]&&y[M]?t():o&&a>0&&"text"===c[M]&&e.isWordLike&&x&&w[M]?(t(),d[M]=!0):null!==r&&a>0&&"text"===c[M]&&h[M]===r?f[M]=(null!=(l=f[M])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===c[M]&&(Bo(e.text)||"-"===e.text&&d[M])?t():(s[a]=e.text,u[a]=[e.text],d[a]=e.isWordLike,c[a]=e.kind,m[a]=e.start,h[a]=r,f[a]=null===r?0:1,p[a]=i,v[a]=x,g[a]=k,y[a]=b,w[a]=$o(x,N),a++)}for(let M=0;M<a;M++)null===h[M]?s[M]=Fo(u[M]):s[M]=Ho(s,h,f,M);for(let M=1;M<a;M++)"text"===c[M]&&!d[M]&&Co(s[M])&&"text"===c[M-1]&&(s[M-1]+=s[M],d[M-1]=d[M-1]||d[M],s[M]="");const x=Array.from({length:a},()=>null);let N=-1;for(let M=a-1;M>=0;M--){const e=s[M];if(0!==e.length){if("text"===c[M]&&!d[M]&&Lo(e)&&N>=0&&"text"===c[N]){const n=null!=(r=x[N])?r:[];n.push(e),x[N]=n,m[N]=m[M],s[M]="";continue}N=M}}for(let M=0;M<a;M++){const e=x[M];null!=e&&(s[M]=Ko(e,s[M]))}let k=0;for(let M=0;M<a;M++){const e=s[M];0!==e.length&&(k!==M&&(s[k]=e,d[k]=d[M],c[k]=c[M],m[k]=m[M]),k++)}s.length=k,d.length=k,c.length=k,m.length=k;const b=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(!vo(n[r])||!vo(n[r+1]))continue;const e=Io(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=Yo.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=Yo.test(n),u++}n.push(Fo(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&&Jo(n)&&Qo(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&&Qo(i)&&Jo(i)){const a=[i];let s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Qo(e.texts[s]);)a.push(e.texts[s]),s++;n.push(Fo(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]),!Xo(i))continue;const a=r+1;if(a>=e.len||Vo(e.kinds[a]))continue;const s=[],u=e.starts[a];let d=a;for(;d<e.len&&!Vo(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(n.push(Fo(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]||!qo(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Vo(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]=Fo(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 m=Fo(d);if(!(r<e.len&&"text"===e.kinds[r])){n.push(m),t.push(!1),o.push("glue"),l.push(c);continue}i[0]=m,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=Fo(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(Fo(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:m})))))));for(let M=0;M<b.len-1;M++){const e=Ro(b.texts[M]);null!==e&&("space"!==b.kinds[M]&&"preserved-space"!==b.kinds[M]||"text"!==b.kinds[M+1]||!fo(b.texts[M+1])||(b.texts[M]=e.space,b.isWordLike[M]=!1,b.kinds[M]="preserved-space"===b.kinds[M]?"preserved-space":"space",b.texts[M+1]=e.marks+b.texts[M+1],b.starts[M+1]=b.starts[M]+e.space.length))}return b}function nl(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 tl=null;const ol=/* @__PURE__ */new Map;let ll=null;const rl=new RegExp("\\p{Emoji_Presentation}","u"),il=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let al=null;const sl=/* @__PURE__ */new Map;function ul(){if(null!==tl)return tl;if("undefined"!=typeof OffscreenCanvas)return tl=new OffscreenCanvas(1,1).getContext("2d"),tl;if("undefined"!=typeof document)return tl=document.createElement("canvas").getContext("2d"),tl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function dl(e,n){let t=n.get(e);return void 0===t&&(t={width:ul().measureText(e).width,containsCJK:vo(e)},n.set(e,t)),t}function cl(){if(null!==ll)return ll;if("undefined"==typeof navigator)return ll={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ll;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 ll={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},ll}function ml(){return null===al&&(al=new Intl.Segmenter(void 0,{granularity:"grapheme"})),al}function hl(e){return rl.test(e)||e.includes("️")}function fl(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=ml();for(const o of t.segment(e))hl(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function pl(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 vl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function gl(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+cl().lineFitEpsilon;let a=0,s=0,u=!1,d=0,c=0,m=-1,h=0;function f(e=d,n=c,t=s){a++,s=0,u=!1,m=-1,h=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=pl(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(m>=0){if(d>m||d===m&&c>0){f();continue}f(m,0,h);continue}if(e>n&&null!==r[w]){f(),y(w,0),w++;continue}f()}else g(w,e),a&&(m=w+1,h=s-e),w++;else e>n&&null!==r[w]?y(w,0):p(w,e),a&&(m=w+1,h=s-e),w++}return u&&f(),a}let yl=null;function wl(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=Po(e),a=No.has(e)}function d(e,n){o.push(e),r=r||n;const t=Po(e);i=1===e.length&&bo.has(e)&&i||t,a=!1}for(const c of(null===yl&&(yl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),yl).segment(e)){const e=c.segment,t=vo(e);0!==o.length?a||xo.has(e)||bo.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 xl(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=vo(e[0].text),r=wo(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=vo(n.text),u=wo(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 Nl(e,n,t,o){const l=cl(),{cache:r,emojiCorrection:i}=function(e,n){ul().font=e;const t=function(e){let n=ol.get(e);return n||(n=/* @__PURE__ */new Map,ol.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=sl.get(e);if(void 0!==t)return t;const o=ul();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 sl.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,il.test(a)));var a;const s=fl("-",dl("-",r),i),u=8*fl(" ",dl(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],m=[],h=[];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),m.push(o),h.push(l),null==p||p.push(r),v.push(i),null!==g&&g.push(e)}function x(e,n,t,o,a){const s=dl(e,r),u=fl(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";Qo(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=ml(),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=dl(n,t);e.push(fl(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=fl(n,dl(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=dl(i,t);e.push(fl(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=fl(s,dl(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 b=0;b<e.len;b++){y[b]=d.length;const n=e.texts[b],t=e.isWordLike[b],i=e.kinds[b],a=e.starts[b];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=dl(n,r);if("text"===i&&u.containsCJK){const e=wl(n,l),r="keep-all"===o?xl(e):e;for(let n=0;n<r.length;n++){const e=r[n];x(e.text,"text",a+e.start,t,"keep-all"===o||!vo(e.text))}continue}x(n,i,a,t,!0)}const N=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=io(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:m,kinds:h,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:N,segments:g}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:N}}function kl(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return Nl(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(!so.test(e))return e;let n=e.replace(ao," ");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(Fo(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let c=0;c<e.len;c++){const m=e.texts[c],h=e.kinds[c],f=e.isWordLike[c],p=e.starts[c];if("text"===h){const e=yo(m),n=wo(m);if(null!==r&&s&&u){r.push(m),i=i||f,s=s||e,u=n;continue}d(),r=[m],i=f,a=p,s=e,u=n;continue}d(),n.push(m),t.push(f),o.push(h),l.push(p)}return d(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(el(r,n,l)):el(r,n,l);return a({normalized:r,chunks:nl(i,l)},i)}(e,cl(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const bl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Ml=(()=>{const e=globalThis;if(e[bl])return e[bl];const n={configs:{},controllers:{},revision:j(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[bl]=n,n})();let Sl=null;const _l=Ml.revision;function Bl(e){var n;return e&&null!=(n=Ml.configs[e])?n:null}function Ol(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Ll(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Cl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Ll(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 Tl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Sl)return Sl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Sl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Sl}catch(n){return Sl=!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=Ml.blockEstimateCache.get(i);if(a)return Ml.blockEstimateCache.delete(i),Ml.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=Ml.preparedCache.get(o);if(l)return Ml.preparedCache.delete(o),Ml.preparedCache.set(o,l),l.prepared;const r=kl(e,n,{whiteSpace:t});for(Ml.preparedCache.set(o,{prepared:r});Ml.preparedCache.size>240;){const e=Ml.preparedCache.keys().next().value;if(!e)break;Ml.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?gl(e,n):function(e,n){if(e.simpleLineWalkFastPath)return gl(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=cl(),c=d.lineFitEpsilon,m=n+c;let h=0,f=0,p=!1,v=0,g=0,y=-1,w=0,x=0,N=null;function k(){y=-1,w=0,x=0,N=null}function b(e=v,n=g,t=f){h++,f=0,p=!1,k()}function M(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):M(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,x=f-r+a,N=e}function O(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];p?f+n>m?(b(),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"!==N)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):(b(e,o,l+a),O(e,o),!0))}function C(e){h++,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,h="tab"===e?vl(f,s):t[c];if("soft-hyphen"!==e)if(p){if(f+h>m){const t=f+("tab"===e?0:o[c]),r=f+("tab"===e?h:l[c]);if("soft-hyphen"===N&&d.preferEarlySoftHyphenBreak&&w<=m){b(y,0,x);continue}if("soft-hyphen"===N&&L(c)){c++;continue}if(u&&t<=m){_(c,h),b(c+1,0,r),c++;continue}if(y>=0&&w<=m){if(v>y||v===y&&g>0){b();continue}const e=y;b(e,0,x),c=e;continue}if(h>n&&null!==i[c]){b(),O(c,0),c++;continue}b();continue}_(c,h),B(e,u,c,h),c++}else h>n&&null!==i[c]?O(c,0):M(c,h),B(e,u,c,h),c++;else p&&(v=c+1,g=0,y=c+1,w=f+a,x=f+a,N=e),c++}if(p){const n=y===e.consumedEndSegmentIndex?x:f;b(e.consumedEndSegmentIndex,0,n)}}return h}(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),m=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(Ml.blockEstimateCache.set(i,{height:m,contentHeight:Math.round(c)});Ml.blockEstimateCache.size>4e3;){const e=Ml.blockEstimateCache.keys().next().value;if(!e)break;Ml.blockEstimateCache.delete(e)}return{kind:"simple-text",height:m,contentHeight:Math.round(c)}}catch(r){return null}}function El(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Cl(e.children);return o&&t.paragraph?Tl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Cl(e.children),r=t.headings[o];return l&&r?Tl(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=Cl(null==(l=r[0])?void 0:l.children);return i?Tl(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=El(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 Il(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Al(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Hl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Ol(o.lineHeight,1.5*Ol(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Al(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}function $l(e){const n="number"==typeof e?e:Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:null}function zl(e){var n;for(const t of e.split(/\r?\n/)){const e=t.trim();if(!e||e.startsWith("%%"))continue;const o=e.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==o?void 0:o[1])?void 0:n.toLowerCase())||""}return""}function Rl(e){const n=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),t=Math.max(1,n.length),o=zl(e);return"gantt"===o?220+28*t:"sequencediagram"===o?180+26*t:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*t:"flowchart"===o||"graph"===o?170+28*t:200+22*t}function Pl(e){const n=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return n>=3?500:n>0?280+60*n:360}function Wl(e,n=360,t=500){return null==t?Math.max(n,e):Math.min(Math.max(n,e),t)}function jl(e,n=360,t=500){return Wl(e,n,t)}function Fl(e,n=360,t=500){return Wl(e,n,t)}let Kl=!1,Dl=null,Vl=!1;function Ul(){return Vl}let ql=null,Xl=!1,Gl=null;function Zl(){return d(this,null,function*(){return!!(yield Yl())})}function Yl(){return d(this,null,function*(){if(Gl)return Gl;Gl=d(null,null,function*(){if(!ql){if(Xl)return null;try{ql=yield import("stream-monaco")}catch(e){return Xl=!0,null}}try{return yield function(e){return d(this,null,function*(){if(Kl)return;if(Dl)return Dl;const n=d(null,null,function*(){const n=null==globalThis?void 0:globalThis.MonacoEnvironment;n&&("function"==typeof n.getWorker||"function"==typeof n.getWorkerUrl)||"function"!=typeof(null==e?void 0:e.preloadMonacoWorkers)||(yield e.preloadMonacoWorkers()),Kl=!0});return Dl=n.finally(()=>{Dl=null}),Dl})}(ql),Vl=!0,ql}catch(e){return null}});try{return yield Gl}finally{Gl=null}})}const Jl=/* @__PURE__ */new Map;let Ql="material";const er=/* @__PURE__ */new Map,nr=/* @__PURE__ */new Map;let tr=null;function or(e){Jl.set(e.id,e)}function lr(e){if(!Jl.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[...Jl.keys()].join(", ")}`);Ql=e,null==tr||tr();const n=Jl.get(e);n.loadExtended&&!er.has(e)&&ir(n)}function rr(){return[...Jl.keys()]}function ir(e){return d(this,null,function*(){var n,t,o;if(er.has(e.id))return null!=(n=er.get(e.id))?n:null;let l=nr.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(er.set(e.id,n),null==tr||tr(),n)).catch(()=>(er.set(e.id,null),null)),nr.set(e.id,l)),l})}function ar({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function sr(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function ur(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function dr(e,n){var t,o;let l=0;for(const r of e){const e=ur(sr(r));e>l&&(l=e)}return ar({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 cr='<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>',mr='<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>',hr={id:"material",core:{"":mr,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:mr,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:cr,csharp:cr,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)};let fr=null;const pr=j(0);tr=()=>{pr.value++},or(hr);const vr={"":"",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 gr(e){fr=null!=e?e:null}function yr(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=vr[t])?n:t}function wr(e){const n=yr(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function xr(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=Jl.get(Ql);(null==e?void 0:e.loadExtended)&&(yield ir(e))})}()})}function Nr(e){if(fr){const n=fr(e);if(null!=n&&""!==n)return n}return function(e){const n=Jl.get(Ql);if(!n)return;const t=n.core[e];if(t)return t;const o=er.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!er.has(n.id)&&ir(n)}(yr(e))||(null!=(t=null==(n=Jl.get(Ql))?void 0:n.fallback)?t:"");var n,t}const kr={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"},br=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 Mr(){br.enable()}function Sr(){br.disable()}function _r(){return br.printReport()}function Br(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Or(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=_r,window.__katexPerfMonitor=br);const Lr={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)]"},Cr={class:"flex items-center gap-0.5"},Tr=["aria-label"],Er={class:"code-diff-stat removed"},Ir={class:"code-diff-stat added"},Ar=["aria-label"],Hr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},$r={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zr=["aria-pressed"],Rr={key:3,class:"relative"},Pr=["aria-expanded"],Wr=["disabled"],jr=["disabled"],Fr=["disabled"],Kr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Dr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Vr={class:"code-block-shell-content"},Ur={class:"code-loading-placeholder"},qr={class:"sr-only","aria-live":"polite",role:"status"},Xr=/* @__PURE__ */E({__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=e,o=n,l=q(!1),r=q(null),i=q(null);function a(){l.value=!l.value,l.value&&document.addEventListener("click",s,{once:!0,capture:!0})}function s(e){var n,t;const o=e.target;(null==(n=r.value)?void 0:n.contains(o))||(null==(t=i.value)?void 0:t.contains(o))?document.addEventListener("click",s,{once:!0,capture:!0}):l.value=!1}const u=D(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:d}=Tn(),c=D(()=>!1!==t.showTooltips);function m(e,n){c.value&&Sn(e.currentTarget,n,"top",!1,void 0,t.isDark)}function h(){c.value&&_n()}function f(e){m(e,t.copyText?d("common.copied")||"Copied":d("common.copy")||"Copy")}const p=D(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(n=t.codeFontMin)?n:0)}),v=D(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),g=D(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(n=t.codeFontMax)?n:100)});return(n,s)=>(I(),A(R,null,[t.showHeader?(I(),A("div",Lr,[se(n.$slots,"header-left"),se(n.$slots,"header-right",{},()=>[z("div",Cr,[e.diffStats?(I(),A("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[z("span",Er,"-"+W(e.diffStats.removed),1),z("span",Ir,"+"+W(e.diffStats.added),1)],8,Tr)):G("",!0),t.showCopyButton?(I(),A("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?$(d)("common.copied")||"Copied":$(d)("common.copy")||"Copy",onClick:s[0]||(s[0]=e=>o("copy")),onMouseenter:s[1]||(s[1]=e=>f(e)),onFocus:s[2]||(s[2]=e=>f(e)),onMouseleave:h,onBlur:h},[e.copyText?(I(),A("svg",$r,[...s[14]||(s[14]=[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(I(),A("svg",Hr,[...s[13]||(s[13]=[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),z("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,Ar)):G("",!0),t.showCollapseButton?(I(),A("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:s[3]||(s[3]=e=>o("toggleCollapse")),onMouseenter:s[4]||(s[4]=n=>m(n,e.isCollapsed?$(d)("common.expand")||"Expand":$(d)("common.collapse")||"Collapse")),onFocus:s[5]||(s[5]=n=>m(n,e.isCollapsed?$(d)("common.expand")||"Expand":$(d)("common.collapse")||"Collapse")),onMouseleave:h,onBlur:h},[(I(),A("svg",{style:oe({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"},[...s[15]||(s[15]=[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,zr)):G("",!0),u.value?(I(),A("div",Rr,[z("button",{ref_key:"moreBtnRef",ref:i,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":l.value,"aria-haspopup":"true",onClick:fe(a,["stop"]),onMouseenter:s[6]||(s[6]=e=>m(e,$(d)("common.more")||"More")),onFocus:s[7]||(s[7]=e=>m(e,$(d)("common.more")||"More")),onMouseleave:h,onBlur:h},[...s[16]||(s[16]=[pe('<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),H(ee,{name:"code-menu"},{default:ne(()=>[l.value?(I(),A("div",{key:0,ref_key:"moreMenuRef",ref:r,class:"code-more-menu 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"},[t.showFontSizeButtons&&t.enableFontSizeControl?(I(),A(R,{key:0},[z("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:p.value,onClick:s[8]||(s[8]=e=>o("decreaseFont"))},[s[17]||(s[17]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),z("span",null,W($(d)("common.fontSmaller")||"Font size −"),1)],8,Wr),z("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:v.value,onClick:s[9]||(s[9]=e=>o("resetFont"))},[s[18]||(s[18]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),z("path",{d:"M3 3v5h5"})])],-1)),z("span",null,W($(d)("common.fontReset")||"Font size reset"),1)],8,jr),z("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:s[10]||(s[10]=e=>o("increaseFont"))},[s[19]||(s[19]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),z("span",null,W($(d)("common.fontLarger")||"Font size +"),1)],8,Fr)],64)):G("",!0),t.showExpandButton?(I(),A("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:s[11]||(s[11]=e=>{o("toggleExpand",e),l.value=!1})},[e.isExpanded?(I(),A("svg",Kr,[...s[20]||(s[20]=[z("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)])])):(I(),A("svg",Dr,[...s[21]||(s[21]=[z("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)])])),z("span",null,W(e.isExpanded?$(d)("common.collapse")||"Collapse":$(d)("common.expand")||"Expand"),1)])):G("",!0),e.isPreviewable&&t.showPreviewButton?(I(),A("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:s[12]||(s[12]=e=>{o("preview"),l.value=!1})},[s[22]||(s[22]=z("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[z("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[z("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"}),z("circle",{cx:"12",cy:"12",r:"3"})])],-1)),z("span",null,W($(d)("common.preview")||"Preview"),1)])):G("",!0)],512)):G("",!0)]),_:1})])):G("",!0)])])])):G("",!0),te(z("div",Vr,[se(n.$slots,"default")],512),[[re,!(e.isCollapsed||!e.stream&&e.loading)]]),te(z("div",Ur,[se(n.$slots,"loading",{},()=>[s[23]||(s[23]=z("div",{class:"loading-skeleton"},[z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line short"})],-1))])],512),[[re,!e.stream&&e.loading]]),z("span",qr,W(e.copyText?$(d)("common.copied")||"Copied":""),1)],64))}}),Gr={class:"code-header-main"},Zr=["innerHTML"],Yr={class:"code-header-copy"},Jr={class:"code-header-title"},Qr=["innerHTML"],ei=/* @__PURE__ */Be(/* @__PURE__ */E({__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},autoScrollOnUpdate:{type:Boolean,default:!0},autoScrollInitial:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=Tn(),r=q(yr(t.node.language)),i=q(!1),s=q(!1),u=q(!1),c=q(null),m=q(null),h=q(null),f=q(""),p=q(!1);let v;const g=zt(),y=q(null),w=q("undefined"==typeof window);"undefined"!=typeof window&&X(()=>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=q(!1!==t.autoScrollInitial),N=q(0),k=D(()=>!1!==t.autoScrollOnUpdate),b=q(14),M=q(b.value),S=D(()=>{const e=b.value,n=M.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),_=D(()=>{const e=r.value.trim().toLowerCase();return kr[e]||e.charAt(0).toUpperCase()+e.slice(1)}),B=D(()=>(pr.value,Nr(r.value.trim().toLowerCase().split(":")[0]))),O=D(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),L=D(()=>{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}),C=D(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),T=D(()=>null!=C.value&&!p.value),E=D(()=>a({fontSize:`${M.value}px`},T.value?{minHeight:`${C.value}px`}:{})),$=D(()=>!1!==t.showTooltips);function R(){return t.isDark?t.darkTheme:t.lightTheme}function P(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 j(){f.value="",p.value=!0}function F(){var e;const n=h.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function K(){return d(this,null,function*(){if(yield Z(),F())return void j();const e=h.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{F()&&(j(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let U,J,Q,ee,te=null;const le=/* @__PURE__ */new Set,re=/* @__PURE__ */new Set,ie=void 0!==import.meta&&Boolean(!1);let ae=null;function ue(e,n){return d(this,null,function*(){if(!U)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?!ee||ee.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 U.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 U.updateCode(e,"plaintext")):ie&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function de(e){if(!Q)return;const n=Array.isArray(e)?e.join("\0"):"";te!==n&&(Q({themes:e}),te=n)}function ce(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!J)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");J=e.createShikiStreamRenderer,Q=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;ee=n?new Set(n.map(e=>e.toLowerCase())):void 0,de(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),m.value&&h.value?(de(t.themes),!U&&J&&(U=J(h.value,{theme:R()}),p.value=!0),U?!1===t.stream&&t.loading?P(t.node.code):(P(t.node.code),yield ue(t.node.code,r.value),yield K()):P(t.node.code)):P(t.node.code)):P(t.node.code)})}function me(){const e=m.value;if(!e||s.value||!k.value)return;const n=e.scrollTop;n<N.value?x.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(x.value=!0),N.value=n}function he(){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 fe(e){if(s.value=!s.value,e&&$.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&Sn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=m.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",k.value&&(x.value=!0,Z(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)}))))}function pe(){u.value=!u.value}function ye(){const e=Math.min(36,M.value+1);M.value=e}function we(){const e=Math.max(10,M.value-1);M.value=e}function xe(){M.value=b.value}function Ne(){if(!O.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 ve(()=>{w.value?ce():P(t.node.code)}),Y(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),X(()=>t.themes,()=>d(null,null,function*(){de(t.themes)})),X(()=>t.loading,e=>{e||(w.value?ce():P(t.node.code))}),X(()=>w.value,e=>{e&&ce()}),X($,e=>{e||_n()}),X(()=>t.autoScrollInitial,e=>{x.value=!1!==e}),X(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=yr(n);o!==r.value&&(r.value=o),w.value&&m.value&&h.value?(U||(P(e),yield ce()),U&&e&&(!1===t.stream&&t.loading||(P(e),yield ue(e,n),yield K()))):P(e)})),X(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&m.value&&h.value&&(U||(yield ce()),null==U||U.setTheme(R()))})),X(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!k.value||!x.value)return;yield Z();const e=m.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(I(),A("div",{ref_key:"container",ref:c,style:oe(L.value),class:V(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[H(Xr,{"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":O.value,"code-font-size":M.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":b.value,"font-baseline-ready":S.value,onToggleCollapse:pe,onDecreaseFont:we,onResetFont:xe,onIncreaseFont:ye,onCopy:he,onToggleExpand:fe,onPreview:Ne},ge({"header-left":ne(()=>[se(n.$slots,"header-left",{},()=>[z("div",Gr,[z("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:B.value},null,8,Zr),z("div",Yr,[z("div",Jr,W(_.value),1)])])],!0)]),loading:ne(()=>[se(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=z("div",{class:"loading-skeleton"},[z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line"}),z("div",{class:"skeleton-line short"})],-1))],!0)]),default:ne(()=>[z("div",{ref_key:"codeBlockContent",ref:m,class:"code-block-content",style:oe(E.value),onScroll:me},[z("div",{ref_key:"rendererTarget",ref:h,class:"code-block-render"},null,512),p.value?G("",!0):(I(),A("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,Qr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:ne(()=>[se(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-68b63065"]]);ei.install=e=>{e.component(ei.__name,ei)};const ni=E({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return Fl(null!=(t=$l(e.estimatedPreviewHeightPx))?t:Pl(String(null!=(n=e.node.code)?n:"")))});return()=>F("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?F("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[F("div",{class:"flex items-center gap-x-2 overflow-hidden"},[F("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),F("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),F("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>F("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,F("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[F("div",{class:"absolute inset-0"},[F("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),ti=E({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return jl(null!=(t=$l(e.estimatedPreviewHeightPx))?t:Rl(String(null!=(n=e.node.code)?n:"")))});return()=>F("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?F("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[F("div",{class:"flex items-center gap-x-2 overflow-hidden"},[F("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),F("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>F("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[F("span",{class:"action-icon block"})])))]):null,F("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[F("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}),oi=["data-custom-id"],li={class:"m-0 p-0"},ri=["data-probe"],ii=["data-node-index","data-node-type"],ai=/* @__PURE__ */Be(/* @__PURE__ */E({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},htmlPolicy:{},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},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=q(),u=q(null),c=q(null),m=q(null),h=ye({1:null,2:null,3:null,4:null,5:null,6:null}),f=q(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=D(()=>!0===l.renderAsFragment),y=D(()=>l.debugPerformance&&v&&"undefined"!=typeof console),w=U(),x=/* @__PURE__ */new Map,N=q(0),k=q(0),b=q({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),T=D(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=w.showTooltips)?e:w["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0}),E=K("markstreamHtmlPolicy",void 0),W=D(()=>{var e,n;return null!=(n=null!=(e=l.htmlPolicy)?e:null==E?void 0:E.value)?n:"safe"});function j(e,n){y.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function F(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function Q(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 te(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(F(window.getComputedStyle(l))&&Q(l))return l;l=l.parentElement}return null}he("markstreamShowTooltips",T),he("markstreamHtmlPolicy",W),he("markstreamTypewriter",D(()=>!1!==l.typewriter)),he("markstreamTextStreamState",x),he("markstreamStreamVersion",N),X([()=>l.content,()=>l.nodes],()=>{N.value+=1},{immediate:!0});const le=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,re=_(le),ie=/* @__PURE__ */new Map,ae=D(()=>(Fe.value,De(l.customId))),se=D(()=>{var e;return B(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ue=D(()=>{const{key:e,tags:n}=O(se.value);if(!e)return re;const t=ie.get(e);if(t)return t;const o=_(le,{customHtmlTags:n});return ie.set(e,o),o}),fe=D(()=>{const e=ue.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),pe=D(()=>{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}),ve=D(()=>{var e;const n=null!=(e=pe.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),ge=D(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return we(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=L(l.content,fe.value,pe.value);return y.value&&j("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),we(n)}return[]}),xe=q(null),Ne=q(null),ke=q(null),be=q(null),Me=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),Se=!Me&&l.customId?Bl(l.customId):null,_e=D(()=>Se?(_l.value,Bl(l.customId)):null),Be=D(()=>{var e;return Boolean(v&&!g.value&&l.customId&&!Me&&(null==(e=_e.value)?void 0:e.enabled))}),Le=D(()=>{var e;return Be.value&&!1!==(null==(e=_e.value)?void 0:e.textEstimation)}),Ce=D(()=>{var e;return Be.value&&!1!==(null==(e=_e.value)?void 0:e.codeBlockEstimation)}),Te=D(()=>{var e;return Math.max(320,k.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ie=D(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Ae=D(()=>{var e;return!g.value&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&ge.value.length>Ie.value}),He=D(()=>Ae.value||Be.value),ze=D(()=>!1!==l.viewportPriority&&!f.value),Pe=$t(e=>{var n;return te(null!=(n=null!=e?e:i.value)?n:null)},ze),We=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,je=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,Ke="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,Ve="test"===(null==Ke?void 0:Ke.NODE_ENV),Ue=v&&"function"==typeof window.requestIdleCallback,qe=D(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Xe=D(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:qe.value);return Number.isFinite(n)?Math.max(0,n):qe.value}),Ze=D(()=>!g.value&&!1!==l.batchRendering&&qe.value>0&&v&&!Ve),Ye=q(0),Je=q({key:l.indexKey,total:0}),Qe=q(Math.max(1,qe.value||1)),en=q(/* @__PURE__ */new Set),nn=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new Map,an=/* @__PURE__ */new Map,sn=/* @__PURE__ */new WeakMap,dn=q(0),cn=D(()=>(dn.value,Array.from(ln.entries()).sort((e,n)=>e[0]-n[0]))),mn=q(0),hn=q([]),fn=q([]),pn=q(null),vn=q(null);let gn=null,yn=[],wn=null,xn=null;const Nn=D(()=>{var e;return!g.value&&!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Ae.value&&!(ge.value.length>900)&&ze.value}),kn=D(()=>{var e;return Ze.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),bn=q({batchSize:qe.value,initial:Xe.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:kn.value}),Mn=D(()=>!!Pe&&(Nn.value||Ae.value)),Sn=D(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),_n=q(0),Bn=ye({start:0,end:0}),On=/* @__PURE__ */new Map,Ln=/* @__PURE__ */new Map,Cn=D(()=>{if(!Ae.value)return ge.value.length;const e=Sn.value,n=Math.max(Bn.end+e,Xe.value),t=Math.min(ge.value.length,n);return Math.max(Ye.value,t)});function Tn(e){var n,t;return null!=(t=null==(n=be.value)?void 0:n[e])?t:null}function En(e){var n,t,o,l;const r=te(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 In(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 An(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(!In(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 Hn(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 $n(){wn&&(wn(),wn=null),pn.value=null}function Rn(){if(!v||!Ae.value)return;const e=En();if(!e||pn.value===e)return;$n();const n=()=>Wn();e.addEventListener("scroll",n,{passive:!0}),pn.value=e,wn=()=>{e.removeEventListener("scroll",n)}}function Pn(){var e,n,t;if(!xn)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;xn.viaTimeout?o?o.clearTimeout(xn.id):clearTimeout(xn.id):null==je||je(xn.id),xn=null}function Wn(e={}){var n,t,o;if(!Ae.value)return;if(!v)return void jn(!0);if(e.immediate)return Pn(),void jn(!0);if(xn)return;const l=()=>{xn=null,jn()};if(We)xn={id:We(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);xn={id:r,viaTimeout:!0}}}function jn(e=!1){var n,t,o,l,r,a,s;if(!Ae.value)return;const u=pn.value||En();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),m=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),h=ge.value.length;if(!m&&h>0&&In(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=ge.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=ft(e);if(n<=t)return e;n-=t}return 0}if(mn.value===t.length){const n=Lt(0,t.length);return Pt(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Kn[l])?n:Zn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Fn(l,0,Math.max(0,h-1));return void((e||Math.abs(r-_n.value)>1)&&(_n.value=r))}const f=m?null:u.getBoundingClientRect(),p=m?0:f.top,v=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=cn.value;let y=null,w=null;for(const[i,N]of g){if(!N)continue;const e=N.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=m?{top:0}:u.getBoundingClientRect(),t=An(u,d,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Hn(e,u);return Math.max(0,t-n)})(),h=m?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=Pt(o+.5*Math.max(0,h));return void(_n.value=Fn(f,0,Math.max(0,ge.value.length-1)))}const x=Math.round((y+w)/2);!e&&Math.abs(x-_n.value)<=1||(_n.value=Fn(x,0,Math.max(0,ge.value.length-1)))}function Fn(e,n,t){return Math.min(Math.max(e,n),t)}const Kn=ye({}),Dn=ye({total:0,count:0});function Vn(){for(const e of Object.keys(Kn))delete Kn[Number(e)];Dn.total=0,Dn.count=0,mn.value=0,hn.value=[],fn.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 Xn(e,n,t){if(t<=n)return 0;const o=qn(e,t-1);return n<=0?o:o-qn(e,n-1)}function Gn(e){mn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Kn)){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))}hn.value=n,fn.value=t}const Zn=D(()=>Dn.count>0?Math.max(12,Dn.total/Dn.count):32);function Yn(e){return null==e?void 0:e.firstElementChild}function Jn(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(k.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;k.value=t>0?t:0}let lt=null;function it(){null==lt||lt.disconnect(),lt=null}const at=de(()=>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),Ut}})),ut=D(()=>l.renderCodeBlocksAsPre?Ut:at);function ct(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const ht=D(()=>{var e;const n=ge.value;if(!n.length||!Be.value)return n.map(()=>null);const t=k.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=Kn[n],r="number"==typeof o&&o>0;if(Le.value&&!r){const n=El(e,t,b.value);if(n)return n}if(Ce.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Mo(e,bo(e));return n===ei?"markdown":n===Ut?"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(Il(String(null!=(n=e.originalCode)?n:"")),Il(String(null!=(t=e.updatedCode)?t:"")),Il(String(null!=(o=e.code)?o:""))):Il(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 ft(e){var n,t,o;return null!=(o=null!=(t=Kn[e])?t:null==(n=ht.value[e])?void 0:n.height)?o:Zn.value}function pt(){const e=pn.value||En(),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,An(e,t,!1)-Hn(n,e))}function vt(e){return Lt(0,Fn(e.nodeIndex,0,Math.max(0,ge.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function yt(){if(null!=gn&&(null==je||je(gn),gn=null),v)for(const e of yn)window.clearTimeout(e);yn=[]}function xt(e){!function(e){var n;const t=pn.value||En(),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=An(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=Hn(o,t)+l}(vt(e))}function kt(){vn.value&&v&&null==gn&&(gn=We?We(()=>{gn=null,vn.value&&xt(vn.value)}):null,null==gn&&vn.value&&xt(vn.value))}function Mt(){const e=pt(),n=ge.value.length;if(null==e||n<=0)return null;const t=Fn(Pt(e+1),0,n-1),o=Lt(0,t),l=ft(t);return{nodeIndex:t,offsetWithinNodePx:Fn(e-o,0,Math.max(0,l-1))}}function _t(e){if(vn.value={nodeIndex:Fn(e.nodeIndex,0,Math.max(0,ge.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},yt(),xt(vn.value),v)for(const n of[0,120,280,480])yn.push(window.setTimeout(()=>{vn.value&&xt(vn.value)},n))}function Bt(e){const n=pt();return null==n?null:n-vt(e)}function Lt(e,n){var t,o;if(e>=n)return 0;if(Be.value){let t=0;for(let o=e;o<n;o++)t+=ft(o);return t}if(mn.value!==ge.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Kn[l])?t:Zn.value;return o}const l=hn.value,r=fn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Kn[l])?o:Zn.value;return t}return Xn(l,e,n)+(n-e-Xn(r,e,n))*Zn.value}X(()=>ge.value.length,e=>{e<=0?Vn():(e<mn.value&&function(e){if(e<=0)return void Vn();let n=0,t=0;for(const[o,l]of Object.entries(Kn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Kn[r]:(n+=i,t++)}Dn.total=n,Dn.count=t}(e),e!==mn.value&&Gn(e))},{immediate:!0});const Tt=D(()=>{if(!Ae.value)return ge.value.map((e,n)=>({node:e,index:n}));const e=ge.value.length,n=Fn(Bn.start,0,e),t=Fn(Bn.end,n,e);return ge.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Ht=D(()=>Ae.value?Lt(0,Math.min(Bn.start,ge.value.length)):0),zt=D(()=>{if(!Ae.value)return 0;const e=ge.value.length;return Lt(Math.min(Bn.end,e),e)});function Rt(){var e;const n=ge.value;return{totalNodes:n.length,measuredCount:Dn.count,estimatedCount:ht.value.filter(Boolean).length,averageNodeHeight:Zn.value,topSpacerHeight:Ht.value,bottomSpacerHeight:zt.value,estimatedTotalHeight:Lt(0,n.length),width:k.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(b.value.paragraph),listItemReady:Boolean(b.value.listItem),listWrapperOverhead:b.value.listWrapperOverhead,headingReadyLevels:Object.entries(b.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=ht.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=ht.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=ht.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=ht.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Kn[n])?d:null}})}}function Pt(e){var n;if(e<=0)return 0;const t=ge.value;if(Be.value){let n=e;for(let e=0;e<t.length;e++){const t=ft(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(mn.value===t.length&&hn.value.length&&fn.value.length){const n=Zn.value,o=hn.value,l=fn.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=Kn[l])?n:Zn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Wt(){dn.value+=1}function Ft(e,n){const t=en.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(en.value=n)}if(!o)return;const l=new Set(t);l.delete(e),en.value=l}function Dt(){0!==en.value.size&&(en.value=/* @__PURE__ */new Set)}function Vt(e){if(!nn.size)return;if(!Ae.value)return;let n=!1;for(const[t,o]of nn)t>=e&&(o.destroy(),nn.delete(t),Nn.value&&Ft(t,!1),io(t),ln.delete(t)&&(n=!0));n&&Wt()}function qt(e,n){Nn.value&&Ft(e,n),n&&(Ae.value?Wn():_n.value=Fn(e,0,Math.max(0,ge.value.length-1)))}function Xt(e){const n=tn.get(e);n&&(n(),tn.delete(e));const t=nn.get(e);t&&(t.destroy(),nn.delete(e)),io(e)}function Gt(e,n){let t=!1;if(n){const o=ln.get(e);ln.set(e,n),o!==n&&(t=!0)}else ln.delete(e)&&(t=!0);if(t&&Wt(),n||io(e),!Mn.value||!Pe)return Xt(e),void(n&&qt(e,!0));if(!Ae.value&&Nn.value&&!f.value&&nn.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of nn.values())e.destroy();if(nn.clear(),v)for(const e of on.values())window.clearTimeout(e);on.clear(),Dt()}}(),!Mn.value||!Pe))return Xt(e),void(n&&qt(e,!0));if(e<Xe.value&&!Ae.value)return Xt(e),void qt(e,!0);if(en.value.has(e))return Xt(e),void qt(e,!0);if(!n)return void Xt(e);Xt(e);const o=Pe(n,{rootMargin:"400px"});if(!o)return;nn.set(e,o),qt(e,o.isVisible.value),Nn.value&&function(e){if(!v||!Nn.value)return;io(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(on.delete(e),!Nn.value)return;if(en.value.has(e))return;const o=ln.get(e);if(!o)return;const l=En(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);on.set(e,t)}(e);let l=null;l=X(()=>o.isVisible.value,n=>{if(n){io(e),qt(e,!0),null==l||l(),tn.delete(e),nn.get(e)===o&&nn.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),tn.set(e,l),Ae.value&&Wn()}X(()=>He.value,e=>{if(!e){for(const e of an.values())e.disconnect();an.clear();for(const e of Ln.values())for(const n of e)window.clearTimeout(n);Ln.clear()}},{immediate:!0});let Zt=null,Yt=null,Qt=!1,no=null,lo=null;function ro(){v&&(null!=Zt&&(null==je||je(Zt),Zt=null),null!=Yt&&(window.clearTimeout(Yt),Yt=null),null!=lo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(lo),lo=null),Qt=!1,no=null)}function io(e){if(!v)return;const n=on.get(e);null!=n&&(window.clearTimeout(n),on.delete(e))}function ao(e,n={}){var t,o;if(!kn.value)return;const r=Cn.value;if(Ye.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Zt=null,Yt=null,lo=null,Qt=!1;const t=null!=no?no:i;no=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();Ye.value=Math.min(r,Ye.value+Math.max(1,e)),Vt(Ye.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!kn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,qe.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Qe.value=Math.max(r,Math.floor(.7*Qe.value)):e<.5*t&&Qe.value<o&&(Qe.value=Math.min(o,Math.ceil(1.2*Qe.value)))}(t),t};let s=t;for(;(a(s),!(Ye.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Qe.value));Ye.value<r&&so()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(no=null!=no?Math.max(no,i):i,!Qt){if(Qt=!0,!Ve&&Ue&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(lo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}We&&!Ve?Zt=We(()=>{0!==s?Yt=window.setTimeout(()=>a(),s):a()}):Yt=window.setTimeout(()=>a(),s)}}function so(){kn.value&&ao(Ze.value?Math.max(1,Math.round(Qe.value)):Math.max(1,qe.value))}X([()=>ge.value,()=>ge.value.length,()=>kn.value,()=>qe.value,()=>Xe.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=ge.value.length,t=Je.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Je.value={key:o,total:n};const s=bn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==qe.value||s.initial!==Xe.value||s.delay!==u||s.enabled!==kn.value;bn.value={batchSize:qe.value,initial:Xe.value,delay:u,enabled:kn.value},r&&(Vn(),n>0&&Gn(n)),(a||d||!kn.value)&&ro(),(a||d)&&(Qe.value=Math.max(1,qe.value||1)),a&&Ae.value&&Wn({immediate:!0});const c=Cn.value;if(!n)return Ye.value=0,void Vt(0);if(!kn.value)return Ye.value=c,void Vt(Ye.value);const m=r||0===t.total;Ye.value=m||d?Math.min(c,Xe.value):Math.min(Ye.value,c);const h=Math.max(1,Xe.value||qe.value||n);Ye.value<c?ao(h,{immediate:!v}):Vt(Ye.value)},{immediate:!0}),X(()=>Ae.value,e=>{if(!e)return $n(),void Pn();Rn(),Wn({immediate:!0})},{immediate:!0}),X([()=>ge.value.length,()=>Ae.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield Z(),Wn({immediate:!0}))}),{flush:"post"}),X(()=>i.value,()=>{Ae.value&&(Rn(),Wn({immediate:!0}))}),X(Be,e=>{e&&function(){var e;if(xe.value&&Ne.value&&ke.value&&(null==(e=be.value)?void 0:e[1]))return;const n=we({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=we({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=we({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});xe.value=n,Ne.value=t,ke.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]=we({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});be.value=l}()},{immediate:!0}),X([()=>i.value,Be],()=>{if(!Be.value)return it(),void(k.value=0);ot(),it(),Be.value&&i.value&&"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(()=>{ot(),vn.value&&kt()}),lt.observe(i.value))},{immediate:!0}),X([Be,Te],()=>d(null,null,function*(){Be.value?(yield Z(),function(){var e,n,t,o;if(!Be.value||"undefined"==typeof window)return void(b.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=Jn(Yn(u.value),".paragraph-node");l.paragraph=Hl(u.value,r,"pre-wrap");const i=Yn(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=Hl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=m.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=Jn(Yn(h[u]),`h${u}`);l.headings[u]=Hl(h[u],e,"pre-wrap")}b.value=l}()):b.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),X(()=>ge.value.length,()=>{Ae.value&&Wn({immediate:!0})}),X([Be,k],()=>{Ae.value&&Wn({immediate:!0}),vn.value&&kt()},{immediate:!1}),X(()=>Nn.value,e=>{if(e)for(const[n,t]of ln)Gt(n,t);else{for(const e of nn.values())e.destroy();nn.clear();for(const e of Array.from(on.keys()))io(e);Dt();for(const[e,n]of ln)n&&qt(e,!0)}},{immediate:!1}),X([()=>l.viewportPriority,()=>ge.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),X(()=>Ye.value,()=>{Ae.value&&Wn({immediate:!0})}),X([_n,Ie,Sn,()=>ge.value.length,Ae],()=>{!function(){const e=ge.value.length;if(!Ae.value||0===e)return Bn.start=0,void(Bn.end=e);const n=Math.min(Ie.value,e),t=Sn.value,o=Fn(_n.value-t,0,Math.max(0,e-n));Bn.start=o,Bn.end=Math.min(e,o+n)}()},{immediate:!0}),X([()=>ge.value.length,Ae,Ie,Sn,()=>Bn.start,()=>Bn.end],([e,n,t,o,l,r])=>{y.value&&j("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:_n.value,scroll:n?(()=>{const e=pn.value||En();return e?{reverse:In(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:Ye.value})}),X(()=>Cn.value,(e,n)=>{kn.value&&("number"==typeof n&&e<=n||e>Ye.value&&so())}),X([()=>l.customId],([e],n,t)=>{if(!e||Me)return;const o=function(e,n){return e?(Ml.controllers[e]=n,()=>{Ml.controllers[e]===n&&delete Ml.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Mt,restoreAnchor:_t,getAnchorDrift:Bt,getReport:Rt});t(()=>{o()})},{immediate:!0}),Y(()=>{ro();for(const e of nn.values())e.destroy();nn.clear();for(const e of an.values())e.disconnect();an.clear();for(const e of Ln.values())for(const n of e)window.clearTimeout(n);Ln.clear();for(const e of tn.values())e();tn.clear();for(const e of Array.from(on.keys()))io(e);it(),yt(),$n(),Pn()});const uo=de({loader:()=>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),Ut}}),loadingComponent:ti,delay:0}),co=de({loader:()=>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),Ut}}),loadingComponent:ni,delay:0}),mo=de(()=>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),Ut}})),ho={text:Qn,paragraph:Kt,heading:Et,code_block:at,list:At,list_item:It,blockquote:Oe,table:Jt,definition_list:$e,footnote:Ot,footnote_reference:Ge,footnote_anchor:St,admonition:vi,vmr_container:oo,hardbreak:Ct,link:gt,image:zn,thematic_break:eo,math_inline:et,math_block:nt,strong:dt,emphasis:bt,strikethrough:mt,highlight:Nt,insert:wt,subscript:st,superscript:rt,emoji:Re,checkbox:Ee,checkbox_input:Ee,inline_code:un,html_inline:rn,reference:tt,html_block:jt},fo=D(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),po=D(()=>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 T.value?{showTooltips:T.value}:{}),l.codeBlockProps||{})),vo=D(()=>a({},l.mermaidProps||{})),go=D(()=>a({},l.d2Props||{})),yo=D(()=>a({},l.infographicProps||{})),wo=D(()=>({typewriter:l.typewriter,customHtmlTags:pe.value.customHtmlTags})),xo=D(()=>a(a({},wo.value),"boolean"==typeof T.value?{showTooltip:T.value}:{})),No=D(()=>a(a({},wo.value),"boolean"==typeof T.value?{showTooltips:T.value}:{})),ko=D(()=>Tt.value.map(e=>{var n,t,o,l,r,i;let u=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=sn.get(u);if(c&&c.signature===d)return c.node;const m=a({},u);return sn.set(u,{signature:d,node:m}),m}(e.node);const d=bo(u);let c=Mo(u,d);if(("html_block"===u.type||"html_inline"===u.type)&&c===ho[u.type]){const e=u,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||M(e.content);if(r){const n=ae.value[r];if(ve.value.has(r)&&n)c=n,u=s(a({},e),{type:r,tag:r,content:C(e.content,r)});else if(S(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===u.type?(c=Qn,u={type:"text",content:n,raw:n}):(c=Kt,u={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let m=a({},function(e,n){const t=null!=n?n:bo(e);return"mermaid"===t?vo.value:"infographic"===t?yo.value:"d2"===t||"d2lang"===t?go.value:"link"===e.type?xo.value:"list"===e.type?No.value:"code_block"===e.type?po.value:wo.value}(u,d));const h=ht.value[e.index];return"code_block"===u.type&&"code-block"===(null==h?void 0:h.kind)&&(m=s(a({},m),{estimatedHeightPx:h.height,estimatedContentHeightPx:h.contentHeight})),"code_block"===u.type&&"mermaid"===d&&null==$l(m.estimatedPreviewHeightPx)&&(m=s(a({},m),{estimatedPreviewHeightPx:jl(Rl(String(null!=(r=u.code)?r:"")))})),"code_block"===u.type&&"infographic"===d&&null==$l(m.estimatedPreviewHeightPx)&&(m=s(a({},m),{estimatedPreviewHeightPx:Fl(Pl(String(null!=(i=u.code)?i:"")))})),s(a({},e),{node:u,component:c,bindings:m,isCodeBlock:"code_block"===u.type,indexKey:`${fo.value}-${e.index}`})}));function bo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Mo(e,n){if(!e)return to;const t=ae.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:bo(e),r=l?t[l]:void 0;if(r)return r;if("mermaid"===l)return t.mermaid||uo;if("infographic"===l)return t.infographic||co;if("d2"===l||"d2lang"===l)return t.d2||mo;if(o)return o;return t.code_block||ut.value}return o||ho[String(e.type)]||to}function So(e){r("click",e)}function _o(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Bo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}function Oo(e){r("mouseover",e)}function Lo(e){r("mouseout",e)}return(e,n)=>g.value?(I(!0),A(R,{key:0},P(ko.value,e=>(I(),J(ce(e.component),me({key:e.index,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onClick:So,onMouseover:Oo,onMouseout:Lo,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"]))),128)):(I(),A("div",{key:1,ref_key:"containerRef",ref:i,class:V(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Ae.value}]]),"data-custom-id":l.customId,onClick:So,onMouseover:_o,onMouseout:Bo},[Be.value||Ae.value?(I(),A(R,{key:0},[Be.value?(I(),A("div",{key:0,class:"height-estimation-probes",style:oe({width:`${Te.value}px`}),"aria-hidden":"true"},[z("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[H($(Kt),{node:xe.value,"index-key":"probe-paragraph"},null,8,["node"])],512),z("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[z("ul",li,[H($(It),{node:Ne.value,"index-key":"probe-list-item"},null,8,["node"])])],512),z("div",{ref_key:"listProbeWrapperRef",ref:m,class:"node-content","data-probe":"list"},[H($(At),{node:ke.value,"index-key":"probe-list"},null,8,["node"])],512),(I(),A(R,null,P(6,e=>z("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(h[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[H($(Et),{node:Tn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,ri)),64))],4)):G("",!0),Ae.value?(I(),A("div",{key:1,class:"node-spacer",style:oe({height:`${Ht.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],64)):G("",!0),(I(!0),A(R,null,P(ko.value,e=>{return I(),A("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,kn.value&&t>=Ye.value||!(!Nn.value||t<Xe.value||en.value.has(t))?(I(),A("div",{key:1,class:"node-placeholder",style:oe({height:`${ft(e.index)}px`})},null,4)):(I(),A("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=Ln.get(e);if(o){for(const e of o)window.clearTimeout(e);Ln.delete(e)}const l=an.get(e);if(l&&(l.disconnect(),an.delete(e)),!n||!He.value)return void On.delete(e);On.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Kn[e];if(Kn[e]=n,t?Dn.total+=n-t:(Dn.total+=n,Dn.count++),mn.value>e){const o=hn.value,l=fn.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)}vn.value&&kt()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),an.set(e,t)}"code_block"===(null==(t=ge.value[e])?void 0:t.type)&&"undefined"!=typeof window&&Ln.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?(I(),J(ce(e.component),me({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[4]||(n[4]=e=>r("copy",e)),onHandleArtifactClick:n[5]||(n[5]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(I(),J(ee,{key:0,name:"typewriter",appear:""},{default:ne(()=>[(I(),J(ce(e.component),me({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"]))]),_:2},1024))],512)))],8,ii);var t}),128)),Ae.value?(I(),A("div",{key:1,class:"node-spacer",style:oe({height:`${zt.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],42,oi))}}),[["__scopeId","data-v-1c8a9515"]]);ai.install=e=>{var n,t;const o=null!=(t=null!=(n=ai.__name)?n:ai.name)?t:"NodeRenderer";e.component(o,ai)};const si=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ai},Symbol.toStringTag,{value:"Module"})),ui={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"},di={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"},ci={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"},mi={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"},hi={class:"admonition-title"},fi=["aria-expanded","aria-controls"],pi=["id"],vi=/* @__PURE__ */Be(/* @__PURE__ */E({__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=D(()=>{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=q(!!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)=>(I(),A("div",{class:V(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(I(),A("svg",ui,[...t[1]||(t[1]=[z("circle",{cx:"12",cy:"12",r:"10"},null,-1),z("path",{d:"M12 16v-4"},null,-1),z("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(I(),A("svg",di,[...t[2]||(t[2]=[z("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),z("path",{d:"M9 18h6"},null,-1),z("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(I(),A("svg",ci,[...t[3]||(t[3]=[z("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),z("path",{d:"M12 9v4"},null,-1),z("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(I(),A("svg",mi,[...t[4]||(t[4]=[z("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),z("path",{d:"M12 8v4"},null,-1),z("path",{d:"M12 16h.01"},null,-1)])])):G("",!0),z("span",hi,W(r.value),1),o.node.collapsible?(I(),A("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(I(),A("svg",{style:oe({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]=[z("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,fi)):G("",!0)]),te(z("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[H($(ai),{"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,pi),[[re,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);vi.install=e=>{e.component(vi.__name,vi)};const gi=()=>import("@terrastruct/d2");let yi=null,wi=gi;function xi(e){wi=e,yi=null}function Ni(e){xi(null!=e?e:gi)}function ki(){xi(null)}function bi(){return"function"==typeof wi}function Mi(){return d(this,null,function*(){if(yi)return yi;const e=wi;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===gi)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(yi=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),yi):null})}const Si=()=>import("mermaid");let _i=null,Bi=Si;function Oi(e){Bi=e,_i=null}function Li(e){Oi(null!=e?e:Si)}function Ci(){Oi(null)}function Ti(){return"function"==typeof Bi}function Ei(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(_i)return _i;const e=function(){try{const e=globalThis;return Ei(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return _i=e,Ii(_i),_i;const n=Bi;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Si)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(_i=Ei(t),Ii(_i),_i):null})}function Hi(e){return JSON.stringify(e)}function $i(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=Hi(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=Hi(o),s=l?Hi(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 zi(e){var n,t;const o=$i(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}}function Ri(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}mn.install=e=>{e.component(mn.__name,mn)};let Pi=null,Wi=null,ji=!1;const Fi=/* @__PURE__ */new Map,Ki=/* @__PURE__ */new Map;let Di=5;const Vi=/* @__PURE__ */new Set;function Ui(){if(Fi.size<Di&&Vi.size){const n=Array.from(Vi);Vi.clear();for(const t of n)try{t()}catch(e){}}}function qi(e){Pi=e,Wi=null,Pi.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=Fi.get(n);if(l)if(Fi.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(Ki.set(e,t),Ki.size>200){const e=Ki.keys().next().value;Ki.delete(e)}}l.resolve(t)}},Pi.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(),Ui()}}function Xi(){var e;Pi&&(null==(e=Pi.terminate)||e.call(Pi)),Pi=null,Wi=null}function Gi(e){ji=!!e,Pi&&Pi.postMessage({type:"init",debug:ji})}function Zi(e,n=!0,t=2e3,o){return d(this,null,function*(){performance.now();const l=Ri(e);if(!qn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(Wi)return Promise.reject(Wi);const r=`${n?"d":"i"}:${l}`,i=Ki.get(r);if(i)return Promise.resolve(i);const a=Pi||(Wi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Wi.name="WorkerInitError",Wi.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(Wi);if(Fi.size>=Di){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=Fi.size,e.max=Di,Promise.reject(e)}return new Promise((e,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const i=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{Fi.delete(i);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),Fi.has(i)&&Fi.delete(i);const e=new Error("Aborted");e.name="AbortError",r(e),Ui()},{once:!0});const u=e,d=r;Fi.set(i,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),a.postMessage({id:i,content:l,displayMode:n})})})}function Yi(e,n=!0,t){const o=`${n?"d":"i"}:${Ri(e)}`;if(Ki.set(o,t),Ki.size>200){const e=Ki.keys().next().value;Ki.delete(e)}}function Ji(){return{inFlight:Fi.size,max:Di}}function Qi(e){Number.isFinite(e)&&e>0&&(Di=Math.floor(e))}const ea="WORKER_BUSY";function na(){return Fi.size>=Di}function ta(e=2e3,n){return Fi.size<Di?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Vi.delete(i),t())};if(Vi.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Vi.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),Vi.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const oa={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function la(e){null!=e.timeout&&(oa.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(oa.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(oa.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(oa.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ra(){return a({},oa)}function ia(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!qn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:oa.timeout,s=null!=(l=t.waitTimeout)?l:oa.waitTimeout,u=null!=(r=t.backoffMs)?r:oa.backoffMs,d=null!=(i=t.maxRetries)?i:oa.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):oa.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Zi(e,n,a,m)}catch(f){if((null==f?void 0:f.code)!==ea||h>=c)throw f;if(h++,yield ta(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*h)))}}})}function aa(e){return JSON.stringify(e)}function sa(e){var n;const t=null!=(n=e.mode)?n:"module",o=aa(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(${aa(a({startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}},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 ua(e){var n,t;const o=sa(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 da=null,ca=null;const ma=/* @__PURE__ */new Map;let ha=5,fa=!1;function pa(e){fa=!!e}function va(e){Number.isFinite(e)&&e>0&&(ha=Math.floor(e))}function ga(){return{inFlight:ma.size,max:ha}}const ya="WORKER_BUSY",wa="MERMAID_DISABLED";function xa(e){da=e,ca=null;const n=e;da.onmessage=e=>{if(da!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=ma.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},da.onerror=e=>{var t,o;if(da===n)if(0!==ma.size){try{fa?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 ma.entries())t.reject(new Error(`Worker error: ${e.message}`));ma.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},da.onmessageerror=e=>{var t,o;if(da===n)if(0!==ma.size){try{fa?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of ma.entries())n.reject(new Error("Worker messageerror"));ma.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Na(){var e;if(da)try{for(const[e,n]of ma.entries())n.reject(new Error("Worker cleared"));ma.clear(),null==(e=da.terminate)||e.call(da)}catch(n){}da=null,ca=null}function ka(e,n,t=1400){if(!Ti()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=wa,Promise.reject(e)}if(ca)return Promise.reject(ca);const o=da||(ca=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),ca.name="WorkerInitError",ca.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(ca);if(ma.size>=ha){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=ya,e.inFlight=ma.size,e.max=ha,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),ma.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};ma.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return ma.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=ma.get(i);n&&n.reject(e)},t)})}function ba(e,n,t=1400){return d(this,null,function*(){try{return yield ka("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Ma(e,n,t=1400){return d(this,null,function*(){try{return yield ka("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Sa(){if(da)try{for(const[e,n]of ma.entries())n.reject(new Error("Worker terminated"));ma.clear(),da.terminate()}finally{da=null}}const _a=de(()=>import("./index7.js")),Ba=de(()=>import("./index3.js")),Oa=de(()=>import("./index2.js")),La=de(()=>import("./index4.js")),Ca=de(()=>import("./index5.js")),Ta=de(()=>import("./index6.js")),Ea={AdmonitionNode:vi,BlockquoteNode:Oe,CheckboxNode:Ee,CodeBlockNode:_a,DefinitionListNode:$e,EmojiNode:Re,EmphasisNode:bt,FootnoteNode:Ot,FootnoteReferenceNode:Ge,FootnoteAnchorNode:St,HardBreakNode:Ct,HeadingNode:Et,HtmlBlockNode:jt,HtmlInlineNode:rn,HighlightNode:Nt,ImageNode:zn,D2BlockNode:Ta,InfographicBlockNode:Ca,InlineCodeNode:un,PreCodeNode:Ut,InsertNode:wt,LinkNode:gt,ListItemNode:It,ListNode:At,MathBlockNode:Ba,MathInlineNode:Oa,MermaidBlockNode:La,ParagraphNode:Kt,StrikethroughNode:mt,StrongNode:dt,SubscriptNode:st,SuperscriptNode:rt,TableNode:Jt,TextNode:Qn,ThematicBreakNode:eo,VmrContainerNode:oo,ReferenceNode:tt,MarkdownCodeBlockNode:ei},Ia={install(e,n){Object.entries(Ea).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&lr(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&gr(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&T(n.mathOptions)}};export{wt as $,pr as A,Nr as B,Ut as C,Xr as D,Or as E,Ul as F,vi as G,Oe as H,Ee as I,_a as J,Ta as K,$e as L,Re as M,bt as N,St as O,Ot as P,Ge as Q,Ct as R,Et as S,Nt as T,jt as U,rn as V,ea as W,zn as X,Ca as Y,un as Z,Be as _,Gn as a,Qi as a$,gt as a0,It as a1,At as a2,wa as a3,ya as a4,ei as a5,ai as a6,Ba as a7,Oa as a8,La as a9,Li as aA,Mr as aB,sr as aC,De as aD,ra as aE,Ji as aF,ga as aG,_r as aH,rr as aI,bi as aJ,na as aK,qn as aL,br as aM,Zl as aN,xr as aO,dr as aP,ar as aQ,or as aR,Ve as aS,Zi as aT,Ke as aU,xi as aV,On as aW,lr as aX,la as aY,qi as aZ,Gi as a_,Kt as aa,tt as ab,mt as ac,dt as ad,st as ae,rt as af,Jt as ag,Qn as ah,eo as ai,mn as aj,oo as ak,Ia as al,$i as am,sa as an,Ue as ao,Xi as ap,Na as aq,zi as ar,ua as as,ur as at,ki as au,Un as av,Ci as aw,Sr as ax,Ni as ay,Vn as az,Tn as b,Dn as b0,gr as b1,Oi as b2,xa as b3,pa as b4,va as b5,ta as b6,Br as c,Ai as d,Rl as e,Sn as f,Xn as g,_n as h,Ti as i,ba as j,jl as k,zl as l,Ma as m,Ri as n,Pl as o,$l as p,Fl as q,ia as r,Yi as s,Sa as t,zt as u,Mi as v,yr as w,wr as x,Yl as y,kr as z};