markstream-vue 1.0.5-beta.2 → 1.0.5-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},u=(e,o)=>n(e,t(o)),s=(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{normalizeCustomHtmlTagName as c,tokenizeHtml as d,hasCustomHtmlComponents as f,sanitizeHtmlAttrs as m,sanitizeHtmlTokenAttrs as h,tokenAttrsToRecord as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,isCustomHtmlComponentTag as N,sanitizeHtmlContent as b,sanitizeImageSrc as S,shouldOpenLinkInNewTab as x,NON_STRUCTURING_HTML_TAGS as w,normalizeCustomHtmlTags as M,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as O,resolveCustomHtmlTags as T,parseMarkdownToStructure as I,EXTENDED_STANDARD_HTML_TAGS as H,stripCustomHtmlWrapper as L,setDefaultMathOptions as A}from"stream-markdown-parser";import{shallowRef as R,inject as $,computed as E,defineComponent as F,openBlock as P,createElementBlock as K,createElementVNode as z,toDisplayString as W,h as j,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as X,watch as Y,Fragment as Z,createTextVNode as J,createCommentVNode as G,getCurrentInstance as Q,onBeforeUnmount as ee,renderSlot as ne,Transition as te,withCtx as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,normalizeStyle as se,renderList as ce,readonly as de,markRaw as fe,provide as me,reactive as he,onScopeDispose as ve,getCurrentScope as pe,onMounted as ge,resolveComponent as ye,withDirectives as ke,vShow as Ne,toRaw as be,toValue as Se}from"vue";import{resolveStreamingTextUpdate as xe,createSmoothMarkdownStream as we,getHighlightRegistrationKey as Me,normalizeShikiLanguage as Ce}from"markstream-core";import{M as _e,n as Be,s as Oe,j as Te}from"./index2.js";import{b as Ie}from"./workers-katexWorkerClient.js";import{c as He,p as Le,e as Ae,a as Re,b as $e}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const Ee="__global__",Fe="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Pe=(()=>{const e=globalThis;if(e[Fe])return e[Fe];const n={scopedCustomComponents:{},revision:R(0)};return e[Fe]=n,n})(),Ke=Pe.revision,ze=/* @__PURE__ */Symbol("markstreamCustomComponents"),We=/* @__PURE__ */new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function je(e){return We.has(String(e).trim().toLowerCase())}function De(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ve(e={}){const n={};for(const[t,o]of Object.entries(e))if(null!=o){n[t]=o;for(const e of/* @__PURE__ */new Set([c(t),c(De(t))]))!e||je(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function qe(e,n){"string"==typeof e?Pe.scopedCustomComponents[e]=Ve(n||{}):Pe.scopedCustomComponents[Ee]=Ve(e||{}),Ke.value++}function Ue(e){const n=Ve(Pe.scopedCustomComponents[Ee]||{});if(!e)return n;const t=Ve(Pe.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Xe(e){const n=$(ze,null);return E(()=>{var t;return Ke.value,function(e,n={}){return Ke.value,a(a(a({},Ve(Pe.scopedCustomComponents[Ee]||{})),Ve(n)),Ve(function(e){return e&&Pe.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Ye(e){if(e===Ee)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete Pe.scopedCustomComponents[e],Ke.value++}function Ze(){delete Pe.scopedCustomComponents[Ee],Ke.value++}const Je=["aria-label"],Ge={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"},Qe={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"},en=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},nn=/* @__PURE__ */en(/* @__PURE__ */F({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(P(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(P(),K("svg",Qe,[...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)])])):(P(),K("svg",Ge,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Je))}),[["__scopeId","data-v-be21ab83"]]);nn.install=e=>{e.component(nn.__name,nn)};const tn={class:"emoji-node"},on=/* @__PURE__ */en(/* @__PURE__ */F({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(P(),K("span",tn,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);on.install=e=>{e.component(on.__name,on)};const ln=["id"],rn=["title"],an=/* @__PURE__ */en(/* @__PURE__ */F({__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)=>(P(),K("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,rn)],8,ln))}}),[["__scopeId","data-v-c1463a29"]]);an.install=e=>{e.component(an.__name,an)};const un=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function sn(e){un&&console.warn(e)}function cn(e,n="safe",t){return m(e,n,t)}function dn(e){return p(e)}function fn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function mn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=h((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),fn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),fn(e.value)]):Object.entries(l).map(([e,n])=>[e,fn(n)]):null,n,t);var l;if(!o)return;const r=dn(v(o));return Object.keys(r).length>0?r:void 0}function hn(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 vn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function pn(e,n,t,o,l,r,i=!1){const s=function(e,n){return N(e,n)}(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[hn(e,n,!0)]:[hn(e,n),...t,`</${e}>`];const c=m(n,r,e),d=c.key,f=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=dn(c);return j(n,u(a({},l),{key:f}),t.length>0?t:void 0)}return j(e,u(a({},c),{innerHTML:void 0,key:f}),t.length>0?t:void 0)}function gn(e,n){return f(e,n)}function yn(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=pn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);vn(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=pn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?vn(l[l.length-1].children,a):vn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&sn(`Auto-closing unclosed tag: <${i.tagName}>`)}else sn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=pn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?vn(l[l.length-1].children,o):vn(r,o),sn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,un&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const kn=["innerHTML"],Nn=/* @__PURE__ */en(/* @__PURE__ */F({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=E(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Xe(()=>n.customId),r=F({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=E(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=yn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!gn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=yn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(P(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(P(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(P(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,kn))}}),[["__scopeId","data-v-d17f12b0"]]);Nn.install=e=>{e.component(Nn.__name,Nn)};const bn={class:"inline-code"},Sn={key:0},xn=/* @__PURE__ */en(/* @__PURE__ */F({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=$("markstreamFade",void 0),l=$("markstreamTextStreamState",void 0),r=$("markstreamStreamVersion",void 0),i=E(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=E(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=E(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=E(()=>!a.value),c=E(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=X(n.node.code),f=X("");let m=null==r?void 0:r.value;const h=X(0);function v(){return d.value+f.value}function p(){f.value&&(d.value=v(),f.value="")}Y([()=>n.node.code,c,a,()=>null==r?void 0:r.value],([e,n,t,o])=>{const r=String(null!=e?e:""),i=c.value,u=o!==m;m=o;const s=xe({nextContent:r,persistedContent:i?null==l?void 0:l.get(i):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value,streamRenderVersionChanged:u});d.value=s.settledContent,f.value=s.streamedDelta,s.appended&&(h.value+=1),i&&(null==l||l.set(i,r))},{immediate:!0}),Y(a,e=>{var n;e||(n=v(),d.value=n,f.value="")});const g=E(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(P(),K("code",bn,[s.value?(P(),K(Z,{key:0},[J(W(u.value),1)],64)):(P(),K(Z,{key:1},[d.value?(P(),K("span",Sn,W(d.value),1)):G("",!0),f.value?(P(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},W(f.value),35)):G("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);xn.install=e=>{e.component(xn.__name,xn)};const wn=X(!1),Mn=X(""),Cn=X("top"),_n=X(null),Bn=X(null),On=X(null),Tn=X(null),In=X(null);let Hn=null,Ln=null,An=0;function Rn(){Hn&&(clearTimeout(Hn),Hn=null),Ln&&(clearTimeout(Ln),Ln=null)}let $n=!1,En=null,Fn=!1;function Pn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++An;Rn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!$n&&!Fn&&"undefined"!=typeof document){null!=En||(En=s(null,null,function*(){const[{createApp:e,h:n},{default:t}]=yield Promise.all([import("vue"),import("./Tooltip.js")]),o=document.createElement("div");o.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(o),e({setup:()=>()=>{var e;return n(t,{visible:wn.value,"anchor-el":_n.value,content:Mn.value,placement:Cn.value,id:Bn.value,originX:On.value,originY:Tn.value,isDark:null!=(e=In.value)?e:void 0})}}).mount(o),$n=!0}));try{yield En}catch(e){$n=!1,En=null,Fn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),$n&&i===An){Bn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,_n.value=e,Mn.value=n,Cn.value=t,On.value=null!=(o=null==l?void 0:l.x)?o:null,Tn.value=null!=(a=null==l?void 0:l.y)?a:null,In.value="boolean"==typeof r?r:null,wn.value=!0;try{e.setAttribute("aria-describedby",Bn.value)}catch(u){}}});o?a():Hn=setTimeout(a,80)}function Kn(e=!1){An+=1,Rn();const n=()=>{if(_n.value&&Bn.value)try{_n.value.removeAttribute("aria-describedby")}catch(e){}wn.value=!1,_n.value=null,Bn.value=null,On.value=null,Tn.value=null};e?n():Ln=setTimeout(n,120)}const zn={"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..."},Wn=/* @__PURE__ */Symbol("markstreamI18nFallback");function jn(e){Object.assign(zn,e)}function Dn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:zn[e]}const Vn=(e,n)=>{var t;return null!=(t=Dn(e,n))?t: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 qn(e,n){return{t(t){const o=Dn(t,n);if(e.te&&null!=o&&!e.te(t))return Vn(t,n);const l=e.t(t);return l===t&&null!=o?Vn(t,n):l}}}function Un(){const e=function(){var e,n,t;try{const o=Q(),l=Wn,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=Q(),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(n)return qn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return qn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Vn(n,e)}}function Xn(e,n){var t,o;const l=null!=(o=null!=(t=e.indexKey)?t:n["index-key"])?o:n.indexKey;return null==l||""===l?"":String(l)}const Yn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Zn={key:1,class:"image-placeholder"},Jn={key:1,class:"image-node__raw-text"},Gn={key:0,class:"image-shimmer-overlay"},Qn={key:1,class:"image-node__raw-text"},et={key:2,class:"image-error"},nt=/* @__PURE__ */en(/* @__PURE__ */F({__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=X(!1),r=X(!1),i=X(""),a=X("primary"),u=X(null),c=U(),d=$(_e,null);let f="",m=null;const h=E(()=>S(t.node.src)),v=E(()=>S(t.fallbackSrc)),p=E(()=>i.value),g=E(()=>!t.lazy),y=E(()=>!t.node.loading&&"failed"!==a.value&&i.value.length>0),k=E(()=>"failed"===a.value),N=E(()=>!g.value&&!l.value&&!r.value&&"failed"!==a.value&&i.value.length>0),b=E(()=>Xn(t,c));function x(e=b.value){e&&u.value&&(null==d||d.reportHeight(e,u.value.offsetHeight))}function w(e=b.value){e&&le(()=>{x(e)})}function M(){m&&(clearTimeout(m),m=null)}function C(){const e=b.value;e&&f!==e&&(f&&(null==d||d.markSettled(f)),M(),f=e,null==d||d.markPending(e),"undefined"!=typeof window&&(m=window.setTimeout(()=>{f===e&&(w(e),_())},8e3)))}function _(){return s(this,null,function*(){const e=f;e&&(M(),f="",yield le(),x(e),null==d||d.markSettled(e))})}function B(){if("primary"===a.value&&v.value&&v.value!==i.value)return a.value="fallback",i.value=v.value,l.value=!1,r.value=!1,void w();a.value="failed",r.value=!0,o("error",i.value),w()}function O(){l.value=!0,r.value=!1,o("load",p.value),w()}function T(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,p.value])}const{t:I}=Un();return Y([h,v,()=>t.node.loading],()=>(l.value=!1,r.value=!1,t.node.loading||h.value?(i.value=h.value,void(a.value="primary")):v.value?(i.value=v.value,void(a.value="fallback")):(i.value="",a.value="failed",void(r.value=!0))),{immediate:!0}),Y([y,l,r,p,()=>t.lazy],([e,n,t,o,l])=>e&&o&&!t?n?(_(),void w()):l?(C(),void w()):void(n||t||C()):(_(),void w()),{flush:"post",immediate:!0}),ee(()=>{!function(){const e=f;e&&(M(),f="",null==d||d.markSettled(e))}()}),(n,o)=>{var i,a,s,c,d;return P(),K("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(P(),K("img",{key:0,src:p.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(c=null!=(s=t.node.title)?s:t.node.alt)?c:""),class:D(["image-node__img",{"is-loading":!g.value&&!l.value,"is-loaded":g.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:g.value?"high":void 0,decoding:g.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(d=t.node.alt)?d:q(I)("image.preview"),onError:B,onLoad:O,onClick:T},null,42,Yn)):G("",!0),e.node.loading&&!r.value?(P(),K("span",Zn,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.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):(P(),K("span",Jn,W(e.node.raw),1))])):G("",!0),V(te,{name:"shimmer-fade"},{default:oe(()=>[N.value&&!e.node.loading?(P(),K("span",Gn,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=z("span",{class:"image-shimmer"},null,-1))],!0):(P(),K("span",Qn,W(e.node.raw),1))])):G("",!0)]),_:3}),k.value?(P(),K("span",et,[ne(n.$slots,"error",{node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[2]||(o[2]=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(q(I)("image.loadError")),1)],!0)])):G("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt={key:2},ot=/* @__PURE__ */F({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Xe(()=>n.customId),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamNestedRendererProps",void 0),r=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=E(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=re({loader:()=>Promise.resolve().then(()=>wi),suspensible:!1}),c=E(()=>n.components[String(n.node.type)]),d=E(()=>Boolean(c.value&&t.value[n.node.type]&&!je(String(n.node.type)))),f=E(()=>d.value?mn(n.node,r.value):void 0),m=E(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=E(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=E(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(P(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:oe(()=>[m.value?(P(),ie(q(s),ue({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):h.value?(P(),ie(q(s),ue({key:1},i.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):G("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(P(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(P(),K("span",tt,W(v.value),1)):G("",!0)}}),lt=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],rt={key:0,translate:"no",class:"markstream-pre__diff-code"},it={class:"markstream-pre__diff-number","aria-hidden":"true"},at={class:"markstream-pre__diff-content"},ut={class:"markstream-pre__diff-content-inner"},st={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},ct=["textContent"],dt=/* @__PURE__ */F({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const n=e,t=E(()=>{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=E(()=>`language-${t.value}`),l=E(()=>{var e,t,o,l,r;return!0===(null==(e=n.node)?void 0:e.diff)?String(null!=(o=null==(t=n.node)?void 0:t.code)?o:""):function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(null==(l=n.node)?void 0:l.code,!0===(null==(r=n.node)?void 0:r.loading))}),r=E(()=>l.value.split(/\r\n|\n|\r/)),i=E(()=>Array.from({length:Math.max(1,r.value.length)},(e,n)=>n+1)),s=E(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),c=E(()=>s.value&&!0===n.diffInline),d=E(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return{height:t,minHeight:t,maxHeight:t,overflow:"auto"}});function f(e){return 0===String(null!=e?e:"").trim().length}function m(e,n="context",t={}){const o=f(e);return{code:e,kind:o&&"hunk"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function h(e){const n=String(null!=e?e:"");return n?n.split(/\r\n|\n|\r/):[]}function v(e,n){return!f(e[n])||n<e.length-1}function p(e){return e.startsWith("-")&&!e.startsWith("---")}function g(e){return e.startsWith("+")&&!e.startsWith("+++")}function y(e,n){const t=h(e),o=h(n),l=function(e,n){const t=e.length,o=n.length;if((t+1)*(o+1)>15e5)return null;const l=o+1,r=new Uint32Array((t+1)*(o+1));for(let s=1;s<=t;s++)for(let t=1;t<=o;t++){const o=s*l+t;if(e[s-1]===n[t-1])r[o]=r[(s-1)*l+(t-1)]+1;else{const e=r[(s-1)*l+t],n=r[s*l+(t-1)];r[o]=e>=n?e:n}}const i=[];let a=t,u=o;for(;a>0&&u>0;)e[a-1]===n[u-1]?(i.push({originalIndex:a-1,modifiedIndex:u-1}),a--,u--):r[(a-1)*l+u]>=r[a*l+(u-1)]?a--:u--;return i.reverse(),i}(t,o);if(l){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},m(o[i.modifiedIndex])),{key:`inline-context-source-${i.originalIndex}-${i.modifiedIndex}`,number:i.modifiedIndex+1})),n=i.originalIndex+1,r=i.modifiedIndex+1}for(;n<t.length;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<o.length;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},m(o[i])),{key:`inline-prefix-${i}`,number:i+1})),i++;const d=[];for(;s>=i&&c>=i&&t[s]===o[c];)d.unshift(u(a({},m(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},m(t[f],"removed",{preserveBlankKind:v(t,f)})),{key:`inline-removed-source-${f}`,number:""}));for(let f=i;f<=c;f++)r.push(u(a({},m(o[f],"added",{preserveBlankKind:v(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}const k=E(()=>{var e,o,l,i;const s=function(e){const o=e.some(e=>p(e)),l=e.some(e=>g(e));return o&&l||function(){var e,o,l,r;if("diff"===t.value)return!0;const i=null!=(r=null==(l=String(null!=(o=null==(e=n.node)?void 0:e.raw)?o:"").split(/\r?\n/,1)[0])?void 0:l.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(o||l)}(r.value),d=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(c.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:s?function(e){const n=[];let t=1;for(const[o,l]of e.entries())if(l.startsWith("@@"))n.push(u(a({},m(l,"hunk")),{key:`inline-hunk-${o}`,number:""}));else if(p(l))n.push(u(a({},m(l.slice(1),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${o}`,number:""}));else if(g(l))n.push(u(a({},m(l.slice(1),"added",{preserveBlankKind:!0})),{key:`inline-added-${o}`,number:t++}));else{const e=l.startsWith(" ")?l.slice(1):l;n.push(u(a({},m(e)),{key:`inline-context-${o}`,number:t})),t++}return n}(r.value):y(null==(e=n.node)?void 0:e.originalCode,null==(o=n.node)?void 0:o.updatedCode)}];if(!s&&d){const e=h(null==(l=n.node)?void 0:l.originalCode),t=h(null==(i=n.node)?void 0:i.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:e.map((n,o)=>{const l=t[o]===n?"context":"removed";return u(a({},m(n,l,{preserveBlankKind:v(e,o)})),{key:`original-${o}`,number:o+1})})},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:t.map((n,o)=>{const l=e[o]===n?"context":"added";return u(a({},m(n,l,{preserveBlankKind:v(t,o)})),{key:`modified-${o}`,number:o+1})})}]}const f=[],k=[];for(const n of r.value)if(n.startsWith("@@"))f.push(m(n,"hunk")),k.push(m(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))f.push(m(n.slice(1),"removed",{preserveBlankKind:!0}));else if(n.startsWith("+")&&!n.startsWith("+++"))k.push(m(n.slice(1),"added",{preserveBlankKind:!0}));else{const e=n.startsWith(" ")?n.slice(1):n;f.push(m(e)),k.push(m(e))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:f.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:k.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}]}),N=E(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"}),b=X(null),S=X([]);let x=null,w=null;function M(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function C(e,n){var t;if(!e)return n;const o=e.querySelector(".markstream-pre__diff-content"),l=null==o?void 0:o.getBoundingClientRect(),r=null!=(t=null==l?void 0:l.height)?t:0;return Math.max(n,Math.ceil(r))}function _(){"undefined"!=typeof window&&(null!=x&&window.cancelAnimationFrame(x),x=window.requestAnimationFrame(()=>{!function(){var e,n;x=null;const t=b.value;if(!t||!s.value)return void(S.value.length&&(S.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=M(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=M(n.lineHeight);return o>0?o:18}(t),l=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),r=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),i=Math.max(l.length,r.length),a=[];for(let s=0;s<i;s++){const t=C(null!=(e=l[s])?e:null,o),i=C(null!=(n=r[s])?n:null,o),u=Math.max(o,t,i);a.push({rowHeight:u,originalHeight:t,modifiedHeight:i})}var u,c;u=S.value,c=a,u.length===c.length&&u.every((e,n)=>{const t=c[n];return t&&Math.abs(e.rowHeight-t.rowHeight)<=.5&&Math.abs(e.originalHeight-t.originalHeight)<=.5&&Math.abs(e.modifiedHeight-t.modifiedHeight)<=.5})||(S.value=a)}()}))}function B(e){null==w||w.disconnect(),w=null,e&&s.value&&"undefined"!=typeof ResizeObserver&&(w=new ResizeObserver(()=>{_()}),w.observe(e))}function O(e,n){const t=S.value[e];if(!t)return;const o="original"===n?t.originalHeight:t.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(t.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(o)}px`}}return Y(b,e=>{B(e),le(()=>_())},{flush:"post"}),Y([s,k],()=>{B(b.value),le(()=>_())},{flush:"post",immediate:!0}),ee(()=>{null!=x&&(window.cancelAnimationFrame(x),x=null),null==w||w.disconnect(),w=null}),(r,a)=>(P(),K("pre",{ref_key:"preRef",ref:b,style:se(d.value),class:D([o.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":s.value,"markstream-pre--diff-inline":c.value}]),"aria-busy":!0===e.node.loading,"aria-label":N.value,"data-language":t.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[s.value?(P(),K("code",rt,[(P(!0),K(Z,null,ce(k.value,e=>(P(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[(P(!0),K(Z,null,ce(e.lines,(n,t)=>(P(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(O(t,e.key))},[a[0]||(a[0]=z("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),z("span",it,W(n.number),1),z("span",at,[z("span",ut,W(n.code),1)])],6))),128))],2))),128))])):(P(),K(Z,{key:1},[n.showLineNumbers?(P(),K("span",st,[(P(!0),K(Z,null,ce(i.value,e=>(P(),K("span",{key:e,class:"markstream-pre__line-number"},W(e),1))),128))])):G("",!0),z("code",{translate:"no",class:"markstream-pre__code",textContent:W(l.value)},null,8,ct)],64))],14,lt))}});dt.install=e=>{e.component(dt.__name,dt)};const ft=R(!1);let mt=null;const ht={key:0},vt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(mt||(mt=Ie().then(e=>{ft.value=!!e}).catch(()=>{ft.value=!1})),de(ft)),o=U(),l=$("markstreamFade",void 0),r=$("markstreamTextStreamState",void 0),i=$("markstreamStreamVersion",void 0),a=E(()=>{const e=o.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),u=E(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),s=E(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),c=X(n.node.content),d=X("");let f=null==i?void 0:i.value;const m=X(0);function h(){return c.value+d.value}function v(){d.value&&(c.value=h(),d.value="")}Y([()=>n.node.content,s,u,()=>null==i?void 0:i.value],([e,n,t,o])=>{const l=String(null!=e?e:""),i=s.value,a=o!==f;f=o;const h=xe({nextContent:l,persistedContent:i?null==r?void 0:r.get(i):void 0,currentState:{settledContent:c.value,streamedDelta:d.value},typewriterEnabled:u.value,streamRenderVersionChanged:a});c.value=h.settledContent,d.value=h.streamedDelta,h.appended&&(m.value+=1),i&&(null==r||r.set(i,l))},{immediate:!0}),Y(u,e=>{var n;e||(n=h(),c.value=n,d.value="")});const p=E(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(P(),K("span",{class:D([[q(t)&&e.node.center?"text-node-center":""],"text-node"])},[c.value?(P(),K("span",ht,W(c.value),1)):G("",!0),d.value?(P(),K("span",{key:1,class:D(["text-node-stream-delta",[p.value]]),onAnimationend:v},W(d.value),35)):G("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);vt.install=e=>{e.component(vt.__name,vt)};const pt=F({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return j(dt,u(a({},n),{node:t.node,showLineNumbers:!0,reservedHeightPx:null!=(e=t.estimatedHeightPx)?e:t.estimatedContentHeightPx,class:["code-pre-fallback",n.class],"data-markstream-code-loading":"1"}))}}}),gt=re({loader:()=>s(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 preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),dt}}),loadingComponent:pt,delay:0,suspensible:!1}),yt=re(()=>s(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 j(vt,u(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 Ie())return(yield import("./index6.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 j(vt,u(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:""}$`}}))}})),kt=re(()=>s(null,null,function*(){try{if(yield Ie())return(yield import("./index5.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 j(vt,u(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=/* @__PURE__ */en(/* @__PURE__ */F({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(P(),K("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"]]);Nt.install=e=>{e.component(Nt.__name,Nt)};const bt={class:"superscript-node"},St=/* @__PURE__ */en(/* @__PURE__ */F({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,emphasis:Pt,footnote_reference:an,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,emoji:on,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("sup",bt,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);St.install=e=>{e.component(St.__name,St)};const xt={class:"subscript-node"},wt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,emphasis:Pt,footnote_reference:an,strikethrough:Bt,highlight:Et,insert:Rt,superscript:St,emoji:on,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("sub",xt,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);wt.install=e=>{e.component(wt.__name,wt)};const Mt={class:"strong-node"},Ct=/* @__PURE__ */en(/* @__PURE__ */F({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,emphasis:Pt,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,superscript:St,emoji:on,footnote_reference:an,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("strong",Mt,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:t,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":n.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const _t={class:"strikethrough-node"},Bt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,emphasis:Pt,highlight:Et,insert:Rt,subscript:wt,superscript:St,emoji:on,footnote_reference:an,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("del",_t,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);Bt.install=e=>{e.component(Bt.__name,Bt)};const Ot=["href","title","aria-label","aria-hidden","target","rel"],Tt=["aria-hidden"],It={class:"link-text-wrapper relative inline-flex"},Ht={class:"leading-[normal] link-text"},Lt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=$("markstreamShowTooltips",void 0),o=E(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=E(()=>{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,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--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&&(s["--link-color"]=n.color),s}),r=Xe(()=>n.customId),i=E(()=>a({text:vt,strong:Ct,strikethrough:Bt,emphasis:Pt,image:nt,html_inline:Nn,inline_code:xn},r.value)),u=U(),s=E(()=>{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 cn(l,"safe","a")}),c=E(()=>a(a({},u),s.value)),d=E(()=>{var e,t;return cn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=E(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(x(d.value)?"_blank":void 0)}),m=E(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=E(()=>{if(!d.value)return;const e=c.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}),v=E(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Kn()}const g=E(()=>{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=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(P(),K("span",ue({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},q(u),{style:l.value}),[z("span",It,[z("span",Ht,[V(q(vt),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Tt)):(P(),K("a",ue({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";Pn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(P(!0),K(Z,null,ce(e.node.children,(t,o)=>(P(),ie(q(ot),{key:`${e.indexKey||"emphasis"}-${o}`,components:i.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))],16,Ot))}}}),[["__scopeId","data-v-367e6ca4"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const At={class:"insert-node"},Rt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,emphasis:Pt,strikethrough:Bt,highlight:Et,subscript:wt,superscript:St,emoji:on,footnote_reference:an,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("ins",At,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);Rt.install=e=>{e.component(Rt.__name,Rt)};const $t={class:"highlight-node"},Et=/* @__PURE__ */en(/* @__PURE__ */F({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,emphasis:Pt,strikethrough:Bt,insert:Rt,subscript:wt,superscript:St,emoji:on,footnote_reference:an,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("mark",$t,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);Et.install=e=>{e.component(Et.__name,Et)};const Ft={class:"emphasis-node"},Pt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>a({text:vt,inline_code:xn,link:Lt,html_inline:Nn,strong:Ct,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,superscript:St,emoji:on,footnote_reference:an,math_inline:yt,reference:Nt},t.value));return(t,l)=>(P(),K("em",Ft,[(P(!0),K(Z,null,ce(e.node.children,(t,l)=>(P(),ie(q(ot),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Pt.install=e=>{e.component(Pt.__name,Pt)};const Kt={class:"hard-break"},zt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(P(),K("br",Kt))}),[["__scopeId","data-v-50c58f70"]]);zt.install=e=>{e.component(zt.__name,zt)};const Wt=/* @__PURE__ */F({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=fe({checkbox:nn,checkbox_input:nn,emoji:on,emphasis:Pt,hardbreak:zt,highlight:Et,inline_code:xn,insert:Rt,link:Lt,reference:Nt,strikethrough:Bt,strong:Ct,subscript:wt,superscript:St,text:vt}),o=Xe(()=>n.customId),l=E(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(P(!0),K(Z,null,ce(e.nodes,(t,o)=>(P(),ie(q(ot),{key:o,components:l.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"inline"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))}});function jt(e){if(!e||"object"!=typeof e)return!1;const n=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(n))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(n))return!0;const t=e.children;return Array.isArray(t)&&t.every(jt)}function Dt(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(jt))return e;if(!n||1!==e.length)return null;const o=e[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const l=o.children;return(t||l.length>0)&&l.every(jt)?l:null}function Vt(e){var n,t;if(!(null==e?void 0:e.length))return null;let o="";for(const l of e){if("text"!==(null==l?void 0:l.type)||!0===l.center)return null;o+=String(null!=(t=null!=(n=l.content)?n:l.raw)?t:"")}return o}const qt=["cite"],Ut={key:0,dir:"auto",class:"paragraph-node"},Xt=["custom-id"],Yt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=Xe(()=>n.customId),o=E(()=>Boolean(t.value.paragraph)),l=E(()=>Boolean(t.value.text)),r=E(()=>Dt(n.node.children,!o.value)),i=E(()=>!1!==n.fade||l.value?null:Vt(r.value));return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(t,o)=>(P(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(P(),K("p",Ut,[null!==i.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(i.value),9,Xt)):(P(),ie(q(Wt),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(P(),ie(q(xi),{key:1,"show-tooltips":n.showTooltips,"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,qt))}}),[["__scopeId","data-v-abfecebc"]]);Yt.install=e=>{e.component(Yt.__name,Yt)};const Zt={class:"definition-list"},Jt={class:"definition-term"},Gt={class:"definition-desc"},Qt=/* @__PURE__ */en(/* @__PURE__ */F({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(P(),K("dl",Zt,[(P(!0),K(Z,null,ce(n.node.items,(o,l)=>(P(),K(Z,{key:l},[z("dt",Jt,[V(q(xi),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),z("dd",Gt,[V(q(xi),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo=["href","title"],no=/* @__PURE__ */en(/* @__PURE__ */F({__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",block:"center"})}return(n,o)=>(P(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,eo))}}),[["__scopeId","data-v-e1eb37b6"]]);no.install=e=>{e.component(no.__name,no)};const to=["id"],oo={class:"flex-1"},lo=/* @__PURE__ */F({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(P(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",oo,[V(q(xi),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,to))}});lo.install=e=>{e.component(lo.__name,lo)};const ro=["custom-id"],io=/* @__PURE__ */en(/* @__PURE__ */F({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Xe(()=>n.customId),o=$("markstreamFade",void 0),l=E(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Vt(n.node.children)),r=E(()=>a({text:vt,inline_code:xn,link:Lt,image:nt,strong:Ct,emphasis:Pt,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,superscript:St,emoji:on,checkbox:nn,checkbox_input:nn,footnote_reference:an,hardbreak:zt,math_inline:yt,reference:Nt},t.value));return(t,o)=>(P(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[null!==l.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(l.value),9,ro)):(P(!0),K(Z,{key:1},ce(e.node.children,(t,o)=>(P(),ie(q(ot),{key:o,components:r.value,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${o}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),ao=io;ao.install=e=>{e.component(io.__name,io)};const uo={key:0,dir:"auto",class:"paragraph-node"},so=["custom-id"],co={dir:"auto",class:"paragraph-node"},fo=["custom-id"],mo=/* @__PURE__ */en(/* @__PURE__ */F({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=E(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Xe(()=>n.customId),l=E(()=>Boolean(o.value.paragraph)),r=E(()=>Boolean(o.value.text)),i=E(()=>{var e;return Dt(null==(e=t.value)?void 0:e.children,!l.value)}),a=E(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=Dt([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=E(()=>u()?Vt(i.value):null),c=E(()=>{var e;return u()?Vt(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=E(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(e,o)=>{var l,r;return P(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(P(),K("p",uo,[null!==s.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(s.value),9,so)):(P(),ie(q(Wt),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(P(),K(Z,{key:1},[z("p",co,[null!==c.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(c.value),9,fo)):(P(),ie(q(Wt),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(P(!0),K(Z,null,ce(a.value.nestedLists,(t,l)=>(P(),ie(q(xi),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(P(),ie(q(xi),{key:2,"show-tooltips":n.showTooltips,"index-key":`list-item-${n.indexKey}`,nodes:null!=(r=null==(l=t.value)?void 0:l.children)?r:[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,onCopy:o[1]||(o[1]=n=>e.$emit("copy",n))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);mo.install=e=>{e.component(mo.__name,mo)};const ho=/* @__PURE__ */en(/* @__PURE__ */F({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=Xe(()=>e.customId),t=E(()=>n.value.list_item||mo);return(n,o)=>(P(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(P(!0),K(Z,null,ce(e.node.items,(l,r)=>{var i;return P(),ie(ae(t.value),ue({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,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);ho.install=e=>{e.component(ho.__name,ho)};const vo=/* @__PURE__ */Symbol("ViewportPriority");function po(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?X(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 u=null,s=null;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Set;let f=null;function m(){if(null!=f){try{null==a||a(f)}catch(e){}f=null}}function h(){if(!c.size){try{null==u||u.disconnect()}catch(e){}u=null,s=null,d.size||m()}}function v(e){const n=c.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==u||u.unobserve(e)}catch(t){}c.delete(e),d.delete(e),h()}}function p(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==f&&d.size&&(f=i(()=>{f=null;const e=d.values().next().value;e&&(d.delete(e),v(e),d.size&&p())},{timeout:1200}))}Y(r,e=>{if(!e){for(const e of Array.from(c.keys()))v(e);m()}},{flush:"sync"});const g=(n,t)=>{const o=X(!1);let i,a=!1;const f=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{try{null==u||u.unobserve(n)}catch(e){}c.delete(n),d.delete(n),h()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:m};const g=function(n,t){if(!l)return u;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(u&&(i=o,(r=s)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return u;var r,i;if(u)try{u.disconnect()}catch(a){}u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&v(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),s=o;for(const e of c.keys())u.observe(e);return u}(n,t);return g?(c.set(n,{resolve:i,visible:o}),g.observe(n),d.add(n),p(),{isVisible:o,whenVisible:f,destroy:m}):(o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:m})};return me(vo,g),g}function go(){var e,n;const t=$(vo,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,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=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||s()}},d=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),c(e),r.size&&d())},{timeout:1200}))};return e=>{const n=X(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),u=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||s()},f=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&c(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return f?(o.set(e,{resolve:t,visible:n}),f.observe(e),r.add(e),d(),{isVisible:n,whenVisible:a,destroy:u}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:u})}}const yo={key:2,class:"html-block-node__raw"},ko=["innerHTML"],No={key:1,class:"html-block-node__placeholder"},bo=/* @__PURE__ */en(/* @__PURE__ */F({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=$("markstreamNestedRendererProps",void 0),l=E(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=E(()=>{var e,t;const r=null!=(e=null==o?void 0:o.value)?e:{};return u(a({},r),{customId:null!=(t=n.customId)?t:r.customId,htmlPolicy:l.value})}),i=re({loader:()=>Promise.resolve().then(()=>wi),suspensible:!1}),s=E(()=>{const e=h(n.node.attrs,l.value);if(!e)return;const t=v(e);return Object.keys(t).length>0?t:void 0}),c=E(()=>{const e=String(n.node.tag||"").trim(),t=h(n.node.attrs,l.value,e);if(!t)return;const o=v(t);return Object.keys(o).length>0?o:void 0}),d=Xe(()=>n.customId),f=F({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=X(null),p=X("undefined"==typeof window),g=X(n.node.content),y=E(()=>Array.isArray(n.node.children)?n.node.children:[]),N=E(()=>String(n.node.tag||"div")),S=E(()=>{const e=N.value.trim().toLowerCase();return w.has(e)||k(e,l.value)}),x=E(()=>y.value.length>0&&!!n.node.tag&&!S.value),M=E(()=>{var e,t,o;if(x.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:null!=(e=g.value)?e:""};const r=null!=(t=g.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===l.value)return{mode:"html",content:b(r,l.value)};if(n.node.loading){const e=yn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!gn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=yn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),C=go(),_=X(null),B=!!n.node.loading;return"undefined"!=typeof window?(Y(m,e=>{var t,o;if(null==(o=null==(t=_.value)?void 0:t.destroy)||o.call(t),_.value=null,!B)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);const l=C(e,{rootMargin:"400px"});_.value=l,p.value=l.isVisible.value,l.whenVisible.then(()=>{p.value=!0})},{immediate:!0}),Y(()=>n.node.content,e=>{B&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=_.value)?void 0:e.destroy)||n.call(e),_.value=null}),(n,t)=>(P(),ie(ae(x.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},x.value?c.value:void 0),{default:oe(()=>[p.value?(P(),K(Z,{key:0},["structured"===M.value.mode?(P(),ie(q(i),ue({key:0},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):"dynamic"===M.value.mode?(P(),ie(q(f),{key:1,nodes:M.value.nodes},null,8,["nodes"])):"text"===M.value.mode?(P(),K("pre",yo,W(M.value.content),1)):(P(),K("div",ue({key:3},s.value,{innerHTML:M.value.content}),null,16,ko))],64)):(P(),K("div",No,[ne(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-f1744dfb"]]);bo.install=e=>{e.component(bo.__name,bo)};const So={dir:"auto",class:"paragraph-node"},xo=["custom-id"],wo=/* @__PURE__ */en(/* @__PURE__ */F({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=Xe(()=>n.customId),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamFade",void 0),r=$("markstreamParseOptions",void 0),i=$("markstreamCustomMarkdownIt",void 0),s=$("markstreamNestedRendererProps",void 0),c=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=E(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=E(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=E(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=E(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})}),v=re({loader:()=>Promise.resolve().then(()=>wi),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=E(()=>n.node.children.filter(e=>!p(e))),y=E(()=>g.value.length>0&&g.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=>!p(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),k=E(()=>new Set(M(m.value))),N=E(()=>{if(!y.value||g.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const o=n.node.children[t];if(!p(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!p(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=E(()=>!1===(null==l?void 0:l.value)&&!t.value.text),S=E(()=>b.value?Vt(N.value):null);function x(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value}}const w=E(()=>a({inline_code:xn,image:nt,link:Lt,hardbreak:zt,emphasis:Pt,strong:Ct,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,superscript:St,html_inline:Nn,html_block:bo,emoji:on,checkbox:nn,math_inline:yt,checkbox_input:nn,reference:Nt,footnote_anchor:no,footnote_reference:an,text:vt},t.value)),B=E(()=>N.value.map((e,o)=>{var l;const r=function(e){var n,o,l,r;if("html_block"===e.type||"html_inline"===e.type){const t=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(t&&!k.value.has(t)&&_(null!=(o=e.content)?o:e.raw,t)){const n=String(null!=(r=null!=(l=e.content)?l:e.raw)?r:"");return{child:{type:"text",content:n,raw:n},component:vt,isCustomComponent:!1}}}return{child:e,component:w.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!je(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?mn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(P(),K("p",So,[null!==S.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(S.value),9,xo)):(P(!0),K(Z,{key:1},ce(B.value,e=>{return P(),K(Z,{key:e.key},[y.value&&p(e.originalChild)?(P(),K(Z,{key:0},[J(W((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(P(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(q(v),ue({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(P(),ie(q(v),ue({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(P(),ie(ae(e.component),ue({key:2,ref_for:!0},x(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);wo.install=e=>{e.component(wo.__name,wo)};const Mo={class:"table-node-wrapper"},Co=["aria-busy"],_o={key:0},Bo=["custom-id"],Oo=["aria-label","onPointerdown"],To=["custom-id"],Io={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Ho=/* @__PURE__ */en(/* @__PURE__ */F({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=E(()=>{var e;return null!=(e=n.node.loading)&&e}),o=E(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=X(null),r=X([]);let i=null;const a=E(()=>n.node.header.cells.length),u=E(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=E(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade));const c=Xe(()=>n.customId),d=E(()=>Boolean(c.value.text)),f=E(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=Dt(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Vt(r):null};return m.set(e,{children:e.children,textFastPath:t,paragraphFastPath:o,info:i}),i}function v(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 p(){i&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),i=null)}return Y(a,()=>{p(),r.value=[]}),ee(p),(a,c)=>(P(),K("div",Mo,[z("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(P(),K("colgroup",_o,[(P(!0),K(Z,null,ce(e.node.header.cells,(e,n)=>(P(),K("col",{key:n,style:se(s.value[n])},null,4))),128))])):G("",!0),z("thead",null,[z("tr",null,[(P(!0),K(Z,null,ce(e.node.header.cells,(t,o)=>(P(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(t).plainText),9,Bo)):h(t).simpleChildren?(P(),ie(q(Wt),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(P(),ie(q(xi),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(P(),K("button",{key:3,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",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,Oo)):G("",!0)],2))),128))])]),z("tbody",null,[(P(!0),K(Z,null,ce(o.value,(e,t)=>(P(),K("tr",{key:t},[(P(!0),K(Z,null,ce(e.cells,(e,o)=>(P(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(e).plainText),9,To)):h(e).simpleChildren?(P(),ie(q(Wt),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(P(),ie(q(xi),{key:2,nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[1]||(c[1]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,Co),V(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(P(),K("div",Io,[ne(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=z("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=z("span",{class:"sr-only"},"Loading",-1))],!0)])):G("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Ho.install=e=>{e.component(Ho.__name,Ho)};const Lo={class:"hr-node"},Ao=/* @__PURE__ */en({},[["render",function(e,n){return P(),K("hr",Lo)}],["__scopeId","data-v-39b2349c"]]);Ao.install=e=>{e.component(Ao.__name,Ao)};const Ro={class:"unknown-node"},$o=/* @__PURE__ */F({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(P(),K("div",Ro,W(e.node.raw),1))}),Eo=/* @__PURE__ */en(/* @__PURE__ */F({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=E(()=>`vmr-container vmr-container-${n.node.name}`),o=Xe(()=>n.customId),l=E(()=>a({text:vt,paragraph:wo,heading:ao,inline_code:xn,link:Lt,image:nt,strong:Ct,emphasis:Pt,strikethrough:Bt,insert:Rt,subscript:wt,superscript:St,checkbox:nn,checkbox_input:nn,hardbreak:zt,math_inline:yt,reference:Nt,list:ho,math_block:kt,table:Ho},o.value));return(o,r)=>(P(),K("div",ue({class:t.value},e.node.attrs),[(P(!0),K(Z,null,ce(e.node.children,(t,o)=>{return P(),ie(ae((r=t.type,l.value[r]||$o)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`,typewriter:n.typewriter,fade:n.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var r}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Eo.install=e=>{e.component(Eo.__name,Eo)};const Fo=["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"],Po=[[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 Ko(e){if(e<=255)return Fo[e];let n=0,t=Po.length-1;for(;n<=t;){const o=n+t>>1,l=Po[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const zo=/[ \t\n\r\f]+/g,Wo=/[\t\n\r\f]| {2,}|^ | $/;let jo=null;const Do=new RegExp("\\p{Script=Arabic}","u"),Vo=new RegExp("\\p{M}","u"),qo=new RegExp("\\p{Nd}","u");function Uo(e){return Do.test(e)}function Xo(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 Yo(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(Xo(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Xo(t))return!0}}return!1}const Zo=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]);function Jo(e){return Yo(e)}function Go(e){return!function(e){const n=dl(e);return null!==n&&(Qo.has(n)||tl.has(n))}(e)&&!function(e){const n=dl(e);return null!==n&&Zo.has(n)}(e)}const Qo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),el=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),nl=/* @__PURE__ */new Set(["'","’"]),tl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),ol=/* @__PURE__ */new Set([":",".","،","؛"]),ll=/* @__PURE__ */new Set(["၏"]),rl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function il(e){if(sl(e))return!0;let n=!1;for(const t of e)if(tl.has(t))n=!0;else if(!n||!Vo.test(t))return!1;return n}function al(e){for(const n of e)if(!Qo.has(n)&&!tl.has(n))return!1;return e.length>0}function ul(e){if(sl(e))return!0;for(const n of e)if(!el.has(n)&&!nl.has(n)&&!Vo.test(n))return!1;return e.length>0}function sl(e){let n=!1;for(const t of e)if("\\"!==t&&!Vo.test(t)){if(!(el.has(t)||tl.has(t)||nl.has(t)))return!1;n=!0}return n}function cl(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 dl(e){if(0===e.length)return null;const n=cl(e,e.length);return e.slice(n)}function fl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Vo.test(e))t--;else{if(!el.has(e)&&!nl.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function ml(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function hl(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 vl(e,n){return e&&null!==n&&ol.has(n)}function pl(e){const n=dl(e);return null!==n&&ll.has(n)}function gl(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 yl(e){let n=e.length;for(;n>0;){const t=cl(e,n),o=e.slice(t,n);if(rl.has(o))return!0;if(!tl.has(o))return!1;n=t}return!1}function kl(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 Nl=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function bl(e){return 1===e.length?e[0]:e.join("")}function Sl(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),bl(t)}function xl(e,n,t,o){if(!Nl.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,u=!1,s=0;for(const c of e){const e=kl(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:bl(i),isWordLike:u,kind:r,start:a}),r=e,i=[c],a=t+s,u=d,s+=c.length):(i.push(c),s+=c.length)}return null!==r&&l.push({text:bl(i),isWordLike:u,kind:r,start:a}),l}function wl(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Ml=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Cl(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Ml.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function _l(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Bl=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Ol=/^[A-Za-z0-9_]+[,:;]*$/,Tl=/[,:;]+$/;function Il(e){for(const n of e)if(qo.test(n))return!0;return!1}function Hl(e){if(0===e.length)return!1;for(const n of e)if(!qo.test(n)&&!Bl.has(n))return!1;return!0}function Ll(e,n,t){var o,l,r;const i=(null===jo&&(jo=new Intl.Segmenter(void 0,{granularity:"word"})),jo);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const w of i.segment(e))for(const e of xl(w.segment,null!=(o=w.isWordLike)&&o,w.index,t)){let t=function(){null!==m[w]&&(s[w]=[hl(u,m,h,w)],m[w]=null),s[w].push(e.text),c[w]=c[w]||e.isWordLike,v[w]=v[w]||i,p[w]=p[w]||N,g[w]=S,y[w]=x,k[w]=vl(p[w],b)};const o="text"===e.kind,r=ml(e.text,e.isWordLike,e.kind),i=Yo(e.text),N=Uo(e.text),b=dl(e.text),S=yl(e.text),x=pl(e.text),w=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[w]&&i&&v[w]&&g[w]||o&&a>0&&"text"===d[w]&&al(e.text)&&v[w]||o&&a>0&&"text"===d[w]&&y[w]?t():o&&a>0&&"text"===d[w]&&e.isWordLike&&N&&k[w]?(t(),c[w]=!0):null!==r&&a>0&&"text"===d[w]&&m[w]===r?h[w]=(null!=(l=h[w])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[w]&&(il(e.text)||"-"===e.text&&c[w])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=N,g[a]=S,y[a]=x,k[a]=vl(N,b),a++)}for(let w=0;w<a;w++)null===m[w]?u[w]=bl(s[w]):u[w]=hl(u,m,h,w);for(let w=1;w<a;w++)"text"===d[w]&&!c[w]&&sl(u[w])&&"text"===d[w-1]&&(u[w-1]+=u[w],c[w-1]=c[w-1]||c[w],u[w]="");const N=Array.from({length:a},()=>null);let b=-1;for(let w=a-1;w>=0;w--){const e=u[w];if(0!==e.length){if("text"===d[w]&&!c[w]&&ul(e)&&b>=0&&"text"===d[b]){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[w],u[w]="";continue}b=w}}for(let w=0;w<a;w++){const e=N[w];null!=e&&(u[w]=Sl(e,u[w]))}let S=0;for(let w=0;w<a;w++){const e=u[w];0!==e.length&&(S!==w&&(u[S]=e,c[S]=c[w],d[S]=d[w],f[S]=f[w]),S++)}u.length=S,c.length=S,d.length=S,f.length=S;const x=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(!Yo(n[r])||!Yo(n[r+1]))continue;const e=fl(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],u=e.isWordLike[r];if("text"===a&&u&&Ol.test(i)){const a=[i];let u=Tl.test(i),s=r+1;for(;u&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&Ol.test(e.texts[s]);){const n=e.texts[s];a.push(n),u=Tl.test(n),s++}n.push(bl(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(u),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 u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&Il(n)&&Hl(n)||(u=!1)}if(u){let i=0;for(let u=0;u<a.length;u++){const s=a[u],c=u<a.length-1?`${s}-`:s;n.push(c),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=c.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&&Hl(i)&&Il(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&Hl(e.texts[u]);)a.push(e.texts[u]),u++;n.push(bl(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-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]),!_l(i))continue;const a=r+1;if(a>=e.len||wl(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!wl(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(bl(u)),t.push(!0),o.push("text"),l.push(s),r=c-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]||!Cl(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!wl(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]=bl(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],u=e.kinds[r],s=e.starts[r];if("glue"===u){const c=[i[0]],d=s;for(r++;r<e.len&&"glue"===e.kinds[r];)c.push(e.texts[r]),r++;const f=bl(c);if(!(r<e.len&&"text"===e.kinds[r])){n.push(f),t.push(!1),o.push("glue"),l.push(d);continue}i[0]=f,i.push(e.texts[r]),a=e.isWordLike[r],u="text",s=d,r++}else r++;if("text"===u)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=bl(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(bl(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:S,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let w=0;w<x.len-1;w++){const e=gl(x.texts[w]);null!==e&&("space"!==x.kinds[w]&&"preserved-space"!==x.kinds[w]||"text"!==x.kinds[w+1]||!Uo(x.texts[w+1])||(x.texts[w]=e.space,x.isWordLike[w]=!1,x.kinds[w]="preserved-space"===x.kinds[w]?"preserved-space":"space",x.texts[w+1]=e.marks+x.texts[w+1],x.starts[w+1]=x.starts[w]+e.space.length))}return x}function Al(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 Rl=null;const $l=/* @__PURE__ */new Map;let El=null;const Fl=new RegExp("\\p{Emoji_Presentation}","u"),Pl=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Kl=null;const zl=/* @__PURE__ */new Map;function Wl(){if(null!==Rl)return Rl;if("undefined"!=typeof OffscreenCanvas)return Rl=new OffscreenCanvas(1,1).getContext("2d"),Rl;if("undefined"!=typeof document)return Rl=document.createElement("canvas").getContext("2d"),Rl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function jl(e,n){let t=n.get(e);return void 0===t&&(t={width:Wl().measureText(e).width,containsCJK:Yo(e)},n.set(e,t)),t}function Dl(){if(null!==El)return El;if("undefined"==typeof navigator)return El={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},El;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 El={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},El}function Vl(){return null===Kl&&(Kl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Kl}function ql(e){return Fl.test(e)||e.includes("️")}function Ul(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=Vl();for(const o of t.segment(e))ql(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Xl(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 Yl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function Zl(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+Dl().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];s?u+n>i?(h(),p(e,o,n)):(u+=n,c=e,d=o+1):p(e,o,n)}s&&c===e&&d===t.length&&(c=e+1,d=0)}let k=0;for(;k<o.length&&(s||(k=Xl(e,k),!(k>=o.length)));){const e=o[k],t=l[k],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(s)if(u+e>i){if(a){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>n&&null!==r[k]){h(),y(k,0),k++;continue}h()}else g(k,e),a&&(f=k+1,m=u-e),k++;else e>n&&null!==r[k]?y(k,0):v(k,e),a&&(f=k+1,m=u-e),k++}return s&&h(),a}let Jl=null;function Gl(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function u(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function s(e,n,t){o=[e],l=n,r=t,i=yl(e),a=el.has(e)}function c(e,n){o.push(e),r=r||n;const t=yl(e);i=1===e.length&&tl.has(e)&&i||t,a=!1}for(const d of(null===Jl&&(Jl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Jl).segment(e)){const e=d.segment,t=Yo(e);0!==o.length?a||Qo.has(e)||tl.has(e)||n.carryCJKAfterClosingQuote&&t&&i?c(e,t):r||t?(u(),s(e,d.index,t)):c(e,t):s(e,d.index,t)}return u(),t}function Ql(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=Yo(e[0].text),r=Go(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],u=Yo(n.text),s=Go(n.text);l&&r?(t.push(n.text),l=l||u,r=s):(i(),t=[n.text],o=n.start,l=u,r=s)}return i(),n}function er(e,n,t,o){const l=Dl(),{cache:r,emojiCorrection:i}=function(e,n){Wl().font=e;const t=function(e){let n=$l.get(e);return n||(n=/* @__PURE__ */new Map,$l.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=zl.get(e);if(void 0!==t)return t;const o=Wl();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 zl.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,Pl.test(a)));var a;const u=Ul("-",jl("-",r),i),s=8*Ul(" ",jl(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const c=[],d=[],f=[],m=[];let h=e.chunks.length<=1;const v=t?[]:null,p=[],g=t?[]:null,y=Array.from({length:e.len});function k(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(h=!1),c.push(n),d.push(t),f.push(o),m.push(l),null==v||v.push(r),p.push(i),null!==g&&g.push(e)}function N(e,n,t,o,a){const u=jl(e,r),s=Ul(e,u,i),c="space"===n||"preserved-space"===n||"zero-width-break"===n?0:s,d="space"===n||"zero-width-break"===n?0:s;if(a&&o&&e.length>1){let o="sum-graphemes";Hl(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=Vl(),i=[];for(const c of r.segment(e))i.push(c.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=jl(n,t);e.push(Ul(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=Ul(n,jl(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=jl(i,t);e.push(Ul(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let u="",s=0;for(const c of i){u+=c;const e=Ul(u,jl(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,u,r,i,o);return void k(e,s,c,d,n,t,a)}k(e,s,c,d,n,t,null)}for(let x=0;x<e.len;x++){y[x]=c.length;const n=e.texts[x],t=e.isWordLike[x],i=e.kinds[x],a=e.starts[x];if("soft-hyphen"===i){k(n,0,u,u,i,a,null);continue}if("hard-break"===i){k(n,0,0,0,i,a,null);continue}if("tab"===i){k(n,0,0,0,i,a,null);continue}const s=jl(n,r);if("text"===i&&s.containsCJK){const e=Gl(n,l),r="keep-all"===o?Ql(e):e;for(let n=0;n<r.length;n++){const e=r[n];N(e.text,"text",a+e.start,t,"keep-all"===o||!Yo(e.text))}continue}N(n,i,a,t,!0)}const b=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,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,y,c.length),S=null===v?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 s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=Ko(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=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,v);return null!==g?{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:S,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:b,segments:g}:{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:S,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:b}}function nr(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return er(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(!Wo.test(e))return e;let n=e.replace(zo," ");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,u=!1,s=!1;function c(){null!==r&&(n.push(bl(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let d=0;d<e.len;d++){const f=e.texts[d],m=e.kinds[d],h=e.isWordLike[d],v=e.starts[d];if("text"===m){const e=Jo(f),n=Go(f);if(null!==r&&u&&s){r.push(f),i=i||h,u=u||e,s=n;continue}c(),r=[f],i=h,a=v,u=e,s=n;continue}c(),n.push(f),t.push(h),o.push(m),l.push(v)}return c(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(Ll(r,n,l)):Ll(r,n,l);return a({normalized:r,chunks:Al(i,l)},i)}(e,Dl(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const tr="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",or=(()=>{const e=globalThis;if(e[tr])return e[tr];const n={configs:{},controllers:{},revision:R(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[tr]=n,n})();let lr=null;const rr=or.revision;function ir(e){var n;return e&&null!=(n=or.configs[e])?n:null}function ar(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function ur(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function sr(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!ur(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 cr(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=lr)return lr;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return lr=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),lr}catch(n){return lr=!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=or.blockEstimateCache.get(i);if(a)return or.blockEstimateCache.delete(i),or.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const u=null!=(l=t.whiteSpace)?l:"pre-wrap",s=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=or.preparedCache.get(o);if(l)return or.preparedCache.delete(o),or.preparedCache.set(o,l),l.prepared;const r=nr(e,n,{whiteSpace:t});for(or.preparedCache.set(o,{prepared:r});or.preparedCache.size>240;){const e=or.preparedCache.keys().next().value;if(!e)break;or.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?Zl(e,n):function(e,n){if(e.simpleLineWalkFastPath)return Zl(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:s}=e;if(0===t.length||0===s.length)return 0;const c=Dl(),d=c.lineFitEpsilon,f=n+d;let m=0,h=0,v=!1,p=0,g=0,y=-1,k=0,N=0,b=null;function S(){y=-1,k=0,N=0,b=null}function x(e=p,n=g,t=h){m++,h=0,v=!1,S()}function w(e,n){v=!0,p=e+1,g=0,h=n}function M(e,n,t){v=!0,p=e,g=n+1,h=t}function C(e,n){v?(h+=n,p=e+1,g=0):w(e,n)}function _(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,k=h-r+i,N=h-r+a,b=e}function B(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];v?h+n>f?(x(),M(e,o,n)):(h+=n,p=e,g=o+1):M(e,o,n)}v&&p===e&&g===t.length&&(p=e+1,g=0)}function O(e){if("soft-hyphen"!==b)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,h,n,d,a);return 0!==o&&(h=l,p=e,g=o,S(),o===t.length?(p=e+1,g=0,!0):(x(e,o,l+a),B(e,o),!0))}function T(e){m++,S()}for(let I=0;I<s.length;I++){const e=s[I];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}v=!1,h=0,e.startSegmentIndex,p=e.startSegmentIndex,g=0,S();let d=e.startSegmentIndex;for(;d<e.endSegmentIndex;){const e=r[d],s="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?Yl(h,u):t[d];if("soft-hyphen"!==e)if(v){if(h+m>f){const t=h+("tab"===e?0:o[d]),r=h+("tab"===e?m:l[d]);if("soft-hyphen"===b&&c.preferEarlySoftHyphenBreak&&k<=f){x(y,0,N);continue}if("soft-hyphen"===b&&O(d)){d++;continue}if(s&&t<=f){C(d,m),x(d+1,0,r),d++;continue}if(y>=0&&k<=f){if(p>y||p===y&&g>0){x();continue}const e=y;x(e,0,N),d=e;continue}if(m>n&&null!==i[d]){x(),B(d,0),d++;continue}x();continue}C(d,m),_(e,s,d,m),d++}else m>n&&null!==i[d]?B(d,0):w(d,m),_(e,s,d,m),d++;else v&&(p=d+1,g=0,y=d+1,k=h+a,N=h+a,b=e),d++}if(v){const n=y===e.consumedEndSegmentIndex?N:h;x(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(e,n);return{lineCount:o,height:o*t}}(s,Math.max(24,r-t.widthAdjustment),t.lineHeight),d=Math.max(t.lineHeight,c.height),f=Math.max(t.lineHeight,Math.round(d+t.wrapperOverhead));for(or.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});or.blockEstimateCache.size>4e3;){const e=or.blockEstimateCache.keys().next().value;if(!e)break;or.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function dr(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=sr(e.children);return o&&t.paragraph?cr(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=sr(e.children),r=t.headings[o];return l&&r?cr(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=sr(null==(l=r[0])?void 0:l.children);return i?cr(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=dr(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 fr(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function mr(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;return e.diff?Math.max(fr(String(null!=(n=e.originalCode)?n:"")),fr(String(null!=(t=e.updatedCode)?t:"")),fr(String(null!=(o=e.code)?o:""))):fr(function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(e.code,!0===e.loading))}(e),i=Boolean(e.diff);let a=0,u=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);u="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),u=Number.POSITIVE_INFINITY);const s=Math.max(1,Math.min(a,u));return{kind:"code-block",height:Math.round(s+(l?40:0)),contentHeight:s,rendererKind:o}}function hr(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function vr(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=ar(o.lineHeight,1.5*ar(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:hr(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const pr=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function gr(e,n={}){var t;const o={},l=new Set(null!=(t=n.omit)?t:[]);if(!e||"object"!=typeof e)return o;const r=Object.getOwnPropertyDescriptors(e);for(const[i,a]of Object.entries(r))pr.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const yr=!1;function kr(){return yr}function Nr(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function br(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const Sr=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function xr(){return $(Sr,null)}function wr(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Mr(e,n,t,o=22){const l=String(null!=e?e:"");if(!l)return t;const r=Math.max(18,Math.floor(Math.max(320,n)/8)),i=l.split(/\r?\n/).length,a=Math.ceil(l.length/r),u=Math.max(1,i,a);return Math.max(t,Math.ceil(u*o+12))}function Cr(e,n,t){return Math.min(Math.max(e,n),t)}const _r=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Br=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],Or=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),Tr=["raw","content","code","originalCode","updatedCode"],Ir=/* @__PURE__ */new WeakMap,Hr=/* @__PURE__ */new WeakMap;let Lr=1;function Ar(){return"undefined"!=typeof performance?performance.now():Date.now()}function Rr(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function $r(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=Ir.get(n);return t||(t=Lr++,Ir.set(n,t)),String(t)}function Er(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:$r(n),customMarkdownIt:$r(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:$r(e.validateLink),preTransformTokens:$r(e.preTransformTokens),postTransformTokens:$r(e.postTransformTokens),postTransformNodes:$r(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function Fr(e){let n=e.length;for(;n>0&&10===e.charCodeAt(n-1);)n-=1;const t=e.lastIndexOf("\n",n-1)+1;return e.slice(t,n).trim()}function Pr(e){const n=Kr(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function Kr(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function zr(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Wr(e){const n=String(null!=e?e:"");return`${n.length}:${zr(n)}`}function jr(e,n=/* @__PURE__ */new WeakMap,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){return e.length<=8192?Wr(e):`${e.length}:${zr(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${$r(e)}`;if("object"!=typeof e)return typeof e;const o=e,l=n.get(o);if(l)return`cycle:${l}`;if(t>=6)return`object:${$r(o)}`;const r=$r(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>jr(e,n,t+1)).join(",")}`}if("object"==typeof e){const o=e,l=Object.keys(o).sort(),r=l.slice(0,80);return`o:${l.length}:${r.sort().map(e=>`${e}:${jr(o[e],n,t+1)}`).join(";")}`}return typeof e}function Dr(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function Vr(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>Dr(e)?Xr(e,n,t+1):Vr(e,n,t+1)).join(",")}`:Dr(e)?Xr(e,n,t):jr(e,n,t)}function qr(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!Tr.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${Wr(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${$r(l)}`:Or.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${Vr(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${$r(l)}`:""}).filter(Boolean).join(";")}function Ur(e){return Tr.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${Wr(t)}`:""}).filter(Boolean).join(";")}function Xr(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Hr.get(e);if(o)return o;const l=e,r=n.get(l);if(r)return`node-cycle:${r}`;if(t>=6)return`node:${e.type}:${$r(l)}`;const i=$r(l);n.set(l,i);const a=function(e,n,t){const o=e,l=Array.isArray(o.children)?o.children:[],r=l.length?l.slice(0,200).map(e=>Xr(e,n,t+1)).join("|"):"";return[e.type,Ur(o),qr(o,n,t),l.length,r].join(":")}(e,n,t);return Hr.set(l,a),a}function Yr(e,n){return Xr(e)===Xr(n)}function Zr(e,n,t){const o=Ar(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Ar()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Jr(e,n,t){return Zr(n,t,()=>Xr(e))}function Gr(e,n,t){return Jr(e,t,"stabilizeSignatureMs")===Jr(n,t,"stabilizeSignatureMs")}function Qr(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ei(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function ni(e,n){return e.length===n.length&&e===n}function ti(e,n,t=0){if(t>=4)return null;if(e.type!==n.type)return!1;const o=e,l=n,r=Object.keys(o).filter(e=>"type"!==e&&"children"!==e).sort(),i=Object.keys(l).filter(e=>"type"!==e&&"children"!==e).sort();if(r.length!==i.length)return!1;for(let c=0;c<r.length;c++){const e=r[c];if(e!==i[c])return!1;const n=o[e],t=l[e];if(typeof n!=typeof t)return!1;if("string"!=typeof n){if("number"!=typeof n&&"boolean"!=typeof n&&null!=n)return null;if(!Object.is(n,t))return!1}else{if("string"!=typeof t)return!1;if(!ni(n,t))return!1}}const a=Object.prototype.hasOwnProperty.call(o,"children");if(a!==Object.prototype.hasOwnProperty.call(l,"children"))return!1;if(!a)return!0;const u=o.children,s=l.children;if(!Array.isArray(u)||!Array.isArray(s))return null;if(u.length!==s.length)return!1;for(let c=0;c<u.length;c++){const e=u[c],n=s[c];if(!Dr(e)||!Dr(n))return null;const o=ti(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function oi(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=ti(e,n);return null!=t?t:Yr(e,n)}function li(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Zr(t,"stabilizeSignatureMs",()=>{o=ti(e,n)}),null!=o?o:Gr(e,n,t)}function ri(e,n){const t={};for(const o of _r){const l=e[o],r=null==n?void 0:n[o];"number"==typeof l&&(t[o]=l-("number"==typeof r?r:0))}return t}function ii(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:E(()=>!1),i=X(n.renderContent.value);let s,d=[],f="",m="",h="",v=0,p=0,y=Ar();function k(){s&&(clearTimeout(s),s=void 0)}function N(){k();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=Ar()}Y([n.renderContent,n.effectiveFinal,r],([n,t,o])=>{i.value!==n&&(!o||t||function(e,n){if(!e&&n)return!0;if(n.length<=80)return!0;if(n.length<e.length||!n.startsWith(e))return!0;const t=n.slice(e.length);return!!t&&(!!Pr(Fr(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=Fr(e);if(Pr(n))return!1;const t=Kr(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?N():function(){if(p+=1,s)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(Ar()-y));n<=0?N():s=setTimeout(N,n)}())},{flush:"sync",immediate:!0}),ve(k);const b=E(()=>{var t,o,l,r;return O(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||je(t)||H.has(t)||g.has(t)?"":t}).filter(Boolean)))}),S=E(()=>{const{key:e,tags:t}=T(b.value);if(!e)return o;const r=l.get(e);if(r)return r;const i=B(n.instanceMsgId,{customHtmlTags:t});return l.set(e,i),i}),x=E(()=>{const n=S.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),w=E(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=b.value,s=null!=r,c=i.length>0;return s||c||null==l.streamParse?a(a(u(a({},l),{streamParse:null==(o=l.streamParse)||o}),s?{final:r}:{}),c?{customHtmlTags:i}:{}):l}),M=E(()=>{var e;return new Set((null!=(e=w.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),C=E(()=>Er(w.value,x.value,e.customMarkdownIt,{includeFinal:!0})),_=E(()=>Er(w.value,x.value,e.customMarkdownIt,{includeFinal:!1}));Y([C,_],([e,n],[t,o])=>{t&&(e===t&&n===o||(N(),n!==o&&(d=[],h="")))},{flush:"sync"});const L=E(()=>{var t,o,l,r,s,c,g,y;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",fe(e.nodes.slice());const k=i.value;if(!k)return d=[],h="",[];const N=n.debugPerformanceEnabled.value,b=N?Ar():0,S=x.value,M=C.value,B=_.value;f&&M!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(S),m&&B!==m&&(d=[],h="");const O=d.length>0&&k.startsWith(h)&&B===m,T=N?Rr(S):null,H=N?{}:void 0,L=H?u(a({},w.value),{__timing:H}):w.value,A=I(k,S,L),R=N?Ar():0,$=N?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let E,F=N?Qr(A.length):void 0,P=0,K=0;if(O){const e=N?Ar():0;if($){const e=function(e,n,t){if(!n.length)return{nodes:e,metrics:Qr(e.length)};const o=function(e,n,t){const o=Math.min(e.length,n.length);for(let l=0;l<o;l++)if(!li(n[l],e[l],t))return l;return e.length===n.length?-1:o}(e,n,t);if(o<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:o,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const l=e.slice();let r=o;for(let i=0;i<o;i++)l[i]=n[i];for(let i=o;i<e.length;i++){const o=n[i],a=e[i];o&&Gr(o,a,t)&&(l[i]=o,r+=1)}return{nodes:l,metrics:{reusedNodeCount:r,dirtyStartIndex:o,stablePrefixNodeCount:o,dirtyTailNodeCount:ei(o,e,n)}}}(A,d,$);E=e.nodes,F=e.metrics}else{const e=function(e,n){if(!n.length)return{nodes:e,metrics:Qr(e.length)};const t=function(e,n){const t=Math.min(e.length,n.length);for(let o=0;o<t;o++)if(!oi(n[o],e[o]))return o;return e.length===n.length?-1:t}(e,n);if(t<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:t,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const o=e.slice();let l=t;for(let r=0;r<t;r++)o[r]=n[r];for(let r=t;r<e.length;r++){const t=n[r],i=e[r];t&&Yr(t,i)&&(o[r]=t,l+=1)}return{nodes:o,metrics:{reusedNodeCount:l,dirtyStartIndex:t,stablePrefixNodeCount:t,dirtyTailNodeCount:ei(t,e,n)}}}(A,d);E=e.nodes,F=e.metrics}P=N?Ar()-e:0,K=null==(null==F?void 0:F.dirtyStartIndex)||F.dirtyStartIndex<0?E.length:F.dirtyStartIndex}else E=A;$?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Zr(n,"primeSignatureMs",()=>Xr(e[o]))}(E,$,K):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Xr(e[t])}(E,K);const z=N?Ar()-R:0;if(v+=1,h=k,f=M,m=B,d=E,N){const e=Rr(S),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(o=null==T?void 0:T.total)?o:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Ar()-b),nodes:E.length,contentLength:k.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:z,signatureMs:null!=(l=null==$?void 0:$.signatureMs)?l:0,stabilizeSignatureMs:null!=(r=null==$?void 0:$.stabilizeSignatureMs)?r:0,primeSignatureMs:null!=(s=null==$?void 0:$.primeSignatureMs)?s:0,signatureCallCount:null!=(c=null==$?void 0:$.signatureCallCount)?c:0,stabilizeSignatureCallCount:null!=(g=null==$?void 0:$.stabilizeSignatureCallCount)?g:0,primeSignatureCallCount:null!=(y=null==$?void 0:$.primeSignatureCallCount)?y:0,stabilizeMs:P},null!=F?F:{}),H?Object.fromEntries(Br.map(e=>{var n;return[e,null!=(n=H[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:ri(e,T),streamStats:e}:{}))}return fe(E)});return{effectiveCustomHtmlTags:b,effectiveCustomHtmlTagsSet:M,mdBase:S,mdInstance:x,mergedParseOptions:w,parsedNodes:L}}function ai(e){const{isClient:n}=e,t=X(/* @__PURE__ */new Set),o=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;function i(e){if(!n)return;const t=r.get(e);null!=t&&(window.clearTimeout(t),r.delete(e))}function a(){if(n)for(const e of r.values())window.clearTimeout(e);r.clear()}function u(){t.value=/* @__PURE__ */new Set}return{visibleNodeIndices:t,nodeVisibilityHandles:o,nodeVisibilityWatchStops:l,nodeVisibilityFallbackTimers:r,clearVisibilityFallback:i,clearAllVisibilityFallbacks:a,markNodeVisible:function(n,o=!0){var l;o&&i(n),function(n,o){if(null!=(r=null==(l=e.shouldTrackVisibleNodeIndices)?void 0:l.call(e))&&!r)return;var l,r;const i=t.value,a=i.has(n);if(o){if(a)return;const e=new Set(i);return e.add(n),void(t.value=e)}if(!a)return;const u=new Set(i);u.delete(n),t.value=u}(n,o),o&&(null==(l=e.onNodeMarkedVisible)||l.call(e,n))},resetNodeVisibleState:u,cleanupNodeVisibility:function(n){var a;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[e,t]of l.entries())e<n||(t(),l.delete(e));for(const[t,l]of o.entries())t<n||(l.destroy(),o.delete(t),i(t),null==(a=e.onNodeVisibilityCleaned)||a.call(e,t));for(const e of Array.from(r.keys()))e<n||i(e);if(!t.value.size)return;const u=/* @__PURE__ */new Set;for(const e of t.value)e<n&&u.add(e);t.value=u},destroyNodeVisibilityState:function(){u();for(const e of l.values())e();l.clear();for(const e of o.values())e.destroy();o.clear(),a()}}}function ui(e={}){const n=X(""),t=X(""),o=X(!1),l=we(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=E(()=>Math.max(0,n.value.length-t.value.length)),u=E(()=>0===a.value),s=E(()=>o.value&&u.value);return pe()&&ve(()=>{i(),l.destroy()}),{source:n,visible:t,done:o,final:s,caughtUp:u,pendingChars:a,enqueue:e=>l.enqueue(e),finish:e=>l.finish(e),flush:()=>l.flush(),reset:e=>l.reset(e),pause:()=>l.pause(),resume:()=>l.resume()}}const si=/auto|scroll|overlay/i;function ci(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return si.test(n)||si.test(t)}function di(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}const fi={class:"m-0 p-0"},mi=["data-probe"],hi=/* @__PURE__ */en(/* @__PURE__ */F(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(P(),K("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[z("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(wo),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),z("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[z("ul",fi,[V(q(mo),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),z("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(ho),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(P(),K(Z,null,ce(6,n=>z("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(ao),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,mi)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),vi=F({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return He(null!=(t=Le(e.estimatedPreviewHeightPx))?t:Ae(String(null!=(n=e.node.code)?n:"")))});return()=>j("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?j("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)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("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},()=>j("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,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),pi=F({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return Re(null!=(t=Le(e.estimatedPreviewHeightPx))?t:$e(String(null!=(n=e.node.code)?n:"")))});return()=>j("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?j("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)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("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},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("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)"}},[j("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"}})])])}}),gi={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function yi(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const ki=["data-custom-id"],Ni=["data-node-index","data-node-type"],bi="typewriter-simple-cursor-target",Si=/* @__PURE__ */en(/* @__PURE__ */F(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t,r=Q(),i=$("markstreamNestedRendererProps",void 0);function c(e){var n,t;const l=o[e];return function(e){const n=null==r?void 0:r.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}(e)?l:null!=(t=null==(n=null==i?void 0:i.value)?void 0:n[e])?t:l}const d=kr(),f=E(()=>{return"chat"===(e=c("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),m=E(()=>br(c("typewriter"))),h=E(()=>"off"!==m.value),v=E(()=>"minimal"===c("domMode")?"minimal":"full"),p=E(()=>{return!0===(e={mode:f.value,codeRenderer:c("codeRenderer"),renderCodeBlocksAsPre:c("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre?"pre":"pre"===e.codeRenderer||"shiki"===e.codeRenderer||"monaco"===e.codeRenderer?e.codeRenderer:!1===e.renderCodeBlocksAsPre||"docs"===e.mode?"monaco":"pre";var e}),g=E(()=>gi[f.value]),y=E(()=>{var e;return null!=(e=c("showTooltips"))?e:g.value.showTooltips}),k=E(()=>{var e;return null!=(e=c("fade"))?e:g.value.fade}),N=E(()=>{var e;return null!=(e=c("batchRendering"))?e:g.value.batchRendering}),b=E(()=>{var e;return null!=(e=c("initialRenderBatchSize"))?e:g.value.initialRenderBatchSize}),S=E(()=>{var e;return null!=(e=c("renderBatchSize"))?e:g.value.renderBatchSize}),x=E(()=>{var e;return null!=(e=c("renderBatchDelay"))?e:g.value.renderBatchDelay}),w=E(()=>{var e;return null!=(e=c("renderBatchBudgetMs"))?e:g.value.renderBatchBudgetMs}),M=E(()=>{var e;return null!=(e=c("renderBatchIdleTimeoutMs"))?e:g.value.renderBatchIdleTimeoutMs}),B=E(()=>{var e;return null!=(e=c("deferNodesUntilVisible"))?e:g.value.deferNodesUntilVisible}),O=E(()=>{var e;return null!=(e=c("maxLiveNodes"))?e:g.value.maxLiveNodes}),T=E(()=>{var e;return null!=(e=c("liveNodeBuffer"))?e:g.value.liveNodeBuffer}),I=E(()=>{var e;return null!=(e=c("nodeVirtual"))?e:g.value.nodeVirtual}),H={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return c("parseOptions")},get customMarkdownIt(){return c("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return c("customHtmlTags")},get mode(){return c("mode")},get domMode(){return v.value},get htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},get codeBlockStream(){return c("codeBlockStream")},get codeBlockDarkTheme(){return c("codeBlockDarkTheme")},get codeBlockLightTheme(){return c("codeBlockLightTheme")},get codeBlockMonacoOptions(){return c("codeBlockMonacoOptions")},get codeRenderer(){return c("codeRenderer")},get renderCodeBlocksAsPre(){return c("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return c("codeBlockMinWidth")},get codeBlockMaxWidth(){return c("codeBlockMaxWidth")},get codeBlockProps(){return c("codeBlockProps")},get mermaidProps(){return c("mermaidProps")},get d2Props(){return c("d2Props")},get infographicProps(){return c("infographicProps")},get showTooltips(){return y.value},get themes(){return c("themes")},get langs(){return c("langs")},get isDark(){return c("isDark")},get customId(){return c("customId")},get indexKey(){return o.indexKey},get typewriter(){return c("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return c("smoothStreamingOptions")},get parseCoalesceMs(){return c("parseCoalesceMs")},get fade(){return k.value},get batchRendering(){return N.value},get initialRenderBatchSize(){return b.value},get renderBatchSize(){return S.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return w.value},get renderBatchIdleTimeoutMs(){return M.value},get deferNodesUntilVisible(){return B.value},get maxLiveNodes(){return O.value},get liveNodeBuffer(){return T.value},get nodeVirtual(){return I.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function A(e){l("height-change",e)}function R(e){l("virtual-state-change",e)}function F(e){l("anchor-change",e)}const z=X(),W=X(null),j=X(null),V=X(null),J=he({1:null,2:null,3:null,4:null,5:null,6:null}),ne=X(!1),de=/* @__PURE__ */new Map,ve=X(0),pe=X(0),ke=X({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Ne(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return be("function"==typeof t?t():t)}function be(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?be(e.value):"object"==typeof e&&"$el"in e?be(e.$el):null:null}const{isClient:Se,renderAsFragment:xe,debugPerformanceEnabled:we,resolvedShowTooltips:Oe,resolvedHtmlPolicy:Te,inheritedSmoothStreaming:Ie,ownsTypewriterCursor:Ee}=function(e){const n="undefined"!=typeof window,t=U(),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamTypewriterCursor",void 0),r=$("markstreamSmoothStreaming",void 0),i=E(()=>!0===e.renderAsFragment),a=E(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=E(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=E(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=E(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(H),{resolveViewportRoot:Fe,resolveScrollContainer:Pe,isReverseFlexScrollRoot:Ke,getNormalizedScrollTop:ze,getOffsetTopWithinRoot:We}=function(e,n){function t(){var e,t;return null!=(t=null==(e=n.scrollRoot)?void 0:e.call(n))?t:null}function o(n){if("undefined"==typeof window)return null;const o=t();if(o)return o;const l=null!=n?n:e.value;if(!l)return null;const r=l.ownerDocument||document,i=r.scrollingElement||r.documentElement;let a=l;for(;a&&a!==r.body&&a!==i;){if(ci(window.getComputedStyle(a))&&di(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(z,{isClient:Se,scrollRoot:Ne});me("markstreamShowTooltips",Oe),me("markstreamHtmlPolicy",Te),me("markstreamTypewriter",h),me("markstreamFade",E(()=>!1!==H.fade)),me("markstreamTypewriterCursor",E(()=>!0)),me("markstreamTextStreamState",de),me("markstreamStreamVersion",ve),me("markstreamParseOptions",E(()=>H.parseOptions)),me("markstreamCustomMarkdownIt",E(()=>H.customMarkdownIt));const{smoothStreamingEnabled:De,renderContent:Ve,requestedFinal:qe,effectiveFinal:Ue}=function(e,n){const t=ui(e.smoothStreamingOptions),o=E(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||"off"!==br(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=X(!n.isClient||!0===e.smoothStreaming);ge(()=>{l.value=!0});const r=E(()=>l.value&&o.value),i=E(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),a=E(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),u=E(()=>{const e=a.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return Y([()=>e.content,()=>e.nodes,r,a],([e,n,o,l])=>{if(null==n?void 0:n.length)return void t.reset("");const r=null!=e?e:"";if(!o)return t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;r?r===i||(r.startsWith(i)?t.enqueue(r.slice(i.length)):t.reset(r)):t.reset(""),l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:a,effectiveFinal:u}}(H,{isClient:Se,inheritedSmoothStreaming:Ie}),Ye=!0===qe.value;me("markstreamSmoothStreaming",De);const Ze=X(!1);let Je="",Ge=!1,Qe=null;function en(){Se&&null!=Qe&&(window.clearTimeout(Qe),Qe=null)}function tn(){Ze.value=!1,en()}function ln(e,n){if(!we.value)return;const t=function(){if(!we.value)return null;const e=dn(rn),n=dn(un),t=Math.max(cn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=rn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return rn.clear(),un.clear(),cn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}Y([Ve,()=>o.nodes,Ue],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(tn(),Je=l,void(Ge=!0)):Ge?(Je&&l.length>Je.length&&l.startsWith(Je)?(Ze.value=!0,Se&&(en(),Qe=window.setTimeout(()=>{var e;Qe=null,!0===Ue.value||(null==(e=o.nodes)?void 0:e.length)||(ta(),Ze.value=!1,la())},1200))):(l.length<Je.length||!l.startsWith(Je))&&tn(),void(Je=l)):(Je=l,void(Ge=!0))},{flush:"sync",immediate:!0});const rn=/* @__PURE__ */new Map,un=/* @__PURE__ */new Map;let sn=!1,cn=0;function dn(e){let n=0;for(const t of e.values())n+=t;return n}function fn(){cn=Math.max(cn,dn(un)),un.clear(),sn=!1}function hn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function vn(e){var n,t;we.value&&(rn.set(e,(null!=(n=rn.get(e))?n:0)+1),un.set(e,(null!=(t=un.get(e))?t:0)+1),function(e){const n=function(){if(!Se||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>hn(n),0):queueMicrotask(()=>hn(n)):window.requestAnimationFrame(()=>hn(n))))}(e),sn||(sn=!0,Se&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(fn):"function"!=typeof queueMicrotask?setTimeout(fn,0):queueMicrotask(fn)))}function pn(e,n){return vn(e),n()}const gn=H.customId?`renderer-${H.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,yn=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(gn),kn=E(()=>`${gn}:${ve.value}`);me(Sr,yn);const bn=Xe(()=>H.customId),{effectiveCustomHtmlTagsSet:Sn,mergedParseOptions:wn,parsedNodes:Mn}=ii(H,{instanceMsgId:gn,renderContent:Ve,effectiveFinal:Ue,smoothStreamingEnabled:De,debugPerformanceEnabled:we,customComponentsMap:bn,logPerf:ln});Y(Mn,()=>{yn.clear(),ve.value+=1},{immediate:!0});const Cn=E(()=>({customId:H.customId,customHtmlTags:wn.value.customHtmlTags,parseOptions:H.parseOptions,customMarkdownIt:H.customMarkdownIt,htmlPolicy:Te.value,viewportPriority:H.viewportPriority,mode:f.value,domMode:H.domMode,codeRenderer:p.value,codeBlockStream:H.codeBlockStream,codeBlockDarkTheme:H.codeBlockDarkTheme,codeBlockLightTheme:H.codeBlockLightTheme,codeBlockMonacoOptions:H.codeBlockMonacoOptions,renderCodeBlocksAsPre:H.renderCodeBlocksAsPre,codeBlockMinWidth:H.codeBlockMinWidth,codeBlockMaxWidth:H.codeBlockMaxWidth,codeBlockProps:H.codeBlockProps,mermaidProps:H.mermaidProps,d2Props:H.d2Props,infographicProps:H.infographicProps,showTooltips:Oe.value,themes:H.themes,langs:H.langs,isDark:H.isDark,typewriter:h.value,smoothStreamingOptions:H.smoothStreamingOptions,parseCoalesceMs:H.parseCoalesceMs,fade:H.fade}));me("markstreamNestedRendererProps",Cn);const _n=E(()=>Mn.value),Bn=E(()=>Mn.value.length),On=X(null),Tn=X(null),In=X(null),Hn=X(null),Ln=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),An=!Ln&&H.customId?ir(H.customId):null,Rn=E(()=>An?(rr.value,ir(H.customId)):null),$n=E(()=>{var e;return Boolean(!xe.value&&H.customId&&!Ln&&(null==(e=Rn.value)?void 0:e.enabled))}),En=E(()=>Boolean(Se&&$n.value)),Fn=E(()=>{var e;return Boolean(!xe.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),Pn=E(()=>Fn.value),Kn=X(!1);ge(()=>{Kn.value=!0});const zn=E(()=>Boolean(Se&&Fn.value));me("markstreamHostScrollManaged",zn);const Wn=E(()=>Boolean(Kn.value&&zn.value)),jn=E(()=>En.value||zn.value),Dn=E(()=>En.value||Wn.value),Vn=E(()=>{var e;return jn.value&&!1!==(null==(e=Rn.value)?void 0:e.textEstimation)}),qn=E(()=>{var e;return jn.value&&!1!==(null==(e=Rn.value)?void 0:e.codeBlockEstimation)});function Un(){const e=pe.value||pn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const Xn=E(()=>{const e=Un();return e>0?Math.max(1,Math.round(e)):640}),Yn=E(()=>{var e;return Math.max(1,null!=(e=H.maxLiveNodes)?e:320)}),Zn=E(()=>{var e;return!xe.value&&!1!==H.nodeVirtual&&!((null!=(e=H.maxLiveNodes)?e:0)<=0)&&(!0===H.nodeVirtual?Mn.value.length>0:Mn.value.length>Yn.value)}),Jn=E(()=>Zn.value||En.value||zn.value),Gn=E(()=>!1!==H.viewportPriority&&!ne.value),Qn=E(()=>{var e;return!(xe.value||!1===H.deferNodesUntilVisible||(null!=(e=H.maxLiveNodes)?e:0)<=0||Zn.value||Mn.value.length>900||!1===H.viewportPriority)}),et=po(e=>{var n;return Fe(null!=(n=null!=e?e:z.value)?n:null)},Gn),{requestFrame:tt,cancelFrame:ot,hasIdleCallback:lt,isTestEnv:rt}=function(e){const n=e.isClient&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,t=e.isClient&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,o=e.isClient&&"function"==typeof window.requestIdleCallback,l=function(){var e;if("undefined"==typeof globalThis||!("process"in globalThis))return;const n=null==(e=Object.getOwnPropertyDescriptor(globalThis,"process"))?void 0:e.value;return null==n?void 0:n.env}();return{requestFrame:n,cancelFrame:t,hasIdleCallback:o,isTestEnv:"test"===(null==l?void 0:l.NODE_ENV)}}({isClient:Se}),{resolvedBatchSize:it,resolvedInitialBatch:at,batchingEnabled:ut,incrementalRenderingActive:st,renderedCount:ct,previousRenderContext:ft,adaptiveBatchSize:mt,previousBatchConfig:ht}=function(e,n){var t;const o=E(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=E(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=E(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=X(0),a=X({key:e.indexKey,total:0}),u=X(Math.max(1,o.value||1)),s=E(()=>{var n;return r.value&&(null!=(n=e.maxLiveNodes)?n:0)<=0}),c=X({batchSize:o.value,initial:l.value,delay:null!=(t=e.renderBatchDelay)?t:16,enabled:s.value});return{resolvedBatchSize:o,resolvedInitialBatch:l,batchingEnabled:r,incrementalRenderingActive:s,renderedCount:i,previousRenderContext:a,adaptiveBatchSize:u,previousBatchConfig:c}}(H,{isClient:Se,isTestEnv:rt,renderAsFragment:xe}),bt=E(()=>{var e;return!xe.value&&!1!==H.batchRendering&&it.value>0&&!rt&&(null!=(e=H.maxLiveNodes)?e:0)<=0}),xt=/* @__PURE__ */new Map,Mt=/* @__PURE__ */new Map,_t=/* @__PURE__ */new WeakMap;let Ot=null;const Tt=/* @__PURE__ */new WeakMap,It=/* @__PURE__ */new Map,Ht=X(0),At=E(()=>(Ht.value,Array.from(xt.entries()).sort((e,n)=>e[0]-n[0]))),$t=X(null),Ft=X(null);let Kt,Wt=null,jt=0,Dt=null;function Vt(){Kt.markFallbackHeightPrefixDirty()}function qt(e){return Kt.getFallbackNodeHeight(e)}function Ut(e,n){return Kt.estimateHeightRange(e,n)}function Xt(e){return Kt.estimateIndexForOffset(e)}const{activeRestoreAnchor:Zt,getRelativeScrollTopWithinContainer:Jt,setRelativeScrollTopWithinContainer:Gt,resolveAnchorOffset:eo,clearRestoreReconcile:to,scheduleRestoreReconcile:oo,captureRestoreAnchor:ro,restoreAnchor:io,getAnchorDrift:uo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=X(null);let v=null,p=[];function g(){const e=i(),n=t.value;if(!e||!n)return null;const o=e.ownerDocument||n.ownerDocument||document;if(e===o.documentElement||e===o.body||e===o.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,a(e,o,!1)-u(n,e))}function y(e){var n;const o=i(),l=t.value;if(!o||!l)return;const r=Math.max(0,e),c=o.ownerDocument||l.ownerDocument||document,d=c.defaultView||("undefined"!=typeof window?window:null);if(o===c.documentElement||o===c.body||o===c.scrollingElement){const e=a(o,c,!0)+l.getBoundingClientRect().top;return void(null==(n=null==d?void 0:d.scrollTo)||n.call(d,0,Math.max(0,e+r)))}Nr(o,c,u(l,o)+r,{isReverseFlexScrollRoot:e=>{var n;return null!=(n=null==s?void 0:s(e))&&n},getNormalizedScrollTop:a})}function k(e){const n=o.value,t=m(e.nodeIndex,0,Math.max(0,n-1));return d(0,t)+Math.max(0,e.offsetWithinNodePx)}function N(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function b(e){const n=k(e),t=g();null!=t&&Math.abs(t-n)<=.5||y(n)}return{activeRestoreAnchor:h,getRelativeScrollTopWithinContainer:g,setRelativeScrollTopWithinContainer:y,resolveAnchorOffset:k,clearRestoreReconcile:N,applyRestoreAnchor:b,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&b(h.value)}):null,null==v&&h.value&&b(h.value))},captureRestoreAnchor:function(){const e=g(),n=o.value;if(null==e||n<=0)return null;const t=m(c(e+1),0,n-1),l=d(0,t),r=f(t);return{nodeIndex:t,offsetWithinNodePx:m(e-l,0,Math.max(0,r-1))}},restoreAnchor:function(e){const t=o.value;if(h.value={nodeIndex:m(e.nodeIndex,0,Math.max(0,t-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},N(),b(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&b(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:Se,containerRef:z,parsedNodeCount:Bn,requestFrame:tt,cancelFrame:ot,resolveScrollContainer:()=>$t.value||Pe(),getNormalizedScrollTop:ze,getOffsetTopWithinRoot:We,isReverseFlexScrollRoot:Ke,estimateIndexForOffset:Xt,estimateHeightRange:Ut,getFallbackNodeHeight:qt,clamp:Bl}),{nodeHeights:so,heightStats:co,heightTreeSize:fo,heightSumTree:vo,heightKnownTree:go,averageNodeHeight:yo,resetHeightMeasurements:ko,pruneHeightMeasurements:No,rebuildHeightTrees:So,recordNodeHeight:xo,removeNodeHeights:Mo,exportHeightCache:Co,importHeightCache:_o,fenwickRangeSum:Bo}=function(e={}){const n=he({}),t=he({total:0,count:0}),o=X(0),l=X([]),r=X([]);function i(){for(const e of Object.keys(n))delete n[Number(e)];t.total=0,t.count=0,o.value=0,l.value=[],r.value=[]}function s(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function c(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function d(e){o.value=e;const t=new Array(e+1).fill(0),i=new Array(e+1).fill(0);for(const[o,l]of Object.entries(n)){const n=Number(o),r=Number(l);!Number.isFinite(n)||n<0||n>=e||!Number.isFinite(r)||r<=0||(s(t,n,r),s(i,n,1))}l.value=t,r.value=i}function f(e){if(!Number.isInteger(e)||e<0)return!1;const i=n[e];if(!Number.isFinite(i)||i<=0)return!1;if(delete n[e],t.total=Math.max(0,t.total-i),t.count=Math.max(0,t.count-1),o.value>e){const n=l.value,t=r.value;n.length&&t.length&&(s(n,e,-i),s(t,e,-1))}return!0}const m=E(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:m,resetHeightMeasurements:i,pruneHeightMeasurements:function(e){if(e<=0)return void i();let o=0,l=0;for(const[t,r]of Object.entries(n)){const i=Number(t),a=Number(r);!Number.isFinite(i)||i<0||i>=e||!Number.isFinite(a)||a<=0?delete n[i]:(o+=a,l++)}t.total=o,t.count=l},rebuildHeightTrees:d,recordNodeHeight:function(i,c,d={}){!function(i,a,u={}){var c;if(!Number.isFinite(a)||a<=0)return!1;const d=n[i];if(d){if(!1===u.allowShrink&&a<d)return!1;if(Math.abs(a-d)<=1)return!1}if(n[i]=a,d?t.total+=a-d:(t.total+=a,t.count++),o.value>i){const e=l.value,n=r.value;if(e.length&&n.length)if(d){const n=a-d;0!==n&&s(e,i,n)}else s(e,i,a),s(n,i,1)}!1!==u.notify&&(null==(c=e.onHeightRecorded)||c.call(e))}(i,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=f(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},removeNodeHeights:function(n,t={}){var o;let l=0;for(const e of n)f(Number(e))&&l++;return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},exportHeightCache:function(){return Object.entries(n).map(([e,n])=>({index:Number(e),height:Number(n)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,n)=>e.index-n.index)},importHeightCache:function(l,r={}){var i;if(!Array.isArray(l))return;const a=o.value;let u=!1;if("merge"!==r.mode){const e=Object.keys(n);if(e.length>0){for(const t of e)delete n[Number(t)];u=!0}}for(const e of l){const t=Number(e.index),o=Number(e.height);if(!Number.isInteger(t)||t<0)continue;if(a>0&&t>=a)continue;if(!Number.isFinite(o)||o<=0)continue;const l=n[t];l&&Math.abs(l-o)<=1||(n[t]=o,u=!0)}u&&(function(){let e=0,l=0;const r=o.value;for(const[t,o]of Object.entries(n)){const i=Number(t),a=Number(o);!Number.isFinite(i)||i<0||r>0&&i>=r||!Number.isFinite(a)||a<=0?delete n[i]:(e+=a,l++)}t.total=e,t.count=l}(),a>0&&d(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:function(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}}}({onHeightRecorded:()=>{Vt(),zn.value&&da(),Zt.value&&oo(),Ft.value&&Yr(),Zi("node-resize")}});function Oo(){ko(),It.clear()}function To(e){!Number.isInteger(e)||e<0||e>=Mn.value.length||It.set(e,Wr(e))}function Io(e,n,t={}){const o=so[e];xo(e,n,t);const l=so[e];l&&l>0?To(e):o&&It.delete(e)}function Lo(e,n){const t=pn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=xt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:pn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function Ro(e,n={}){_o(e,n),Ci()}const Fo=E(()=>Qn.value&&Gn.value),Po=E(()=>{var e;return!xe.value&&!1!==H.batchRendering&&it.value>0&&(null!=(e=H.maxLiveNodes)?e:0)<=0}),Ko=E(()=>!xe.value&&Ye&&!0===Ue.value&&!Zn.value&&!Fn.value&&!$n.value&&!Fo.value&&!Po.value),zo=E(()=>!!et&&(Fo.value||Zn.value)),Wo=E(()=>Zn.value||zn.value),{liveNodeBufferResolved:jo,focusIndex:Do,liveRange:Vo,updateLiveRange:qo}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,clamp:r}=n,i=E(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),a=X(0),u=he({start:0,end:0});return{liveNodeBufferResolved:i,focusIndex:a,liveRange:u,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return u.start=0,void(u.end=e);const n=Math.min(l.value,e),s=i.value,c=r(a.value-s,0,Math.max(0,e-n));u.start=c,u.end=Math.min(e,c+n)}}}(H,{parsedNodeCount:Bn,virtualizationEnabled:Zn,maxLiveNodesResolved:Yn,clamp:Bl}),Uo=/* @__PURE__ */new Map,Xo=/* @__PURE__ */new Map,Yo=/* @__PURE__ */new Map,Zo=[],Jo=/* @__PURE__ */new Map,Go=/* @__PURE__ */new Set,Qo=X(0);let el=!1;const nl=E(()=>(Qo.value,Go.size)),tl=/* @__PURE__ */new Map,ol=/* @__PURE__ */new Map,ll=X(0),rl=E(()=>{ll.value;let e=0;for(const n of tl.values())e+=Math.max(0,n);return e});let il=null;const al=E(()=>{if(!Zn.value)return Mn.value.length;const e=jo.value,n=Math.max(Vo.end+e,at.value),t=Math.min(Mn.value.length,n);return Math.max(ct.value,t)});function ul(){el||(el=!0,queueMicrotask(()=>{el=!1,Qo.value+=1}))}function sl(e,n,t="node-resize"){if(!Se||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Go.delete(o)&&ul();try{n()}finally{Zi(t)}},Math.max(0,e));return Go.add(o),ul(),o}function cl(e){Se&&null!=e&&(Go.delete(e)&&ul(),window.clearTimeout(e))}function dl(){if(Se&&"undefined"!=typeof window)for(const e of Go)window.clearTimeout(e);Go.size&&(Go.clear(),ul()),Zo.length=0,Yo.clear()}function fl(e){W.value=e}function ml(e){j.value=e}function hl(e){V.value=e}const{cancelScheduledFocusSync:vl,scheduleFocusSync:pl}=function(e){const{isClient:n,containerRef:t,virtualizationEnabled:o,requestFrame:l,cancelFrame:r,syncFocusToScroll:i}=e;let a=null;function u(){var e,n,o;return null!=(o=null==(n=null==(e=t.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?o:"undefined"!=typeof window?window:null}function s(){if(!a)return;const e=u();a.viaTimeout?e?e.clearTimeout(a.id):clearTimeout(a.id):null==r||r(a.id),a=null}return{cancelScheduledFocusSync:s,scheduleFocusSync:function(e={}){if(!o.value)return;if(!n)return void i(!0);if(e.immediate)return s(),void i(!0);if(a)return;const t=()=>{a=null,i()};if(l)return void(a={id:l(t),viaTimeout:!1});const r=u(),c=r?r.setTimeout(t,16):setTimeout(t,16);a={id:c,viaTimeout:!0}}}}({isClient:Se,containerRef:z,virtualizationEnabled:Zn,requestFrame:tt,cancelFrame:ot,syncFocusToScroll:function(e=!1){var n;if(!Zn.value)return;const t=$t.value||Pe();if(!t)return;const o=t.ownerDocument||(null==(n=z.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=Mn.value.length;if(i<=0)return;if(!r&&i>0&&Ke(t)){const n=pn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=pn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void _l(Bl((a=Math.max(0,l)+.5*Math.max(0,n),Kt.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=z.value;if(!l)return null;const r=o?0:pn("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=pn("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?pn("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):pn("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return Bl(Xt(a+.5*Math.max(0,u)),0,Math.max(0,Mn.value.length-1))}(t,o,l,r);if(null!=u)return void _l(u,e);const s=r?null:pn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?pn("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=At.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=pn("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=z.value;if(!e)return;const n=r?{top:0}:pn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=pn("syncFocusToScroll.fallback.scrollTop",()=>ze(t,o,r)),a=r?(()=>{const t=pn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=We(e,t);return Math.max(0,i-n)})(),u=r?pn("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):pn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void _l(Bl(Xt(a+.5*Math.max(0,u)),0,Math.max(0,Mn.value.length-1)),!0)}_l(Math.round((m+h)/2),e)}}),{visibleNodeIndices:gl,nodeVisibilityHandles:yl,nodeVisibilityWatchStops:kl,nodeVisibilityFallbackTimers:Nl,clearVisibilityFallback:bl,markNodeVisible:Sl,cleanupNodeVisibility:xl,destroyNodeVisibilityState:wl}=ai({isClient:Se,shouldTrackVisibleNodeIndices:()=>Fo.value,shouldCleanupNodeVisibility:()=>Zn.value,onNodeMarkedVisible:e=>{Zn.value?pl():Do.value=Bl(e,0,Math.max(0,Mn.value.length-1))},onNodeVisibilityCleaned:e=>{xt.delete(e)&&Ji()}}),{cleanupScrollListener:Ml,setupScrollListener:Cl}=function(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null;function c(){u&&(u(),u=null),s=null,l.value=null}function d(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:c,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void c();var e;const f=r();if(!f)return void c();if(l.value===f&&u)return;c(),s=d(f);const m=()=>{if(null==a||a(),t.value){const e=function(e){const n=d(e),t=s;s=n;const o=Math.max(480,.75*(e.clientHeight||0));return null==t?n>o?{immediate:!0}:void 0:Math.abs(n-t)>o?{immediate:!0}:void 0}(f);e?i(e):i()}};f.addEventListener("scroll",m,{passive:!0}),l.value=f,u=()=>{f.removeEventListener("scroll",m)}}}}({isClient:Se,virtualizationEnabled:Zn,listenerEnabled:Wo,scrollRootElement:$t,resolveScrollContainer:Pe,scheduleFocusSync:pl,onScroll:function(){const e=Ft.value;if(!e)return;const n=Hr();if(!n)return;if(function(e){if(Ki()>=jt)return Dt=null,!1;const n=Dt;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(Dt=null),t}(n))return;const t=Ar(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Xr("restore"):Xr("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=z.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return pn("scrollListener.getScrollTop",()=>ze(e,t,o))}});function _l(e,n=!1){const t=Bl(e,0,Math.max(0,Mn.value.length-1));!n&&Math.abs(t-Do.value)<=1||(Do.value=t,qo())}function Bl(e,n,t){return Math.min(Math.max(e,n),t)}function Ol(e){return null==e?void 0:e.firstElementChild}function Tl(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function Il(e,n){e<1||e>6||(J[e]=n)}function Hl(){if(!jn.value)return void(pe.value=0);const e=pn("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.clientWidth)?n:0});pe.value=e>0?e:0}let Ll=null;function Al(){null==Ll||Ll.disconnect(),Ll=null}const Rl=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:pt,delay:0,suspensible:!1});function $l(e){return e===Rl}const El=E(()=>"pre"===p.value?dt:"shiki"===p.value?Rl:gt),Fl=[],Pl=E(()=>{const e=Mn.value;if(!e.length||!jn.value)return Fl;const n=pe.value||pn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0});return!Number.isFinite(n)||n<=0?Fl:e.map((e,t)=>{const o=so[t],l="number"==typeof o&&o>0;if(Vn.value&&!l){const t=dr(e,n,ke.value);if(t)return t}if(qn.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ja(e,Fa(e));return $l(n)?"markdown":n===dt?"pre":n===El.value||n===gt?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return mr(e,{rendererKind:n,monacoOptions:H.codeBlockMonacoOptions,showHeader:!1!==(null==(r=H.codeBlockProps)?void 0:r.showHeader)})}var r;return null})});Kt=function(e){let n=!0,t=[0],o="";function l(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=null==(t=e.estimatedNodeHeights.value[n])?void 0:t.height;return Number.isFinite(l)&&l>0?l:Math.max(e.averageNodeHeight.value,function(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h;if(!e||"object"!=typeof e)return 32;const v=e,p=String(null!=(t=v.type)?t:""),g=Number.isFinite(n)&&n>0?n:640;switch(p){case"heading":return 44;case"paragraph":return Mr(String(null!=(l=null!=(o=v.raw)?o:v.content)?l:""),g,34);case"list":{const e=Array.isArray(v.items)?v.items.length:1;return Math.max(48,30*e+12)}case"list_item":return Mr(String(null!=(i=null!=(r=v.raw)?r:v.content)?i:""),g,34);case"blockquote":return Mr(String(null!=(u=null!=(a=v.raw)?a:v.content)?u:""),g,56);case"table":{const e=Array.isArray(v.rows)?v.rows.length:Array.isArray(v.children)?v.children.length:3;return Math.max(120,38*e+48)}case"code_block":return Mr(String(null!=(c=null!=(s=v.code)?s:v.raw)?c:""),g,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return Mr(String(null!=(f=null!=(d=v.raw)?d:v.content)?f:""),g,96);case"thematic_break":return 24;default:return Mr(String(null!=(h=null!=(m=v.raw)?m:v.content)?h:""),g,40)}}(e.parsedNodes.value[n],e.getContainerWidth()||640))}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=Cr(Math.trunc(n),0,i),u=Cr(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function s(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Mn,nodeHeights:so,heightStats:co,heightTreeSize:fo,heightSumTree:vo,heightKnownTree:go,averageNodeHeight:yo,heightEstimationActive:jn,estimatedNodeHeights:Pl,getContainerWidth:Un,getPrefixCacheKeyParts:()=>{var e;const n=wr(pe.value||pn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[Mn.value.length,co.count,Math.round(co.total),Math.round(100*yo.value),t,n,jn.value?1:0,rr.value,ve.value]},fenwickRangeSum:Bo}),Y(()=>Mn.value.length,e=>{Vt(),e<=0?Oo():(e<fo.value&&No(e),e!==fo.value&&So(e))},{immediate:!0});const Kl=E(()=>{if(!Zn.value)return Mn.value.map((e,n)=>({node:e,index:n}));const e=Mn.value.length,n=Bl(Vo.start,0,e),t=Bl(Vo.end,n,e);return Mn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),zl=E(()=>Zn.value?Ut(0,Math.min(Vo.start,Mn.value.length)):0),Wl=E(()=>{if(!Zn.value)return 0;const e=Mn.value.length;return Ut(Math.min(Vo.end,e),e)});function jl(){return Kt.buildVirtualHeightSummary({topSpacerHeight:zl.value,bottomSpacerHeight:Wl.value,width:Jl()})}function Dl(){const e=Mn.value,n=jl();return u(a({},n),{probe:{paragraphReady:Boolean(ke.value.paragraph),listItemReady:Boolean(ke.value.listItem),listWrapperOverhead:ke.value.listWrapperOverhead,headingReadyLevels:Object.entries(ke.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:e.map((e,n)=>{var t,o,l,r,i,a,u,s,c;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=Pl.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=Pl.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=Pl.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=Pl.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=so[n])?c:null}})})}function Vl(){return null!=o.indexKey?String(o.indexKey):Fn.value?`virtual-${Ul()}`:"markdown-renderer"}function ql(e){const n=String(e),t=`${Vl()}-`;if(!n.startsWith(t))return null;const o=n.slice(t.length).match(/^(\d+)(?:$|-)/);if(!o)return null;const l=Number(o[1]);return!Number.isInteger(l)||l<0||l>=Mn.value.length?null:l}function Ul(){var e,n,t;const l=null==(e=o.virtualScroll)?void 0:e.sessionKey;return String(null!=l&&""!==l?l:null!=(t=null!=(n=o.indexKey)?n:H.customId)?t:gn)}function Xl(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function Yl(e){var n;return(null!=e?e:"")===(null!=(n=Xl())?n:"")}function Zl(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(){const e=p.value;return function(e){var n,t;const o=e.renderer,l="monaco"===o?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i="shiki"===o;return[e.isDark?"dark":"light","monaco"===o?"code-rich":"pre"===o?"code-pre":"code-shiki",!1===e.codeBlockStream?"code-static":"code-stream",yi(e.codeBlockMinWidth),yi(e.codeBlockMaxWidth),...i?[Me(null!=(n=null==r?void 0:r.themes)?n:e.themes,null!=(t=null==r?void 0:r.langs)?t:e.langs)]:[],yi(null==l?void 0:l.fontSize),yi(null==l?void 0:l.lineHeight),yi(null==l?void 0:l.fontFamily),yi(null==l?void 0:l.tabSize),yi(null==l?void 0:l.MAX_HEIGHT),yi(null==l?void 0:l.wordWrap),yi(null==l?void 0:l.wrappingIndent),yi(null==l?void 0:l.padding),yi(null==r?void 0:r.showHeader),yi(null==r?void 0:r.showCopyButton),yi(null==r?void 0:r.showExpandButton),yi(null==r?void 0:r.showPreviewButton),yi(null==r?void 0:r.showCollapseButton),yi(null==r?void 0:r.showFontSizeButtons)].join("\0")}({renderer:e,isDark:H.isDark,codeBlockStream:H.codeBlockStream,codeBlockMinWidth:H.codeBlockMinWidth,codeBlockMaxWidth:H.codeBlockMaxWidth,codeBlockMonacoOptions:"monaco"===e?H.codeBlockMonacoOptions:void 0,codeBlockProps:H.codeBlockProps,themes:"shiki"===e?H.themes:void 0,langs:"shiki"===e?H.langs:void 0})}(),[null==n?"":String(n),t].join("\0")}function Jl(){return Un()}const Gl=E(()=>wr(Jl())),Ql=E(()=>[Zl(),Gl.value].join("\0")),er=E(()=>{var e;return Fn.value?["virtual",null!=(e=Xl())?e:"",Ul(),Ql.value].join("\0"):o.indexKey});function nr(){ll.value+=1}function tr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Mn.value.length||e.sessionKey!==Ul()||e.threadKey!==Xl()||e.layoutEpochKey!==Ql.value)}function lr(e){const n=String(e),t=ol.get(n);return t?tr(t)?t.index:null:ql(n)}function ar(e="async-node"){(tl.size||ol.size)&&(tl.clear(),ol.clear(),nr(),Zi(e))}const ur=$(_e,null),sr={reportHeight(e,n){if(!zn.value)return;const t=lr(e);if(null==t)return;const o=Uo.get(t);if(!o)return;const l=Number(n),r=Lo(t,o);Io(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!zn.value)return;const n=ql(e);null!=n&&function(e,n){var t;const o=ol.get(e);if(o&&tr(o))return tl.set(e,Math.max(0,null!=(t=tl.get(e))?t:0)+1),nr(),void Zi("async-node");tl.set(e,1),ol.set(e,function(e){return{index:e,sessionKey:Ul(),threadKey:Xl(),layoutEpochKey:Ql.value}}(n)),nr(),Zi("async-node")}(String(e),n)},markSettled(e){if(!zn.value)return;const n=String(e),t=lr(e);(null!=t||function(e){return tl.has(String(e))}(n))&&function(e){var n;const t=null!=(n=tl.get(e))?n:0;return!(t<=0||(t<=1?(tl.delete(e),ol.delete(e)):tl.set(e,t-1),nr(),1===t&&Zi("async-node"),0))}(n)&&null!=t&&la()}};function cr(){let e=0;for(const n of Uo.values())e+=pn("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}me(_e,{reportHeight(e,n){sr.reportHeight(e,n),null==ur||ur.reportHeight(e,n)},markPending(e){sr.markPending(e),null==ur||ur.markPending(e)},markSettled(e){sr.markSettled(e),null==ur||ur.markSettled(e)}});let fr,hr=null,pr=null;function yr(e){return!1!==e&&null!=e&&""!==e}function xr(){return Zn.value?function(){if(!Zn.value)return!0;const e=Mn.value.length,n=Bl(Vo.start,0,e),t=Bl(Vo.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!xt.has(o))return!1;if(Gi(o)&&!Uo.has(o))return!1}return!0}():ct.value>=al.value}function _r(){return!0===Ue.value&&!Ze.value&&0===rl.value&&0===Go.size&&0===Jo.size&&null==il&&xr()}function Br(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(hr===Ul()&&fr===Xl())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!yr(t)&&pr===ha(t)}function Or(){return _r()&&Br()}function Tr(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function Ir(e="manual",n){const t=jl(),o=function(e){return e||(!0!==Ue.value?Mn.value.length>0?"streaming":"estimating":!xr()||Jo.size>0||null!=il?"measuring":Or()?"settled":"settling")}(n);return{sessionKey:Ul(),threadKey:Xl(),phase:o,nodeCount:t.totalNodes,liveRange:{start:Vo.start,end:Vo.end},renderedCount:ct.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:cr(),totalHeight:Lr(),width:t.width,final:!0===Ue.value,stable:Or(),confidence:Tr(o,t),reason:e}}function Hr(){const e=$t.value||Pe(),n=z.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=pn("getScrollBox.scrollTop",()=>ze(e,t,o)),r=pn("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=pn("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function Lr(){const e=Mn.value.length,n=Math.max(0,Ut(0,e)),t=pn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:pn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):Zn.value?n>0?Math.max(1,Math.ceil(n),function(){let e=zl.value+Wl.value;for(const n of xt.values())n&&(e+=Math.max(0,pn("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(n,o)):Math.max(1,Math.ceil(o)):zn.value?n>0||co.count>0||Kt.getEstimatedNodeHeightCount()>0?(st.value&&ct.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function Ar(e){const n=z.value;if(!n)return null;const t=pn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:pn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function Rr(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=Hr(),t=z.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=pn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=pn("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=Hr(),n=z.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=Ar(e);return null==t?null:t>=-8&&t<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,t)}:null}();if(o)return{anchor:o,captured:!0};const l=ro();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Mn.value.length;return e<=0?null:{type:"node",nodeIndex:Bl(Do.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function $r(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Er(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t^=31,t=Math.imul(t,16777619),t}const Fr=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Pr(e,n=/* @__PURE__ */new WeakSet,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){const n=e.length>8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${$r(n)}`}(e)}`;if("function"==typeof e)return"fn";if("object"!=typeof e)return typeof e;if(n.has(e))return"cycle";if(t>=6)return"max-depth";n.add(e);try{if(Array.isArray(e)){if(e.length<=160){const o=[];for(let l=0;l<e.length;l++)o.push(Pr(e[l],n,t+1));return`a:${e.length}:${o.join(",")}`}const o=[],l=[],r=Math.max(0,e.length-32);let i=2166136261;for(let a=0;a<e.length;a++){const u=Pr(e[a],n,t+1);i=Er(i,u),a<32&&o.push(u),a>=r&&l.push(u)}return[`a:${e.length}`,`h=${o.join(",")}`,`t=${l.join(",")}`,`all=${(i>>>0).toString(36)}`].join(":")}const o=e,l=Object.keys(o).filter(e=>{const n=o[e];return"parent"!==e&&"el"!==e&&"component"!==e&&(null==n||"string"==typeof n||"number"==typeof n||"boolean"==typeof n||Fr.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${Pr(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let Kr=-1,zr="";function Wr(e){const n=Mn.value[e];return n?$r(Pr(n)):""}function jr(){const e=ve.value;if(Kr===e)return zr;let n=2166136261;for(let t=0;t<Mn.value.length;t++){const e=Wr(t);for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)}return zr=(n>>>0).toString(36),Kr=e,zr}function Dr(e,n={}){var t;const l=!0===n.includeHeightCache,r=null!=(t=n.includeContentHash)?t:l,i=l?function(e){const n=function(){var e,n;const t=Number(null!=(n=null==(e=o.virtualScroll)?void 0:e.heightCacheLimit)?n:5e3);return!Number.isFinite(t)||t<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(t))}();if(!Number.isFinite(n)||e.length<=n)return e;const t=/* @__PURE__ */new Map,l=e=>{!e||t.size>=n||t.set(e.index,e)},r=Mn.value.length,i=Bl(Vo.start-2*jo.value,0,r),a=Bl(Vo.end+2*jo.value,i,r);for(const o of e)o.index>=i&&o.index<a&&l(o);const u=Math.max(1,Math.ceil(e.length/n));for(let o=0;o<e.length&&t.size<n;o+=u)l(e[o]);for(let o=e.length-1;o>=0&&t.size<n;o-=u)l(e[o]);return Array.from(t.values()).sort((e,n)=>e.index-n.index).slice(0,n)}(Co().map(e=>{var n;const t=Mn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Wr(e.index)}):null}).filter(e=>Boolean(e))):[],s=Rr({allowFallback:!0===n.allowAnchorFallback,requireViewport:n.requireViewport});return s||i.length||!0===n.includeEmptyState?u(a({sessionKey:e.sessionKey,threadKey:e.threadKey},s?{anchor:s.anchor,anchorCaptured:s.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?jr():void 0,measurementKey:Zl()||void 0,heightCache:i.length?i:void 0}):null}function Vr(e){var n,t;const o=Hr();if(!o)return;const l=function(e){const n=z.value;if(!n)return null;const t=We(n,e.root),o=Mn.value.length,l=pn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?pn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=Lr();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){jt=Ki()+120,Dt=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Nr(o.root,o.doc,i,{isReverseFlexScrollRoot:Ke,getNormalizedScrollTop:ze})}const qr=[];function Ur(){if(Se)for(null!=Wt&&(null==ot||ot(Wt),Wt=null);qr.length;){const e=qr.pop();null!=e&&window.clearTimeout(e)}}function Xr(e){const n=Boolean(Ft.value);Ft.value=null,jt=0,Dt=null,Ur(),n&&e&&Zi(e)}function Yr(){if(!Ft.value||!Se)return;if(null!=Wt)return;const e=()=>{Wt=null;const e=Ft.value;e&&Vr(e)};Wt=tt?tt(e):null,null==Wt&&e()}function Zr(e,n={}){const t=Mn.value.length;return t<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=t)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(n.requireSignature&&!e.signature)&&!(n.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){var n;const t=Mn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==Wr(e.index))}(e))}function Jr(e){const n=wr(Jl()),t=wr(e);return-1!==n&&-1!==t&&n===t}function Gr(e){var n;const t=Number(null==e?void 0:e.width);if(Number.isFinite(t)&&t>0)return t;const o=Number(null==(n=null==e?void 0:e.metrics)?void 0:n.width);return Number.isFinite(o)&&o>0?o:null}function Qr(e){var n;return e.sessionKey===Ul()&&!!Yl(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Zl()&&!!Jr(Gr(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(ei(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function ei(e){return Boolean(e.contentHash&&e.contentHash===jr())}function ni(e){return!ei(e)}let ti=null,oi=null,li=null,ri=null,si=null,fi=!1;function mi(e){var n;const t=e.map(e=>{var n,t;return[e.index,Math.round(10*e.height),null!=(n=e.nodeType)?n:"",null!=(t=e.signature)?t:""].join("")}).join(""),o=wr(Jl());return[null!=(n=Xl())?n:"",Ul(),Zl(),Mn.value.length,o,e.length,$r(t)].join(":")}function Si(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!zn.value||!(null==e?void 0:e.length))return!1;if(Mn.value.length<=0)return!1;if(!Jr(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Zr(e,{requireSignature:!0});if(!t.length)return!fi&&"undefined"!=typeof console&&d&&(fi=!0,console.warn("[markstream-vue] virtualScroll.heightCache ignored: standalone heightCache entries must include compatible signature metadata. Use heightCache exported from virtual-state-change/render-settled, and pass heightCacheWidth from the same state.")),!1;const l=mi(t);return l===ti?(oi="standalone",!0):(Ro(t,{mode:"merge"}),Vt(),ti=l,oi="standalone",Di(),Zi("restore"),!0)}function xi(e,n={}){var t,o,l;if(!zn.value||!e)return!1;if(e.sessionKey!==Ul())return!1;if(!Yl(e.threadKey))return!1;if(Mn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!wi(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!wi()&&Number(Gr(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&Qr(e)){const n=Zr(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:ni(e)});n.length&&(Ro(n,{mode:"merge"}),Vt(),ti=mi(n),oi="restore",Di(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Zi("restore"),!0;if(!i)return u&&Zi("restore"),!0;const s=function(e,n){var t;const o=e.anchor,l=o?"bottom"===o.type?`bottom:${Math.round(o.distanceFromBottomPx)}`:`node:${o.nodeIndex}:${Math.round(o.offsetWithinNodePx)}`:"none";return[null!=(t=Xl())?t:"",Ul(),Zl(),Gl.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return li===s?(u&&Zi("restore"),!0):(li=s,function(e){const n=()=>{if("node"===e.type)return Xr(),void io({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(to(),Zt.value=null,Ft.value=e,Ur(),Vr(e),Se)for(const e of[0,120,280,480])qr.push(window.setTimeout(()=>{const e=Ft.value;e&&Vr(e)},e))};!function(e){if(!Zn.value)return!1;const n=Mn.value.length;return!(n<=0||(Do.value="node"===e.type?Bl(e.nodeIndex,0,n-1):n-1,qo(),0))}(e)?n():le(n)}(i),Zi("restore"),!0)}function wi(){const e=Jl();return Number.isFinite(e)&&e>0}function Mi(e){var n;return e.sessionKey===Ul()&&!!Yl(e.threadKey)&&(Mn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||wi())||!(!(e.anchor&&Number(Gr(e))>0)||wi()))}function Ci(){It.clear();for(const e of Object.keys(so)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Mn.value.length&&To(n)}}function _i(){null!=il&&(null==ot||ot(il),il=null),na()}function Bi(){return!Se||rt?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(tt)return tt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function Oi(e,n=Xl(),t=Ql.value){return Ul()===e&&Xl()===n&&Ql.value===t}function Ti(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Ul(),c=Xl(),d=Ql.value,f=null!=(n=e.frames)?n:2,m=null!=(t=e.timeoutMs)?t:120,h=null!=(l=e.reason)?l:"manual",v=e.expectedSettledTokenKey,p=!0===e.flushPendingTimers,g=Ir(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>Oi(s,c,d)&&(null==v||Wi()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield Bi(),!k())return y();la(),_i()}if(yield function(e){return!Se||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&dl(),la(),_i(),!k())return y();const N=_r();N&&(hr=s,fr=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&yr(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Wi()===v&&(pr=ha(o.virtualScroll.settledToken)));const b=k()&&N&&Br(),S=Ir(h,b?"final":void 0);return Ui(S,!0),S})}let Ii="content",Li=null,Ai=null,Ri=0,$i=null,Ei=null,Fi=null,Pi=null;function Ki(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function zi(e){var n,t;const l=$i;if(!l)return!0;const r=null!=(t=null==(n=o.virtualScroll)?void 0:n.heightDiffThresholdPx)?t:1;return Math.abs(e.totalHeight-l.totalHeight)>r||e.sessionKey!==l.sessionKey||e.phase!==l.phase||e.stable!==l.stable||e.final!==l.final||e.threadKey!==l.threadKey||e.nodeCount!==l.nodeCount||e.measuredCount!==l.measuredCount||e.width!==l.width}function Wi(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return yi(e)}function ji(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Zl(),jr(),yi(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function Di(){Fi=null,Pi=null,Ei=null}function Vi(e){const n=e.heightCache;return(null==n?void 0:n.length)?mi(n):""}function qi(e){var n,t,o;const l=e.metrics,r=e.anchor?"bottom"===(i=e.anchor).type?`bottom:${Math.round(i.distanceFromBottomPx)}`:`node:${i.nodeIndex}:${Math.round(i.offsetWithinNodePx)}`:"none";var i;return[e.sessionKey,null!=(n=e.threadKey)?n:"",null!=(t=e.measurementKey)?t:Zl(),null!=(o=e.contentHash)?o:"",Vi(e),r,e.anchorCaptured?1:0,l.liveRange.start,l.liveRange.end,l.renderedCount,l.nodeCount,Math.round(l.totalHeight),Math.round(l.width),l.phase,l.stable?1:0].join("\0")}function Ui(e,n=!1){if(!zn.value)return;if(function(e=!1){return!e&&Fn.value&&!Wn.value}(n))return;const t=n||zi(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Dr(e,{includeHeightCache:!0})}:{state:Dr(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||qi(e)!==Ei}(r,n)));if(t&&(A(e),$i=e,Ri=Ki()),r&&i&&(R(r),r.anchor&&F(r.anchor),Ei=qi(r)),e.stable){const n=ji("settled",e);if(n!==Fi){Fi=n;const t=Dr(e,{includeHeightCache:!0});t&&(R(t),Ei=qi(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=ji("final",e);if(n!==Pi){Pi=n;const t=Dr(e,{includeHeightCache:!0});t&&(R(t),Ei=qi(t)),function(e){l("render-final",e)}(e)}}}function Xi(){null!=Li&&(null==ot||ot(Li),Li=null),null!=Ai&&Se&&(window.clearTimeout(Ai),Ai=null)}function Yi(){Li=null,Ai=null,function(e){if(Jo.size>0||null!=il)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(Ii)&&(la(),_i()),Ui(Ir(Ii))}function Zi(e){var n,t;if(!zn.value)return;if(Ii=e,null!=Li||null!=Ai)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(Ki()-Ri)),i=()=>{Ai=null,Li=tt?tt(Yi):null,null==Li&&Yi()};Se&&r>0?Ai=window.setTimeout(i,r):i()}function Ji(){Ht.value+=1}function Gi(e){return!(st.value&&e>=ct.value)&&(!Fo.value||e<at.value||gl.value.has(e))}function Qi(e){const n=kl.get(e);n&&(n(),kl.delete(e));const t=yl.get(e);t&&(t.destroy(),yl.delete(e)),bl(e)}function ea(e,n){let t=!1;if(n){const o=xt.get(e);xt.set(e,n),o!==n&&(t=!0)}else xt.delete(e)&&(t=!0);if(t&&Ji(),n||bl(e),!zo.value||!et)return Qi(e),void(n&&Sl(e,!0));if(!Zn.value&&Fo.value&&!ne.value&&yl.size>=640&&(ne.value||(ne.value=!0,d&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),wl()),!zo.value||!et))return Qi(e),void(n&&Sl(e,!0));if(e<at.value&&!Zn.value)return Qi(e),void Sl(e,!0);if(gl.value.has(e))return Qi(e),void Sl(e,!0);if(!n)return void Qi(e);Qi(e);const o=et(n,{rootMargin:"400px"});if(!o)return;yl.set(e,o),Sl(e,o.isVisible.value),Fo.value&&function(e){if(!Se||!Fo.value)return;bl(e);const n=e%17*23,t=window.setTimeout(()=>{if(Nl.delete(e),!Fo.value)return;if(gl.value.has(e))return;const n=xt.get(e);if(!n)return;const t=Pe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?pn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?pn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=pn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&Sl(e,!0)},1800+n);Nl.set(e,t)}(e);let l=null;l=Y(()=>o.isVisible.value,n=>{if(n){bl(e),Sl(e,!0),null==l||l(),kl.delete(e),yl.get(e)===o&&yl.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),kl.set(e,l),Zn.value&&pl()}function na(){il=null;for(const[e,n]of Jo)Jo.delete(e),Uo.get(e)===n.el&&Xo.get(e)===n.version&&Io(e,n.height,{allowShrink:n.allowShrink})}function ta(){null!=il&&(null==ot||ot(il),il=null),Jo.clear()}function oa(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Uo.get(e)!==n)return;const r=Xo.get(e);if(null==r)return;const i=Mn.value[e],a=Ze.value&&!0!==Ue.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Mn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Jo.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Jo.set(e,{height:d,allowShrink:c,version:r,el:n}),null==il&&(il=tt?tt(na):null,null==il&&na())}(e,n,Lo(e,n))}function la(){for(const[e,n]of Uo)n&&oa(e,n)}function ra(){null==Ot||Ot.disconnect(),Ot=null,Mt.clear()}function ia(){for(;Zo.length;)cl(Zo.pop())}Y(Wn,e=>{e&&Zi("content")},{flush:"post"}),n({getVirtualMetrics:Ir,captureVirtualState:function(e={}){var n;return Dr(Ir("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:null==(n=e.includeEmptyState)||n})},restoreVirtualState:function(e,n={}){const t=!0===n.restoreAnchor,o=null==n.restoreToken?"imperative":String(n.restoreToken);ri=e,si={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!xi(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&Mi(e)||(ri=null,si=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield Bi(),la(),_i(),yield le();const n=Ir(e);return Ui(n,!0),n})},settle:Ti,scrollToNode:function(e,n="start"){Xr(),to();const t=Mn.value.length;if(t<=0)return;const o=Bl(e,0,t-1),l=()=>{var e;const t=eo({nodeIndex:o,offsetWithinNodePx:0}),l=qt(o),r=Hr(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Jt();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}Gt(Math.max(0,u)),pl({immediate:!0}),Zn.value&&(Do.value=o,qo())};if(Zn.value)return Do.value=o,qo(),void le(l);l()}}),Y(()=>Jn.value,e=>{if(!e){ra();for(const e of Yo.values())for(const n of e)cl(n);Yo.clear(),Xo.clear(),ia(),ta()}},{immediate:!0}),Y(Ue,e=>{e&&function(){if(Se&&Ue.value&&Uo.size){ia();for(const e of[80,240,640]){const n=sl(e,()=>{for(const[e,n]of Uo)n&&oa(e,n)},"final");null!=n&&Zo.push(n)}}}(),Zi(e?"final":"content")}),Y([()=>Mn.value.length,()=>ct.value],()=>{Ft.value&&Yr(),Zi("content")},{flush:"post",immediate:!0}),Y([()=>Vo.start,()=>Vo.end],()=>{Zi("batch")},{flush:"post"});const{cleanupBatchScheduler:aa}=function(e){const{props:n,isClient:t,isTestEnv:o,parsedNodesIdentity:l,parsedNodeCount:r,desiredRenderedCount:i,datasetKey:a,batchingEnabled:u,incrementalRenderingActive:s,resolvedBatchSize:c,resolvedInitialBatch:d,renderedCount:f,adaptiveBatchSize:m,previousRenderContext:h,previousBatchConfig:v,requestFrame:p,cancelFrame:g,hasIdleCallback:y,cleanupNodeVisibility:k,onDatasetKeyChanged:N,onDatasetChanged:b}=e;let S=null,x=null,w=!1,M=null,C=null,_=0,B=!1,O=!1;const T=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function H(){if(t){null!=S&&(null==g||g(S),S=null),null!=x&&(window.clearTimeout(x),x=null),null!=C&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(C),C=null),_+=1;for(const e of T)null==g||g(e);T.clear();for(const e of I)window.clearTimeout(e);I.clear(),w=!1,M=null,B=!1,O=!1}}function L(){return"undefined"!=typeof performance?performance.now():Date.now()}function A(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.2*o?m.value=Math.max(r,Math.floor(.7*m.value)):e<.5*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),B=!1;const t=O||f.value<i.value;O=!1,t&&E()}function R(e,l={}){var r,a;if(!s.value)return;const u=i.value;if(f.value>=u)return;const c=Math.max(1,e),d=()=>{const e=L();let o=0;S=null,x=null,C=null,w=!1;const l=null!=M?M:c;M=null;const r=L();f.value=Math.min(u,f.value+l),k(f.value),o=L()-r,function(e,o){if(!t)return void A(o);B=!0;const l=++_;le().then(()=>{var t;if(l!==_)return;const r=L(),i=Math.max(o,r-e),a=()=>{l===_&&A(i)};if(p){let e=!1,o=null;const l=()=>{e||(e=!0,a())},r=p(()=>{T.delete(r),null!=o&&(window.clearTimeout(o),I.delete(o),o=null),l()});return T.add(r),o=window.setTimeout(()=>{null!=o&&I.delete(o),o=null,null==g||g(r),T.delete(r),l()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,o)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(M=null!=M?Math.max(M,c):c,!w){if(w=!0,!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return void(C=window.requestIdleCallback(()=>d(),{timeout:e}))}p&&!o?S=p(()=>{0!==m?x=window.setTimeout(()=>d(),m):d()}):x=window.setTimeout(()=>d(),m)}}function $(e,n={}){B?O=!0:null==e?E():R(e,n)}function E(){s.value&&R(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return Y([l,r,a,s,c,d,()=>n.renderBatchDelay],()=>{var e;const o=r.value,l=h.value,u=a.value,p=!Object.is(u,l.key),g=o!==l.total,y=p||g;h.value={key:u,total:o};const S=v.value,x=null!=(e=n.renderBatchDelay)?e:16,w=S.batchSize!==c.value||S.initial!==d.value||S.delay!==x||S.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:x,enabled:s.value},p&&N(o),(y||w||!s.value)&&H(),(y||w)&&(m.value=Math.max(1,c.value||1)),y&&b();const M=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=M,void k(f.value);const C=p||0===l.total;f.value=C||w?Math.min(M,d.value):Math.min(f.value,M);const _=Math.max(1,d.value||c.value||o);f.value<M?$(_,{immediate:!t}):k(f.value)},{immediate:!0}),Y(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&$())}),{cleanupBatchScheduler:H}}({props:H,isClient:Se,isTestEnv:rt,parsedNodesIdentity:_n,parsedNodeCount:Bn,desiredRenderedCount:al,datasetKey:er,batchingEnabled:ut,incrementalRenderingActive:st,resolvedBatchSize:it,resolvedInitialBatch:at,renderedCount:ct,adaptiveBatchSize:mt,previousRenderContext:ft,previousBatchConfig:ht,requestFrame:tt,cancelFrame:ot,hasIdleCallback:lt,cleanupNodeVisibility:xl,onDatasetKeyChanged:e=>{ta(),Oo(),Vt(),Di(),e>0&&So(e)},onDatasetChanged:()=>{Zn.value&&pl({immediate:!0})}});Y([Wo,Zn,()=>z.value,()=>Ne()],([e,n])=>{if(!e)return Ml(),void vl();Cl(),n?pl({immediate:!0}):vl()},{flush:"post",immediate:!0}),Y([()=>Mn.value.length,()=>Zn.value],e=>s(null,[e],function*([e,n]){n&&e&&Se&&(yield le(),pl({immediate:!0}))}),{flush:"post"}),Y(jn,e=>{e&&function(){var e;if(On.value&&Tn.value&&In.value&&(null==(e=Hn.value)?void 0:e[1]))return;const n=fe({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=fe({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=fe({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});On.value=n,Tn.value=t,In.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]=fe({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Hn.value=l}()},{immediate:!0}),Y([()=>z.value,jn],()=>{if(!jn.value)return Al(),void(pe.value=0);Hl(),Al(),jn.value&&z.value&&"undefined"!=typeof ResizeObserver&&(Ll=new ResizeObserver(()=>{Hl(),Zt.value&&oo(),Ft.value&&Yr(),Zi("resize")}),Ll.observe(z.value))},{immediate:!0}),Y([jn,Xn,Ql],()=>s(null,null,function*(){if(!jn.value)return ke.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Vt();yield le(),function(){if(!jn.value||"undefined"==typeof window)return ke.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Vt();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=Tl(Ol(W.value),".paragraph-node");e.paragraph=vr(W.value,n,"pre-wrap");const t=Ol(j.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=vr(j.value,o,"pre-wrap");const l=pn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0}),r=pn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=j.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=Tl(Ol(J[i]),`h${i}`);e.headings[i]=vr(J[i],n,"pre-wrap")}ke.value=e,Vt()}()}),{flush:"post",immediate:!0}),Y(()=>Mn.value.length,()=>{Zn.value&&pl({immediate:!0})}),Y([jn,pe],()=>{Vt(),Zn.value&&pl({immediate:!0}),Zt.value&&oo(),Ft.value&&Yr(),Zi("resize")},{immediate:!1}),Y(()=>Fo.value,e=>{if(e)for(const[n,t]of xt)ea(n,t);else{wl();for(const[e,n]of xt)n&&Sl(e,!0)}},{immediate:!1}),Y([()=>H.viewportPriority,()=>Mn.value.length],([e,n])=>{!1!==e?ne.value&&n<=200&&(ne.value=!1):ne.value=!1}),Y(()=>ct.value,()=>{Zn.value&&pl({immediate:!0})}),Y([Do,Yn,jo,()=>Mn.value.length,Zn],()=>{qo()},{immediate:!0});let ua=null,sa=!1,ca=null;function da(){ua=null,hr=null,fr=void 0,pr=null,Di()}function fa(){ta(),Oo(),Vt(),It.clear();const e=Mn.value.length;e>0&&So(e),Ci()}function ma(){Xi(),dl(),$i=null,ti=null,oi=null,li=null,ri=null,si=null,sa=!1,da(),ar("restore"),to(),Xr()}function ha(e){var n;return[null!=(n=Xl())?n:"",Ul(),Zl(),Gl.value,Wi(e),Mn.value.length,Math.round(Ut(0,Mn.value.length)),Math.round(Jl()),co.count,Math.round(co.total)].join(":")}function va(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Wi(r),a=Ul(),u=Xl(),s=Ql.value;if(zn.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&yr(r))if(_r()){if(ha(r)!==pr&&!sa){sa=!0;try{const e=yield Ti({reason:"manual",expectedSettledTokenKey:i}),n=Wi()===i;Oi(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(pr=ha(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{sa=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=yr(e)?ha(e):"";Oi(a,u,s)&&n&&pr!==n&&va()}}}else Zi("manual")})}Y(zn,(e,n)=>{if(e!==n){if(!e)return ma(),void Xi();ma(),fa(),ca=Ql.value,Zi("content")}},{flush:"post"}),Y([zn,Ql],([e,n])=>{e?null!=ca?ca!==n&&(ca=n,function(e="resize"){ta(),Oo(),Vt(),It.clear();const n=Mn.value.length;n>0&&So(n),Ci(),ti=null,oi=null,li=null,$i=null,sa=!1,da(),Si(),le(()=>{la(),Zt.value&&oo(),Ft.value&&Yr(),Zi(e)})}("resize")):ca=n:ca=null},{flush:"post",immediate:!0}),Y([zn,()=>Ul(),()=>Xl()],([e])=>{e&&(ma(),fa(),ar("content"),Zi("content"))}),Y([zn,()=>Ul(),()=>Xl(),Ql,()=>Mn.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(ol.entries()))tr(o)||(ol.delete(t),tl.delete(t),n=!0);n&&(nr(),Zi(e))}("async-node")},{flush:"post"}),Y([zn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>ve.value],([e])=>{e&&(Di(),function(e="content"){if(!zn.value)return;const n=[],t=Mn.value.length;for(const o of Array.from(It.keys())){if(o>=t){n.push(o);continue}const e=Wr(o),l=It.get(o);null!=l&&l!==e&&n.push(o),It.set(o,e)}for(const o of Array.from(It.keys()))o>=t&&It.delete(o);n.length&&(function(e,n={}){const t=Array.from(e,Number),o=Mo(t,n);o>0&&function(e){for(const n of e)It.delete(n)}(t)}(n,{notify:!1}),Vt(),da(),Zt.value&&oo(),Ft.value&&Yr(),Zi(e))}("content"))},{flush:"post",immediate:!0}),Y([zn,()=>Mn.value.length,()=>Ul(),()=>Xl()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&da()},{flush:"post"}),Y([zn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCache},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCacheWidth},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Mn.value.length,()=>Ul(),pe],()=>{Si()},{flush:"post",immediate:!0}),Y([zn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreAnchor},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Mn.value.length,()=>Ul(),pe],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield le();const t=function(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}();xi(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),Y([zn,pe,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey}],([e])=>{var n;if(!e)return;const t=null==(n=o.virtualScroll)?void 0:n.restoreState;t&&ti&&"restore"===oi&&(Qr(t)||(fa(),ti=null,oi=null,Zi("resize")))},{flush:"post"}),Y([zn,()=>Mn.value.length,()=>Ul(),pe],e=>s(null,[e],function*([e]){var n;const t=ri,o=si;e&&t&&(yield le(),!xi(t,{restoreAnchor:!0===(null==o?void 0:o.restoreAnchor),restoreToken:null!=(n=null==o?void 0:o.restoreToken)?n:"imperative",allowUncapturedAnchor:!0===(null==o?void 0:o.allowUncapturedAnchor)})&&Mi(t)||(ri=null,si=null))}),{flush:"post",immediate:!0}),Y([zn,Ue,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Ul(),()=>Xl(),Ql,rl,nl,()=>ct.value,al,()=>co.count,()=>co.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!Or())return;const o=function(){var e;const n=Mn.value.length;return[null!=(e=Xl())?e:"",Ul(),Zl(),Gl.value,n,Math.round(Ut(0,n)),Math.round(Jl()),co.count,Math.round(co.total)].join(":")}();ua!==o&&(ua=o,Ti({reason:"final"}).then(e=>{e.stable||ua!==o||(ua=null)}))},{flush:"post",immediate:!0}),Y([zn,Ue,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Ul(),()=>Xl(),Ql,rl,nl,()=>ct.value,al,()=>Mn.value.length,()=>co.count,()=>co.total],()=>{va()},{flush:"post",immediate:!0}),Y([()=>Mn.value.length,Zn,Yn,jo,()=>Vo.start,()=>Vo.end],([e,n,t,o,l,r])=>{we.value&&ln("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Do.value,scroll:n?(()=>{const e=$t.value||Pe();return e?{reverse:Ke(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:ct.value})}),Y([()=>H.customId],([e],n,t)=>{if(!e||Ln)return;const o=function(e,n){return e?(or.controllers[e]=n,()=>{or.controllers[e]===n&&delete or.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:ro,restoreAnchor:io,getAnchorDrift:uo,getReport:Dl});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(zn.value)try{la(),_i();const e=Ir("manual");zi(e)&&(A(e),$i=e,Ri=Ki());const n=Dr(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(R(n),n.anchor&&F(n.anchor),Ei=qi(n))}catch(e){}}(),aa(),wl(),en(),ra();for(const e of Yo.values())for(const n of e)cl(n);Yo.clear(),Xo.clear(),It.clear(),ia(),ta(),Al(),to(),Xr(),Xi(),Ml(),vl()});const pa=re({loader:()=>s(null,null,function*(){try{return(yield import("./index11.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),dt}}),loadingComponent:pi,delay:0}),ga=re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),dt}}),loadingComponent:vi,delay:0}),ya=re(()=>s(null,null,function*(){try{return(yield import("./index7.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),dt}})),ka={text:vt,paragraph:wo,heading:ao,code_block:gt,list:ho,list_item:mo,blockquote:Yt,table:Ho,definition_list:Qt,footnote:lo,footnote_reference:an,footnote_anchor:no,admonition:Hi,vmr_container:Eo,hardbreak:zt,link:Lt,image:nt,thematic_break:Ao,math_inline:yt,math_block:kt,strong:Ct,emphasis:Pt,strikethrough:Bt,highlight:Et,insert:Rt,subscript:wt,superscript:St,emoji:on,checkbox:nn,checkbox_input:nn,inline_code:xn,html_inline:Nn,reference:Nt,html_block:bo},Na=E(()=>Vl()),ba=E(()=>gr(H.codeBlockProps)),Sa=E(()=>gr(H.codeBlockProps,{omit:["langs"]})),xa=E(()=>a(a({stream:H.codeBlockStream,darkTheme:H.codeBlockDarkTheme,lightTheme:H.codeBlockLightTheme,monacoOptions:H.codeBlockMonacoOptions,themes:H.themes,langs:"shiki"===p.value?H.langs:void 0,minWidth:H.codeBlockMinWidth,maxWidth:H.codeBlockMaxWidth},"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}),Sa.value)),wa=E(()=>a(u(a({},xa.value),{langs:H.langs}),ba.value));function Ma(e){return"boolean"==typeof e?e:void 0}const Ca=E(()=>{const e=H.codeBlockProps||{},n={},t=Ma(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const o=Ma(e.diffInline);void 0!==o&&(n.diffInline=o);const l=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(e.reservedHeightPx);return void 0!==l&&(n.reservedHeightPx=l),n}),_a=E(()=>a(a({stream:H.codeBlockStream,darkTheme:H.codeBlockDarkTheme,lightTheme:H.codeBlockLightTheme,themes:H.themes,langs:H.langs,minWidth:H.codeBlockMinWidth,maxWidth:H.codeBlockMaxWidth},"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}),ba.value)),Ba=E(()=>a({},H.mermaidProps||{})),Oa=E(()=>a({},H.d2Props||{})),Ta=E(()=>a({},H.infographicProps||{})),Ia=E(()=>({typewriter:h.value,fade:H.fade,customHtmlTags:wn.value.customHtmlTags})),Ha=E(()=>a(a({},Ia.value),"boolean"==typeof Oe.value?{showTooltip:Oe.value}:{})),La=E(()=>a(a({},Ia.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{})),Aa=E(()=>a(a({},Ia.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{})),Ra=E(()=>a(a({},Ia.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}));function $a(e){return Array.isArray(e.children)&&e.children.length>0}const Ea=E(()=>Kl.value.map(e=>{var n,t,o,l,r,i,s,c;let d=function(e){var n,t,o,l,r,i,u;if("code_block"!==e.type)return e;const s=e,c=[String(null!=(n=s.language)?n:""),String(null!=(t=s.loading)?t:""),String(null!=(o=s.diff)?o:""),String(null!=(l=s.code)?l:""),String(null!=(r=s.originalCode)?r:""),String(null!=(i=s.updatedCode)?i:""),String(null!=(u=s.raw)?u:"")].join("\0"),d=Tt.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return Tt.set(s,{signature:c,node:f}),f}(e.node);const f=Fa(d);let m=ja(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===ka[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=bn.value[r];if(Sn.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:L(e.content,r)});else if(_(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===d.type?(m=vt,d={type:"text",content:n,raw:n}):(m=wo,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h="code_block"===d.type&&"pre"===p.value&&m===dt&&!Pa(bn.value,f);let v=a({},function(e,n,t){const o=null!=n?n:Fa(e);if("code_block"===e.type){const n=o?Pa(bn.value,o):void 0;if(t&&"pre"===p.value&&!n&&t===dt)return Ca.value;if(t&&o&&t===n)return"mermaid"===o?za(e):"infographic"===o?Wa(e):"d2"===o||"d2lang"===o?Oa.value:wa.value;if(t&&t===bn.value.code_block)return wa.value;if($l(t))return _a.value}return"mermaid"===o?za(e):"infographic"===o?Wa(e):"d2"===o||"d2lang"===o?Oa.value:"link"===e.type?Ha.value:"list"===e.type?La.value:"blockquote"===e.type?Aa.value:"table"===e.type?Ra.value:"code_block"===e.type?xa.value:Ia.value}(d,f,m));const g=Pl.value[e.index];"code_block"===d.type&&"code-block"===(null==g?void 0:g.kind)&&(v=u(a({},v),h?{reservedHeightPx:null!=(r=g.height)?r:g.contentHeight}:{estimatedHeightPx:g.height,estimatedContentHeightPx:g.contentHeight})),h||"code_block"!==d.type||"mermaid"!==f||null!=Le(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Re($e(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Le(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:He(Ae(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:kn.value}));const y=function(e,n){const t=String(e.type);return!je(t)&&bn.value[t]===n}(d,m),k=y?mn(d,Te.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=k?k:{}),v),rendersCustomNode:y,hasSlotChildren:$a(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${Na.value}-${e.index}`})}));function Fa(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Pa(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Be(t),Ce(t)]){const n=o&&e[o];if(n)return n}}function Ka(e,n,t,o){var l,r;const i=a({},e.value);return null==Le(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Le(i.maxHeight))?r:void 0)),i}function za(e){return Ka(Ba,e,$e,Re)}function Wa(e){return Ka(Ta,e,Ae,He)}function ja(e,n){if(!e)return $o;const t=bn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:Fa(e),r=l?Pa(t,l):void 0;if(r)return r;if("pre"===p.value)return t.code_block||dt;if("mermaid"===l)return t.mermaid||pa;if("infographic"===l)return t.infographic||ga;if("d2"===l||"d2lang"===l)return t.d2||ya;if(o)return o;return t.code_block||El.value}return o||ka[String(e.type)]||$o}function Da(e){l("click",e)}function Va(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function qa(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function Ua(e){l("mouseover",e)}function Xa(e){l("mouseout",e)}const Ya=X(null),Za=X(!1),Ja=X(null),Ga=E(()=>!("minimal"!==H.domMode||xe.value||!1!==H.fade||h.value||Za.value||bt.value||Zn.value||Pn.value||$n.value||Qn.value||0!==Object.keys(bn.value).length));let Qa,eu=null,nu=0,tu=0,ou=0;const lu=["code_block","admonition","table","math_block","html_block","image","thematic_break"],ru=new Set(lu),iu=[".typewriter-cursor",".height-estimation-probes",...lu.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function au(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&ru.has(n)}function uu(e){var n,t;if(!e||"object"!=typeof e)return 0;const o=e,l=null!=(t=null!=(n=o.raw)?n:o.content)?t:o.code;if("string"==typeof l)return l.length;const r=o.children;if(Array.isArray(r))return r.reduce((e,n)=>e+uu(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+uu(n),0):0}function su(){Qa&&(clearTimeout(Qa),Qa=void 0)}function cu(){nu+=1,null!=eu&&(null==ot||ot(eu),eu=null)}function du(){cu(),vu(),Ya.value&&(Ya.value.style.visibility="hidden")}function fu(e){var n;if(e.nodeType!==Node.TEXT_NODE)return!1;if(!(null!=(n=e.textContent)?n:"").trim())return!1;const t=e.parentElement;return!!t&&!t.closest(iu)}function mu(e){let n=e.lastChild;for(;n;){if(fu(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(iu)&&e.lastChild){n=e.lastChild;continue}}for(;n&&n!==e&&!n.previousSibling;)n=n.parentNode;if(!n||n===e)break;n=n.previousSibling}return null}function hu(){const e=Ea.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||au(t.node)||!Gi(t.index))continue;const o=xt.get(t.index);if(!o)continue;const l=mu(o);if(l)return l}return null}function vu(){Ja.value&&(Ja.value.classList.remove(bi),Ja.value=null)}function pu(){if("simple"!==m.value||!Se||!Za.value||!z.value)return void vu();const e=hu(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==Ja.value&&(vu(),n&&(n.classList.add(bi),Ja.value=n))}function gu(){if("precise"!==m.value)return;if(!Se||!Za.value)return;if(null!=eu)return;const e=nu,n=()=>{eu=null,e===nu&&function(){var e,n;if("precise"!==m.value)return;if(!(Se&&Za.value&&z.value&&Ya.value))return;const t=z.value,o=Ya.value;o.style.visibility="hidden";const l=hu();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=pn("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};tt?eu=tt(n):n()}return Y([Ve,()=>o.content,()=>o.nodes,()=>H.typewriter,Ue],()=>s(null,null,function*(){var e,n;if(!Se||xe.value||!Ee.value)return;if(Ue.value)return Za.value=!1,su(),void du();if(null==(e=o.nodes)?void 0:e.length)return Za.value=!1,su(),du(),tu=(null!=(n=o.content)?n:"").length,void(ou=Ve.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+uu(n),0):(null!=(n=o.content)?n:"").length}(),l=function(){var e;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+uu(n),0):Ve.value.length}(),r=!au(Mn.value[Mn.value.length-1]),i=t>tu,a=l>ou;if(!h.value||!r||!i&&!a)return h.value&&r||(Za.value=!1,du()),tu=t,void(ou=l);tu=t,ou=l,Za.value=!0,"precise"===m.value&&Ya.value&&(Ya.value.style.visibility="hidden"),su(),yield le(),"simple"===m.value?pu():(vu(),gu()),Qa=setTimeout(()=>{Qa=void 0,Za.value=!1},3e3)}),{flush:"post",immediate:!0}),Y(Za,e=>s(null,null,function*(){e?(yield le(),"simple"!==m.value?(vu(),"precise"===m.value&&gu()):pu()):du()}),{flush:"post"}),Y(m,()=>s(null,null,function*(){if(Se&&!xe.value&&Ee.value&&Za.value){if(yield le(),"simple"===m.value)return cu(),void pu();vu(),"precise"!==m.value?du():gu()}}),{flush:"post"}),Y([()=>ct.value,()=>Vo.start,()=>Vo.end],()=>s(null,null,function*(){Se&&!xe.value&&Ee.value&&Za.value&&(yield le(),"simple"!==m.value?(vu(),"precise"===m.value&&gu()):pu())}),{flush:"post"}),ee(()=>{su(),cu(),vu(),yn.clear()}),(e,n)=>{const t=ye("NodeRenderer",!0);return q(xe)?(P(!0),K(Z,{key:0},ce(Ea.value,e=>(P(),K(Z,{key:e.index},[e.rendersCustomNode?(P(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onClick:Da,onMouseover:Ua,onMouseout:Xa,onCopy:n[0]||(n[0]=e=>l("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},Cn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(P(),ie(t,ue({key:1,ref_for:!0},Cn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onClick:Da,onMouseover:Ua,onMouseout:Xa,onCopy:n[2]||(n[2]=e=>l("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(P(),K("div",{key:1,ref_key:"containerRef",ref:z,class:D(["markstream-vue markdown-renderer",[{dark:H.isDark},{virtualized:Zn.value},{"virtual-scroll-coordinated":Wn.value},{"stable-layout":Ko.value},{"typewriter-simple-cursor":Za.value&&"simple"===m.value}]]),"data-custom-id":H.customId,onClick:Da,onMouseover:Va,onMouseout:qa},[Dn.value||Zn.value?(P(),K(Z,{key:0},[Dn.value?(P(),ie(hi,{key:0,width:Xn.value,"flow-root":Zn.value||Wn.value,"paragraph-node":On.value,"list-item-node":Tn.value,"list-node":In.value,"heading-nodes":Hn.value,"set-paragraph-wrapper":fl,"set-list-item-wrapper":ml,"set-list-wrapper":hl,"set-heading-wrapper":Il},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):G("",!0),Zn.value?(P(),K("div",{key:1,class:"node-spacer",style:se({height:`${zl.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],64)):G("",!0),Ga.value?(P(!0),K(Z,{key:1},ce(Ea.value,e=>(P(),K(Z,{key:e.index},[Gi(e.index)?(P(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>l("copy",e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):G("",!0)],64))),128)):(P(!0),K(Z,{key:2},ce(Ea.value,e=>(P(),K("div",{key:e.index,ref_for:!0,ref:n=>ea(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[Gi(e.index)?(P(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Vl()}-${e}`;let t=!1;for(const o of Array.from(tl.keys())){const l=ol.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(tl.delete(o),ol.delete(o),t=!0)}t&&(nr(),Zi("async-node"))}(e),Jo.delete(e),function(e){var n;const t=(null!=(n=Xo.get(e))?n:0)+1;Xo.set(e,t)}(e);const o=Yo.get(e);if(o){for(const e of o)cl(e);Yo.delete(e)}if(function(e){const n=Mt.get(e);n&&(null==Ot||Ot.unobserve(n),_t.delete(n),Mt.delete(e))}(e),!n||!Jn.value)return Uo.delete(e),void Xo.delete(e);Uo.set(e,n);const l=()=>{oa(e,n)};queueMicrotask(l);const r=(Ot||"undefined"==typeof ResizeObserver||(Ot=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=_t.get(n.target),t=Mt.get(null!=e?e:-1);null!=e&&t&&oa(e,t)}else la()})),Ot);if(r&&(Mt.set(e,n),_t.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=Mn.value[e])?void 0:t.type)?[16,80,240,800]:Ue.value?[80]:[];if(n.length){const t=n.map(e=>sl(e,l,"node-resize")).filter(e=>null!=e);t.length&&Yo.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(P(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[12]||(n[12]=e=>l("copy",e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},Cn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(P(),ie(t,ue({key:1,ref_for:!0},Cn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[14]||(n[14]=e=>l("copy",e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(P(),ie(te,{key:0,name:"fade",css:!1!==H.fade,appear:!1!==H.fade},{default:oe(()=>[e.rendersCustomNode?(P(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[8]||(n[8]=e=>l("copy",e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},Cn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(P(),ie(t,ue({key:1,ref_for:!0},Cn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[10]||(n[10]=e=>l("copy",e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(P(),K("div",{key:1,class:"node-placeholder",style:se({height:`${qt(e.index)}px`})},null,4))],8,Ni))),128)),Za.value&&"precise"===m.value?(P(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:Ya,class:"typewriter-cursor","aria-hidden":"true"},null,512)):G("",!0),Zn.value?(P(),K("div",{key:4,class:"node-spacer",style:se({height:`${Wl.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],42,ki))}}})),[["__scopeId","data-v-04858d0d"]]),xi=Si;xi.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",xi.__name,xi.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,Si)};const wi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:xi},Symbol.toStringTag,{value:"Module"})),Mi={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"},Ci={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"},_i={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"},Bi={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"},Oi={class:"admonition-title"},Ti=["aria-expanded","aria-controls"],Ii=["id"],Hi=/* @__PURE__ */en(/* @__PURE__ */F({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=E(()=>{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=X(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(P(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(P(),K("svg",Mi,[...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?(P(),K("svg",Ci,[...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?(P(),K("svg",_i,[...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?(P(),K("svg",Bi,[...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",Oi,W(r.value),1),o.node.collapsible?(P(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(P(),K("svg",{style:se({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,Ti)):G("",!0)]),ke(z("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(xi),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Ii),[[Ne,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Hi.install=e=>{e.component(Hi.__name,Hi)};const Li=()=>import("@terrastruct/d2");let Ai=null,Ri=Li,$i=null,Ei=!1,Fi=!1,Pi=0;function Ki(e){Ri=e,Pi++,Ai=null,$i=null,Ei=!1,Fi=!1}function zi(e){Ki(null!=e?e:Li)}function Wi(){Ki(null)}function ji(){return"function"==typeof Ri}function Di(){return s(this,null,function*(){if(Ai)return Ai;const e=Ri,n=Pi;return e?e===Li&&Ei?null:$i||($i=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===Li)return n===Pi&&e===Ri&&(Ei=!0,function(e){Fi||(Fi=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===Pi&&e===Ri&&($i=null)}return n!==Pi||e!==Ri?null:t?(Ai=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}(t),Ai):null}),$i):null})}let Vi=null,qi=null,Ui=null,Xi=0;function Yi(e){qi=null!=e?e:null,Vi=null,Ui=null,Xi++}function Zi(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Yi(e)}function Ji(){Yi()}function Gi(){return"function"==typeof qi}function Qi(){return s(this,null,function*(){if(Vi)return Vi;const e=qi,n=Xi;return e?Ui||(Ui=s(null,null,function*(){const t=yield e();if(n!==Xi||e!==qi)return null;const o=function(e){var n,t,o;if(!e)return null;const l=null!=(n=e.default)?n:e,r="function"==typeof l&&"function"==typeof(null==(t=l.prototype)?void 0:t.render)?l:null!=(o=e.Infographic)?o:null==l?void 0:l.Infographic;return"function"==typeof r?r:null}(t);return n!==Xi||e!==qi?null:o?(Vi=o,Vi):null}).finally(()=>{n===Xi&&e===qi&&(Ui=null)}),Ui):null})}function ea(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function na(e,n){null==e||e(n)}function ta(e,n){return e?(na(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function oa(e,n){const t=ta(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;na(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=ea(o.marginTop),r=ea(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function la(e,n,t){if(!e)return 0;const o=function(e){var n;return e?(null==(n=e.matches)?void 0:n.call(e,".markstream-vue.markdown-renderer"))?e:e.querySelector(".markstream-vue.markdown-renderer"):null}(e);if(!o)return 0;const l=Number.isFinite(t)?Number(t):oa(e,n),r=ta(o,n);return Math.max(0,l-r)}function ra(e,n,t){var o,l,r;const i=null!=(r=null!=(l=null==(o=t.getKey)?void 0:o.call(t,e,n))?l:e.id)?r:n;return String(i)}function ia(e,n,t){var o,l,r;return null!=(r=null==(o=t.getKind)?void 0:o.call(t,e,n))?r:String(null!=(l=e.kind)?l:"")}function aa(e,n,t){var o,l;const r=null!=(l=null==(o=t.getContent)?void 0:o.call(t,e,n))?l:e.content;return"string"==typeof r?r:""}function ua(e,n,t){var o;const l=null==(o=t.getFinal)?void 0:o.call(t,e,n);if("boolean"==typeof l)return l;const r=e.final;return"boolean"!=typeof r||r}function sa(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function ca(e,n,t){const o=ia(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&aa(e,n,t).length>0}function da(e,n,t){var o;const l=null==(o=t.estimateItemHeight)?void 0:o.call(t,e,n);if(Number.isFinite(l)&&l>0)return l;const r=ia(e,n,t);return"assistant-markdown"===r||"markdown"===r?360:"system-divider"===r?44:"tool-call"===r?72:"thinking"===r?92:"error"===r?76:"user-message"===r?88:aa(e,n,t).length>0?360:96}function fa(e){const n=he(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=he(/* @__PURE__ */new Map),l=he(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=X(!1),f=[0,80,180,360,640];let m,h=0,v=null,p=[],g=0;const y=/* @__PURE__ */new Map,k=/* @__PURE__ */new Map;let N,b=!1,S=null,x=!1,w=null;function M(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(le(e),null)}function _(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function B(){return[...Se(e.items)]}function O(){const n=Se(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return ra(n,t,e)}function I(n,t){return ca(n,t,e)}function H(n,t){const o=T(n,t),l=O(),r=sa(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function L(){const n=Se(e.measurementKey);return null==n?void 0:String(n)}function A(){const n=Se(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){const n=Se(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===A()?"monaco":"pre"}function $(){var e;return`${null!=(e=L())?e:""}${A()}${R()}`}function E(n,t){if(I(n,t))return H(n,t);const o=T(n,t),l=O(),r=sa(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function F(e){const n=B();for(let t=0;t<n.length;t++){const o=n[t];if(T(o,t)===e)return{item:o,index:t}}return null}function P(e,n){var t;const o=F(e);if(!o||!n)return!1;if(n.sourceKey!==E(o.item,o.index))return!1;const l=I(o.item,o.index)?$():L();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!P(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=F(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===H(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=O())?o:"")&&function(e){const n=$(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function W(e,n){return z(e,n)}function j(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!W(e,n))return 0;const l=Number(null==(t=null==n?void 0:n.metrics)?void 0:t.totalHeight);return Number.isFinite(l)&&l>0?Math.ceil(l):0}(e,n);return!Number.isFinite(r)||r<=0||!n?0:(j(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function q(e){return Number.isFinite(e)&&e>0?e:null}function U(){if(!x)return;x=!1,w=null;const e=N;N=void 0,e&&ae(e)}function Y(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function Z(o,l,r=function(e){const n=F(e);return n?function(e,n){const t=I(e,n)?$():L();return a({sourceKey:E(e,n)},null==t?{}:{measurementKey:t})}(n.item,n.index):void 0}(o)){const i=q(l);if(null==i)return;const u=n.get(o),s=r&&(f=r,!((null!=(h=null==(c=t.get(o))?void 0:c.sourceKey)?h:"")===(null!=(p=null==f?void 0:f.sourceKey)?p:"")&&(null!=(y=null==c?void 0:c.measurementKey)?y:"")===(null!=(k=null==f?void 0:f.measurementKey)?k:"")&&(null!=(b=null==c?void 0:c.widthBucket)?b:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,b,S;if(null!=u&&Math.abs(u-i)<.5&&!s)return;if(d.value)return n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),void function(){const e=m,n=g;e&&le(()=>{ue(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,_=M?re():void 0,B=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),O=M&&B<=2,T=M&&B<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var H;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),M&&((H=O?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:B}:_)&&(x||(N=H,x=!0,w=C(U))))}function J(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function G(){if(!b)return;b=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ee(n,{allowMarkdownShrink:t.allowMarkdownShrink});U()}function Q(){G(),U()}function ee(n,t={}){const o=function(e){return oa(s.get(e),M)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=F(e);return!!n&&I(n.item,n.index)}(n))return o>0&&Z(n,o),void i();const a=V(n),u=function(e,n){return la(s.get(e),M,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&Z(n,e),void i()}const c=F(n);return c&&!aa(c.item,c.index,e).trim()?(o>0&&Z(n,o),void i()):l>0?(o>l+1&&Z(n,o),void i()):(o>0&&Z(n,o),void i())}function ne(){const e={},n=B();for(let t=0;t<n.length;t++){const o=T(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function te(){const e={},n=B();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);P(l,r)&&(e[l]=r)}return e}function oe(){const e={};for(const[n,t]of o)e[n]=t;return e}function re(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=B();for(let a=0;a<l.length;a++){const t=T(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:T(i,r.start),offsetWithinItemPx:0}:void 0}function ie(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=L())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&P(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ae(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function ue(e,n){e===h&&ae(n)}function se(e){e===h&&(d.value=!1,Q(),ue(e,m),m=void 0,g=0)}function ce(){Y(),_(w),x=!1,w=null,N=void 0,_(S),b=!1,S=null,k.clear();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return pe()&&ve(ce),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void J(i);if(u===a)return void ee(i);if(J(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ee(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ee(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=T(n,t),r=ua(n,t,e),a=O(),u=aa(n,t,e),s=H(n,t),c=$(),d=A(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=be(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=W(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:W(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:96,heightDiffThresholdPx:4},g={content:u,final:r,mode:d,codeRenderer:f,nodeVirtual:!1,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==H(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:$()});const o=function(e){return"final"===e.phase||!!e.stable&&("measured"===e.confidence||"final"===e.confidence)}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),b||(b=!0,S=C(G))},onVirtualStateChange(e){e.sessionKey===H(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=L();return u(a({threadKey:O()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:oe()})},preloadThreadState:ie,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(Y(),d.value=Boolean(t),g=n,m=t,ie(e),!t)return d.value=!1,m=void 0,void(g=0);ue(n,t),le(()=>{ue(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{ue(n,t),o===f.length-1&&se(n)},e);p.push(l)}):se(n)})},dispose:ce}}const ma=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function ha(e){return re(e)}const va=ha(()=>import("./index3.js")),pa=ha(()=>import("./index5.js")),ga=ha(()=>import("./index6.js")),ya=ha(()=>import("./index11.js")),ka=ha(()=>import("./index10.js")),Na=ha(()=>import("./index7.js")),ba=ha(()=>import("./index4.js")),Sa=ha(()=>import("./index8.js")),xa=ha(()=>import("./index9.js")),wa={MarkdownRender:xi,NodeRenderer:xi,AdmonitionNode:Hi,BlockquoteNode:Yt,CheckboxNode:nn,CodeBlockNode:va,DefinitionListNode:Qt,EmojiNode:on,EmphasisNode:Pt,FootnoteNode:lo,FootnoteReferenceNode:an,FootnoteAnchorNode:no,HardBreakNode:zt,HeadingNode:ao,HtmlBlockNode:bo,HtmlInlineNode:Nn,HighlightNode:Et,ImageNode:nt,D2BlockNode:Na,InfographicBlockNode:ka,InlineCodeNode:xn,PreCodeNode:dt,InsertNode:Rt,LinkNode:Lt,ListItemNode:mo,ListNode:ho,MathBlockNode:pa,MathInlineNode:ga,MermaidBlockNode:ya,ParagraphNode:wo,StrikethroughNode:Bt,StrongNode:Ct,SubscriptNode:wt,SuperscriptNode:St,TableNode:Ho,TextNode:vt,ThematicBreakNode:Ao,VmrContainerNode:Eo,ReferenceNode:Nt,MarkdownCodeBlockNode:Sa,MarkstreamVirtualTimeline:xa,Tooltip:ba},Ma={install(e,n){var t,o;Object.entries(wa).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Oe(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(ma,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&Te(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions),n&&"infographicLoader"in n&&Yi(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Wn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(ze,function(e={}){return R(Ve(e))}(n.components))}};export{la as $,Hi as A,Yt as B,nn as C,Na as D,on as E,no as F,dt as G,zt as H,nt as I,lo as J,Ze as K,Lt as L,ma as M,Wi as N,Ji as O,wo as P,zi as Q,Nt as R,Bt as S,Ho as T,Zi as U,Eo as V,da as W,Ue as X,Di as Y,Qi as Z,ao as _,va as a,aa as a0,ua as a1,ra as a2,ia as a3,sa as a4,Kn as a5,ji as a6,kr as a7,Gi as a8,ca as a9,oa as aa,Ye as ab,Xn as ac,qe as ad,Ki as ae,jn as af,Yi as ag,Pn as ah,fa as ai,xr as aj,Un as ak,ui as al,go as am,Qt as b,Pt as c,an as d,Et as e,bo as f,Nn as g,ka as h,xn as i,Rt as j,mo as k,ho as l,Sa as m,xa as n,pa as o,ga as p,ya as q,Ct as r,wt as s,St as t,vt as u,Ao as v,ba as w,Ma as x,xi as y,en 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},u=(e,o)=>n(e,t(o)),s=(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{normalizeCustomHtmlTagName as c,tokenizeHtml as d,hasCustomHtmlComponents as f,sanitizeHtmlAttrs as m,sanitizeHtmlTokenAttrs as h,tokenAttrsToRecord as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,isCustomHtmlComponentTag as N,sanitizeHtmlContent as b,sanitizeImageSrc as S,shouldOpenLinkInNewTab as x,NON_STRUCTURING_HTML_TAGS as M,normalizeCustomHtmlTags as w,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as O,resolveCustomHtmlTags as T,parseMarkdownToStructure as I,EXTENDED_STANDARD_HTML_TAGS as H,stripCustomHtmlWrapper as A,setDefaultMathOptions as L}from"stream-markdown-parser";import{shallowRef as R,inject as E,computed as $,defineComponent as P,openBlock as F,createElementBlock as K,createElementVNode as z,toDisplayString as W,h as j,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as X,watch as G,Fragment as Y,createTextVNode as J,createCommentVNode as Z,getCurrentInstance as Q,onBeforeUnmount as ee,renderSlot as ne,Transition as te,withCtx as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,normalizeStyle as se,renderList as ce,readonly as de,markRaw as fe,provide as me,reactive as he,onScopeDispose as ve,getCurrentScope as pe,onMounted as ge,watchEffect as ye,triggerRef as ke,resolveComponent as Ne,withDirectives as be,vShow as Se,toRaw as xe,toValue as Me}from"vue";import{resolveStreamingTextUpdate as we,createSmoothMarkdownStream as Ce,getHighlightRegistrationKey as _e,normalizeShikiLanguage as Be}from"markstream-core";import{M as Oe,n as Te,s as Ie,j as He}from"./index2.js";import{b as Ae}from"./workers-katexWorkerClient.js";import{c as Le,p as Re,e as Ee,a as $e,b as Pe}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const Fe="__global__",Ke="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ze=(()=>{const e=globalThis;if(e[Ke])return e[Ke];const n={scopedCustomComponents:{},revision:R(0)};return e[Ke]=n,n})(),We=ze.revision,je=/* @__PURE__ */Symbol("markstreamCustomComponents"),De=/* @__PURE__ */new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Ve(e){return De.has(String(e).trim().toLowerCase())}function qe(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ue(e={}){const n={};for(const[t,o]of Object.entries(e))if(null!=o){n[t]=o;for(const e of/* @__PURE__ */new Set([c(t),c(qe(t))]))!e||Ve(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Xe(e,n){"string"==typeof e?ze.scopedCustomComponents[e]=Ue(n||{}):ze.scopedCustomComponents[Fe]=Ue(e||{}),We.value++}function Ge(e){const n=Ue(ze.scopedCustomComponents[Fe]||{});if(!e)return n;const t=Ue(ze.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ye(e){const n=E(je,null);return $(()=>{var t;return We.value,function(e,n={}){return We.value,a(a(a({},Ue(ze.scopedCustomComponents[Fe]||{})),Ue(n)),Ue(function(e){return e&&ze.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Je(e){if(e===Fe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ze.scopedCustomComponents[e],We.value++}function Ze(){delete ze.scopedCustomComponents[Fe],We.value++}const Qe=["aria-label"],en={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"},nn={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"},tn=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},on=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),K("svg",nn,[...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)])])):(F(),K("svg",en,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Qe))}),[["__scopeId","data-v-be21ab83"]]);on.install=e=>{e.component(on.__name,on)};const ln={class:"emoji-node"},rn=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",ln,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);rn.install=e=>{e.component(rn.__name,rn)};const an=["id"],un=["title"],sn=/* @__PURE__ */tn(/* @__PURE__ */P({__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)=>(F(),K("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,un)],8,an))}}),[["__scopeId","data-v-c1463a29"]]);sn.install=e=>{e.component(sn.__name,sn)};const cn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function dn(e){cn&&console.warn(e)}function fn(e,n="safe",t){return m(e,n,t)}function mn(e){return p(e)}function hn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function vn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=h((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),hn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),hn(e.value)]):Object.entries(l).map(([e,n])=>[e,hn(n)]):null,n,t);var l;if(!o)return;const r=mn(v(o));return Object.keys(r).length>0?r:void 0}function pn(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 gn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function yn(e,n,t,o,l,r,i=!1){const s=function(e,n){return N(e,n)}(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[pn(e,n,!0)]:[pn(e,n),...t,`</${e}>`];const c=m(n,r,e),d=c.key,f=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=mn(c);return j(n,u(a({},l),{key:f}),t.length>0?t:void 0)}return j(e,u(a({},c),{innerHTML:void 0,key:f}),t.length>0?t:void 0)}function kn(e,n){return f(e,n)}function Nn(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=yn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);gn(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=yn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?gn(l[l.length-1].children,a):gn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&dn(`Auto-closing unclosed tag: <${i.tagName}>`)}else dn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=yn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?gn(l[l.length-1].children,o):gn(r,o),dn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,cn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const bn=["innerHTML"],Sn=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=E("markstreamHtmlPolicy",void 0),o=$(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Ye(()=>n.customId),r=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=$(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Nn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!kn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=Nn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(F(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(F(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,bn))}}),[["__scopeId","data-v-d17f12b0"]]);Sn.install=e=>{e.component(Sn.__name,Sn)};const xn={class:"inline-code"},Mn={key:0},wn=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=E("markstreamFade",void 0),l=E("markstreamTextStreamState",void 0),r=E("markstreamStreamVersion",void 0),i=$(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=$(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=$(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=$(()=>!a.value),c=$(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=X(n.node.code),f=X("");let m=null==r?void 0:r.value;const h=X(0);function v(){return d.value+f.value}function p(){f.value&&(d.value=v(),f.value="")}G([()=>n.node.code,c,a,()=>null==r?void 0:r.value],([e,n,t,o])=>{const r=String(null!=e?e:""),i=c.value,u=o!==m;m=o;const s=we({nextContent:r,persistedContent:i?null==l?void 0:l.get(i):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value,streamRenderVersionChanged:u});d.value=s.settledContent,f.value=s.streamedDelta,s.appended&&(h.value+=1),i&&(null==l||l.set(i,r))},{immediate:!0}),G(a,e=>{var n;e||(n=v(),d.value=n,f.value="")});const g=$(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),K("code",xn,[s.value?(F(),K(Y,{key:0},[J(W(u.value),1)],64)):(F(),K(Y,{key:1},[d.value?(F(),K("span",Mn,W(d.value),1)):Z("",!0),f.value?(F(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},W(f.value),35)):Z("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);wn.install=e=>{e.component(wn.__name,wn)};const Cn=X(!1),_n=X(""),Bn=X("top"),On=X(null),Tn=X(null),In=X(null),Hn=X(null),An=X(null);let Ln=null,Rn=null,En=0;function $n(){Ln&&(clearTimeout(Ln),Ln=null),Rn&&(clearTimeout(Rn),Rn=null)}let Pn=!1,Fn=null,Kn=!1;function zn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++En;$n();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!Pn&&!Kn&&"undefined"!=typeof document){null!=Fn||(Fn=s(null,null,function*(){const[{createApp:e,h:n},{default:t}]=yield Promise.all([import("vue"),import("./Tooltip.js")]),o=document.createElement("div");o.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(o),e({setup:()=>()=>{var e;return n(t,{visible:Cn.value,"anchor-el":On.value,content:_n.value,placement:Bn.value,id:Tn.value,originX:In.value,originY:Hn.value,isDark:null!=(e=An.value)?e:void 0})}}).mount(o),Pn=!0}));try{yield Fn}catch(e){Pn=!1,Fn=null,Kn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),Pn&&i===En){Tn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,On.value=e,_n.value=n,Bn.value=t,In.value=null!=(o=null==l?void 0:l.x)?o:null,Hn.value=null!=(a=null==l?void 0:l.y)?a:null,An.value="boolean"==typeof r?r:null,Cn.value=!0;try{e.setAttribute("aria-describedby",Tn.value)}catch(u){}}});o?a():Ln=setTimeout(a,80)}function Wn(e=!1){En+=1,$n();const n=()=>{if(On.value&&Tn.value)try{On.value.removeAttribute("aria-describedby")}catch(e){}Cn.value=!1,On.value=null,Tn.value=null,In.value=null,Hn.value=null};e?n():Rn=setTimeout(n,120)}const jn={"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..."},Dn=/* @__PURE__ */Symbol("markstreamI18nFallback");function Vn(e){Object.assign(jn,e)}function qn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:jn[e]}const Un=(e,n)=>{var t;return null!=(t=qn(e,n))?t: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 Xn(e,n){return{t(t){const o=qn(t,n);if(e.te&&null!=o&&!e.te(t))return Un(t,n);const l=e.t(t);return l===t&&null!=o?Un(t,n):l}}}function Gn(){const e=function(){var e,n,t;try{const o=Q(),l=Dn,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=Q(),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(n)return Xn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return Xn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Un(n,e)}}function Yn(e,n){var t,o;const l=null!=(o=null!=(t=e.indexKey)?t:n["index-key"])?o:n.indexKey;return null==l||""===l?"":String(l)}const Jn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Zn={key:1,class:"image-placeholder"},Qn={key:1,class:"image-node__raw-text"},et={key:0,class:"image-shimmer-overlay"},nt={key:1,class:"image-node__raw-text"},tt={key:2,class:"image-error"},ot=/* @__PURE__ */tn(/* @__PURE__ */P({__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=X(!1),r=X(!1),i=X(""),a=X("primary"),u=X(null),c=U(),d=E(Oe,null);let f="",m=null;const h=$(()=>S(t.node.src)),v=$(()=>S(t.fallbackSrc)),p=$(()=>i.value),g=$(()=>!t.lazy),y=$(()=>!t.node.loading&&"failed"!==a.value&&i.value.length>0),k=$(()=>"failed"===a.value),N=$(()=>!g.value&&!l.value&&!r.value&&"failed"!==a.value&&i.value.length>0),b=$(()=>Yn(t,c));function x(e=b.value){e&&u.value&&(null==d||d.reportHeight(e,u.value.offsetHeight))}function M(e=b.value){e&&le(()=>{x(e)})}function w(){m&&(clearTimeout(m),m=null)}function C(){const e=b.value;e&&f!==e&&(f&&(null==d||d.markSettled(f)),w(),f=e,null==d||d.markPending(e),"undefined"!=typeof window&&(m=window.setTimeout(()=>{f===e&&(M(e),_())},8e3)))}function _(){return s(this,null,function*(){const e=f;e&&(w(),f="",yield le(),x(e),null==d||d.markSettled(e))})}function B(){if("primary"===a.value&&v.value&&v.value!==i.value)return a.value="fallback",i.value=v.value,l.value=!1,r.value=!1,void M();a.value="failed",r.value=!0,o("error",i.value),M()}function O(){l.value=!0,r.value=!1,o("load",p.value),M()}function T(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,p.value])}const{t:I}=Gn();return G([h,v,()=>t.node.loading],()=>(l.value=!1,r.value=!1,t.node.loading||h.value?(i.value=h.value,void(a.value="primary")):v.value?(i.value=v.value,void(a.value="fallback")):(i.value="",a.value="failed",void(r.value=!0))),{immediate:!0}),G([y,l,r,p,()=>t.lazy],([e,n,t,o,l])=>e&&o&&!t?n?(_(),void M()):l?(C(),void M()):void(n||t||C()):(_(),void M()),{flush:"post",immediate:!0}),ee(()=>{!function(){const e=f;e&&(w(),f="",null==d||d.markSettled(e))}()}),(n,o)=>{var i,a,s,c,d;return F(),K("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(F(),K("img",{key:0,src:p.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(c=null!=(s=t.node.title)?s:t.node.alt)?c:""),class:D(["image-node__img",{"is-loading":!g.value&&!l.value,"is-loaded":g.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:g.value?"high":void 0,decoding:g.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(d=t.node.alt)?d:q(I)("image.preview"),onError:B,onLoad:O,onClick:T},null,42,Jn)):Z("",!0),e.node.loading&&!r.value?(F(),K("span",Zn,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.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):(F(),K("span",Qn,W(e.node.raw),1))])):Z("",!0),V(te,{name:"shimmer-fade"},{default:oe(()=>[N.value&&!e.node.loading?(F(),K("span",et,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=z("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",nt,W(e.node.raw),1))])):Z("",!0)]),_:3}),k.value?(F(),K("span",tt,[ne(n.$slots,"error",{node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[2]||(o[2]=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(q(I)("image.loadError")),1)],!0)])):Z("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);ot.install=e=>{e.component(ot.__name,ot)};const lt={key:2},rt=/* @__PURE__ */P({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Ye(()=>n.customId),o=E("markstreamHtmlPolicy",void 0),l=E("markstreamNestedRendererProps",void 0),r=$(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=$(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=re({loader:()=>Promise.resolve().then(()=>Xi),suspensible:!1}),c=$(()=>n.components[String(n.node.type)]),d=$(()=>Boolean(c.value&&t.value[n.node.type]&&!Ve(String(n.node.type)))),f=$(()=>d.value?vn(n.node,r.value):void 0),m=$(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=$(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=$(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(F(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:oe(()=>[m.value?(F(),ie(q(s),ue({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):h.value?(F(),ie(q(s),ue({key:1},i.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(F(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(F(),K("span",lt,W(v.value),1)):Z("",!0)}}),it=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],at={key:0,translate:"no",class:"markstream-pre__diff-code"},ut={class:"markstream-pre__diff-number","aria-hidden":"true"},st={class:"markstream-pre__diff-content"},ct={class:"markstream-pre__diff-content-inner"},dt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},ft=["textContent"],mt=/* @__PURE__ */P({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const n=e,t=$(()=>{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=$(()=>`language-${t.value}`),l=$(()=>{var e,t,o,l,r;return!0===(null==(e=n.node)?void 0:e.diff)?String(null!=(o=null==(t=n.node)?void 0:t.code)?o:""):function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(null==(l=n.node)?void 0:l.code,!0===(null==(r=n.node)?void 0:r.loading))}),r=$(()=>l.value.split(/\r\n|\n|\r/)),i=$(()=>Array.from({length:Math.max(1,r.value.length)},(e,n)=>n+1)),s=$(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),c=$(()=>s.value&&!0===n.diffInline),d=$(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return{height:t,minHeight:t,maxHeight:t,overflow:"auto"}});function f(e){return 0===String(null!=e?e:"").trim().length}function m(e,n="context",t={}){const o=f(e);return{code:e,kind:o&&"hunk"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function h(e){const n=String(null!=e?e:"");return n?n.split(/\r\n|\n|\r/):[]}function v(e,n){return!f(e[n])||n<e.length-1}function p(e){return e.startsWith("-")&&!e.startsWith("---")}function g(e){return e.startsWith("+")&&!e.startsWith("+++")}function y(e,n){const t=h(e),o=h(n),l=function(e,n){const t=e.length,o=n.length;if((t+1)*(o+1)>15e5)return null;const l=o+1,r=new Uint32Array((t+1)*(o+1));for(let s=1;s<=t;s++)for(let t=1;t<=o;t++){const o=s*l+t;if(e[s-1]===n[t-1])r[o]=r[(s-1)*l+(t-1)]+1;else{const e=r[(s-1)*l+t],n=r[s*l+(t-1)];r[o]=e>=n?e:n}}const i=[];let a=t,u=o;for(;a>0&&u>0;)e[a-1]===n[u-1]?(i.push({originalIndex:a-1,modifiedIndex:u-1}),a--,u--):r[(a-1)*l+u]>=r[a*l+(u-1)]?a--:u--;return i.reverse(),i}(t,o);if(l){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},m(o[i.modifiedIndex])),{key:`inline-context-source-${i.originalIndex}-${i.modifiedIndex}`,number:i.modifiedIndex+1})),n=i.originalIndex+1,r=i.modifiedIndex+1}for(;n<t.length;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<o.length;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},m(o[i])),{key:`inline-prefix-${i}`,number:i+1})),i++;const d=[];for(;s>=i&&c>=i&&t[s]===o[c];)d.unshift(u(a({},m(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},m(t[f],"removed",{preserveBlankKind:v(t,f)})),{key:`inline-removed-source-${f}`,number:""}));for(let f=i;f<=c;f++)r.push(u(a({},m(o[f],"added",{preserveBlankKind:v(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}const k=$(()=>{var e,o,l,i;const s=function(e){const o=e.some(e=>p(e)),l=e.some(e=>g(e));return o&&l||function(){var e,o,l,r;if("diff"===t.value)return!0;const i=null!=(r=null==(l=String(null!=(o=null==(e=n.node)?void 0:e.raw)?o:"").split(/\r?\n/,1)[0])?void 0:l.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(o||l)}(r.value),d=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(c.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:s?function(e){const n=[];let t=1;for(const[o,l]of e.entries())if(l.startsWith("@@"))n.push(u(a({},m(l,"hunk")),{key:`inline-hunk-${o}`,number:""}));else if(p(l))n.push(u(a({},m(l.slice(1),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${o}`,number:""}));else if(g(l))n.push(u(a({},m(l.slice(1),"added",{preserveBlankKind:!0})),{key:`inline-added-${o}`,number:t++}));else{const e=l.startsWith(" ")?l.slice(1):l;n.push(u(a({},m(e)),{key:`inline-context-${o}`,number:t})),t++}return n}(r.value):y(null==(e=n.node)?void 0:e.originalCode,null==(o=n.node)?void 0:o.updatedCode)}];if(!s&&d){const e=h(null==(l=n.node)?void 0:l.originalCode),t=h(null==(i=n.node)?void 0:i.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:e.map((n,o)=>{const l=t[o]===n?"context":"removed";return u(a({},m(n,l,{preserveBlankKind:v(e,o)})),{key:`original-${o}`,number:o+1})})},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:t.map((n,o)=>{const l=e[o]===n?"context":"added";return u(a({},m(n,l,{preserveBlankKind:v(t,o)})),{key:`modified-${o}`,number:o+1})})}]}const f=[],k=[];for(const n of r.value)if(n.startsWith("@@"))f.push(m(n,"hunk")),k.push(m(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))f.push(m(n.slice(1),"removed",{preserveBlankKind:!0}));else if(n.startsWith("+")&&!n.startsWith("+++"))k.push(m(n.slice(1),"added",{preserveBlankKind:!0}));else{const e=n.startsWith(" ")?n.slice(1):n;f.push(m(e)),k.push(m(e))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:f.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:k.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}]}),N=$(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"}),b=X(null),S=X([]);let x=null,M=null;function w(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function C(e,n){var t;if(!e)return n;const o=e.querySelector(".markstream-pre__diff-content"),l=null==o?void 0:o.getBoundingClientRect(),r=null!=(t=null==l?void 0:l.height)?t:0;return Math.max(n,Math.ceil(r))}function _(){"undefined"!=typeof window&&(null!=x&&window.cancelAnimationFrame(x),x=window.requestAnimationFrame(()=>{!function(){var e,n;x=null;const t=b.value;if(!t||!s.value)return void(S.value.length&&(S.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=w(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=w(n.lineHeight);return o>0?o:18}(t),l=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),r=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),i=Math.max(l.length,r.length),a=[];for(let s=0;s<i;s++){const t=C(null!=(e=l[s])?e:null,o),i=C(null!=(n=r[s])?n:null,o),u=Math.max(o,t,i);a.push({rowHeight:u,originalHeight:t,modifiedHeight:i})}var u,c;u=S.value,c=a,u.length===c.length&&u.every((e,n)=>{const t=c[n];return t&&Math.abs(e.rowHeight-t.rowHeight)<=.5&&Math.abs(e.originalHeight-t.originalHeight)<=.5&&Math.abs(e.modifiedHeight-t.modifiedHeight)<=.5})||(S.value=a)}()}))}function B(e){null==M||M.disconnect(),M=null,e&&s.value&&"undefined"!=typeof ResizeObserver&&(M=new ResizeObserver(()=>{_()}),M.observe(e))}function O(e,n){const t=S.value[e];if(!t)return;const o="original"===n?t.originalHeight:t.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(t.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(o)}px`}}return G(b,e=>{B(e),le(()=>_())},{flush:"post"}),G([s,k],()=>{B(b.value),le(()=>_())},{flush:"post",immediate:!0}),ee(()=>{null!=x&&(window.cancelAnimationFrame(x),x=null),null==M||M.disconnect(),M=null}),(r,a)=>(F(),K("pre",{ref_key:"preRef",ref:b,style:se(d.value),class:D([o.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":s.value,"markstream-pre--diff-inline":c.value}]),"aria-busy":!0===e.node.loading,"aria-label":N.value,"data-language":t.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[s.value?(F(),K("code",at,[(F(!0),K(Y,null,ce(k.value,e=>(F(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[(F(!0),K(Y,null,ce(e.lines,(n,t)=>(F(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(O(t,e.key))},[a[0]||(a[0]=z("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),z("span",ut,W(n.number),1),z("span",st,[z("span",ct,W(n.code),1)])],6))),128))],2))),128))])):(F(),K(Y,{key:1},[n.showLineNumbers?(F(),K("span",dt,[(F(!0),K(Y,null,ce(i.value,e=>(F(),K("span",{key:e,class:"markstream-pre__line-number"},W(e),1))),128))])):Z("",!0),z("code",{translate:"no",class:"markstream-pre__code",textContent:W(l.value)},null,8,ft)],64))],14,it))}});mt.install=e=>{e.component(mt.__name,mt)};const ht=R(!1);let vt=null;const pt={key:0},gt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(vt||(vt=Ae().then(e=>{ht.value=!!e}).catch(()=>{ht.value=!1})),de(ht)),o=U(),l=E("markstreamFade",void 0),r=E("markstreamTextStreamState",void 0),i=E("markstreamStreamVersion",void 0),a=$(()=>{const e=o.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),u=$(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),s=$(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),c=X(n.node.content),d=X("");let f=null==i?void 0:i.value;const m=X(0);function h(){return c.value+d.value}function v(){d.value&&(c.value=h(),d.value="")}G([()=>n.node.content,s,u,()=>null==i?void 0:i.value],([e,n,t,o])=>{const l=String(null!=e?e:""),i=s.value,a=o!==f;f=o;const h=we({nextContent:l,persistedContent:i?null==r?void 0:r.get(i):void 0,currentState:{settledContent:c.value,streamedDelta:d.value},typewriterEnabled:u.value,streamRenderVersionChanged:a});c.value=h.settledContent,d.value=h.streamedDelta,h.appended&&(m.value+=1),i&&(null==r||r.set(i,l))},{immediate:!0}),G(u,e=>{var n;e||(n=h(),c.value=n,d.value="")});const p=$(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(F(),K("span",{class:D([[q(t)&&e.node.center?"text-node-center":""],"text-node"])},[c.value?(F(),K("span",pt,W(c.value),1)):Z("",!0),d.value?(F(),K("span",{key:1,class:D(["text-node-stream-delta",[p.value]]),onAnimationend:v},W(d.value),35)):Z("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt=P({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return j(mt,u(a({},n),{node:t.node,showLineNumbers:!0,reservedHeightPx:null!=(e=t.estimatedHeightPx)?e:t.estimatedContentHeightPx,class:["code-pre-fallback",n.class],"data-markstream-code-loading":"1"}))}}}),kt=re({loader:()=>s(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 preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),mt}}),loadingComponent:yt,delay:0,suspensible:!1}),Nt=re(()=>s(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 j(gt,u(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 Ae())return(yield import("./index6.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 j(gt,u(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:""}$`}}))}})),bt=re(()=>s(null,null,function*(){try{if(yield Ae())return(yield import("./index5.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 j(gt,u(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:""}$$`}}))}})),St=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),K("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"]]);St.install=e=>{e.component(St.__name,St)};const xt={class:"superscript-node"},Mt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,emphasis:zt,footnote_reference:sn,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,emoji:rn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("sup",xt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const wt={class:"subscript-node"},Ct=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,emphasis:zt,footnote_reference:sn,strikethrough:Tt,highlight:Ft,insert:$t,superscript:Mt,emoji:rn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("sub",wt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const _t={class:"strong-node"},Bt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,emphasis:zt,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,footnote_reference:sn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("strong",_t,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:t,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":n.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Bt.install=e=>{e.component(Bt.__name,Bt)};const Ot={class:"strikethrough-node"},Tt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,emphasis:zt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,footnote_reference:sn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("del",Ot,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);Tt.install=e=>{e.component(Tt.__name,Tt)};const It=["href","title","aria-label","aria-hidden","target","rel"],Ht=["aria-hidden"],At={class:"link-text-wrapper relative inline-flex"},Lt={class:"leading-[normal] link-text"},Rt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=E("markstreamShowTooltips",void 0),o=$(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=$(()=>{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,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--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&&(s["--link-color"]=n.color),s}),r=Ye(()=>n.customId),i=$(()=>a({text:gt,strong:Bt,strikethrough:Tt,emphasis:zt,image:ot,html_inline:Sn,inline_code:wn},r.value)),u=U(),s=$(()=>{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 fn(l,"safe","a")}),c=$(()=>a(a({},u),s.value)),d=$(()=>{var e,t;return fn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=$(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(x(d.value)?"_blank":void 0)}),m=$(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=$(()=>{if(!d.value)return;const e=c.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}),v=$(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Wn()}const g=$(()=>{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=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(F(),K("span",ue({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},q(u),{style:l.value}),[z("span",At,[z("span",Lt,[V(q(gt),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Ht)):(F(),K("a",ue({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";zn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>(F(),ie(q(rt),{key:`${e.indexKey||"emphasis"}-${o}`,components:i.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))],16,It))}}}),[["__scopeId","data-v-367e6ca4"]]);Rt.install=e=>{e.component(Rt.__name,Rt)};const Et={class:"insert-node"},$t=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,emphasis:zt,strikethrough:Tt,highlight:Ft,subscript:Ct,superscript:Mt,emoji:rn,footnote_reference:sn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("ins",Et,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);$t.install=e=>{e.component($t.__name,$t)};const Pt={class:"highlight-node"},Ft=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,emphasis:zt,strikethrough:Tt,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,footnote_reference:sn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("mark",Pt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);Ft.install=e=>{e.component(Ft.__name,Ft)};const Kt={class:"emphasis-node"},zt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>a({text:gt,inline_code:wn,link:Rt,html_inline:Sn,strong:Bt,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,footnote_reference:sn,math_inline:Nt,reference:St},t.value));return(t,l)=>(F(),K("em",Kt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(rt),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);zt.install=e=>{e.component(zt.__name,zt)};const Wt={class:"hard-break"},jt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),K("br",Wt))}),[["__scopeId","data-v-50c58f70"]]);jt.install=e=>{e.component(jt.__name,jt)};const Dt=/* @__PURE__ */P({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=fe({checkbox:on,checkbox_input:on,emoji:rn,emphasis:zt,hardbreak:jt,highlight:Ft,inline_code:wn,insert:$t,link:Rt,reference:St,strikethrough:Tt,strong:Bt,subscript:Ct,superscript:Mt,text:gt}),o=Ye(()=>n.customId),l=$(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),K(Y,null,ce(e.nodes,(t,o)=>(F(),ie(q(rt),{key:o,components:l.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"inline"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))}});function Vt(e){if(!e||"object"!=typeof e)return!1;const n=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(n))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(n))return!0;const t=e.children;return Array.isArray(t)&&t.every(Vt)}function qt(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Vt))return e;if(!n||1!==e.length)return null;const o=e[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const l=o.children;return(t||l.length>0)&&l.every(Vt)?l:null}function Ut(e){var n,t;if(!(null==e?void 0:e.length))return null;let o="";for(const l of e){if("text"!==(null==l?void 0:l.type)||!0===l.center)return null;o+=String(null!=(t=null!=(n=l.content)?n:l.raw)?t:"")}return o}const Xt=["cite"],Gt={key:0,dir:"auto",class:"paragraph-node"},Yt=["custom-id"],Jt=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=Ye(()=>n.customId),o=$(()=>Boolean(t.value.paragraph)),l=$(()=>Boolean(t.value.text)),r=$(()=>qt(n.node.children,!o.value)),i=$(()=>!1!==n.fade||l.value?null:Ut(r.value));return me("markstreamShowTooltips",$(()=>n.showTooltips)),me("markstreamFade",$(()=>n.fade)),(t,o)=>(F(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),K("p",Gt,[null!==i.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(i.value),9,Yt)):(F(),ie(q(Dt),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),ie(q(Ui),{key:1,"show-tooltips":n.showTooltips,"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,Xt))}}),[["__scopeId","data-v-abfecebc"]]);Jt.install=e=>{e.component(Jt.__name,Jt)};const Zt={class:"definition-list"},Qt={class:"definition-term"},eo={class:"definition-desc"},no=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(F(),K("dl",Zt,[(F(!0),K(Y,null,ce(n.node.items,(o,l)=>(F(),K(Y,{key:l},[z("dt",Qt,[V(q(Ui),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),z("dd",eo,[V(q(Ui),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);no.install=e=>{e.component(no.__name,no)};const to=["href","title"],oo=/* @__PURE__ */tn(/* @__PURE__ */P({__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",block:"center"})}return(n,o)=>(F(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,to))}}),[["__scopeId","data-v-e1eb37b6"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["id"],ro={class:"flex-1"},io=/* @__PURE__ */P({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(F(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",ro,[V(q(Ui),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,lo))}});io.install=e=>{e.component(io.__name,io)};const ao=["custom-id"],uo=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ye(()=>n.customId),o=E("markstreamFade",void 0),l=$(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Ut(n.node.children)),r=$(()=>a({text:gt,inline_code:wn,link:Rt,image:ot,strong:Bt,emphasis:zt,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,checkbox:on,checkbox_input:on,footnote_reference:sn,hardbreak:jt,math_inline:Nt,reference:St},t.value));return(t,o)=>(F(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[null!==l.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(l.value),9,ao)):(F(!0),K(Y,{key:1},ce(e.node.children,(t,o)=>(F(),ie(q(rt),{key:o,components:r.value,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${o}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),so=uo;so.install=e=>{e.component(uo.__name,uo)};const co={key:0,dir:"auto",class:"paragraph-node"},fo=["custom-id"],mo={dir:"auto",class:"paragraph-node"},ho=["custom-id"],vo=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=$(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Ye(()=>n.customId),l=$(()=>Boolean(o.value.paragraph)),r=$(()=>Boolean(o.value.text)),i=$(()=>{var e;return qt(null==(e=t.value)?void 0:e.children,!l.value)}),a=$(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=qt([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=$(()=>u()?Ut(i.value):null),c=$(()=>{var e;return u()?Ut(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=$(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return me("markstreamShowTooltips",$(()=>n.showTooltips)),me("markstreamFade",$(()=>n.fade)),(e,o)=>{var l,r;return F(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(F(),K("p",co,[null!==s.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(s.value),9,fo)):(F(),ie(q(Dt),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(F(),K(Y,{key:1},[z("p",mo,[null!==c.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(c.value),9,ho)):(F(),ie(q(Dt),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(F(!0),K(Y,null,ce(a.value.nestedLists,(t,l)=>(F(),ie(q(Ui),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(F(),ie(q(Ui),{key:2,"show-tooltips":n.showTooltips,"index-key":`list-item-${n.indexKey}`,nodes:null!=(r=null==(l=t.value)?void 0:l.children)?r:[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,onCopy:o[1]||(o[1]=n=>e.$emit("copy",n))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);vo.install=e=>{e.component(vo.__name,vo)};const po=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=Ye(()=>e.customId),t=$(()=>n.value.list_item||vo);return(n,o)=>(F(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(F(!0),K(Y,null,ce(e.node.items,(l,r)=>{var i;return F(),ie(ae(t.value),ue({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,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);po.install=e=>{e.component(po.__name,po)};const go=/* @__PURE__ */Symbol("ViewportPriority"),yo=/* @__PURE__ */Symbol("ViewportPriorityOptions"),ko="400px";function No(){return E(yo,void 0)}function bo(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?X(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,u=/* @__PURE__ */new WeakMap;let s=1;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Set;let m=null;function h(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function v(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function p(e){if(e){const t=c.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch(n){}c.delete(e)}}d.size||f.size||v()}function g(e){const n=d.get(e);if(!n)return;const t=c.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(o){}}try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),p(n.bucketKey)}function y(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==m&&f.size&&(m=i(()=>{m=null;const e=f.values().next().value;e&&(f.delete(e),g(e),f.size&&y())},{timeout:1200}))}function k(n,t){if(!l)return null;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:ko,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[h((i=o).root),i.rootMargin,i.threshold].join("\0");var i;const a=c.get(r);if(a)return{key:r,bucket:a};let u;try{u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&g(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold})}catch(d){return null}const s={io:u,targets:/* @__PURE__ */new Map};return c.set(r,s),{key:r,bucket:s}}G(r,e=>{if(!e){for(const e of Array.from(d.keys()))g(e);v()}},{flush:"sync"});const N=(e,n)=>{const t=X(!1);let o,i=!1;const a=new Promise(e=>{o=()=>{i||(i=!0,e())}}),u=()=>{const n=d.get(e);if(!n)return f.delete(e),void p();const t=c.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),p(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=k(e,n);if(!s)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const m={resolve:o,visible:t,bucketKey:s.key,opts:n};return d.set(e,m),s.bucket.targets.set(e,m),s.bucket.io.observe(e),f.add(e),y(),{isVisible:t,whenVisible:a,destroy:u}};return N.refresh=function(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=k(n,t.opts);if(!o){g(n);continue}if(o.key===t.bucketKey)continue;const l=t.bucketKey,r=c.get(l);try{null==r||r.io.unobserve(n)}catch(e){}null==r||r.targets.delete(n),t.bucketKey=o.key,o.bucket.targets.set(n,t),o.bucket.io.observe(n),p(l)}},me(go,N),N}function So(){var e,n;const t=E(go,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new Map,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,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=e=>{if(!e)return;const n=l.get(e);if(n){for(const n of r){const t=o.get(n);if((null==t?void 0:t.bucketKey)===e)return}try{n.io.disconnect()}catch(t){}l.delete(e)}},d=e=>{const n=o.get(e);if(!n)return;const t=l.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(i){}}try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},f=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&f())},{timeout:1200}))};return(e,n)=>{const t=X(!1);let i,a=!1;const u=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{const n=o.get(e);if(!n)return r.delete(e),void(r.size||s());const t=l.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},h=(e=>{var n,t;if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return null;const o=(e=>{var n,t;return[null!=(n=null==e?void 0:e.rootMargin)?n:ko,null!=(t=null==e?void 0:e.threshold)?t:0].join("\0")})(e),r=l.get(o);if(r)return{key:o,bucket:r};const i=null!=(n=null==e?void 0:e.rootMargin)?n:ko;let a;try{a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:i,threshold:null!=(t=null==e?void 0:e.threshold)?t:0})}catch(s){return null}const u={io:a};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.io.observe(e),r.add(e),f(),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}const xo={key:2,class:"html-block-node__raw"},Mo=["innerHTML"],wo={key:1,class:"html-block-node__placeholder"},Co=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=E("markstreamHtmlPolicy",void 0),o=E("markstreamNestedRendererProps",void 0),l=$(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=$(()=>{var e,t;const r=null!=(e=null==o?void 0:o.value)?e:{};return u(a({},r),{customId:null!=(t=n.customId)?t:r.customId,htmlPolicy:l.value})}),i=re({loader:()=>Promise.resolve().then(()=>Xi),suspensible:!1}),s=$(()=>{const e=h(n.node.attrs,l.value);if(!e)return;const t=v(e);return Object.keys(t).length>0?t:void 0}),c=$(()=>{const e=String(n.node.tag||"").trim(),t=h(n.node.attrs,l.value,e);if(!t)return;const o=v(t);return Object.keys(o).length>0?o:void 0}),d=Ye(()=>n.customId),f=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=X(null),p=X("undefined"==typeof window),g=X(n.node.content),y=$(()=>Array.isArray(n.node.children)?n.node.children:[]),N=$(()=>String(n.node.tag||"div")),S=$(()=>{const e=N.value.trim().toLowerCase();return M.has(e)||k(e,l.value)}),x=$(()=>y.value.length>0&&!!n.node.tag&&!S.value),w=$(()=>{var e,t,o;if(x.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:null!=(e=g.value)?e:""};const r=null!=(t=g.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===l.value)return{mode:"html",content:b(r,l.value)};if(n.node.loading){const e=Nn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!kn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=Nn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),C=So(),_=No(),B=R(null),O=!!n.node.loading;return"undefined"!=typeof window?(G([()=>m.value,()=>null==_?void 0:_.value.heavyBlockMargin,()=>null==_?void 0:_.value.rootMargin],([e],t,o)=>{var l,r,i,a;if(null==(r=null==(l=B.value)?void 0:l.destroy)||r.call(l),B.value=null,!O)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);let u=!0;const s=null!=(a=null!=(i=null==_?void 0:_.value.heavyBlockMargin)?i:null==_?void 0:_.value.rootMargin)?a:ko,c=C(e,{rootMargin:s});B.value=c,p.value=p.value||c.isVisible.value,c.whenVisible.then(()=>{u&&B.value===c&&(p.value=!0)}),o(()=>{u=!1,c.destroy(),B.value===c&&(B.value=null)})},{immediate:!0}),G(()=>n.node.content,e=>{O&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=B.value)?void 0:e.destroy)||n.call(e),B.value=null}),(n,t)=>(F(),ie(ae(x.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},x.value?c.value:void 0),{default:oe(()=>[p.value?(F(),K(Y,{key:0},["structured"===w.value.mode?(F(),ie(q(i),ue({key:0},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):"dynamic"===w.value.mode?(F(),ie(q(f),{key:1,nodes:w.value.nodes},null,8,["nodes"])):"text"===w.value.mode?(F(),K("pre",xo,W(w.value.content),1)):(F(),K("div",ue({key:3},s.value,{innerHTML:w.value.content}),null,16,Mo))],64)):(F(),K("div",wo,[ne(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-91ef60b6"]]);Co.install=e=>{e.component(Co.__name,Co)};const _o={dir:"auto",class:"paragraph-node"},Bo=["custom-id"],Oo=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=Ye(()=>n.customId),o=E("markstreamHtmlPolicy",void 0),l=E("markstreamFade",void 0),r=E("markstreamParseOptions",void 0),i=E("markstreamCustomMarkdownIt",void 0),s=E("markstreamNestedRendererProps",void 0),c=$(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=$(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=$(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=$(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=$(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})}),v=re({loader:()=>Promise.resolve().then(()=>Xi),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=$(()=>n.node.children.filter(e=>!p(e))),y=$(()=>g.value.length>0&&g.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=>!p(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),k=$(()=>new Set(w(m.value))),N=$(()=>{if(!y.value||g.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const o=n.node.children[t];if(!p(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!p(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=$(()=>!1===(null==l?void 0:l.value)&&!t.value.text),S=$(()=>b.value?Ut(N.value):null);function x(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value}}const M=$(()=>a({inline_code:wn,image:ot,link:Rt,hardbreak:jt,emphasis:zt,strong:Bt,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,html_inline:Sn,html_block:Co,emoji:rn,checkbox:on,math_inline:Nt,checkbox_input:on,reference:St,footnote_anchor:oo,footnote_reference:sn,text:gt},t.value)),B=$(()=>N.value.map((e,o)=>{var l;const r=function(e){var n,o,l,r;if("html_block"===e.type||"html_inline"===e.type){const t=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(t&&!k.value.has(t)&&_(null!=(o=e.content)?o:e.raw,t)){const n=String(null!=(r=null!=(l=e.content)?l:e.raw)?r:"");return{child:{type:"text",content:n,raw:n},component:gt,isCustomComponent:!1}}}return{child:e,component:M.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Ve(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?vn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(F(),K("p",_o,[null!==S.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(S.value),9,Bo)):(F(!0),K(Y,{key:1},ce(B.value,e=>{return F(),K(Y,{key:e.key},[y.value&&p(e.originalChild)?(F(),K(Y,{key:0},[J(W((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(q(v),ue({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(q(v),ue({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(F(),ie(ae(e.component),ue({key:2,ref_for:!0},x(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Oo.install=e=>{e.component(Oo.__name,Oo)};const To={class:"table-node-wrapper"},Io=["aria-busy"],Ho={key:0},Ao=["custom-id"],Lo=["aria-label","onPointerdown"],Ro=["custom-id"],Eo={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},$o=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=$(()=>{var e;return null!=(e=n.node.loading)&&e}),o=$(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=X(null),r=X([]);let i=null;const a=$(()=>n.node.header.cells.length),u=$(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=$(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);me("markstreamShowTooltips",$(()=>n.showTooltips)),me("markstreamFade",$(()=>n.fade));const c=Ye(()=>n.customId),d=$(()=>Boolean(c.value.text)),f=$(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=qt(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Ut(r):null};return m.set(e,{children:e.children,textFastPath:t,paragraphFastPath:o,info:i}),i}function v(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 p(){i&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),i=null)}return G(a,()=>{p(),r.value=[]}),ee(p),(a,c)=>(F(),K("div",To,[z("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),K("colgroup",Ho,[(F(!0),K(Y,null,ce(e.node.header.cells,(e,n)=>(F(),K("col",{key:n,style:se(s.value[n])},null,4))),128))])):Z("",!0),z("thead",null,[z("tr",null,[(F(!0),K(Y,null,ce(e.node.header.cells,(t,o)=>(F(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(t).plainText),9,Ao)):h(t).simpleChildren?(F(),ie(q(Dt),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(Ui),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(F(),K("button",{key:3,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",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,Lo)):Z("",!0)],2))),128))])]),z("tbody",null,[(F(!0),K(Y,null,ce(o.value,(e,t)=>(F(),K("tr",{key:t},[(F(!0),K(Y,null,ce(e.cells,(e,o)=>(F(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(e).plainText),9,Ro)):h(e).simpleChildren?(F(),ie(q(Dt),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(Ui),{key:2,nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[1]||(c[1]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,Io),V(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(F(),K("div",Eo,[ne(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=z("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=z("span",{class:"sr-only"},"Loading",-1))],!0)])):Z("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);$o.install=e=>{e.component($o.__name,$o)};const Po={class:"hr-node"},Fo=/* @__PURE__ */tn({},[["render",function(e,n){return F(),K("hr",Po)}],["__scopeId","data-v-39b2349c"]]);Fo.install=e=>{e.component(Fo.__name,Fo)};const Ko={class:"unknown-node"},zo=/* @__PURE__ */P({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),K("div",Ko,W(e.node.raw),1))}),Wo=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=$(()=>`vmr-container vmr-container-${n.node.name}`),o=Ye(()=>n.customId),l=$(()=>a({text:gt,paragraph:Oo,heading:so,inline_code:wn,link:Rt,image:ot,strong:Bt,emphasis:zt,strikethrough:Tt,insert:$t,subscript:Ct,superscript:Mt,checkbox:on,checkbox_input:on,hardbreak:jt,math_inline:Nt,reference:St,list:po,math_block:bt,table:$o},o.value));return(o,r)=>(F(),K("div",ue({class:t.value},e.node.attrs),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>{return F(),ie(ae((r=t.type,l.value[r]||zo)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`,typewriter:n.typewriter,fade:n.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var r}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Wo.install=e=>{e.component(Wo.__name,Wo)};const jo=["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"],Do=[[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 Vo(e){if(e<=255)return jo[e];let n=0,t=Do.length-1;for(;n<=t;){const o=n+t>>1,l=Do[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const qo=/[ \t\n\r\f]+/g,Uo=/[\t\n\r\f]| {2,}|^ | $/;let Xo=null;const Go=new RegExp("\\p{Script=Arabic}","u"),Yo=new RegExp("\\p{M}","u"),Jo=new RegExp("\\p{Nd}","u");function Zo(e){return Go.test(e)}function Qo(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>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function el(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(Qo(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Qo(t))return!0}}return!1}const nl=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]),tl=/* @__PURE__ */new Set(["-","‐","–","—"]);function ol(e,n){return!(function(e){const n=pl(e);return null!==n&&nl.has(n)}(e)||n&&(function(e){const n=pl(e);return null!==n&&(ll.has(n)||al.has(n))}(e)||function(e){const n=pl(e);return null!==n&&tl.has(n)}(e)))}const ll=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),rl=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),il=/* @__PURE__ */new Set(["'","’"]),al=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),ul=/* @__PURE__ */new Set([":",".","،","؛"]),sl=/* @__PURE__ */new Set(["၏"]),cl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function dl(e){if(hl(e))return!0;let n=!1;for(const t of e)if(al.has(t)||yl(t))n=!0;else if(!n||!Yo.test(t))return!1;return n}function fl(e){for(const n of e)if(!ll.has(n)&&!al.has(n))return!1;return e.length>0}function ml(e){if(hl(e))return!0;for(const n of e)if(!(rl.has(n)||il.has(n)||Yo.test(n)||yl(n)))return!1;return e.length>0}function hl(e){let n=!1;for(const t of e)if("\\"!==t&&!Yo.test(t)){if(!(rl.has(t)||al.has(t)||il.has(t)))return!1;n=!0}return n}function vl(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 pl(e){if(0===e.length)return null;const n=vl(e,e.length);return e.slice(n)}const gl=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function yl(e){const n=e.codePointAt(0);return void 0!==n&&function(e,n){for(let t=0;t<n.length;t+=2)if(e>=n[t]&&e<=n[t+1])return!0;return!1}(n,gl)}function kl(e){const n=function(e){for(const n of e)if(!Yo.test(n))return n;return null}(e);return null!==n&&Jo.test(n)}function Nl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Yo.test(e))t--;else{if(!rl.has(e)&&!il.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function bl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Sl(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 xl(e,n){return e&&null!==n&&ul.has(n)}function Ml(e){const n=pl(e);return null!==n&&sl.has(n)}function wl(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 Cl(e){let n=e.length;for(;n>0;){const t=vl(e,n),o=e.slice(t,n);if(cl.has(o))return!0;if(!al.has(o))return!1;n=t}return!1}function _l(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 Bl=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Ol(e){return 1===e.length?e[0]:e.join("")}function Tl(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Ol(t)}function Il(e,n,t,o){if(!Bl.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,u=!1,s=0;for(const c of e){const e=_l(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:Ol(i),isWordLike:u,kind:r,start:a}),r=e,i=[c],a=t+s,u=d,s+=c.length):(i.push(c),s+=c.length)}return null!==r&&l.push({text:Ol(i),isWordLike:u,kind:r,start:a}),l}function Hl(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Al=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Ll(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Al.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Rl(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const El=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),$l=/[\p{P}\p{S}\p{Co}]/u,Pl=new RegExp("\\p{Emoji_Presentation}","u"),Fl=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function Kl(e){const n=e.charCodeAt(0);return n<128?function(e){return e>=33&&e<=47&&45!==e||e>=58&&e<=64&&63!==e||e>=91&&e<=96||e>=123&&e<=126}(n):!Fl.has(e)&&!Pl.test(e)&&$l.test(e)}function zl(e){let n=!1;for(const t of e)if(!Yo.test(t)){if(!Kl(t))return!1;n=!0}return n}function Wl(e,n,t,o){const l=!n&&zl(e),r=!o&&zl(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=vl(e,n),o=e.slice(t,n);if(!Yo.test(o))return o;n=t}return null}(e);return null!==n&&yl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=vl(e,n),o=e.slice(t,n);if(!Yo.test(o))return Kl(o)||yl(o);n=t}return!1}(e);return!!(l||r||a)&&!el(e)&&!el(t)&&(n||l||i)&&(o||r)}function jl(e){for(const n of e)if(Jo.test(n))return!0;return!1}function Dl(e){if(0===e.length)return!1;for(const n of e)if(!Jo.test(n)&&!El.has(n))return!1;return!0}function Vl(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}function ql(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}(e):function(e){if(!Uo.test(e))return e;let n=e.replace(qo," ");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=function(e,n,t){var o,l,r;const i=(null===Xo&&(Xo=new Intl.Segmenter(void 0,{granularity:"word"})),Xo);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const M of i.segment(e))for(const e of Il(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==m[M]&&(s[M]=[Sl(u,m,h,M)],m[M]=null),s[M].push(e.text),c[M]=c[M]||e.isWordLike,v[M]=v[M]||i,p[M]=p[M]||N,g[M]=S,y[M]=x,k[M]=xl(p[M],b)};const o="text"===e.kind,r=bl(e.text,e.isWordLike,e.kind),i=el(e.text),N=Zo(e.text),b=pl(e.text),S=Cl(e.text),x=Ml(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[M]&&i&&v[M]&&g[M]||o&&a>0&&"text"===d[M]&&fl(e.text)&&v[M]||o&&a>0&&"text"===d[M]&&y[M]?t():o&&a>0&&"text"===d[M]&&e.isWordLike&&N&&k[M]?(t(),c[M]=!0):null!==r&&a>0&&"text"===d[M]&&m[M]===r?h[M]=(null!=(l=h[M])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[M]&&!v[M]&&(dl(e.text)||"-"===e.text&&c[M])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=N,g[a]=S,y[a]=x,k[a]=xl(N,b),a++)}for(let M=0;M<a;M++)null===m[M]?u[M]=Ol(s[M]):u[M]=Sl(u,m,h,M);for(let M=1;M<a;M++)"text"!==d[M]||c[M]||!hl(u[M])||"text"!==d[M-1]||v[M-1]||(u[M-1]+=u[M],c[M-1]=c[M-1]||c[M],u[M]="");const N=Array.from({length:a},()=>null);let b=-1;for(let M=a-1;M>=0;M--){const e=u[M];if(0!==e.length){if("text"===d[M]&&!c[M]&&b>=0&&"text"===d[b]&&(ml(e)||"-"===e&&kl(u[b]))){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[M],u[M]="";continue}b=M}}for(let M=0;M<a;M++){const e=N[M];null!=e&&(u[M]=Tl(e,u[M]))}let S=0;for(let M=0;M<a;M++){const e=u[M];0!==e.length&&(S!==M&&(u[S]=e,c[S]=c[M],d[S]=d[M],f[S]=f[M]),S++)}u.length=S,c.length=S,d.length=S,f.length=S;const x=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(!el(n[r])||!el(n[r+1]))continue;const e=Nl(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=[];let r=0;for(;r<e.len;){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a){const a=[i];let s=r+1,c=u;for(;s<e.len&&"text"===e.kinds[s]&&Wl(e.texts[s-1],e.isWordLike[s-1],e.texts[s],e.isWordLike[s]);){const n=e.texts[s];a.push(n),c=c||e.isWordLike[s],s++}if(s>r+1){n.push(Ol(a)),t.push(c),o.push("text"),l.push(e.starts[r]),r=s;continue}}n.push(i),t.push(u),o.push(a),l.push(e.starts[r]),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 u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&jl(n)&&Dl(n)||(u=!1)}if(u){let i=0;for(let u=0;u<a.length;u++){const s=a[u],c=u<a.length-1?`${s}-`:s;n.push(c),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=c.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&&Dl(i)&&jl(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&Dl(e.texts[u]);)a.push(e.texts[u]),u++;n.push(Ol(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-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]),!Rl(i))continue;const a=r+1;if(a>=e.len||Hl(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!Hl(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(Ol(u)),t.push(!0),o.push("text"),l.push(s),r=c-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]||!Ll(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Hl(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]=Ol(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],u=e.kinds[r],s=e.starts[r];if("glue"===u){const c=[i[0]],d=s;for(r++;r<e.len&&"glue"===e.kinds[r];)c.push(e.texts[r]),r++;const f=Ol(c);if(!(r<e.len&&"text"===e.kinds[r])){n.push(f),t.push(!1),o.push("glue"),l.push(d);continue}i[0]=f,i.push(e.texts[r]),a=e.isWordLike[r],u="text",s=d,r++}else r++;if("text"===u)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=Ol(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(Ol(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:S,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let M=0;M<x.len-1;M++){const e=wl(x.texts[M]);null!==e&&("space"!==x.kinds[M]&&"preserved-space"!==x.kinds[M]||"text"!==x.kinds[M+1]||!Zo(x.texts[M+1])||(x.texts[M]=e.space,x.isWordLike[M]=!1,x.kinds[M]="preserved-space"===x.kinds[M]?"preserved-space":"space",x.texts[M+1]=e.marks+x.texts[M+1],x.starts[M+1]=x.starts[M]+e.space.length))}return x}(r,n,l),u="keep-all"===o?function(e,n,t){if(n.len<=1)return n;const o=[],l=[],r=[],i=[];let a=-1,u=!1;function s(e){o.push(n.texts[e]),l.push(n.isWordLike[e]),r.push("text"),i.push(n.starts[e])}function c(t){if(!(a<0)){if(u)a+1===t?s(a):function(t,a){let u=!1;for(let e=t;e<a;e++)u=u||n.isWordLike[e];const s=n.starts[t],c=a<n.len?n.starts[a]:e.length;o.push(e.slice(s,c)),l.push(u),r.push("text"),i.push(s)}(a,t);else for(let e=a;e<t;e++)s(e);a=-1,u=!1}}for(let d=0;d<n.len;d++){const e=n.texts[d],s=n.kinds[d];"text"!==s?(c(d),o.push(e),l.push(n.isWordLike[d]),r.push(s),i.push(n.starts[d])):(a>=0&&!ol(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||el(e))}return c(n.len),{len:o.length,texts:o,isWordLike:l,kinds:r,starts:i}}(r,i,n.breakKeepAllAfterPunctuation):i;return a({normalized:r,chunks:Vl(u,l)},u)}let Ul=null;const Xl=/* @__PURE__ */new Map;let Gl=null;const Yl=new RegExp("\\p{Emoji_Presentation}","u"),Jl=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Zl=null;const Ql=/* @__PURE__ */new Map;function er(){if(null!==Ul)return Ul;if("undefined"!=typeof OffscreenCanvas)return Ul=new OffscreenCanvas(1,1).getContext("2d"),Ul;if("undefined"!=typeof document)return Ul=document.createElement("canvas").getContext("2d"),Ul;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function nr(e,n){let t=n.get(e);return void 0===t&&(t={width:er().measureText(e).width,containsCJK:el(e)},n.set(e,t)),t}function tr(){if(null!==Gl)return Gl;if("undefined"==typeof navigator)return Gl={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Gl;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 Gl={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Gl}function or(){return null===Zl&&(Zl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Zl}function lr(e){return Yl.test(e)||e.includes("️")}function rr(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=or();for(const o of t.segment(e))lr(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function ir(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function ar(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function ur(e,n,t=e.widths.length){for(;n<t&&ir(e.kinds[n]);)n++;return n}function sr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function cr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function dr(e,n){return 0===n?0:e+n}function fr(e,n,t,o,l){return dr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function mr(e,n,t,o){return dr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function hr(e,n,t,o,l){return dr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function vr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function pr(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function gr(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function yr(e,n){return function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r}=e;if(0===t.length)return 0;const i=n+tr().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){var t;const o=l[e],a=null!=(t=r[e])?t:null;let f=null===a?-1:gr(a,0,n+1),m=-1,v=0,g=n;for(;g<o.length;){const t=o[g];if(s)if(u+t>i){if(null!==a&&m>n){h(e,m,v),g=m,f=gr(a,f,g+1),m=-1,v=0;continue}h(),p(e,g,t)}else u+=t,c=e,d=g+1;else p(e,g,t);const l=g+1;null!==a&&a[f]===l&&(m=l,v=u,f++),g++}s&&c===e&&d===o.length&&(c=e+1,d=0)}let k=0;for(;k<t.length&&(s||(k=ur(e,k),!(k>=t.length)));){const e=t[k],n=ar(o[k]);if(s)if(u+e>i){if(n){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>i&&null!==l[k]){h(),y(k,0),k++;continue}h()}else g(k,e),n&&(f=k+1,m=u-e),k++;else e>i&&null!==l[k]?y(k,0):v(k,e),n&&(f=k+1,m=u-e),k++}return s&&h(),a}(e,n);const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r,discretionaryHyphenWidth:i,chunks:a}=e;if(0===t.length||0===a.length)return 0;const u=tr(),s=n+u.lineFitEpsilon;let c=0,d=0,f=!1,m=0,h=0,v=-1,p=0,g=0,y=null;function k(){v=-1,p=0,g=0,y=null}function N(e=m,n=h,t){c++,d=0,f=!1,k()}function b(e,n){f=!0,m=e+1,h=0,d=n}function S(e,n,t){f=!0,m=e,h=n+1,d=t}function x(e,n){f?(d+=n,m=e+1,h=0):b(e,n)}function M(n,t,o,l,r,i){if(!t)return;const a=mr(e,n,o,r),u=hr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function w(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:gr(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=vr(e,!0,o),r=d+l;if(pr(e,r)>s){if(null!==a&&c>t){N(n,c),v=c,u=gr(a,u,v+1),c=-1;continue}N(),S(n,v,o)}else d=r,m=n,h=v+1}else S(n,v,o);const l=v+1;null!==a&&a[u]===l&&(c=l,u++),v++}f&&m===n&&h===i.length&&(m=n+1,h=0)}function C(e){c++,k()}for(let _=0;_<a.length;_++){const n=a[_];if(n.startSegmentIndex===n.endSegmentIndex){C();continue}f=!1,d=0,n.startSegmentIndex,m=n.startSegmentIndex,h=0,k();let r=n.startSegmentIndex;for(;r<n.endSegmentIndex&&(f||(r=ur(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=ar(n),c=cr(e,f,r),k="tab"===n?sr(d+c,e.tabStopAdvance):t[r],S=c+k,C=fr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+mr(e,n,r,c);if(hr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){N(v,0);continue}if(a&&t<=s){x(r,S),N(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){N();continue}const e=v;N(e,0),r=e;continue}if(C>s&&null!==l[r]){N(),w(r,0),r++;continue}N();continue}x(r,S),M(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?w(r,0):b(r,k),M(n,a,r,k,c,S),r++;else f&&(m=r+1,h=0,v=r+1,p=d+i,g=d+i,y=n),r++}f&&(n.consumedEndSegmentIndex,N(n.consumedEndSegmentIndex,0))}return c}(e,n)}let kr=null;function Nr(){return null===kr&&(kr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),kr}function br(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function u(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function s(e,n,t){o=[e],l=n,r=t,i=Cl(e),a=rl.has(e)}function c(e,n){o.push(e),r=r||n;const t=Cl(e);i=1===e.length&&al.has(e)&&i||t,a=!1}for(const d of Nr().segment(e)){const e=d.segment,t=el(e);0!==o.length?a||ll.has(e)||al.has(e)||n.carryCJKAfterClosingQuote&&t&&i?c(e,t):r||t?(u(),s(e,d.index,t)):c(e,t):s(e,d.index,t)}return u(),t}function Sr(e,n,t){if(n.length<=1)return n;const o=[];let l=-1,r=!1;function i(t){if(!(l<0)){if(r)l+1===t?o.push(n[l]):function(t,l){const r=n[t].start,i=l<n.length?n[l].start:e.length;o.push({text:e.slice(r,i),start:r})}(l,t);else for(let e=l;e<t;e++)o.push(n[e]);l=-1,r=!1}}for(let a=0;a<n.length;a++){const e=n[a];l>=0&&!ol(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||el(e.text)}return i(n.length),o}function xr(e,n){if("zero-width-break"===n||"soft-hyphen"===n||"hard-break"===n)return 0;if("tab"===n)return 1;let t=0;const o=Nr();for(const l of o.segment(e))t++;return t}function Mr(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function wr(e,n,t,o,l){const r=tr(),{cache:i,emojiCorrection:a}=function(e,n){er().font=e;const t=function(e){let n=Xl.get(e);return n||(n=/* @__PURE__ */new Map,Xl.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=Ql.get(e);if(void 0!==t)return t;const o=er();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 Ql.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,Jl.test(u)));var u;const s=rr("-",nr("-",i),a)+(0===l?0:2*l),c=8*rr(" ",nr(" ",i),a),d=0!==l;if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],m=[],h=[],v=[];let p=e.chunks.length<=1&&!d;const g=t?[]:null,y=[],k=[],N=[],b=t?[]:null,S=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a,u){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(p=!1),f.push(n),m.push(t),h.push(o),v.push(l),null==g||g.push(r),y.push(i),k.push(a),d&&N.push(u),null!==b&&b.push(e)}function M(e,n,t,u,s){const c=nr(e,i),f=d?xr(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(rr(e,c,a),f,l),h="space"===n||"preserved-space"===n||"zero-width-break"===n?0:m,v=0===h?0:h+(f>0?l:0),p="space"===n||"zero-width-break"===n?0:m;if(s&&u&&e.length>1){let u="sum-graphemes";0!==l?u="segment-prefixes":Dl(e)?u="pair-context":r.preferPrefixWidthsForBreakableRuns&&(u="segment-prefixes");const s=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances&&n.breakableFitMode===l)return n.breakableFitAdvances;n.breakableFitMode=l;const r=or(),i=[];for(const c of r.segment(e))i.push(c.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=nr(n,t);e.push(rr(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=rr(n,nr(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=nr(i,t);e.push(rr(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let u="",s=0;for(const c of i){u+=c;const e=rr(u,nr(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,c,i,a,u),d=null===s||"keep-all"===o?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const n=[];let t=0;for(const o of Nr().segment(e))t++,Mr(o.segment)&&n.push(t);return 0===n.length?null:n}(e);return void x(e,m,v,p,n,t,s,d,f)}x(e,m,v,p,n,t,null,null,f)}for(let _=0;_<e.len;_++){S[_]=f.length;const n=e.texts[_],t=e.isWordLike[_],l=e.kinds[_],a=e.starts[_];if("soft-hyphen"===l){x(n,0,s,s,l,a,null,null,0);continue}if("hard-break"===l){x(n,0,0,0,l,a,null,null,0);continue}if("tab"===l){x(n,0,0,0,l,a,null,null,d?xr(n,l):0);continue}const u=nr(n,i);if("text"===l&&u.containsCJK){const e=br(n,r),l="keep-all"===o?Sr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];M(e.text,"text",a+e.start,t,"keep-all"===o||!el(e.text))}continue}M(n,l,a,t,!0)}const w=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,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,S,f.length),C=null===g?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 s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=Vo(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=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,g);return null!==b?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w,segments:b}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w}}const Cr="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",_r=(()=>{const e=globalThis;if(e[Cr])return e[Cr];const n={configs:{},controllers:{},revision:R(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Cr]=n,n})();let Br=null;const Or=_r.revision;function Tr(e){var n;return e&&null!=(n=_r.configs[e])?n:null}function Ir(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Hr(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Ar(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Hr(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 Lr(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Br)return Br;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Br=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Br}catch(n){return Br=!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=_r.blockEstimateCache.get(i);if(a)return _r.blockEstimateCache.delete(i),_r.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const u=null!=(l=t.whiteSpace)?l:"pre-wrap",s=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=_r.preparedCache.get(o);if(l)return _r.preparedCache.delete(o),_r.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){var l,r;const i=null!=(l=null==o?void 0:o.wordBreak)?l:"normal",a=null!=(r=null==o?void 0:o.letterSpacing)?r:0;return wr(ql(e,tr(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(_r.preparedCache.set(o,{prepared:r});_r.preparedCache.size>240;){const e=_r.preparedCache.keys().next().value;if(!e)break;_r.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=yr(e,n);return{lineCount:o,height:o*t}}(s,Math.max(24,r-t.widthAdjustment),t.lineHeight),d=Math.max(t.lineHeight,c.height),f=Math.max(t.lineHeight,Math.round(d+t.wrapperOverhead));for(_r.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});_r.blockEstimateCache.size>4e3;){const e=_r.blockEstimateCache.keys().next().value;if(!e)break;_r.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function Rr(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Ar(e.children);return o&&t.paragraph?Lr(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Ar(e.children),r=t.headings[o];return l&&r?Lr(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=Ar(null==(l=r[0])?void 0:l.children);return i?Lr(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=Rr(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 Er(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function $r(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;return e.diff?Math.max(Er(String(null!=(n=e.originalCode)?n:"")),Er(String(null!=(t=e.updatedCode)?t:"")),Er(String(null!=(o=e.code)?o:""))):Er(function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(e.code,!0===e.loading))}(e),i=Boolean(e.diff);let a=0,u=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);u="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),u=Number.POSITIVE_INFINITY);const s=Math.max(1,Math.min(a,u));return{kind:"code-block",height:Math.round(s+(l?40:0)),contentHeight:s,rendererKind:o}}function Pr(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Fr(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Ir(o.lineHeight,1.5*Ir(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Pr(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const Kr=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function zr(e,n={}){var t;const o={},l=new Set(null!=(t=n.omit)?t:[]);if(!e||"object"!=typeof e)return o;const r=Object.getOwnPropertyDescriptors(e);for(const[i,a]of Object.entries(r))Kr.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const Wr=!1;function jr(){return Wr}function Dr(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function Vr(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const qr=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Ur(){return E(qr,null)}function Xr(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Gr(e,n,t,o=22){const l=String(null!=e?e:"");if(!l)return t;const r=Math.max(18,Math.floor(Math.max(320,n)/8)),i=l.split(/\r?\n/).length,a=Math.ceil(l.length/r),u=Math.max(1,i,a);return Math.max(t,Math.ceil(u*o+12))}function Yr(e,n,t){return Math.min(Math.max(e,n),t)}const Jr=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Zr=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],Qr=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),ei=["raw","content","code","originalCode","updatedCode"],ni=/* @__PURE__ */new WeakMap,ti=/* @__PURE__ */new WeakMap;let oi=1;function li(){return"undefined"!=typeof performance?performance.now():Date.now()}function ri(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function ii(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=ni.get(n);return t||(t=oi++,ni.set(n,t)),String(t)}function ai(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:ii(n),customMarkdownIt:ii(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:ii(e.validateLink),preTransformTokens:ii(e.preTransformTokens),postTransformTokens:ii(e.postTransformTokens),postTransformNodes:ii(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function ui(e){let n=e.length;for(;n>0&&10===e.charCodeAt(n-1);)n-=1;const t=e.lastIndexOf("\n",n-1)+1;return e.slice(t,n).trim()}function si(e){const n=ci(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function ci(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function di(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function fi(e){const n=String(null!=e?e:"");return`${n.length}:${di(n)}`}function mi(e,n=/* @__PURE__ */new WeakMap,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){return e.length<=8192?fi(e):`${e.length}:${di(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${ii(e)}`;if("object"!=typeof e)return typeof e;const o=e,l=n.get(o);if(l)return`cycle:${l}`;if(t>=6)return`object:${ii(o)}`;const r=ii(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>mi(e,n,t+1)).join(",")}`}if("object"==typeof e){const o=e,l=Object.keys(o).sort(),r=l.slice(0,80);return`o:${l.length}:${r.sort().map(e=>`${e}:${mi(o[e],n,t+1)}`).join(";")}`}return typeof e}function hi(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function vi(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>hi(e)?yi(e,n,t+1):vi(e,n,t+1)).join(",")}`:hi(e)?yi(e,n,t):mi(e,n,t)}function pi(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!ei.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${fi(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${ii(l)}`:Qr.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${vi(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${ii(l)}`:""}).filter(Boolean).join(";")}function gi(e){return ei.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${fi(t)}`:""}).filter(Boolean).join(";")}function yi(e,n=/* @__PURE__ */new WeakMap,t=0){const o=ti.get(e);if(o)return o;const l=e,r=n.get(l);if(r)return`node-cycle:${r}`;if(t>=6)return`node:${e.type}:${ii(l)}`;const i=ii(l);n.set(l,i);const a=function(e,n,t){const o=e,l=Array.isArray(o.children)?o.children:[],r=l.length?l.slice(0,200).map(e=>yi(e,n,t+1)).join("|"):"";return[e.type,gi(o),pi(o,n,t),l.length,r].join(":")}(e,n,t);return ti.set(l,a),a}function ki(e,n){return yi(e)===yi(n)}function Ni(e,n,t){const o=li(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=li()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function bi(e,n,t){return Ni(n,t,()=>yi(e))}function Si(e,n,t){return bi(e,t,"stabilizeSignatureMs")===bi(n,t,"stabilizeSignatureMs")}function xi(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Mi(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function wi(e,n){return e.length===n.length&&e===n}function Ci(e,n,t=0){if(t>=4)return null;if(e.type!==n.type)return!1;const o=e,l=n,r=Object.keys(o).filter(e=>"type"!==e&&"children"!==e).sort(),i=Object.keys(l).filter(e=>"type"!==e&&"children"!==e).sort();if(r.length!==i.length)return!1;for(let c=0;c<r.length;c++){const e=r[c];if(e!==i[c])return!1;const n=o[e],t=l[e];if(typeof n!=typeof t)return!1;if("string"!=typeof n){if("number"!=typeof n&&"boolean"!=typeof n&&null!=n)return null;if(!Object.is(n,t))return!1}else{if("string"!=typeof t)return!1;if(!wi(n,t))return!1}}const a=Object.prototype.hasOwnProperty.call(o,"children");if(a!==Object.prototype.hasOwnProperty.call(l,"children"))return!1;if(!a)return!0;const u=o.children,s=l.children;if(!Array.isArray(u)||!Array.isArray(s))return null;if(u.length!==s.length)return!1;for(let c=0;c<u.length;c++){const e=u[c],n=s[c];if(!hi(e)||!hi(n))return null;const o=Ci(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function _i(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=Ci(e,n);return null!=t?t:ki(e,n)}function Bi(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Ni(t,"stabilizeSignatureMs",()=>{o=Ci(e,n)}),null!=o?o:Si(e,n,t)}function Oi(e,n){const t={};for(const o of Jr){const l=e[o],r=null==n?void 0:n[o];"number"==typeof l&&(t[o]=l-("number"==typeof r?r:0))}return t}function Ti(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:$(()=>!1),i=X(n.renderContent.value);let s,d=[],f="",m="",h="",v=0,p=0,y=li(),k=-1,N=0;function b(e){k=Number.isInteger(e)?e:0,N+=1}function S(){s&&(clearTimeout(s),s=void 0)}function x(){S();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=li()}G([n.renderContent,n.effectiveFinal,r],([n,t,o])=>{i.value!==n&&(!o||t||function(e,n){if(!e&&n)return!0;if(n.length<=80)return!0;if(n.length<e.length||!n.startsWith(e))return!0;const t=n.slice(e.length);return!!t&&(!!si(ui(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=ui(e);if(si(n))return!1;const t=ci(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?x():function(){if(p+=1,s)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(li()-y));n<=0?x():s=setTimeout(x,n)}())},{flush:"sync",immediate:!0}),ve(S);const M=$(()=>{var t,o,l,r;return O(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||Ve(t)||H.has(t)||g.has(t)?"":t}).filter(Boolean)))}),w=$(()=>{const{key:e,tags:t}=T(M.value);if(!e)return o;const r=l.get(e);if(r)return r;const i=B(n.instanceMsgId,{customHtmlTags:t});return l.set(e,i),i}),C=$(()=>{const n=w.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),_=$(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=M.value,s=null!=r,c=i.length>0;return s||c||null==l.streamParse?a(a(u(a({},l),{streamParse:null==(o=l.streamParse)||o}),s?{final:r}:{}),c?{customHtmlTags:i}:{}):l}),A=$(()=>{var e;return new Set((null!=(e=_.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),L=$(()=>ai(_.value,C.value,e.customMarkdownIt,{includeFinal:!0})),R=$(()=>ai(_.value,C.value,e.customMarkdownIt,{includeFinal:!1}));G([L,R],([e,n],[t,o])=>{t&&(e===t&&n===o||(x(),n!==o&&(d=[],h="")))},{flush:"sync"});const E=$(()=>{var t,o,l,r,s,c,g,y,k;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",b(0),fe(e.nodes.slice());const N=i.value;if(!N)return d=[],h="",b(-1),[];const S=n.debugPerformanceEnabled.value,x=S?li():0,M=C.value,w=L.value,B=R.value;f&&w!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(M),m&&B!==m&&(d=[],h="");const O=d.length>0&&N.startsWith(h)&&B===m,T=S?ri(M):null,H=S?{}:void 0,A=H?u(a({},_.value),{__timing:H}):_.value,E=I(N,M,A),$=S?li():0,P=S?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let F,K=S?xi(E.length):void 0,z=0,W=0;if(O){const e=S?li():0;if(P){const e=function(e,n,t){if(!n.length)return{nodes:e,metrics:xi(e.length)};const o=function(e,n,t){const o=Math.min(e.length,n.length);for(let l=0;l<o;l++)if(!Bi(n[l],e[l],t))return l;return e.length===n.length?-1:o}(e,n,t);if(o<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:o,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const l=e.slice();let r=o;for(let i=0;i<o;i++)l[i]=n[i];for(let i=o;i<e.length;i++){const o=n[i],a=e[i];o&&Si(o,a,t)&&(l[i]=o,r+=1)}return{nodes:l,metrics:{reusedNodeCount:r,dirtyStartIndex:o,stablePrefixNodeCount:o,dirtyTailNodeCount:Mi(o,e,n)}}}(E,d,P);F=e.nodes,K=e.metrics}else{const e=function(e,n){if(!n.length)return{nodes:e,metrics:xi(e.length)};const t=function(e,n){const t=Math.min(e.length,n.length);for(let o=0;o<t;o++)if(!_i(n[o],e[o]))return o;return e.length===n.length?-1:t}(e,n);if(t<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:t,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const o=e.slice();let l=t;for(let r=0;r<t;r++)o[r]=n[r];for(let r=t;r<e.length;r++){const t=n[r],i=e[r];t&&ki(t,i)&&(o[r]=t,l+=1)}return{nodes:o,metrics:{reusedNodeCount:l,dirtyStartIndex:t,stablePrefixNodeCount:t,dirtyTailNodeCount:Mi(t,e,n)}}}(E,d);F=e.nodes,K=e.metrics}z=S?li()-e:0,W=null==(null==K?void 0:K.dirtyStartIndex)||K.dirtyStartIndex<0?F.length:K.dirtyStartIndex}else F=E,K=xi(F.length);P?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Ni(n,"primeSignatureMs",()=>yi(e[o]))}(F,P,W):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)yi(e[t])}(F,W);const j=S?li()-$:0;if(v+=1,h=N,f=w,m=B,d=F,b(null!=(o=null==K?void 0:K.dirtyStartIndex)?o:0),S){const e=ri(M),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(l=null==T?void 0:T.total)?l:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(li()-x),nodes:F.length,contentLength:N.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:j,signatureMs:null!=(r=null==P?void 0:P.signatureMs)?r:0,stabilizeSignatureMs:null!=(s=null==P?void 0:P.stabilizeSignatureMs)?s:0,primeSignatureMs:null!=(c=null==P?void 0:P.primeSignatureMs)?c:0,signatureCallCount:null!=(g=null==P?void 0:P.signatureCallCount)?g:0,stabilizeSignatureCallCount:null!=(y=null==P?void 0:P.stabilizeSignatureCallCount)?y:0,primeSignatureCallCount:null!=(k=null==P?void 0:P.primeSignatureCallCount)?k:0,stabilizeMs:z},null!=K?K:{}),H?Object.fromEntries(Zr.map(e=>{var n;return[e,null!=(n=H[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Oi(e,T),streamStats:e}:{}))}return fe(F)});return{effectiveCustomHtmlTags:M,effectiveCustomHtmlTagsSet:A,mdBase:w,mdInstance:C,mergedParseOptions:_,getParsedNodesDirtyStartIndex:()=>k,getParsedNodesRevision:()=>N,parsedNodes:E}}function Ii(e){const{isClient:n}=e,t=X(/* @__PURE__ */new Set),o=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;function i(e){if(!n)return;const t=r.get(e);null!=t&&(window.clearTimeout(t),r.delete(e))}function a(){if(n)for(const e of r.values())window.clearTimeout(e);r.clear()}function u(){t.value=/* @__PURE__ */new Set}return{visibleNodeIndices:t,nodeVisibilityHandles:o,nodeVisibilityWatchStops:l,nodeVisibilityFallbackTimers:r,clearVisibilityFallback:i,clearAllVisibilityFallbacks:a,markNodeVisible:function(n,o=!0){var l;o&&i(n),function(n,o){if(null!=(r=null==(l=e.shouldTrackVisibleNodeIndices)?void 0:l.call(e))&&!r)return;var l,r;const i=t.value,a=i.has(n);if(o){if(a)return;const e=new Set(i);return e.add(n),void(t.value=e)}if(!a)return;const u=new Set(i);u.delete(n),t.value=u}(n,o),o&&(null==(l=e.onNodeMarkedVisible)||l.call(e,n))},resetNodeVisibleState:u,cleanupNodeVisibility:function(n){var a;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[e,t]of l.entries())e<n||(t(),l.delete(e));for(const[t,l]of o.entries())t<n||(l.destroy(),o.delete(t),i(t),null==(a=e.onNodeVisibilityCleaned)||a.call(e,t));for(const e of Array.from(r.keys()))e<n||i(e);if(!t.value.size)return;const u=/* @__PURE__ */new Set;for(const e of t.value)e<n&&u.add(e);t.value=u},destroyNodeVisibilityState:function(){u();for(const e of l.values())e();l.clear();for(const e of o.values())e.destroy();o.clear(),a()}}}function Hi(e={}){const n=X(""),t=X(""),o=X(!1),l=Ce(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=$(()=>Math.max(0,n.value.length-t.value.length)),u=$(()=>0===a.value),s=$(()=>o.value&&u.value);return pe()&&ve(()=>{i(),l.destroy()}),{source:n,visible:t,done:o,final:s,caughtUp:u,pendingChars:a,enqueue:e=>l.enqueue(e),finish:e=>l.finish(e),flush:()=>l.flush(),reset:e=>l.reset(e),pause:()=>l.pause(),resume:()=>l.resume()}}const Ai=/auto|scroll|overlay/i;function Li(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return Ai.test(n)||Ai.test(t)}function Ri(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}const Ei={class:"m-0 p-0"},$i=["data-probe"],Pi=/* @__PURE__ */tn(/* @__PURE__ */P(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(F(),K("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[z("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(Oo),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),z("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[z("ul",Ei,[V(q(vo),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),z("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(po),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),K(Y,null,ce(6,n=>z("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(so),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,$i)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),Fi=P({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=$(()=>{var n,t;return Le(null!=(t=Re(e.estimatedPreviewHeightPx))?t:Ee(String(null!=(n=e.node.code)?n:"")))});return()=>j("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?j("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)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("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},()=>j("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,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),Ki=P({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=$(()=>{var n,t;return $e(null!=(t=Re(e.estimatedPreviewHeightPx))?t:Pe(String(null!=(n=e.node.code)?n:"")))});return()=>j("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?j("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)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("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},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("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)"}},[j("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"}})])])}}),zi={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Wi(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const ji=["data-custom-id"],Di=["data-node-index","data-node-type"],Vi="typewriter-simple-cursor-target",qi=/* @__PURE__ */tn(/* @__PURE__ */P(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t,r=Q(),i=E("markstreamNestedRendererProps",void 0);function c(e){var n,t;const l=o[e];return function(e){const n=null==r?void 0:r.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}(e)?l:null!=(t=null==(n=null==i?void 0:i.value)?void 0:n[e])?t:l}const d=jr(),f=$(()=>{return"chat"===(e=c("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),m=$(()=>Vr(c("typewriter"))),h=$(()=>"off"!==m.value),v=$(()=>"minimal"===c("domMode")?"minimal":"full"),p=$(()=>{return!0===(e={mode:f.value,codeRenderer:c("codeRenderer"),renderCodeBlocksAsPre:c("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre?"pre":"pre"===e.codeRenderer||"shiki"===e.codeRenderer||"monaco"===e.codeRenderer?e.codeRenderer:!1===e.renderCodeBlocksAsPre||"docs"===e.mode?"monaco":"pre";var e}),g=$(()=>zi[f.value]),y=$(()=>{var e;return null!=(e=c("showTooltips"))?e:g.value.showTooltips}),k=$(()=>{var e;return null!=(e=c("fade"))?e:g.value.fade}),N=$(()=>{var e;return null!=(e=c("batchRendering"))?e:g.value.batchRendering}),b=$(()=>{var e;return null!=(e=c("initialRenderBatchSize"))?e:g.value.initialRenderBatchSize}),S=$(()=>{var e;return null!=(e=c("renderBatchSize"))?e:g.value.renderBatchSize}),x=$(()=>{var e;return null!=(e=c("renderBatchDelay"))?e:g.value.renderBatchDelay}),M=$(()=>{var e;return null!=(e=c("renderBatchBudgetMs"))?e:g.value.renderBatchBudgetMs}),w=$(()=>{var e;return null!=(e=c("renderBatchIdleTimeoutMs"))?e:g.value.renderBatchIdleTimeoutMs}),B=$(()=>{var e;return null!=(e=c("deferNodesUntilVisible"))?e:g.value.deferNodesUntilVisible}),O=$(()=>{var e;return null!=(e=c("maxLiveNodes"))?e:g.value.maxLiveNodes}),T=$(()=>{var e;return null!=(e=c("liveNodeBuffer"))?e:g.value.liveNodeBuffer}),I=$(()=>{var e;return null!=(e=c("nodeVirtual"))?e:g.value.nodeVirtual}),H={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return c("parseOptions")},get customMarkdownIt(){return c("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return c("customHtmlTags")},get mode(){return c("mode")},get domMode(){return v.value},get htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},get viewportPriorityOptions(){return c("viewportPriorityOptions")},get codeBlockStream(){return c("codeBlockStream")},get codeBlockDarkTheme(){return c("codeBlockDarkTheme")},get codeBlockLightTheme(){return c("codeBlockLightTheme")},get codeBlockMonacoOptions(){return c("codeBlockMonacoOptions")},get codeRenderer(){return c("codeRenderer")},get renderCodeBlocksAsPre(){return c("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return c("codeBlockMinWidth")},get codeBlockMaxWidth(){return c("codeBlockMaxWidth")},get codeBlockProps(){return c("codeBlockProps")},get mermaidProps(){return c("mermaidProps")},get d2Props(){return c("d2Props")},get infographicProps(){return c("infographicProps")},get showTooltips(){return y.value},get themes(){return c("themes")},get langs(){return c("langs")},get isDark(){return c("isDark")},get customId(){return c("customId")},get indexKey(){return o.indexKey},get typewriter(){return c("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return c("smoothStreamingOptions")},get parseCoalesceMs(){return c("parseCoalesceMs")},get fade(){return k.value},get batchRendering(){return N.value},get initialRenderBatchSize(){return b.value},get renderBatchSize(){return S.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return M.value},get renderBatchIdleTimeoutMs(){return w.value},get deferNodesUntilVisible(){return B.value},get maxLiveNodes(){return O.value},get liveNodeBuffer(){return T.value},get nodeVirtual(){return I.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function L(e){l("height-change",e)}function P(e){l("virtual-state-change",e)}function z(e){l("anchor-change",e)}const W=X(),j=X(null),V=X(null),J=X(null),ne=he({1:null,2:null,3:null,4:null,5:null,6:null}),de=X(!1),ve=/* @__PURE__ */new Map,pe=X(0),be=X(0),Se=X({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function xe(e,n){return"string"!=typeof e?n:e.trim()||n}function Me(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const we=$(()=>{var e;const n=null!=(e=H.viewportPriorityOptions)?e:{},t=xe(n.rootMargin,ko);return{rootMargin:t,heavyBlockMargin:xe(n.heavyBlockMargin,t),maxTargets:Me(n.maxTargets)}}),Ce=$(()=>{var e;return null!=(e=we.value.rootMargin)?e:ko}),Ie=$(()=>{var e;return null!=(e=we.value.maxTargets)?e:640});function He(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return Ae("function"==typeof t?t():t)}function Ae(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?Ae(e.value):"object"==typeof e&&"$el"in e?Ae(e.$el):null:null}me(yo,we);const{isClient:Fe,renderAsFragment:Ke,debugPerformanceEnabled:ze,resolvedShowTooltips:We,resolvedHtmlPolicy:je,inheritedSmoothStreaming:De,ownsTypewriterCursor:qe}=function(e){const n="undefined"!=typeof window,t=U(),o=E("markstreamHtmlPolicy",void 0),l=E("markstreamTypewriterCursor",void 0),r=E("markstreamSmoothStreaming",void 0),i=$(()=>!0===e.renderAsFragment),a=$(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=$(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=$(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=$(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(H),{resolveViewportRoot:Ue,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ge,getNormalizedScrollTop:Je,getOffsetTopWithinRoot:Ze}=function(e,n){function t(){var e,t;return null!=(t=null==(e=n.scrollRoot)?void 0:e.call(n))?t:null}function o(n){if("undefined"==typeof window)return null;const o=t();if(o)return o;const l=null!=n?n:e.value;if(!l)return null;const r=l.ownerDocument||document,i=r.scrollingElement||r.documentElement;let a=l;for(;a&&a!==r.body&&a!==i;){if(Li(window.getComputedStyle(a))&&Ri(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(W,{isClient:Fe,scrollRoot:He});me("markstreamShowTooltips",We),me("markstreamHtmlPolicy",je),me("markstreamTypewriter",h),me("markstreamFade",$(()=>!1!==H.fade)),me("markstreamTypewriterCursor",$(()=>!0)),me("markstreamTextStreamState",ve),me("markstreamStreamVersion",pe),me("markstreamParseOptions",$(()=>H.parseOptions)),me("markstreamCustomMarkdownIt",$(()=>H.customMarkdownIt));const{smoothStreamingEnabled:Qe,renderContent:en,requestedFinal:nn,effectiveFinal:tn}=function(e,n){const t=Hi(e.smoothStreamingOptions),o=$(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||"off"!==Vr(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=X(!n.isClient||!0===e.smoothStreaming);ge(()=>{l.value=!0});const r=$(()=>l.value&&o.value),i=$(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),a=$(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),u=$(()=>{const e=a.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return G([()=>e.content,()=>e.nodes,r,a],([e,n,o,l])=>{if(null==n?void 0:n.length)return void t.reset("");const r=null!=e?e:"";if(!o)return t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;r?r===i||(r.startsWith(i)?t.enqueue(r.slice(i.length)):t.reset(r)):t.reset(""),l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:a,effectiveFinal:u}}(H,{isClient:Fe,inheritedSmoothStreaming:De}),ln=!0===nn.value;me("markstreamSmoothStreaming",Qe);const an=X(!1);let un="",cn=!1,dn=null;function fn(){Fe&&null!=dn&&(window.clearTimeout(dn),dn=null)}function mn(){an.value=!1,fn()}function hn(e,n){if(!ze.value)return;const t=function(){if(!ze.value)return null;const e=Nn(pn),n=Nn(gn),t=Math.max(kn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=pn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return pn.clear(),gn.clear(),kn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}G([en,()=>o.nodes,tn],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(mn(),un=l,void(cn=!0)):cn?(un&&l.length>un.length&&l.startsWith(un)?(an.value=!0,Fe&&(fn(),dn=window.setTimeout(()=>{var e;dn=null,!0===tn.value||(null==(e=o.nodes)?void 0:e.length)||(Ta(),an.value=!1,Ha())},1200))):(l.length<un.length||!l.startsWith(un))&&mn(),void(un=l)):(un=l,void(cn=!0))},{flush:"sync",immediate:!0});const pn=/* @__PURE__ */new Map,gn=/* @__PURE__ */new Map;let yn=!1,kn=0;function Nn(e){let n=0;for(const t of e.values())n+=t;return n}function bn(){kn=Math.max(kn,Nn(gn)),gn.clear(),yn=!1}function xn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function Mn(e){var n,t;ze.value&&(pn.set(e,(null!=(n=pn.get(e))?n:0)+1),gn.set(e,(null!=(t=gn.get(e))?t:0)+1),function(e){const n=function(){if(!Fe||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>xn(n),0):queueMicrotask(()=>xn(n)):window.requestAnimationFrame(()=>xn(n))))}(e),yn||(yn=!0,Fe&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(bn):"function"!=typeof queueMicrotask?setTimeout(bn,0):queueMicrotask(bn)))}function Cn(e,n){return Mn(e),n()}const _n=H.customId?`renderer-${H.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bn=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(_n),On=$(()=>`${_n}:${pe.value}`);me(qr,Bn);const Tn=Ye(()=>H.customId),{effectiveCustomHtmlTagsSet:In,mergedParseOptions:Hn,parsedNodes:An,getParsedNodesDirtyStartIndex:Ln,getParsedNodesRevision:Rn}=Ti(H,{instanceMsgId:_n,renderContent:en,effectiveFinal:tn,smoothStreamingEnabled:Qe,debugPerformanceEnabled:ze,customComponentsMap:Tn,logPerf:hn});G(An,()=>{Bn.clear(),pe.value+=1},{immediate:!0});const En=$(()=>({customId:H.customId,customHtmlTags:Hn.value.customHtmlTags,parseOptions:H.parseOptions,customMarkdownIt:H.customMarkdownIt,htmlPolicy:je.value,viewportPriority:H.viewportPriority,viewportPriorityOptions:we.value,mode:f.value,domMode:H.domMode,codeRenderer:p.value,codeBlockStream:H.codeBlockStream,codeBlockDarkTheme:H.codeBlockDarkTheme,codeBlockLightTheme:H.codeBlockLightTheme,codeBlockMonacoOptions:H.codeBlockMonacoOptions,renderCodeBlocksAsPre:H.renderCodeBlocksAsPre,codeBlockMinWidth:H.codeBlockMinWidth,codeBlockMaxWidth:H.codeBlockMaxWidth,codeBlockProps:H.codeBlockProps,mermaidProps:H.mermaidProps,d2Props:H.d2Props,infographicProps:H.infographicProps,showTooltips:We.value,themes:H.themes,langs:H.langs,isDark:H.isDark,typewriter:h.value,smoothStreamingOptions:H.smoothStreamingOptions,parseCoalesceMs:H.parseCoalesceMs,fade:H.fade}));me("markstreamNestedRendererProps",En);const $n=$(()=>An.value),Pn=$(()=>An.value.length),Fn=X(null),Kn=X(null),zn=X(null),Wn=X(null),jn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Dn=!jn&&H.customId?Tr(H.customId):null,Vn=$(()=>Dn?(Or.value,Tr(H.customId)):null),qn=$(()=>{var e;return Boolean(!Ke.value&&H.customId&&!jn&&(null==(e=Vn.value)?void 0:e.enabled))}),Un=$(()=>Boolean(Fe&&qn.value)),Xn=$(()=>{var e;return Boolean(!Ke.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),Gn=$(()=>Xn.value),Yn=X(!1);ge(()=>{Yn.value=!0});const Jn=$(()=>Boolean(Fe&&Xn.value));me("markstreamHostScrollManaged",Jn);const Zn=$(()=>Boolean(Yn.value&&Jn.value)),Qn=$(()=>Un.value||Jn.value),et=$(()=>Un.value||Zn.value),nt=$(()=>{var e;return Qn.value&&!1!==(null==(e=Vn.value)?void 0:e.textEstimation)}),tt=$(()=>{var e;return Qn.value&&!1!==(null==(e=Vn.value)?void 0:e.codeBlockEstimation)});function lt(){const e=be.value||Cn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=W.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const rt=$(()=>{const e=lt();return e>0?Math.max(1,Math.round(e)):640}),it=$(()=>{var e;return Math.max(1,null!=(e=H.maxLiveNodes)?e:320)}),at=$(()=>{var e;return!Ke.value&&!1!==H.nodeVirtual&&!((null!=(e=H.maxLiveNodes)?e:0)<=0)&&(!0===H.nodeVirtual?An.value.length>0:An.value.length>it.value)}),ut=$(()=>at.value||Un.value||Jn.value),st=$(()=>!1!==H.viewportPriority&&!de.value),ct=$(()=>{var e;return!(Ke.value||!1===H.deferNodesUntilVisible||(null!=(e=H.maxLiveNodes)?e:0)<=0||at.value||An.value.length>900||!1===H.viewportPriority)}),dt=bo(e=>{var n;return Ue(null!=(n=null!=e?e:W.value)?n:null)},st),{requestFrame:ft,cancelFrame:ht,hasIdleCallback:vt,isTestEnv:pt}=function(e){const n=e.isClient&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,t=e.isClient&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,o=e.isClient&&"function"==typeof window.requestIdleCallback,l=function(){var e;if("undefined"==typeof globalThis||!("process"in globalThis))return;const n=null==(e=Object.getOwnPropertyDescriptor(globalThis,"process"))?void 0:e.value;return null==n?void 0:n.env}();return{requestFrame:n,cancelFrame:t,hasIdleCallback:o,isTestEnv:"test"===(null==l?void 0:l.NODE_ENV)}}({isClient:Fe}),{resolvedBatchSize:xt,resolvedInitialBatch:wt,batchingEnabled:_t,incrementalRenderingActive:Ot,renderedCount:It,previousRenderContext:Ht,adaptiveBatchSize:At,previousBatchConfig:Lt}=function(e,n){var t;const o=$(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=$(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=$(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=X(0),a=X({key:e.indexKey,total:0}),u=X(Math.max(1,o.value||1)),s=$(()=>{var n;return r.value&&(null!=(n=e.maxLiveNodes)?n:0)<=0}),c=X({batchSize:o.value,initial:l.value,delay:null!=(t=e.renderBatchDelay)?t:16,enabled:s.value});return{resolvedBatchSize:o,resolvedInitialBatch:l,batchingEnabled:r,incrementalRenderingActive:s,renderedCount:i,previousRenderContext:a,adaptiveBatchSize:u,previousBatchConfig:c}}(H,{isClient:Fe,isTestEnv:pt,renderAsFragment:Ke}),Et=$(()=>{var e;return!Ke.value&&!1!==H.batchRendering&&xt.value>0&&!pt&&(null!=(e=H.maxLiveNodes)?e:0)<=0}),Pt=/* @__PURE__ */new Map,Kt=/* @__PURE__ */new Map,Wt=/* @__PURE__ */new WeakMap;let Dt=null;const Vt=/* @__PURE__ */new WeakMap,qt=/* @__PURE__ */new Map,Ut=[];let Xt=[],Gt=[],Yt=-1;const Zt=R(Ut),Qt=/* @__PURE__ */new Set,eo=X(0);let to=0;const lo=X(0),ro=$(()=>(lo.value,Array.from(Pt.entries()).sort((e,n)=>e[0]-n[0]))),ao=X(null),uo=X(null);let co,fo=null,mo=0,ho=null;function go(){co.markFallbackHeightPrefixDirty()}function No(e){return co.getFallbackNodeHeight(e)}function So(e,n){return co.estimateHeightRange(e,n)}function xo(e){return co.estimateIndexForOffset(e)}const{activeRestoreAnchor:Mo,getRelativeScrollTopWithinContainer:wo,setRelativeScrollTopWithinContainer:_o,resolveAnchorOffset:Bo,clearRestoreReconcile:To,scheduleRestoreReconcile:Io,captureRestoreAnchor:Ho,restoreAnchor:Ao,getAnchorDrift:Lo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=X(null);let v=null,p=[];function g(){const e=i(),n=t.value;if(!e||!n)return null;const o=e.ownerDocument||n.ownerDocument||document;if(e===o.documentElement||e===o.body||e===o.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,a(e,o,!1)-u(n,e))}function y(e){var n;const o=i(),l=t.value;if(!o||!l)return;const r=Math.max(0,e),c=o.ownerDocument||l.ownerDocument||document,d=c.defaultView||("undefined"!=typeof window?window:null);if(o===c.documentElement||o===c.body||o===c.scrollingElement){const e=a(o,c,!0)+l.getBoundingClientRect().top;return void(null==(n=null==d?void 0:d.scrollTo)||n.call(d,0,Math.max(0,e+r)))}Dr(o,c,u(l,o)+r,{isReverseFlexScrollRoot:e=>{var n;return null!=(n=null==s?void 0:s(e))&&n},getNormalizedScrollTop:a})}function k(e){const n=o.value,t=m(e.nodeIndex,0,Math.max(0,n-1));return d(0,t)+Math.max(0,e.offsetWithinNodePx)}function N(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function b(e){const n=k(e),t=g();null!=t&&Math.abs(t-n)<=.5||y(n)}return{activeRestoreAnchor:h,getRelativeScrollTopWithinContainer:g,setRelativeScrollTopWithinContainer:y,resolveAnchorOffset:k,clearRestoreReconcile:N,applyRestoreAnchor:b,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&b(h.value)}):null,null==v&&h.value&&b(h.value))},captureRestoreAnchor:function(){const e=g(),n=o.value;if(null==e||n<=0)return null;const t=m(c(e+1),0,n-1),l=d(0,t),r=f(t);return{nodeIndex:t,offsetWithinNodePx:m(e-l,0,Math.max(0,r-1))}},restoreAnchor:function(e){const t=o.value;if(h.value={nodeIndex:m(e.nodeIndex,0,Math.max(0,t-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},N(),b(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&b(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:Fe,containerRef:W,parsedNodeCount:Pn,requestFrame:ft,cancelFrame:ht,resolveScrollContainer:()=>ao.value||Xe(),getNormalizedScrollTop:Je,getOffsetTopWithinRoot:Ze,isReverseFlexScrollRoot:Ge,estimateIndexForOffset:xo,estimateHeightRange:So,getFallbackNodeHeight:No,clamp:Zl}),{nodeHeights:Ro,heightStats:Eo,heightTreeSize:Po,heightSumTree:Ko,heightKnownTree:jo,averageNodeHeight:Do,resetHeightMeasurements:Vo,pruneHeightMeasurements:qo,rebuildHeightTrees:Uo,recordNodeHeight:Xo,removeNodeHeights:Go,exportHeightCache:Yo,importHeightCache:Jo,fenwickRangeSum:Zo}=function(e={}){const n=he({}),t=he({total:0,count:0}),o=X(0),l=X([]),r=X([]);function i(){for(const e of Object.keys(n))delete n[Number(e)];t.total=0,t.count=0,o.value=0,l.value=[],r.value=[]}function s(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function c(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function d(e){o.value=e;const t=new Array(e+1).fill(0),i=new Array(e+1).fill(0);for(const[o,l]of Object.entries(n)){const n=Number(o),r=Number(l);!Number.isFinite(n)||n<0||n>=e||!Number.isFinite(r)||r<=0||(s(t,n,r),s(i,n,1))}l.value=t,r.value=i}function f(e){if(!Number.isInteger(e)||e<0)return!1;const i=n[e];if(!Number.isFinite(i)||i<=0)return!1;if(delete n[e],t.total=Math.max(0,t.total-i),t.count=Math.max(0,t.count-1),o.value>e){const n=l.value,t=r.value;n.length&&t.length&&(s(n,e,-i),s(t,e,-1))}return!0}const m=$(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:m,resetHeightMeasurements:i,pruneHeightMeasurements:function(e){if(e<=0)return void i();let o=0,l=0;for(const[t,r]of Object.entries(n)){const i=Number(t),a=Number(r);!Number.isFinite(i)||i<0||i>=e||!Number.isFinite(a)||a<=0?delete n[i]:(o+=a,l++)}t.total=o,t.count=l},rebuildHeightTrees:d,recordNodeHeight:function(i,c,d={}){!function(i,a,u={}){var c;if(!Number.isFinite(a)||a<=0)return!1;const d=n[i];if(d){if(!1===u.allowShrink&&a<d)return!1;if(Math.abs(a-d)<=1)return!1}if(n[i]=a,d?t.total+=a-d:(t.total+=a,t.count++),o.value>i){const e=l.value,n=r.value;if(e.length&&n.length)if(d){const n=a-d;0!==n&&s(e,i,n)}else s(e,i,a),s(n,i,1)}!1!==u.notify&&(null==(c=e.onHeightRecorded)||c.call(e))}(i,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=f(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},removeNodeHeights:function(n,t={}){var o;let l=0;for(const e of n)f(Number(e))&&l++;return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},exportHeightCache:function(){return Object.entries(n).map(([e,n])=>({index:Number(e),height:Number(n)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,n)=>e.index-n.index)},importHeightCache:function(l,r={}){var i;if(!Array.isArray(l))return;const a=o.value;let u=!1;if("merge"!==r.mode){const e=Object.keys(n);if(e.length>0){for(const t of e)delete n[Number(t)];u=!0}}for(const e of l){const t=Number(e.index),o=Number(e.height);if(!Number.isInteger(t)||t<0)continue;if(a>0&&t>=a)continue;if(!Number.isFinite(o)||o<=0)continue;const l=n[t];l&&Math.abs(l-o)<=1||(n[t]=o,u=!0)}u&&(function(){let e=0,l=0;const r=o.value;for(const[t,o]of Object.entries(n)){const i=Number(t),a=Number(o);!Number.isFinite(i)||i<0||r>0&&i>=r||!Number.isFinite(a)||a<=0?delete n[i]:(e+=a,l++)}t.total=e,t.count=l}(),a>0&&d(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:function(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}}}({onHeightRecorded:()=>{go(),Jn.value&&Fa(),Mo.value&&Io(),uo.value&&xi(),Ma("node-resize")}});function Qo(e){Number.isInteger(e)&&e>=0&&Qt.add(e)}function el(e){for(const n of e)Qo(Number(n))}function nl(e){to++;let n=!0;try{const t=e();return n=!1!==t,t}finally{to--,0===to&&n&&eo.value++}}function tl(){Xt=[],Gt=[],Yt=-1,Qt.clear(),Zt.value=Ut}function ol(){tl(),nl(()=>Vo()),qt.clear()}function ll(e){!Number.isInteger(e)||e<0||e>=An.value.length||qt.set(e,vi(e))}function rl(e,n,t={}){const o=Ro[e];Qo(e),Xo(e,n,t);const l=Ro[e];return Object.is(o,l)?(Qt.delete(e),!1):(l&&l>0?ll(e):o&&qt.delete(e),!0)}function il(e,n){const t=Cn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Pt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:Cn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function al(e,n={}){"merge"!==n.mode?tl():el(e.map(e=>e.index)),nl(()=>Jo(e,n)),ea()}const ul=$(()=>ct.value&&st.value),sl=$(()=>{var e;return!Ke.value&&!1!==H.batchRendering&&xt.value>0&&(null!=(e=H.maxLiveNodes)?e:0)<=0}),cl=$(()=>!Ke.value&&ln&&!0===tn.value&&!at.value&&!Xn.value&&!qn.value&&!ul.value&&!sl.value),dl=$(()=>!!dt&&(ul.value||at.value)),fl=$(()=>at.value||Jn.value),{liveNodeBufferResolved:ml,focusIndex:hl,liveRange:vl,updateLiveRange:pl}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,clamp:r}=n,i=$(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),a=X(0),u=he({start:0,end:0});return{liveNodeBufferResolved:i,focusIndex:a,liveRange:u,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return u.start=0,void(u.end=e);const n=Math.min(l.value,e),s=i.value,c=r(a.value-s,0,Math.max(0,e-n));u.start=c,u.end=Math.min(e,c+n)}}}(H,{parsedNodeCount:Pn,virtualizationEnabled:at,maxLiveNodesResolved:it,clamp:Zl}),gl=/* @__PURE__ */new Map,yl=/* @__PURE__ */new Map,kl=/* @__PURE__ */new Map,Nl=[],bl=/* @__PURE__ */new Map,Sl=/* @__PURE__ */new Set,xl=X(0);let Ml=!1;const wl=$(()=>(xl.value,Sl.size)),Cl=/* @__PURE__ */new Map,_l=/* @__PURE__ */new Map,Bl=X(0),Ol=$(()=>{Bl.value;let e=0;for(const n of Cl.values())e+=Math.max(0,n);return e});let Tl=null;const Il=$(()=>{if(!at.value)return An.value.length;const e=ml.value,n=Math.max(vl.end+e,wt.value),t=Math.min(An.value.length,n);return Math.max(It.value,t)});function Hl(){Ml||(Ml=!0,queueMicrotask(()=>{Ml=!1,xl.value+=1}))}function Al(e,n,t="node-resize"){if(!Fe||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Sl.delete(o)&&Hl();try{n()}finally{Ma(t)}},Math.max(0,e));return Sl.add(o),Hl(),o}function Ll(e){Fe&&null!=e&&(Sl.delete(e)&&Hl(),window.clearTimeout(e))}function Rl(){if(Fe&&"undefined"!=typeof window)for(const e of Sl)window.clearTimeout(e);Sl.size&&(Sl.clear(),Hl()),Nl.length=0,kl.clear()}function El(e){j.value=e}function $l(e){V.value=e}function Pl(e){J.value=e}const{cancelScheduledFocusSync:Fl,scheduleFocusSync:Kl}=function(e){const{isClient:n,containerRef:t,virtualizationEnabled:o,requestFrame:l,cancelFrame:r,syncFocusToScroll:i}=e;let a=null;function u(){var e,n,o;return null!=(o=null==(n=null==(e=t.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?o:"undefined"!=typeof window?window:null}function s(){if(!a)return;const e=u();a.viaTimeout?e?e.clearTimeout(a.id):clearTimeout(a.id):null==r||r(a.id),a=null}return{cancelScheduledFocusSync:s,scheduleFocusSync:function(e={}){if(!o.value)return;if(!n)return void i(!0);if(e.immediate)return s(),void i(!0);if(a)return;const t=()=>{a=null,i()};if(l)return void(a={id:l(t),viaTimeout:!1});const r=u(),c=r?r.setTimeout(t,16):setTimeout(t,16);a={id:c,viaTimeout:!0}}}}({isClient:Fe,containerRef:W,virtualizationEnabled:at,requestFrame:ft,cancelFrame:ht,syncFocusToScroll:function(e=!1){var n;if(!at.value)return;const t=ao.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=W.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=An.value.length;if(i<=0)return;if(!r&&i>0&&Ge(t)){const n=Cn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=Cn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void Jl(Zl((a=Math.max(0,l)+.5*Math.max(0,n),co.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=W.value;if(!l)return null;const r=o?0:Cn("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=Cn("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?Cn("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):Cn("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return Zl(xo(a+.5*Math.max(0,u)),0,Math.max(0,An.value.length-1))}(t,o,l,r);if(null!=u)return void Jl(u,e);const s=r?null:Cn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?Cn("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=ro.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=Cn("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=W.value;if(!e)return;const n=r?{top:0}:Cn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=Cn("syncFocusToScroll.fallback.scrollTop",()=>Je(t,o,r)),a=r?(()=>{const t=Cn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Ze(e,t);return Math.max(0,i-n)})(),u=r?Cn("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):Cn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void Jl(Zl(xo(a+.5*Math.max(0,u)),0,Math.max(0,An.value.length-1)),!0)}Jl(Math.round((m+h)/2),e)}}),{visibleNodeIndices:zl,nodeVisibilityHandles:Wl,nodeVisibilityWatchStops:jl,nodeVisibilityFallbackTimers:Dl,clearVisibilityFallback:Vl,markNodeVisible:ql,cleanupNodeVisibility:Ul,destroyNodeVisibilityState:Xl}=Ii({isClient:Fe,shouldTrackVisibleNodeIndices:()=>ul.value,shouldCleanupNodeVisibility:()=>at.value,onNodeMarkedVisible:e=>{at.value?Kl():hl.value=Zl(e,0,Math.max(0,An.value.length-1))},onNodeVisibilityCleaned:e=>{Pt.delete(e)&&wa()}}),{cleanupScrollListener:Gl,setupScrollListener:Yl}=function(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null;function c(){u&&(u(),u=null),s=null,l.value=null}function d(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:c,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void c();var e;const f=r();if(!f)return void c();if(l.value===f&&u)return;c(),s=d(f);const m=()=>{if(null==a||a(),t.value){const e=function(e){const n=d(e),t=s;s=n;const o=Math.max(480,.75*(e.clientHeight||0));return null==t?n>o?{immediate:!0}:void 0:Math.abs(n-t)>o?{immediate:!0}:void 0}(f);e?i(e):i()}};f.addEventListener("scroll",m,{passive:!0}),l.value=f,u=()=>{f.removeEventListener("scroll",m)}}}}({isClient:Fe,virtualizationEnabled:at,listenerEnabled:fl,scrollRootElement:ao,resolveScrollContainer:Xe,scheduleFocusSync:Kl,onScroll:function(){const e=uo.value;if(!e)return;const n=li();if(!n)return;if(function(e){if(ha()>=mo)return ho=null,!1;const n=ho;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(ho=null),t}(n))return;const t=ii(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Si("restore"):Si("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=W.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return Cn("scrollListener.getScrollTop",()=>Je(e,t,o))}});function Jl(e,n=!1){const t=Zl(e,0,Math.max(0,An.value.length-1));!n&&Math.abs(t-hl.value)<=1||(hl.value=t,pl())}function Zl(e,n,t){return Math.min(Math.max(e,n),t)}function Ql(e=An.value.length){const n=Ln();return!Number.isInteger(n)||n<0?e:Zl(n,0,e)}function er(e){return null==e?void 0:e.firstElementChild}function nr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function tr(e,n){e<1||e>6||(ne[e]=n)}function or(){if(!Qn.value)return void(be.value=0);const e=Cn("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=W.value)?void 0:e.clientWidth)?n:0});be.value=e>0?e:0}let lr=null;function rr(){null==lr||lr.disconnect(),lr=null}const ir=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:yt,delay:0,suspensible:!1});function ar(e){return e===ir}const ur=$(()=>"pre"===p.value?mt:"shiki"===p.value?ir:kt);function sr(){var e;return!1!==(null==(e=H.codeBlockProps)?void 0:e.showHeader)}function cr(e,n,t){const o=Ro[n],l="number"==typeof o&&o>0;if(nt.value&&!l){const n=Rr(e,t,Se.value);if(n)return n}if(tt.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=gu(e,fu(e));return ar(n)?"markdown":n===mt?"pre":n===ur.value||n===kt?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return $r(e,{rendererKind:n,monacoOptions:H.codeBlockMonacoOptions,showHeader:sr()})}return null}ye(()=>{if(eo.value,to>0)return;const e=An.value,n=Rn();if(!e.length||!Qn.value)return Xt=[],Gt=[],Yt=-1,Qt.clear(),void(Zt.value=Ut);const t=be.value||Cn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=W.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return Xt=[],Gt=[],Yt=-1,Qt.clear(),void(Zt.value=Ut);const o=function(e){return[Math.round(e),nt.value,tt.value,Se.value,H.codeBlockMonacoOptions,sr(),p.value,Tn.value,Or.value]}(t),l=Xt.length<=e.length&&(i=o,(r=Gt).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&Yt===n?e.length:l?Ql(e.length):0,u=l?Array.from(Qt):[];Xt.length=e.length;for(let s=a;s<e.length;s++)Xt[s]=cr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(Xt[s]=cr(e[s],s,t));Qt.clear(),Gt=o,Yt=n,Zt.value=Xt,ke(Zt)},{flush:"sync"});const dr=$(()=>Zt.value);co=function(e){let n=!0,t=[0],o="";function l(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=null==(t=e.estimatedNodeHeights.value[n])?void 0:t.height;return Number.isFinite(l)&&l>0?l:Math.max(e.averageNodeHeight.value,function(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h;if(!e||"object"!=typeof e)return 32;const v=e,p=String(null!=(t=v.type)?t:""),g=Number.isFinite(n)&&n>0?n:640;switch(p){case"heading":return 44;case"paragraph":return Gr(String(null!=(l=null!=(o=v.raw)?o:v.content)?l:""),g,34);case"list":{const e=Array.isArray(v.items)?v.items.length:1;return Math.max(48,30*e+12)}case"list_item":return Gr(String(null!=(i=null!=(r=v.raw)?r:v.content)?i:""),g,34);case"blockquote":return Gr(String(null!=(u=null!=(a=v.raw)?a:v.content)?u:""),g,56);case"table":{const e=Array.isArray(v.rows)?v.rows.length:Array.isArray(v.children)?v.children.length:3;return Math.max(120,38*e+48)}case"code_block":return Gr(String(null!=(c=null!=(s=v.code)?s:v.raw)?c:""),g,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return Gr(String(null!=(f=null!=(d=v.raw)?d:v.content)?f:""),g,96);case"thematic_break":return 24;default:return Gr(String(null!=(h=null!=(m=v.raw)?m:v.content)?h:""),g,40)}}(e.parsedNodes.value[n],e.getContainerWidth()||640))}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=Yr(Math.trunc(n),0,i),u=Yr(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function s(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:An,nodeHeights:Ro,heightStats:Eo,heightTreeSize:Po,heightSumTree:Ko,heightKnownTree:jo,averageNodeHeight:Do,heightEstimationActive:Qn,estimatedNodeHeights:dr,getContainerWidth:lt,getPrefixCacheKeyParts:()=>{var e;const n=Xr(be.value||Cn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=W.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[An.value.length,Eo.count,Math.round(Eo.total),Math.round(100*Do.value),t,n,Qn.value?1:0,Or.value,pe.value]},fenwickRangeSum:Zo}),G(()=>An.value.length,e=>{var n;go(),e<=0?ol():(e<Po.value&&(n=e,tl(),nl(()=>qo(n))),e!==Po.value&&Uo(e))},{immediate:!0});const fr=$(()=>{if(!at.value)return An.value.map((e,n)=>({node:e,index:n}));const e=An.value.length,n=Zl(vl.start,0,e),t=Zl(vl.end,n,e);return An.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),mr=$(()=>at.value?So(0,Math.min(vl.start,An.value.length)):0),hr=$(()=>{if(!at.value)return 0;const e=An.value.length;return So(Math.min(vl.end,e),e)});function vr(){return co.buildVirtualHeightSummary({topSpacerHeight:mr.value,bottomSpacerHeight:hr.value,width:xr()})}function pr(){const e=An.value,n=vr();return u(a({},n),{probe:{paragraphReady:Boolean(Se.value.paragraph),listItemReady:Boolean(Se.value.listItem),listWrapperOverhead:Se.value.listWrapperOverhead,headingReadyLevels:Object.entries(Se.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:e.map((e,n)=>{var t,o,l,r,i,a,u,s,c;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=dr.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=dr.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=dr.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=dr.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Ro[n])?c:null}})})}function gr(){return null!=o.indexKey?String(o.indexKey):Xn.value?`virtual-${kr()}`:"markdown-renderer"}function yr(e){const n=String(e),t=`${gr()}-`;if(!n.startsWith(t))return null;const o=n.slice(t.length).match(/^(\d+)(?:$|-)/);if(!o)return null;const l=Number(o[1]);return!Number.isInteger(l)||l<0||l>=An.value.length?null:l}function kr(){var e,n,t;const l=null==(e=o.virtualScroll)?void 0:e.sessionKey;return String(null!=l&&""!==l?l:null!=(t=null!=(n=o.indexKey)?n:H.customId)?t:_n)}function Nr(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function br(e){var n;return(null!=e?e:"")===(null!=(n=Nr())?n:"")}function Sr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(){const e=p.value;return function(e){var n,t;const o=e.renderer,l="monaco"===o?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i="shiki"===o;return[e.isDark?"dark":"light","monaco"===o?"code-rich":"pre"===o?"code-pre":"code-shiki",!1===e.codeBlockStream?"code-static":"code-stream",Wi(e.codeBlockMinWidth),Wi(e.codeBlockMaxWidth),...i?[_e(null!=(n=null==r?void 0:r.themes)?n:e.themes,null!=(t=null==r?void 0:r.langs)?t:e.langs)]:[],Wi(null==l?void 0:l.fontSize),Wi(null==l?void 0:l.lineHeight),Wi(null==l?void 0:l.fontFamily),Wi(null==l?void 0:l.tabSize),Wi(null==l?void 0:l.MAX_HEIGHT),Wi(null==l?void 0:l.wordWrap),Wi(null==l?void 0:l.wrappingIndent),Wi(null==l?void 0:l.padding),Wi(null==r?void 0:r.showHeader),Wi(null==r?void 0:r.showCopyButton),Wi(null==r?void 0:r.showExpandButton),Wi(null==r?void 0:r.showPreviewButton),Wi(null==r?void 0:r.showCollapseButton),Wi(null==r?void 0:r.showFontSizeButtons)].join("\0")}({renderer:e,isDark:H.isDark,codeBlockStream:H.codeBlockStream,codeBlockMinWidth:H.codeBlockMinWidth,codeBlockMaxWidth:H.codeBlockMaxWidth,codeBlockMonacoOptions:"monaco"===e?H.codeBlockMonacoOptions:void 0,codeBlockProps:H.codeBlockProps,themes:"shiki"===e?H.themes:void 0,langs:"shiki"===e?H.langs:void 0})}(),[null==n?"":String(n),t].join("\0")}function xr(){return lt()}const Mr=$(()=>Xr(xr())),wr=$(()=>[Sr(),Mr.value].join("\0")),Cr=$(()=>{var e;return Xn.value?["virtual",null!=(e=Nr())?e:"",kr(),wr.value].join("\0"):o.indexKey});function Br(){Bl.value+=1}function Ir(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=An.value.length||e.sessionKey!==kr()||e.threadKey!==Nr()||e.layoutEpochKey!==wr.value)}function Hr(e){const n=String(e),t=_l.get(n);return t?Ir(t)?t.index:null:yr(n)}function Ar(e="async-node"){(Cl.size||_l.size)&&(Cl.clear(),_l.clear(),Br(),Ma(e))}const Lr=E(Oe,null),Er={reportHeight(e,n){if(!Jn.value)return;const t=Hr(e);if(null==t)return;const o=gl.get(t);if(!o)return;const l=Number(n),r=il(t,o);!function(e,n,t={}){nl(()=>rl(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!Jn.value)return;const n=yr(e);null!=n&&function(e,n){var t;const o=_l.get(e);if(o&&Ir(o))return Cl.set(e,Math.max(0,null!=(t=Cl.get(e))?t:0)+1),Br(),void Ma("async-node");Cl.set(e,1),_l.set(e,function(e){return{index:e,sessionKey:kr(),threadKey:Nr(),layoutEpochKey:wr.value}}(n)),Br(),Ma("async-node")}(String(e),n)},markSettled(e){if(!Jn.value)return;const n=String(e),t=Hr(e);(null!=t||function(e){return Cl.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Cl.get(e))?n:0;return!(t<=0||(t<=1?(Cl.delete(e),_l.delete(e)):Cl.set(e,t-1),Br(),1===t&&Ma("async-node"),0))}(n)&&null!=t&&Ha()}};function Pr(){let e=0;for(const n of gl.values())e+=Cn("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}me(Oe,{reportHeight(e,n){Er.reportHeight(e,n),null==Lr||Lr.reportHeight(e,n)},markPending(e){Er.markPending(e),null==Lr||Lr.markPending(e)},markSettled(e){Er.markSettled(e),null==Lr||Lr.markSettled(e)}});let Kr,Wr=null,Ur=null;function Jr(e){return!1!==e&&null!=e&&""!==e}function Zr(){return at.value?function(){if(!at.value)return!0;const e=An.value.length,n=Zl(vl.start,0,e),t=Zl(vl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Pt.has(o))return!1;if(Ca(o)&&!gl.has(o))return!1}return!0}():It.value>=Il.value}function Qr(){return!0===tn.value&&!an.value&&0===Ol.value&&0===Sl.size&&0===bl.size&&null==Tl&&Zr()}function ei(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(Wr===kr()&&Kr===Nr())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!Jr(t)&&Ur===Wa(t)}function ni(){return Qr()&&ei()}function ti(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function oi(e="manual",n){const t=vr(),o=function(e){return e||(!0!==tn.value?An.value.length>0?"streaming":"estimating":!Zr()||bl.size>0||null!=Tl?"measuring":ni()?"settled":"settling")}(n);return{sessionKey:kr(),threadKey:Nr(),phase:o,nodeCount:t.totalNodes,liveRange:{start:vl.start,end:vl.end},renderedCount:It.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:Pr(),totalHeight:ri(),width:t.width,final:!0===tn.value,stable:ni(),confidence:ti(o,t),reason:e}}function li(){const e=ao.value||Xe(),n=W.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=Cn("getScrollBox.scrollTop",()=>Je(e,t,o)),r=Cn("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=Cn("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function ri(){const e=An.value.length,n=Math.max(0,So(0,e)),t=Cn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=W.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:Cn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=W.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):at.value?n>0?Math.max(1,Math.ceil(n),function(){let e=mr.value+hr.value;for(const n of Pt.values())n&&(e+=Math.max(0,Cn("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(n,o)):Math.max(1,Math.ceil(o)):Jn.value?n>0||Eo.count>0||co.getEstimatedNodeHeightCount()>0?(Ot.value&&It.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function ii(e){const n=W.value;if(!n)return null;const t=Cn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:Cn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function ai(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=li(),t=W.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=Cn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=Cn("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=li(),n=W.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=ii(e);return null==t?null:t>=-8&&t<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,t)}:null}();if(o)return{anchor:o,captured:!0};const l=Ho();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=An.value.length;return e<=0?null:{type:"node",nodeIndex:Zl(hl.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function ui(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function si(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t^=31,t=Math.imul(t,16777619),t}const ci=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function di(e,n=/* @__PURE__ */new WeakSet,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){const n=e.length>8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${ui(n)}`}(e)}`;if("function"==typeof e)return"fn";if("object"!=typeof e)return typeof e;if(n.has(e))return"cycle";if(t>=6)return"max-depth";n.add(e);try{if(Array.isArray(e)){if(e.length<=160){const o=[];for(let l=0;l<e.length;l++)o.push(di(e[l],n,t+1));return`a:${e.length}:${o.join(",")}`}const o=[],l=[],r=Math.max(0,e.length-32);let i=2166136261;for(let a=0;a<e.length;a++){const u=di(e[a],n,t+1);i=si(i,u),a<32&&o.push(u),a>=r&&l.push(u)}return[`a:${e.length}`,`h=${o.join(",")}`,`t=${l.join(",")}`,`all=${(i>>>0).toString(36)}`].join(":")}const o=e,l=Object.keys(o).filter(e=>{const n=o[e];return"parent"!==e&&"el"!==e&&"component"!==e&&(null==n||"string"==typeof n||"number"==typeof n||"boolean"==typeof n||ci.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${di(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let fi=-1,mi="",hi=[2166136261];function vi(e){const n=An.value[e];return n?ui(di(n)):""}function pi(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function gi(){var e,n;const t=pe.value;if(fi===t)return mi;const o=An.value.length;let l=Ql(o);(fi!==t-1||l>o||hi.length<l+1)&&(l=0),0===l?hi=[2166136261]:hi.length=l+1;for(let r=l;r<o;r++){const n=vi(r);hi[r+1]=pi(null!=(e=hi[r])?e:2166136261,n)}return hi.length=o+1,mi=((null!=(n=hi[o])?n:2166136261)>>>0).toString(36),fi=t,mi}function yi(e,n={}){var t;const l=!0===n.includeHeightCache,r=null!=(t=n.includeContentHash)?t:l,i=l?function(e){const n=function(){var e,n;const t=Number(null!=(n=null==(e=o.virtualScroll)?void 0:e.heightCacheLimit)?n:5e3);return!Number.isFinite(t)||t<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(t))}();if(!Number.isFinite(n)||e.length<=n)return e;const t=/* @__PURE__ */new Map,l=e=>{!e||t.size>=n||t.set(e.index,e)},r=An.value.length,i=Zl(vl.start-2*ml.value,0,r),a=Zl(vl.end+2*ml.value,i,r);for(const o of e)o.index>=i&&o.index<a&&l(o);const u=Math.max(1,Math.ceil(e.length/n));for(let o=0;o<e.length&&t.size<n;o+=u)l(e[o]);for(let o=e.length-1;o>=0&&t.size<n;o-=u)l(e[o]);return Array.from(t.values()).sort((e,n)=>e.index-n.index).slice(0,n)}(Yo().map(e=>{var n;const t=An.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:vi(e.index)}):null}).filter(e=>Boolean(e))):[],s=ai({allowFallback:!0===n.allowAnchorFallback,requireViewport:n.requireViewport});return s||i.length||!0===n.includeEmptyState?u(a({sessionKey:e.sessionKey,threadKey:e.threadKey},s?{anchor:s.anchor,anchorCaptured:s.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?gi():void 0,measurementKey:Sr()||void 0,heightCache:i.length?i:void 0}):null}function ki(e){var n,t;const o=li();if(!o)return;const l=function(e){const n=W.value;if(!n)return null;const t=Ze(n,e.root),o=An.value.length,l=Cn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?Cn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=ri();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){mo=ha()+120,ho=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Dr(o.root,o.doc,i,{isReverseFlexScrollRoot:Ge,getNormalizedScrollTop:Je})}const Ni=[];function bi(){if(Fe)for(null!=fo&&(null==ht||ht(fo),fo=null);Ni.length;){const e=Ni.pop();null!=e&&window.clearTimeout(e)}}function Si(e){const n=Boolean(uo.value);uo.value=null,mo=0,ho=null,bi(),n&&e&&Ma(e)}function xi(){if(!uo.value||!Fe)return;if(null!=fo)return;const e=()=>{fo=null;const e=uo.value;e&&ki(e)};fo=ft?ft(e):null,null==fo&&e()}function Mi(e,n={}){const t=An.value.length;return t<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=t)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(n.requireSignature&&!e.signature)&&!(n.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){var n;const t=An.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==vi(e.index))}(e))}function wi(e){const n=Xr(xr()),t=Xr(e);return-1!==n&&-1!==t&&n===t}function Ci(e){var n;const t=Number(null==e?void 0:e.width);if(Number.isFinite(t)&&t>0)return t;const o=Number(null==(n=null==e?void 0:e.metrics)?void 0:n.width);return Number.isFinite(o)&&o>0?o:null}function _i(e){var n;return e.sessionKey===kr()&&!!br(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Sr()&&!!wi(Ci(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Bi(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Bi(e){return Boolean(e.contentHash&&e.contentHash===gi())}function Oi(e){return!Bi(e)}let Ai=null,Ei=null,$i=null,qi=null,Ui=null,Xi=!1;function Gi(e){var n;const t=e.map(e=>{var n,t;return[e.index,Math.round(10*e.height),null!=(n=e.nodeType)?n:"",null!=(t=e.signature)?t:""].join("")}).join(""),o=Xr(xr());return[null!=(n=Nr())?n:"",kr(),Sr(),An.value.length,o,e.length,ui(t)].join(":")}function Yi(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!Jn.value||!(null==e?void 0:e.length))return!1;if(An.value.length<=0)return!1;if(!wi(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Mi(e,{requireSignature:!0});if(!t.length)return!Xi&&"undefined"!=typeof console&&d&&(Xi=!0,console.warn("[markstream-vue] virtualScroll.heightCache ignored: standalone heightCache entries must include compatible signature metadata. Use heightCache exported from virtual-state-change/render-settled, and pass heightCacheWidth from the same state.")),!1;const l=Gi(t);return l===Ai?(Ei="standalone",!0):(al(t,{mode:"merge"}),go(),Ai=l,Ei="standalone",ya(),Ma("restore"),!0)}function Ji(e,n={}){var t,o,l;if(!Jn.value||!e)return!1;if(e.sessionKey!==kr())return!1;if(!br(e.threadKey))return!1;if(An.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!Zi(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!Zi()&&Number(Ci(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&_i(e)){const n=Mi(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Oi(e)});n.length&&(al(n,{mode:"merge"}),go(),Ai=Gi(n),Ei="restore",ya(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Ma("restore"),!0;if(!i)return u&&Ma("restore"),!0;const s=function(e,n){var t;const o=e.anchor,l=o?"bottom"===o.type?`bottom:${Math.round(o.distanceFromBottomPx)}`:`node:${o.nodeIndex}:${Math.round(o.offsetWithinNodePx)}`:"none";return[null!=(t=Nr())?t:"",kr(),Sr(),Mr.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return $i===s?(u&&Ma("restore"),!0):($i=s,function(e){const n=()=>{if("node"===e.type)return Si(),void Ao({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(To(),Mo.value=null,uo.value=e,bi(),ki(e),Fe)for(const e of[0,120,280,480])Ni.push(window.setTimeout(()=>{const e=uo.value;e&&ki(e)},e))};!function(e){if(!at.value)return!1;const n=An.value.length;return!(n<=0||(hl.value="node"===e.type?Zl(e.nodeIndex,0,n-1):n-1,pl(),0))}(e)?n():le(n)}(i),Ma("restore"),!0)}function Zi(){const e=xr();return Number.isFinite(e)&&e>0}function Qi(e){var n;return e.sessionKey===kr()&&!!br(e.threadKey)&&(An.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||Zi())||!(!(e.anchor&&Number(Ci(e))>0)||Zi()))}function ea(){qt.clear();for(const e of Object.keys(Ro)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<An.value.length&&ll(n)}}function na(){null!=Tl&&(null==ht||ht(Tl),Tl=null),Oa()}function oa(){return!Fe||pt?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(ft)return ft(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function la(e,n=Nr(),t=wr.value){return kr()===e&&Nr()===n&&wr.value===t}function ra(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=kr(),c=Nr(),d=wr.value,f=null!=(n=e.frames)?n:2,m=null!=(t=e.timeoutMs)?t:120,h=null!=(l=e.reason)?l:"manual",v=e.expectedSettledTokenKey,p=!0===e.flushPendingTimers,g=oi(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>la(s,c,d)&&(null==v||pa()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield oa(),!k())return y();Ha(),na()}if(yield function(e){return!Fe||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&Rl(),Ha(),na(),!k())return y();const N=Qr();N&&(Wr=s,Kr=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&Jr(null==(i=o.virtualScroll)?void 0:i.settledToken)&&pa()===v&&(Ur=Wa(o.virtualScroll.settledToken)));const b=k()&&N&&ei(),S=oi(h,b?"final":void 0);return ba(S,!0),S})}let ia="content",aa=null,ua=null,sa=0,ca=null,da=null,fa=null,ma=null;function ha(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function va(e){var n,t;const l=ca;if(!l)return!0;const r=null!=(t=null==(n=o.virtualScroll)?void 0:n.heightDiffThresholdPx)?t:1;return Math.abs(e.totalHeight-l.totalHeight)>r||e.sessionKey!==l.sessionKey||e.phase!==l.phase||e.stable!==l.stable||e.final!==l.final||e.threadKey!==l.threadKey||e.nodeCount!==l.nodeCount||e.measuredCount!==l.measuredCount||e.width!==l.width}function pa(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Wi(e)}function ga(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Sr(),gi(),Wi(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function ya(){fa=null,ma=null,da=null}function ka(e){const n=e.heightCache;return(null==n?void 0:n.length)?Gi(n):""}function Na(e){var n,t,o;const l=e.metrics,r=e.anchor?"bottom"===(i=e.anchor).type?`bottom:${Math.round(i.distanceFromBottomPx)}`:`node:${i.nodeIndex}:${Math.round(i.offsetWithinNodePx)}`:"none";var i;return[e.sessionKey,null!=(n=e.threadKey)?n:"",null!=(t=e.measurementKey)?t:Sr(),null!=(o=e.contentHash)?o:"",ka(e),r,e.anchorCaptured?1:0,l.liveRange.start,l.liveRange.end,l.renderedCount,l.nodeCount,Math.round(l.totalHeight),Math.round(l.width),l.phase,l.stable?1:0].join("\0")}function ba(e,n=!1){if(!Jn.value)return;if(function(e=!1){return!e&&Xn.value&&!Zn.value}(n))return;const t=n||va(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:yi(e,{includeHeightCache:!0})}:{state:yi(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||Na(e)!==da}(r,n)));if(t&&(L(e),ca=e,sa=ha()),r&&i&&(P(r),r.anchor&&z(r.anchor),da=Na(r)),e.stable){const n=ga("settled",e);if(n!==fa){fa=n;const t=yi(e,{includeHeightCache:!0});t&&(P(t),da=Na(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=ga("final",e);if(n!==ma){ma=n;const t=yi(e,{includeHeightCache:!0});t&&(P(t),da=Na(t)),function(e){l("render-final",e)}(e)}}}function Sa(){null!=aa&&(null==ht||ht(aa),aa=null),null!=ua&&Fe&&(window.clearTimeout(ua),ua=null)}function xa(){aa=null,ua=null,function(e){if(bl.size>0||null!=Tl)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(ia)&&(Ha(),na()),ba(oi(ia))}function Ma(e){var n,t;if(!Jn.value)return;if(ia=e,null!=aa||null!=ua)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(ha()-sa)),i=()=>{ua=null,aa=ft?ft(xa):null,null==aa&&xa()};Fe&&r>0?ua=window.setTimeout(i,r):i()}function wa(){lo.value+=1}function Ca(e){return!(Ot.value&&e>=It.value)&&(!ul.value||e<wt.value||zl.value.has(e))}function _a(e){const n=jl.get(e);n&&(n(),jl.delete(e));const t=Wl.get(e);t&&(t.destroy(),Wl.delete(e)),Vl(e)}function Ba(e,n){let t=!1;if(n){const o=Pt.get(e);Pt.set(e,n),o!==n&&(t=!0)}else Pt.delete(e)&&(t=!0);if(t&&wa(),n||Vl(e),!dl.value||!dt)return _a(e),void(n&&ql(e,!0));if(!at.value&&ul.value&&!de.value&&Wl.size>=Ie.value&&(de.value||(de.value=!0,d&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),Xl()),!dl.value||!dt))return _a(e),void(n&&ql(e,!0));if(e<wt.value&&!at.value)return _a(e),void ql(e,!0);if(zl.value.has(e))return _a(e),void ql(e,!0);if(!n)return void _a(e);_a(e);const o=dt(n,{rootMargin:Ce.value});if(!o)return;Wl.set(e,o),ql(e,o.isVisible.value),ul.value&&function(e){if(!Fe||!ul.value)return;Vl(e);const n=e%17*23,t=window.setTimeout(()=>{if(Dl.delete(e),!ul.value)return;if(zl.value.has(e))return;const n=Pt.get(e);if(!n)return;const t=Xe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?Cn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?Cn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=Cn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&ql(e,!0)},1800+n);Dl.set(e,t)}(e);let l=null;l=G(()=>o.isVisible.value,n=>{if(n){Vl(e),ql(e,!0),null==l||l(),jl.delete(e),Wl.get(e)===o&&Wl.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),jl.set(e,l),at.value&&Kl()}function Oa(){Tl=null,nl(()=>{let e=!1;for(const[n,t]of bl)bl.delete(n),gl.get(n)===t.el&&yl.get(n)===t.version&&(e=rl(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function Ta(){null!=Tl&&(null==ht||ht(Tl),Tl=null),bl.clear()}function Ia(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(gl.get(e)!==n)return;const r=yl.get(e);if(null==r)return;const i=An.value[e],a=an.value&&!0!==tn.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=An.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=bl.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;bl.set(e,{height:d,allowShrink:c,version:r,el:n}),null==Tl&&(Tl=ft?ft(Oa):null,null==Tl&&Oa())}(e,n,il(e,n))}function Ha(){for(const[e,n]of gl)n&&Ia(e,n)}function Aa(){null==Dt||Dt.disconnect(),Dt=null,Kt.clear()}function La(){for(;Nl.length;)Ll(Nl.pop())}G(Zn,e=>{e&&Ma("content")},{flush:"post"}),n({getVirtualMetrics:oi,captureVirtualState:function(e={}){var n;return yi(oi("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:null==(n=e.includeEmptyState)||n})},restoreVirtualState:function(e,n={}){const t=!0===n.restoreAnchor,o=null==n.restoreToken?"imperative":String(n.restoreToken);qi=e,Ui={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!Ji(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&Qi(e)||(qi=null,Ui=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield oa(),Ha(),na(),yield le();const n=oi(e);return ba(n,!0),n})},settle:ra,scrollToNode:function(e,n="start"){Si(),To();const t=An.value.length;if(t<=0)return;const o=Zl(e,0,t-1),l=()=>{var e;const t=Bo({nodeIndex:o,offsetWithinNodePx:0}),l=No(o),r=li(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=wo();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}_o(Math.max(0,u)),Kl({immediate:!0}),at.value&&(hl.value=o,pl())};if(at.value)return hl.value=o,pl(),void le(l);l()}}),G(()=>ut.value,e=>{if(!e){Aa();for(const e of kl.values())for(const n of e)Ll(n);kl.clear(),yl.clear(),La(),Ta()}},{immediate:!0}),G(tn,e=>{e&&function(){if(Fe&&tn.value&&gl.size){La();for(const e of[80,240,640]){const n=Al(e,()=>{for(const[e,n]of gl)n&&Ia(e,n)},"final");null!=n&&Nl.push(n)}}}(),Ma(e?"final":"content")}),G([()=>An.value.length,()=>It.value],()=>{uo.value&&xi(),Ma("content")},{flush:"post",immediate:!0}),G([()=>vl.start,()=>vl.end],()=>{Ma("batch")},{flush:"post"});const{cleanupBatchScheduler:Ra}=function(e){const{props:n,isClient:t,isTestEnv:o,parsedNodesIdentity:l,parsedNodeCount:r,desiredRenderedCount:i,datasetKey:a,batchingEnabled:u,incrementalRenderingActive:s,resolvedBatchSize:c,resolvedInitialBatch:d,renderedCount:f,adaptiveBatchSize:m,previousRenderContext:h,previousBatchConfig:v,requestFrame:p,cancelFrame:g,hasIdleCallback:y,cleanupNodeVisibility:k,onDatasetKeyChanged:N,onDatasetChanged:b}=e;let S=null,x=null,M=!1,w=null,C=null,_=0,B=!1,O=!1;const T=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function H(){if(t){null!=S&&(null==g||g(S),S=null),null!=x&&(window.clearTimeout(x),x=null),null!=C&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(C),C=null),_+=1;for(const e of T)null==g||g(e);T.clear();for(const e of I)window.clearTimeout(e);I.clear(),M=!1,w=null,B=!1,O=!1}}function A(){return"undefined"!=typeof performance?performance.now():Date.now()}function L(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.2*o?m.value=Math.max(r,Math.floor(.7*m.value)):e<.5*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),B=!1;const t=O||f.value<i.value;O=!1,t&&$()}function R(e,l={}){var r,a;if(!s.value)return;const u=i.value;if(f.value>=u)return;const c=Math.max(1,e),d=()=>{const e=A();let o=0;S=null,x=null,C=null,M=!1;const l=null!=w?w:c;w=null;const r=A();f.value=Math.min(u,f.value+l),k(f.value),o=A()-r,function(e,o){if(!t)return void L(o);B=!0;const l=++_;le().then(()=>{var t;if(l!==_)return;const r=A(),i=Math.max(o,r-e),a=()=>{l===_&&L(i)};if(p){let e=!1,o=null;const l=()=>{e||(e=!0,a())},r=p(()=>{T.delete(r),null!=o&&(window.clearTimeout(o),I.delete(o),o=null),l()});return T.add(r),o=window.setTimeout(()=>{null!=o&&I.delete(o),o=null,null==g||g(r),T.delete(r),l()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,o)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(w=null!=w?Math.max(w,c):c,!M){if(M=!0,!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return void(C=window.requestIdleCallback(()=>d(),{timeout:e}))}p&&!o?S=p(()=>{0!==m?x=window.setTimeout(()=>d(),m):d()}):x=window.setTimeout(()=>d(),m)}}function E(e,n={}){B?O=!0:null==e?$():R(e,n)}function $(){s.value&&R(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return G([l,r,a,s,c,d,()=>n.renderBatchDelay],()=>{var e;const o=r.value,l=h.value,u=a.value,p=!Object.is(u,l.key),g=o!==l.total,y=p||g;h.value={key:u,total:o};const S=v.value,x=null!=(e=n.renderBatchDelay)?e:16,M=S.batchSize!==c.value||S.initial!==d.value||S.delay!==x||S.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:x,enabled:s.value},p&&N(o),(y||M||!s.value)&&H(),(y||M)&&(m.value=Math.max(1,c.value||1)),y&&b();const w=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=w,void k(f.value);const C=p||0===l.total;f.value=C||M?Math.min(w,d.value):Math.min(f.value,w);const _=Math.max(1,d.value||c.value||o);f.value<w?E(_,{immediate:!t}):k(f.value)},{immediate:!0}),G(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&E())}),{cleanupBatchScheduler:H}}({props:H,isClient:Fe,isTestEnv:pt,parsedNodesIdentity:$n,parsedNodeCount:Pn,desiredRenderedCount:Il,datasetKey:Cr,batchingEnabled:_t,incrementalRenderingActive:Ot,resolvedBatchSize:xt,resolvedInitialBatch:wt,renderedCount:It,adaptiveBatchSize:At,previousRenderContext:Ht,previousBatchConfig:Lt,requestFrame:ft,cancelFrame:ht,hasIdleCallback:vt,cleanupNodeVisibility:Ul,onDatasetKeyChanged:e=>{Ta(),ol(),go(),ya(),e>0&&Uo(e)},onDatasetChanged:()=>{at.value&&Kl({immediate:!0})}});G([fl,at,()=>W.value,()=>He()],([e,n])=>{if(!e)return Gl(),void Fl();Yl(),n?Kl({immediate:!0}):Fl()},{flush:"post",immediate:!0}),G([()=>An.value.length,()=>at.value],e=>s(null,[e],function*([e,n]){n&&e&&Fe&&(yield le(),Kl({immediate:!0}))}),{flush:"post"}),G(Qn,e=>{e&&function(){var e;if(Fn.value&&Kn.value&&zn.value&&(null==(e=Wn.value)?void 0:e[1]))return;const n=fe({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=fe({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=fe({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Fn.value=n,Kn.value=t,zn.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]=fe({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Wn.value=l}()},{immediate:!0}),G([()=>W.value,Qn],()=>{if(!Qn.value)return rr(),void(be.value=0);or(),rr(),Qn.value&&W.value&&"undefined"!=typeof ResizeObserver&&(lr=new ResizeObserver(()=>{or(),Mo.value&&Io(),uo.value&&xi(),Ma("resize")}),lr.observe(W.value))},{immediate:!0}),G([Qn,rt,wr],()=>s(null,null,function*(){if(!Qn.value)return Se.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void go();yield le(),function(){if(!Qn.value||"undefined"==typeof window)return Se.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void go();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=nr(er(j.value),".paragraph-node");e.paragraph=Fr(j.value,n,"pre-wrap");const t=er(V.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=Fr(V.value,o,"pre-wrap");const l=Cn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=J.value)?void 0:e.offsetHeight)?n:0}),r=Cn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=nr(er(ne[i]),`h${i}`);e.headings[i]=Fr(ne[i],n,"pre-wrap")}Se.value=e,go()}()}),{flush:"post",immediate:!0}),G(()=>An.value.length,()=>{at.value&&Kl({immediate:!0})}),G([Qn,be],()=>{go(),at.value&&Kl({immediate:!0}),Mo.value&&Io(),uo.value&&xi(),Ma("resize")},{immediate:!1}),G(()=>ul.value,e=>{if(e)for(const[n,t]of Pt)Ba(n,t);else{Xl();for(const[e,n]of Pt)n&&ql(e,!0)}},{immediate:!1}),G([Ce,Ie,()=>He()],()=>{var e;null==(e=dt.refresh)||e.call(dt);for(const[n,t]of Pt)Ba(n,t)},{immediate:!1}),G([()=>H.viewportPriority,()=>An.value.length,Ie],([e,n,t])=>{if(!1!==e){if(de.value&&(n<=200||n<=t)){de.value=!1;for(const[e,n]of Pt)Ba(e,n)}}else de.value=!1}),G(()=>It.value,()=>{at.value&&Kl({immediate:!0})}),G([hl,it,ml,()=>An.value.length,at],()=>{pl()},{immediate:!0});let Ea=null,$a=!1,Pa=null;function Fa(){Ea=null,Wr=null,Kr=void 0,Ur=null,ya()}function Ka(){Ta(),ol(),go(),qt.clear();const e=An.value.length;e>0&&Uo(e),ea()}function za(){Sa(),Rl(),ca=null,Ai=null,Ei=null,$i=null,qi=null,Ui=null,$a=!1,Fa(),Ar("restore"),To(),Si()}function Wa(e){var n;return[null!=(n=Nr())?n:"",kr(),Sr(),Mr.value,pa(e),An.value.length,Math.round(So(0,An.value.length)),Math.round(xr()),Eo.count,Math.round(Eo.total)].join(":")}function ja(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=pa(r),a=kr(),u=Nr(),s=wr.value;if(Jn.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&Jr(r))if(Qr()){if(Wa(r)!==Ur&&!$a){$a=!0;try{const e=yield ra({reason:"manual",expectedSettledTokenKey:i}),n=pa()===i;la(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(Ur=Wa(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{$a=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=Jr(e)?Wa(e):"";la(a,u,s)&&n&&Ur!==n&&ja()}}}else Ma("manual")})}G(Jn,(e,n)=>{if(e!==n){if(!e)return za(),void Sa();za(),Ka(),Pa=wr.value,Ma("content")}},{flush:"post"}),G([Jn,wr],([e,n])=>{e?null!=Pa?Pa!==n&&(Pa=n,function(e="resize"){Ta(),ol(),go(),qt.clear();const n=An.value.length;n>0&&Uo(n),ea(),Ai=null,Ei=null,$i=null,ca=null,$a=!1,Fa(),Yi(),le(()=>{Ha(),Mo.value&&Io(),uo.value&&xi(),Ma(e)})}("resize")):Pa=n:Pa=null},{flush:"post",immediate:!0}),G([Jn,()=>kr(),()=>Nr()],([e])=>{e&&(za(),Ka(),Ar("content"),Ma("content"))}),G([Jn,()=>kr(),()=>Nr(),wr,()=>An.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(_l.entries()))Ir(o)||(_l.delete(t),Cl.delete(t),n=!0);n&&(Br(),Ma(e))}("async-node")},{flush:"post"}),G([Jn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>pe.value],([e])=>{e&&(ya(),function(e="content"){if(!Jn.value)return;const n=[],t=An.value.length,o=Ql(t);for(const l of Array.from(qt.keys())){if(l>=t){n.push(l);continue}if(l<o)continue;const e=vi(l),r=qt.get(l);null!=r&&r!==e&&n.push(l),qt.set(l,e)}for(const l of Array.from(qt.keys()))l>=t&&qt.delete(l);n.length&&(function(e,n={}){const t=Array.from(e,Number);el(t);let o=0;if(nl(()=>(o=Go(t,n),o>0)),o>0)!function(e){for(const n of e)qt.delete(n)}(t);else for(const l of t)Qt.delete(l)}(n,{notify:!1}),go(),Fa(),Mo.value&&Io(),uo.value&&xi(),Ma(e))}("content"))},{flush:"post",immediate:!0}),G([Jn,()=>An.value.length,()=>kr(),()=>Nr()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Fa()},{flush:"post"}),G([Jn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCache},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCacheWidth},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>An.value.length,()=>kr(),be],()=>{Yi()},{flush:"post",immediate:!0}),G([Jn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreAnchor},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>An.value.length,()=>kr(),be],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield le();const t=function(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}();Ji(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),G([Jn,be,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey}],([e])=>{var n;if(!e)return;const t=null==(n=o.virtualScroll)?void 0:n.restoreState;t&&Ai&&"restore"===Ei&&(_i(t)||(Ka(),Ai=null,Ei=null,Ma("resize")))},{flush:"post"}),G([Jn,()=>An.value.length,()=>kr(),be],e=>s(null,[e],function*([e]){var n;const t=qi,o=Ui;e&&t&&(yield le(),!Ji(t,{restoreAnchor:!0===(null==o?void 0:o.restoreAnchor),restoreToken:null!=(n=null==o?void 0:o.restoreToken)?n:"imperative",allowUncapturedAnchor:!0===(null==o?void 0:o.allowUncapturedAnchor)})&&Qi(t)||(qi=null,Ui=null))}),{flush:"post",immediate:!0}),G([Jn,tn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>kr(),()=>Nr(),wr,Ol,wl,()=>It.value,Il,()=>Eo.count,()=>Eo.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!ni())return;const o=function(){var e;const n=An.value.length;return[null!=(e=Nr())?e:"",kr(),Sr(),Mr.value,n,Math.round(So(0,n)),Math.round(xr()),Eo.count,Math.round(Eo.total)].join(":")}();Ea!==o&&(Ea=o,ra({reason:"final"}).then(e=>{e.stable||Ea!==o||(Ea=null)}))},{flush:"post",immediate:!0}),G([Jn,tn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>kr(),()=>Nr(),wr,Ol,wl,()=>It.value,Il,()=>An.value.length,()=>Eo.count,()=>Eo.total],()=>{ja()},{flush:"post",immediate:!0}),G([()=>An.value.length,at,it,ml,()=>vl.start,()=>vl.end],([e,n,t,o,l,r])=>{ze.value&&hn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:hl.value,scroll:n?(()=>{const e=ao.value||Xe();return e?{reverse:Ge(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:It.value})}),G([()=>H.customId],([e],n,t)=>{if(!e||jn)return;const o=function(e,n){return e?(_r.controllers[e]=n,()=>{_r.controllers[e]===n&&delete _r.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Ho,restoreAnchor:Ao,getAnchorDrift:Lo,getReport:pr});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(Jn.value)try{Ha(),na();const e=oi("manual");va(e)&&(L(e),ca=e,sa=ha());const n=yi(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(P(n),n.anchor&&z(n.anchor),da=Na(n))}catch(e){}}(),Ra(),Xl(),fn(),Aa();for(const e of kl.values())for(const n of e)Ll(n);kl.clear(),yl.clear(),qt.clear(),La(),Ta(),rr(),To(),Si(),Sa(),Gl(),Fl()});const Da=re({loader:()=>s(null,null,function*(){try{return(yield import("./index11.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),mt}}),loadingComponent:Ki,delay:0}),Va=re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),mt}}),loadingComponent:Fi,delay:0}),qa=re(()=>s(null,null,function*(){try{return(yield import("./index7.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),mt}})),Ua={text:gt,paragraph:Oo,heading:so,code_block:kt,list:po,list_item:vo,blockquote:Jt,table:$o,definition_list:no,footnote:io,footnote_reference:sn,footnote_anchor:oo,admonition:ta,vmr_container:Wo,hardbreak:jt,link:Rt,image:ot,thematic_break:Fo,math_inline:Nt,math_block:bt,strong:Bt,emphasis:zt,strikethrough:Tt,highlight:Ft,insert:$t,subscript:Ct,superscript:Mt,emoji:rn,checkbox:on,checkbox_input:on,inline_code:wn,html_inline:Sn,reference:St,html_block:Co},Xa=$(()=>gr()),Ga=$(()=>zr(H.codeBlockProps)),Ya=$(()=>zr(H.codeBlockProps,{omit:["langs"]})),Ja=$(()=>a(a({stream:H.codeBlockStream,darkTheme:H.codeBlockDarkTheme,lightTheme:H.codeBlockLightTheme,monacoOptions:H.codeBlockMonacoOptions,themes:H.themes,langs:"shiki"===p.value?H.langs:void 0,minWidth:H.codeBlockMinWidth,maxWidth:H.codeBlockMaxWidth},"boolean"==typeof We.value?{showTooltips:We.value}:{}),Ya.value)),Za=$(()=>a(u(a({},Ja.value),{langs:H.langs}),Ga.value));function Qa(e){return"boolean"==typeof e?e:void 0}const eu=$(()=>{const e=H.codeBlockProps||{},n={},t=Qa(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const o=Qa(e.diffInline);void 0!==o&&(n.diffInline=o);const l=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(e.reservedHeightPx);return void 0!==l&&(n.reservedHeightPx=l),n}),nu=$(()=>a(a({stream:H.codeBlockStream,darkTheme:H.codeBlockDarkTheme,lightTheme:H.codeBlockLightTheme,themes:H.themes,langs:H.langs,minWidth:H.codeBlockMinWidth,maxWidth:H.codeBlockMaxWidth},"boolean"==typeof We.value?{showTooltips:We.value}:{}),Ga.value)),tu=$(()=>a({},H.mermaidProps||{})),ou=$(()=>a({},H.d2Props||{})),lu=$(()=>a({},H.infographicProps||{})),ru=$(()=>({typewriter:h.value,fade:H.fade,customHtmlTags:Hn.value.customHtmlTags})),iu=$(()=>a(a({},ru.value),"boolean"==typeof We.value?{showTooltip:We.value}:{})),au=$(()=>a(a({},ru.value),"boolean"==typeof We.value?{showTooltips:We.value}:{})),uu=$(()=>a(a({},ru.value),"boolean"==typeof We.value?{showTooltips:We.value}:{})),su=$(()=>a(a({},ru.value),"boolean"==typeof We.value?{showTooltips:We.value}:{}));function cu(e){return Array.isArray(e.children)&&e.children.length>0}const du=$(()=>fr.value.map(e=>{var n,t,o,l,r,i,s,c;let d=function(e){var n,t,o,l,r,i,u;if("code_block"!==e.type)return e;const s=e,c=[String(null!=(n=s.language)?n:""),String(null!=(t=s.loading)?t:""),String(null!=(o=s.diff)?o:""),String(null!=(l=s.code)?l:""),String(null!=(r=s.originalCode)?r:""),String(null!=(i=s.updatedCode)?i:""),String(null!=(u=s.raw)?u:"")].join("\0"),d=Vt.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return Vt.set(s,{signature:c,node:f}),f}(e.node);const f=fu(d);let m=gu(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===Ua[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=Tn.value[r];if(In.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:A(e.content,r)});else if(_(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===d.type?(m=gt,d={type:"text",content:n,raw:n}):(m=Oo,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h="code_block"===d.type&&"pre"===p.value&&m===mt&&!mu(Tn.value,f);let v=a({},function(e,n,t){const o=null!=n?n:fu(e);if("code_block"===e.type){const n=o?mu(Tn.value,o):void 0;if(t&&"pre"===p.value&&!n&&t===mt)return eu.value;if(t&&o&&t===n)return"mermaid"===o?vu(e):"infographic"===o?pu(e):"d2"===o||"d2lang"===o?ou.value:Za.value;if(t&&t===Tn.value.code_block)return Za.value;if(ar(t))return nu.value}return"mermaid"===o?vu(e):"infographic"===o?pu(e):"d2"===o||"d2lang"===o?ou.value:"link"===e.type?iu.value:"list"===e.type?au.value:"blockquote"===e.type?uu.value:"table"===e.type?su.value:"code_block"===e.type?Ja.value:ru.value}(d,f,m));const g=dr.value[e.index];"code_block"===d.type&&"code-block"===(null==g?void 0:g.kind)&&(v=u(a({},v),h?{reservedHeightPx:null!=(r=g.height)?r:g.contentHeight}:{estimatedHeightPx:g.height,estimatedContentHeightPx:g.contentHeight})),h||"code_block"!==d.type||"mermaid"!==f||null!=Re(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:$e(Pe(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Re(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Le(Ee(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:On.value}));const y=function(e,n){const t=String(e.type);return!Ve(t)&&Tn.value[t]===n}(d,m),k=y?vn(d,je.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=k?k:{}),v),rendersCustomNode:y,hasSlotChildren:cu(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${Xa.value}-${e.index}`})}));function fu(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function mu(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Te(t),Be(t)]){const n=o&&e[o];if(n)return n}}function hu(e,n,t,o){var l,r;const i=a({},e.value);return null==Re(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Re(i.maxHeight))?r:void 0)),i}function vu(e){return hu(tu,e,Pe,$e)}function pu(e){return hu(lu,e,Ee,Le)}function gu(e,n){if(!e)return zo;const t=Tn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:fu(e),r=l?mu(t,l):void 0;if(r)return r;if("pre"===p.value)return t.code_block||mt;if("mermaid"===l)return t.mermaid||Da;if("infographic"===l)return t.infographic||Va;if("d2"===l||"d2lang"===l)return t.d2||qa;if(o)return o;return t.code_block||ur.value}return o||Ua[String(e.type)]||zo}function yu(e){l("click",e)}function ku(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function Nu(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function bu(e){l("mouseover",e)}function Su(e){l("mouseout",e)}const xu=X(null),Mu=X(!1),wu=X(null),Cu=$(()=>!("minimal"!==H.domMode||Ke.value||!1!==H.fade||h.value||Mu.value||Et.value||at.value||Gn.value||qn.value||ct.value||0!==Object.keys(Tn.value).length));let _u,Bu=null,Ou=0,Tu=0,Iu=0;const Hu=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Au=new Set(Hu),Lu=[".typewriter-cursor",".height-estimation-probes",...Hu.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Ru(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Au.has(n)}function Eu(e){var n,t;if(!e||"object"!=typeof e)return 0;const o=e,l=null!=(t=null!=(n=o.raw)?n:o.content)?t:o.code;if("string"==typeof l)return l.length;const r=o.children;if(Array.isArray(r))return r.reduce((e,n)=>e+Eu(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Eu(n),0):0}function $u(){_u&&(clearTimeout(_u),_u=void 0)}function Pu(){Ou+=1,null!=Bu&&(null==ht||ht(Bu),Bu=null)}function Fu(){Pu(),ju(),xu.value&&(xu.value.style.visibility="hidden")}function Ku(e){var n;if(e.nodeType!==Node.TEXT_NODE)return!1;if(!(null!=(n=e.textContent)?n:"").trim())return!1;const t=e.parentElement;return!!t&&!t.closest(Lu)}function zu(e){let n=e.lastChild;for(;n;){if(Ku(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Lu)&&e.lastChild){n=e.lastChild;continue}}for(;n&&n!==e&&!n.previousSibling;)n=n.parentNode;if(!n||n===e)break;n=n.previousSibling}return null}function Wu(){const e=du.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Ru(t.node)||!Ca(t.index))continue;const o=Pt.get(t.index);if(!o)continue;const l=zu(o);if(l)return l}return null}function ju(){wu.value&&(wu.value.classList.remove(Vi),wu.value=null)}function Du(){if("simple"!==m.value||!Fe||!Mu.value||!W.value)return void ju();const e=Wu(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==wu.value&&(ju(),n&&(n.classList.add(Vi),wu.value=n))}function Vu(){if("precise"!==m.value)return;if(!Fe||!Mu.value)return;if(null!=Bu)return;const e=Ou,n=()=>{Bu=null,e===Ou&&function(){var e,n;if("precise"!==m.value)return;if(!(Fe&&Mu.value&&W.value&&xu.value))return;const t=W.value,o=xu.value;o.style.visibility="hidden";const l=Wu();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=Cn("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};ft?Bu=ft(n):n()}return G([en,()=>o.content,()=>o.nodes,()=>H.typewriter,tn],()=>s(null,null,function*(){var e,n;if(!Fe||Ke.value||!qe.value)return;if(tn.value)return Mu.value=!1,$u(),void Fu();if(null==(e=o.nodes)?void 0:e.length)return Mu.value=!1,$u(),Fu(),Tu=(null!=(n=o.content)?n:"").length,void(Iu=en.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Eu(n),0):(null!=(n=o.content)?n:"").length}(),l=function(){var e;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Eu(n),0):en.value.length}(),r=!Ru(An.value[An.value.length-1]),i=t>Tu,a=l>Iu;if(!h.value||!r||!i&&!a)return h.value&&r||(Mu.value=!1,Fu()),Tu=t,void(Iu=l);Tu=t,Iu=l,Mu.value=!0,"precise"===m.value&&xu.value&&(xu.value.style.visibility="hidden"),$u(),yield le(),"simple"===m.value?Du():(ju(),Vu()),_u=setTimeout(()=>{_u=void 0,Mu.value=!1},3e3)}),{flush:"post",immediate:!0}),G(Mu,e=>s(null,null,function*(){e?(yield le(),"simple"!==m.value?(ju(),"precise"===m.value&&Vu()):Du()):Fu()}),{flush:"post"}),G(m,()=>s(null,null,function*(){if(Fe&&!Ke.value&&qe.value&&Mu.value){if(yield le(),"simple"===m.value)return Pu(),void Du();ju(),"precise"!==m.value?Fu():Vu()}}),{flush:"post"}),G([()=>It.value,()=>vl.start,()=>vl.end],()=>s(null,null,function*(){Fe&&!Ke.value&&qe.value&&Mu.value&&(yield le(),"simple"!==m.value?(ju(),"precise"===m.value&&Vu()):Du())}),{flush:"post"}),ee(()=>{$u(),Pu(),ju(),Bn.clear()}),(e,n)=>{const t=Ne("NodeRenderer",!0);return q(Ke)?(F(!0),K(Y,{key:0},ce(du.value,e=>(F(),K(Y,{key:e.index},[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onClick:yu,onMouseover:bu,onMouseout:Su,onCopy:n[0]||(n[0]=e=>l("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},En.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},En.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onClick:yu,onMouseover:bu,onMouseout:Su,onCopy:n[2]||(n[2]=e=>l("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(F(),K("div",{key:1,ref_key:"containerRef",ref:W,class:D(["markstream-vue markdown-renderer",[{dark:H.isDark},{virtualized:at.value},{"virtual-scroll-coordinated":Zn.value},{"stable-layout":cl.value},{"typewriter-simple-cursor":Mu.value&&"simple"===m.value}]]),"data-custom-id":H.customId,onClick:yu,onMouseover:ku,onMouseout:Nu},[et.value||at.value?(F(),K(Y,{key:0},[et.value?(F(),ie(Pi,{key:0,width:rt.value,"flow-root":at.value||Zn.value,"paragraph-node":Fn.value,"list-item-node":Kn.value,"list-node":zn.value,"heading-nodes":Wn.value,"set-paragraph-wrapper":El,"set-list-item-wrapper":$l,"set-list-wrapper":Pl,"set-heading-wrapper":tr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Z("",!0),at.value?(F(),K("div",{key:1,class:"node-spacer",style:se({height:`${mr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],64)):Z("",!0),Cu.value?(F(!0),K(Y,{key:1},ce(du.value,e=>(F(),K(Y,{key:e.index},[Ca(e.index)?(F(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>l("copy",e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):Z("",!0)],64))),128)):(F(!0),K(Y,{key:2},ce(du.value,e=>(F(),K("div",{key:e.index,ref_for:!0,ref:n=>Ba(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[Ca(e.index)?(F(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${gr()}-${e}`;let t=!1;for(const o of Array.from(Cl.keys())){const l=_l.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Cl.delete(o),_l.delete(o),t=!0)}t&&(Br(),Ma("async-node"))}(e),bl.delete(e),function(e){var n;const t=(null!=(n=yl.get(e))?n:0)+1;yl.set(e,t)}(e);const o=kl.get(e);if(o){for(const e of o)Ll(e);kl.delete(e)}if(function(e){const n=Kt.get(e);n&&(null==Dt||Dt.unobserve(n),Wt.delete(n),Kt.delete(e))}(e),!n||!ut.value)return gl.delete(e),void yl.delete(e);gl.set(e,n);const l=()=>{Ia(e,n)};queueMicrotask(l);const r=(Dt||"undefined"==typeof ResizeObserver||(Dt=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Wt.get(n.target),t=Kt.get(null!=e?e:-1);null!=e&&t&&Ia(e,t)}else Ha()})),Dt);if(r&&(Kt.set(e,n),Wt.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=An.value[e])?void 0:t.type)?[16,80,240,800]:tn.value?[80]:[];if(n.length){const t=n.map(e=>Al(e,l,"node-resize")).filter(e=>null!=e);t.length&&kl.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[12]||(n[12]=e=>l("copy",e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},En.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},En.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[14]||(n[14]=e=>l("copy",e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(te,{key:0,name:"fade",css:!1!==H.fade,appear:!1!==H.fade},{default:oe(()=>[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[8]||(n[8]=e=>l("copy",e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},En.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},En.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":H.customId,"is-dark":H.isDark,onCopy:n[10]||(n[10]=e=>l("copy",e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(F(),K("div",{key:1,class:"node-placeholder",style:se({height:`${No(e.index)}px`})},null,4))],8,Di))),128)),Mu.value&&"precise"===m.value?(F(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:xu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Z("",!0),at.value?(F(),K("div",{key:4,class:"node-spacer",style:se({height:`${hr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],42,ji))}}})),[["__scopeId","data-v-b2599f07"]]),Ui=qi;Ui.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",Ui.__name,Ui.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,qi)};const Xi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Ui},Symbol.toStringTag,{value:"Module"})),Gi={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"},Yi={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"},Ji={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"},Zi={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"},Qi={class:"admonition-title"},ea=["aria-expanded","aria-controls"],na=["id"],ta=/* @__PURE__ */tn(/* @__PURE__ */P({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=$(()=>{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=X(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(F(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),K("svg",Gi,[...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?(F(),K("svg",Yi,[...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?(F(),K("svg",Ji,[...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?(F(),K("svg",Zi,[...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)])])):Z("",!0),z("span",Qi,W(r.value),1),o.node.collapsible?(F(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),K("svg",{style:se({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,ea)):Z("",!0)]),be(z("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(Ui),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,na),[[Se,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);ta.install=e=>{e.component(ta.__name,ta)};const oa=()=>import("@terrastruct/d2");let la=null,ra=oa,ia=null,aa=!1,ua=!1,sa=0;function ca(e){ra=e,sa++,la=null,ia=null,aa=!1,ua=!1}function da(e){ca(null!=e?e:oa)}function fa(){ca(null)}function ma(){return"function"==typeof ra}function ha(){return s(this,null,function*(){if(la)return la;const e=ra,n=sa;return e?e===oa&&aa?null:ia||(ia=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===oa)return n===sa&&e===ra&&(aa=!0,function(e){ua||(ua=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===sa&&e===ra&&(ia=null)}return n!==sa||e!==ra?null:t?(la=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}(t),la):null}),ia):null})}let va=null,pa=null,ga=null,ya=0;function ka(e){pa=null!=e?e:null,va=null,ga=null,ya++}function Na(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");ka(e)}function ba(){ka()}function Sa(){return"function"==typeof pa}function xa(){return s(this,null,function*(){if(va)return va;const e=pa,n=ya;return e?ga||(ga=s(null,null,function*(){const t=yield e();if(n!==ya||e!==pa)return null;const o=function(e){var n,t,o;if(!e)return null;const l=null!=(n=e.default)?n:e,r="function"==typeof l&&"function"==typeof(null==(t=l.prototype)?void 0:t.render)?l:null!=(o=e.Infographic)?o:null==l?void 0:l.Infographic;return"function"==typeof r?r:null}(t);return n!==ya||e!==pa?null:o?(va=o,va):null}).finally(()=>{n===ya&&e===pa&&(ga=null)}),ga):null})}function Ma(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function wa(e,n){null==e||e(n)}function Ca(e,n){return e?(wa(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function _a(e,n){const t=Ca(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;wa(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=Ma(o.marginTop),r=Ma(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function Ba(e,n,t){if(!e)return 0;const o=function(e){var n;return e?(null==(n=e.matches)?void 0:n.call(e,".markstream-vue.markdown-renderer"))?e:e.querySelector(".markstream-vue.markdown-renderer"):null}(e);if(!o)return 0;const l=Number.isFinite(t)?Number(t):_a(e,n),r=Ca(o,n);return Math.max(0,l-r)}function Oa(e,n,t){var o,l,r;const i=null!=(r=null!=(l=null==(o=t.getKey)?void 0:o.call(t,e,n))?l:e.id)?r:n;return String(i)}function Ta(e,n,t){var o,l,r;return null!=(r=null==(o=t.getKind)?void 0:o.call(t,e,n))?r:String(null!=(l=e.kind)?l:"")}function Ia(e,n,t){var o,l;const r=null!=(l=null==(o=t.getContent)?void 0:o.call(t,e,n))?l:e.content;return"string"==typeof r?r:""}function Ha(e,n,t){var o;const l=null==(o=t.getFinal)?void 0:o.call(t,e,n);if("boolean"==typeof l)return l;const r=e.final;return"boolean"!=typeof r||r}function Aa(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function La(e,n,t){const o=Ta(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&Ia(e,n,t).length>0}function Ra(e,n,t){var o;const l=null==(o=t.estimateItemHeight)?void 0:o.call(t,e,n);if(Number.isFinite(l)&&l>0)return l;const r=Ta(e,n,t);return"assistant-markdown"===r||"markdown"===r?360:"system-divider"===r?44:"tool-call"===r?72:"thinking"===r?92:"error"===r?76:"user-message"===r?88:Ia(e,n,t).length>0?360:96}function Ea(e){const n=he(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=he(/* @__PURE__ */new Map),l=he(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=X(!1),f=[0,80,180,360,640];let m,h=0,v=null,p=[],g=0;const y=/* @__PURE__ */new Map,k=/* @__PURE__ */new Map;let N,b=!1,S=null,x=!1,M=null;function w(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(le(e),null)}function _(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function B(){return[...Me(e.items)]}function O(){const n=Me(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return Oa(n,t,e)}function I(n,t){return La(n,t,e)}function H(n,t){const o=T(n,t),l=O(),r=Aa(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function A(){const n=Me(e.measurementKey);return null==n?void 0:String(n)}function L(){const n=Me(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){const n=Me(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===L()?"monaco":"pre"}function E(){var e;return`${null!=(e=A())?e:""}${L()}${R()}`}function $(n,t){if(I(n,t))return H(n,t);const o=T(n,t),l=O(),r=Aa(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function P(e){const n=B();for(let t=0;t<n.length;t++){const o=n[t];if(T(o,t)===e)return{item:o,index:t}}return null}function F(e,n){var t;const o=P(e);if(!o||!n)return!1;if(n.sourceKey!==$(o.item,o.index))return!1;const l=I(o.item,o.index)?E():A();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!F(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=P(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===H(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=O())?o:"")&&function(e){const n=E(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function W(e,n){return z(e,n)}function j(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!W(e,n))return 0;const l=Number(null==(t=null==n?void 0:n.metrics)?void 0:t.totalHeight);return Number.isFinite(l)&&l>0?Math.ceil(l):0}(e,n);return!Number.isFinite(r)||r<=0||!n?0:(j(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function q(e){return Number.isFinite(e)&&e>0?e:null}function U(){if(!x)return;x=!1,M=null;const e=N;N=void 0,e&&ae(e)}function G(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function Y(o,l,r=function(e){const n=P(e);return n?function(e,n){const t=I(e,n)?E():A();return a({sourceKey:$(e,n)},null==t?{}:{measurementKey:t})}(n.item,n.index):void 0}(o)){const i=q(l);if(null==i)return;const u=n.get(o),s=r&&(f=r,!((null!=(h=null==(c=t.get(o))?void 0:c.sourceKey)?h:"")===(null!=(p=null==f?void 0:f.sourceKey)?p:"")&&(null!=(y=null==c?void 0:c.measurementKey)?y:"")===(null!=(k=null==f?void 0:f.measurementKey)?k:"")&&(null!=(b=null==c?void 0:c.widthBucket)?b:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,b,S;if(null!=u&&Math.abs(u-i)<.5&&!s)return;if(d.value)return n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),void function(){const e=m,n=g;e&&le(()=>{ue(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,e)}))})}();const w=!1!==e.preserveScrollAnchor,_=w?re():void 0,B=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),O=w&&B<=2,T=w&&B<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var H;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),w&&((H=O?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:B}:_)&&(x||(N=H,x=!0,M=C(U))))}function J(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Z(){if(!b)return;b=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ee(n,{allowMarkdownShrink:t.allowMarkdownShrink});U()}function Q(){Z(),U()}function ee(n,t={}){const o=function(e){return _a(s.get(e),w)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=P(e);return!!n&&I(n.item,n.index)}(n))return o>0&&Y(n,o),void i();const a=V(n),u=function(e,n){return Ba(s.get(e),w,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&Y(n,e),void i()}const c=P(n);return c&&!Ia(c.item,c.index,e).trim()?(o>0&&Y(n,o),void i()):l>0?(o>l+1&&Y(n,o),void i()):(o>0&&Y(n,o),void i())}function ne(){const e={},n=B();for(let t=0;t<n.length;t++){const o=T(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function te(){const e={},n=B();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);F(l,r)&&(e[l]=r)}return e}function oe(){const e={};for(const[n,t]of o)e[n]=t;return e}function re(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=B();for(let a=0;a<l.length;a++){const t=T(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:T(i,r.start),offsetWithinItemPx:0}:void 0}function ie(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=A())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&F(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ae(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function ue(e,n){e===h&&ae(n)}function se(e){e===h&&(d.value=!1,Q(),ue(e,m),m=void 0,g=0)}function ce(){G(),_(M),x=!1,M=null,N=void 0,_(S),b=!1,S=null,k.clear();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return pe()&&ve(ce),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void J(i);if(u===a)return void ee(i);if(J(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ee(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ee(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=T(n,t),r=Ha(n,t,e),a=O(),u=Ia(n,t,e),s=H(n,t),c=E(),d=L(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=xe(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=W(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:W(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:96,heightDiffThresholdPx:4},g={content:u,final:r,mode:d,codeRenderer:f,nodeVirtual:!1,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==H(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:E()});const o=function(e){return"final"===e.phase||!0===e.final&&("measured"===e.confidence||"final"===e.confidence)||!!e.stable&&("measured"===e.confidence||"final"===e.confidence)}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),b||(b=!0,S=C(Z))},onVirtualStateChange(e){e.sessionKey===H(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=A();return u(a({threadKey:O()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:oe()})},preloadThreadState:ie,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(G(),d.value=Boolean(t),g=n,m=t,ie(e),!t)return d.value=!1,m=void 0,void(g=0);ue(n,t),le(()=>{ue(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{ue(n,t),o===f.length-1&&se(n)},e);p.push(l)}):se(n)})},dispose:ce}}const $a=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function Pa(e){return re(e)}const Fa=Pa(()=>import("./index3.js")),Ka=Pa(()=>import("./index5.js")),za=Pa(()=>import("./index6.js")),Wa=Pa(()=>import("./index11.js")),ja=Pa(()=>import("./index10.js")),Da=Pa(()=>import("./index7.js")),Va=Pa(()=>import("./index4.js")),qa=Pa(()=>import("./index8.js")),Ua=Pa(()=>import("./index9.js")),Xa={MarkdownRender:Ui,NodeRenderer:Ui,AdmonitionNode:ta,BlockquoteNode:Jt,CheckboxNode:on,CodeBlockNode:Fa,DefinitionListNode:no,EmojiNode:rn,EmphasisNode:zt,FootnoteNode:io,FootnoteReferenceNode:sn,FootnoteAnchorNode:oo,HardBreakNode:jt,HeadingNode:so,HtmlBlockNode:Co,HtmlInlineNode:Sn,HighlightNode:Ft,ImageNode:ot,D2BlockNode:Da,InfographicBlockNode:ja,InlineCodeNode:wn,PreCodeNode:mt,InsertNode:$t,LinkNode:Rt,ListItemNode:vo,ListNode:po,MathBlockNode:Ka,MathInlineNode:za,MermaidBlockNode:Wa,ParagraphNode:Oo,StrikethroughNode:Tt,StrongNode:Bt,SubscriptNode:Ct,SuperscriptNode:Mt,TableNode:$o,TextNode:gt,ThematicBreakNode:Fo,VmrContainerNode:Wo,ReferenceNode:St,MarkdownCodeBlockNode:qa,MarkstreamVirtualTimeline:Ua,Tooltip:Va},Ga={install(e,n){var t,o;Object.entries(Xa).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Ie(n.iconTheme),n&&"languageIconResolver"in n&&e.provide($a,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&He(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&L(n.mathOptions),n&&"infographicLoader"in n&&ka(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Dn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(je,function(e={}){return R(Ue(e))}(n.components))}};export{xa as $,ta as A,Jt as B,on as C,Da as D,rn as E,oo as F,tn as G,jt as H,ot as I,mt as J,io as K,Rt as L,$a as M,Ze as N,fa as O,Oo as P,ba as Q,St as R,Tt as S,$o as T,da as U,Wo as V,Na as W,Ra as X,Ge as Y,ha as Z,so as _,Fa as a,Ba as a0,Ia as a1,Ha as a2,Oa as a3,Ta as a4,Aa as a5,Wn as a6,ma as a7,jr as a8,Sa as a9,La as aa,_a as ab,Je as ac,Yn as ad,Xe as ae,ca as af,Vn as ag,ka as ah,zn as ai,Ea as aj,Ur as ak,Gn as al,Hi as am,So as an,No as ao,ko as b,no as c,zt as d,sn as e,Ft as f,Co as g,Sn as h,ja as i,wn as j,$t as k,vo as l,po as m,qa as n,Ua as o,Ka as p,za as q,Wa as r,Bt as s,Ct as t,Mt as u,gt as v,Fo as w,Va as x,Ga as y,Ui as z};