markstream-vue
Version:
Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.
1 lines • 153 kB
JavaScript
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))l.call(t,n)&&i(e,n,t[n]);if(o)for(var n of o(t))r.call(t,n)&&i(e,n,t[n]);return e},s=(e,o)=>t(e,n(o)),c=(e,t)=>{var n={};for(var i in e)l.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&o)for(var i of o(e))t.indexOf(i)<0&&r.call(e,i)&&(n[i]=e[i]);return n},u=(e,t,n)=>new Promise((o,l)=>{var r=e=>{try{a(n.next(e))}catch(t){l(t)}},i=e=>{try{a(n.throw(e))}catch(t){l(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((n=n.apply(e,t)).next())});import{getMarkdown as d,parseMarkdownToStructure as h,setDefaultMathOptions as v}from"stream-markdown-parser";import{defineComponent as m,createElementBlock as p,openBlock as f,withMemo as g,createVNode as w,unref as y,createElementVNode as x,Fragment as k,renderList as b,toDisplayString as M,computed as _,ref as B,watch as C,nextTick as T,onBeforeUnmount as L,createBlock as $,Teleport as S,Transition as I,withCtx as j,withDirectives as E,normalizeClass as H,normalizeStyle as N,vShow as R,createApp as z,h as A,inject as D,provide as P,createCommentVNode as V,renderSlot as O,shallowRef as F,readonly as W,defineAsyncComponent as K,resolveDynamicComponent as X,useAttrs as Y,mergeProps as q,isMemoSame as Z,onMounted as U,onUnmounted as G,withModifiers as J,createTextVNode as Q,markRaw as ee,reactive as te}from"vue";const ne=["cite"],oe=(e,t)=>{const n=e.__vccOpts||e;for(const[o,l]of t)n[o]=l;return n},le=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean}},emits:["copy"],setup:e=>(t,n)=>(f(),p("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[g([e.node.children],()=>w(y(dl),{"index-key":`blockquote-${e.indexKey}`,nodes:e.node.children||[],typewriter:e.typewriter,onCopy:n[0]||(n[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","typewriter"]),n,1)],8,ne))}),[["__scopeId","data-v-adfdba00"]]);le.install=e=>{e.component(le.__name,le)};const re={class:"checkbox-node"},ie=["checked"],ae=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(f(),p("span",re,[x("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,ie)]))}),[["__scopeId","data-v-8dc6c46f"]]);ae.install=e=>{e.component(ae.__name,ae)};const se={class:"definition-list"},ce={class:"definition-term"},ue={class:"definition-desc"},de=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean}},emits:["copy"],setup:e=>(t,n)=>(f(),p("dl",se,[(f(!0),p(k,null,b(e.node.items,(o,l)=>(f(),p(k,{key:l},[x("dt",ce,[w(y(dl),{"index-key":`definition-term-${e.indexKey}-${l}`,nodes:o.term,typewriter:e.typewriter,onCopy:n[0]||(n[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","typewriter"])]),x("dd",ue,[w(y(dl),{"index-key":`definition-desc-${e.indexKey}-${l}`,nodes:o.definition,typewriter:e.typewriter,onCopy:n[1]||(n[1]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","typewriter"])])],64))),128))]))}),[["__scopeId","data-v-5a21f288"]]);de.install=e=>{e.component(de.__name,de)};const he={class:"emoji-node"},ve=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(f(),p("span",he,M(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ve.install=e=>{e.component(ve.__name,ve)};const me="__global__",pe={};function fe(e,t){"string"==typeof e?pe[e]=t||{}:pe[me]=e||{}}function ge(e){return e?pe[e]||pe[me]||{}:pe[me]||{}}function we(e){if(e===me)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete pe[e]}function ye(){delete pe[me]}const xe=["id"],ke=["title"],be=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#footnote-${e.node.id}`;function n(){if("undefined"==typeof document)return;const e=document.querySelector(t);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,l)=>(f(),p("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[x("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+M(e.node.id)+"]",9,ke)],8,xe))}}),[["__scopeId","data-v-01af0fee"]]);be.install=e=>{e.component(be.__name,be)};const Me={class:"inline text-[85%] px-1 py-0.5 rounded font-mono bg-secondary whitespace-normal break-words max-w-full before:content-[''] after:content-['']"},_e=/* @__PURE__ */m({__name:"InlineCodeNode",props:{node:{}},setup:e=>(t,n)=>(f(),p("code",Me,M(e.node.code),1))});_e.install=e=>{e.component(_e.__name,_e)};const Be=Math.min,Ce=Math.max,Te=Math.round,Le=Math.floor,$e=e=>({x:e,y:e}),Se={left:"right",right:"left",bottom:"top",top:"bottom"},Ie={start:"end",end:"start"};function je(e,t,n){return Ce(e,Be(t,n))}function Ee(e,t){return"function"==typeof e?e(t):e}function He(e){return e.split("-")[0]}function Ne(e){return e.split("-")[1]}function Re(e){return"x"===e?"y":"x"}function ze(e){return"y"===e?"height":"width"}const Ae=/* @__PURE__ */new Set(["top","bottom"]);function De(e){return Ae.has(He(e))?"y":"x"}function Pe(e){return Re(De(e))}function Ve(e){return e.replace(/start|end/g,e=>Ie[e])}const Oe=["left","right"],Fe=["right","left"],We=["top","bottom"],Ke=["bottom","top"];function Xe(e){return e.replace(/left|right|bottom|top/g,e=>Se[e])}function Ye(e){const{x:t,y:n,width:o,height:l}=e;return{width:o,height:l,top:n,left:t,right:t+o,bottom:n+l,x:t,y:n}}function qe(e,t,n){let{reference:o,floating:l}=e;const r=De(t),i=Pe(t),a=ze(i),s=He(t),c="y"===r,u=o.x+o.width/2-l.width/2,d=o.y+o.height/2-l.height/2,h=o[a]/2-l[a]/2;let v;switch(s){case"top":v={x:u,y:o.y-l.height};break;case"bottom":v={x:u,y:o.y+o.height};break;case"right":v={x:o.x+o.width,y:d};break;case"left":v={x:o.x-l.width,y:d};break;default:v={x:o.x,y:o.y}}switch(Ne(t)){case"start":v[i]-=h*(n&&c?-1:1);break;case"end":v[i]+=h*(n&&c?-1:1)}return v}function Ze(e,t){return u(this,null,function*(){var n;void 0===t&&(t={});const{x:o,y:l,platform:r,rects:i,elements:s,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:v=!1,padding:m=0}=Ee(t,e),p=function(e){return"number"!=typeof e?function(e){return a({top:0,right:0,bottom:0,left:0},e)}(e):{top:e,right:e,bottom:e,left:e}}(m),f=s[v?"floating"===h?"reference":"floating":h],g=Ye(yield r.getClippingRect({element:null==(n=yield null==r.isElement?void 0:r.isElement(f))||n?f:f.contextElement||(yield null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:u,rootBoundary:d,strategy:c})),w="floating"===h?{x:o,y:l,width:i.floating.width,height:i.floating.height}:i.reference,y=yield null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating),x=(yield null==r.isElement?void 0:r.isElement(y))&&(yield null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},k=Ye(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:y,strategy:c}):w);return{top:(g.top-k.top+p.top)/x.y,bottom:(k.bottom-g.bottom+p.bottom)/x.y,left:(g.left-k.left+p.left)/x.x,right:(k.right-g.right+p.right)/x.x}})}const Ue=/* @__PURE__ */new Set(["left","top"]);function Ge(){return"undefined"!=typeof window}function Je(e){return tt(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function et(e){var t;return null==(t=(tt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tt(e){return!!Ge()&&(e instanceof Node||e instanceof Qe(e).Node)}function nt(e){return!!Ge()&&(e instanceof Element||e instanceof Qe(e).Element)}function ot(e){return!!Ge()&&(e instanceof HTMLElement||e instanceof Qe(e).HTMLElement)}function lt(e){return!(!Ge()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot)}const rt=/* @__PURE__ */new Set(["inline","contents"]);function it(e){const{overflow:t,overflowX:n,overflowY:o,display:l}=wt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!rt.has(l)}const at=/* @__PURE__ */new Set(["table","td","th"]);function st(e){return at.has(Je(e))}const ct=[":popover-open",":modal"];function ut(e){return ct.some(t=>{try{return e.matches(t)}catch(n){return!1}})}const dt=["transform","translate","scale","rotate","perspective"],ht=["transform","translate","scale","rotate","perspective","filter"],vt=["paint","layout","strict","content"];function mt(e){const t=pt(),n=nt(e)?wt(e):e;return dt.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||ht.some(e=>(n.willChange||"").includes(e))||vt.some(e=>(n.contain||"").includes(e))}function pt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const ft=/* @__PURE__ */new Set(["html","body","#document"]);function gt(e){return ft.has(Je(e))}function wt(e){return Qe(e).getComputedStyle(e)}function yt(e){return nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if("html"===Je(e))return e;const t=e.assignedSlot||e.parentNode||lt(e)&&e.host||et(e);return lt(t)?t.host:t}function kt(e){const t=xt(e);return gt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ot(t)&&it(t)?t:kt(t)}function bt(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const l=kt(e),r=l===(null==(o=e.ownerDocument)?void 0:o.body),i=Qe(l);if(r){const e=Mt(i);return t.concat(i,i.visualViewport||[],it(l)?l:[],e&&n?bt(e):[])}return t.concat(l,bt(l,[],n))}function Mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _t(e){const t=wt(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=ot(e),r=l?e.offsetWidth:n,i=l?e.offsetHeight:o,a=Te(n)!==r||Te(o)!==i;return a&&(n=r,o=i),{width:n,height:o,$:a}}function Bt(e){return nt(e)?e:e.contextElement}function Ct(e){const t=Bt(e);if(!ot(t))return $e(1);const n=t.getBoundingClientRect(),{width:o,height:l,$:r}=_t(t);let i=(r?Te(n.width):n.width)/o,a=(r?Te(n.height):n.height)/l;return i&&Number.isFinite(i)||(i=1),a&&Number.isFinite(a)||(a=1),{x:i,y:a}}const Tt=/* @__PURE__ */$e(0);function Lt(e){const t=Qe(e);return pt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Tt}function $t(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect(),r=Bt(e);let i=$e(1);t&&(o?nt(o)&&(i=Ct(o)):i=Ct(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Qe(e))&&t}(r,n,o)?Lt(r):$e(0);let s=(l.left+a.x)/i.x,c=(l.top+a.y)/i.y,u=l.width/i.x,d=l.height/i.y;if(r){const e=Qe(r),t=o&&nt(o)?Qe(o):o;let n=e,l=Mt(n);for(;l&&o&&t!==n;){const e=Ct(l),t=l.getBoundingClientRect(),o=wt(l),r=t.left+(l.clientLeft+parseFloat(o.paddingLeft))*e.x,i=t.top+(l.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=r,c+=i,n=Qe(l),l=Mt(n)}}return Ye({width:u,height:d,x:s,y:c})}function St(e,t){const n=yt(e).scrollLeft;return t?t.left+n:$t(et(e)).left+n}function It(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-St(e,n),y:n.top+t.scrollTop}}const jt=/* @__PURE__ */new Set(["absolute","fixed"]);function Et(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Qe(e),o=et(e),l=n.visualViewport;let r=o.clientWidth,i=o.clientHeight,a=0,s=0;if(l){r=l.width,i=l.height;const e=pt();(!e||e&&"fixed"===t)&&(a=l.offsetLeft,s=l.offsetTop)}const c=St(o);if(c<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),l="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-l);i<=25&&(r-=i)}else c<=25&&(r+=c);return{width:r,height:i,x:a,y:s}}(e,n);else if("document"===t)o=function(e){const t=et(e),n=yt(e),o=e.ownerDocument.body,l=Ce(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=Ce(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+St(e);const a=-n.scrollTop;return"rtl"===wt(o).direction&&(i+=Ce(t.clientWidth,o.clientWidth)-l),{width:l,height:r,x:i,y:a}}(et(e));else if(nt(t))o=function(e,t){const n=$t(e,!0,"fixed"===t),o=n.top+e.clientTop,l=n.left+e.clientLeft,r=ot(e)?Ct(e):$e(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:l*r.x,y:o*r.y}}(t,n);else{const n=Lt(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ye(o)}function Ht(e,t){const n=xt(e);return!(n===t||!nt(n)||gt(n))&&("fixed"===wt(n).position||Ht(n,t))}function Nt(e,t,n){const o=ot(t),l=et(t),r="fixed"===n,i=$t(e,!0,r,t);let a={scrollLeft:0,scrollTop:0};const s=$e(0);function c(){s.x=St(l)}if(o||!o&&!r)if(("body"!==Je(t)||it(l))&&(a=yt(t)),o){const e=$t(t,!0,r,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else l&&c();r&&!o&&l&&c();const u=!l||o||r?$e(0):It(l,a);return{x:i.left+a.scrollLeft-s.x-u.x,y:i.top+a.scrollTop-s.y-u.y,width:i.width,height:i.height}}function Rt(e){return"static"===wt(e).position}function zt(e,t){if(!ot(e)||"fixed"===wt(e).position)return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function At(e,t){const n=Qe(e);if(ut(e))return n;if(!ot(e)){let t=xt(e);for(;t&&!gt(t);){if(nt(t)&&!Rt(t))return t;t=xt(t)}return n}let o=zt(e,t);for(;o&&st(o)&&Rt(o);)o=zt(o,t);return o&>(o)&&Rt(o)&&!mt(o)?n:o||function(e){let t=xt(e);for(;ot(t)&&!gt(t);){if(mt(t))return t;if(ut(t))return null;t=xt(t)}return null}(e)||n}const Dt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:l}=e;const r="fixed"===l,i=et(o),a=!!t&&ut(t.floating);if(o===i||a&&r)return n;let s={scrollLeft:0,scrollTop:0},c=$e(1);const u=$e(0),d=ot(o);if((d||!d&&!r)&&(("body"!==Je(o)||it(i))&&(s=yt(o)),ot(o))){const e=$t(o);c=Ct(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const h=!i||d||r?$e(0):It(i,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-s.scrollTop*c.y+u.y+h.y}},getDocumentElement:et,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:l}=e;const r=[..."clippingAncestors"===n?ut(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=bt(e,[],!1).filter(e=>nt(e)&&"body"!==Je(e)),l=null;const r="fixed"===wt(e).position;let i=r?xt(e):e;for(;nt(i)&&!gt(i);){const t=wt(i),n=mt(i);n||"fixed"!==t.position||(l=null),(r?!n&&!l:!n&&"static"===t.position&&l&&jt.has(l.position)||it(i)&&!n&&Ht(e,i))?o=o.filter(e=>e!==i):l=t,i=xt(i)}return t.set(e,o),o}(t,this._c):[].concat(n),o],i=r[0],a=r.reduce((e,n)=>{const o=Et(t,n,l);return e.top=Ce(o.top,e.top),e.right=Be(o.right,e.right),e.bottom=Be(o.bottom,e.bottom),e.left=Ce(o.left,e.left),e},Et(t,i,l));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:At,getElementRects:function(e){return u(this,null,function*(){const t=this.getOffsetParent||At,n=this.getDimensions,o=yield n(e.floating);return{reference:Nt(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}})},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=_t(e);return{width:t,height:n}},getScale:Ct,isElement:nt,isRTL:function(e){return"rtl"===wt(e).direction}};function Pt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vt(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:l=!0,ancestorResize:r=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:u=!1}=o,d=Bt(e),h=l||r?[...d?bt(d):[],...bt(t)]:[];h.forEach(e=>{l&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)});const v=d&&c?function(e,t){let n,o=null;const l=et(e);function r(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function i(c,u){void 0===c&&(c=!1),void 0===u&&(u=1),r();const d=e.getBoundingClientRect(),{left:h,top:v,width:m,height:p}=d;if(c||t(),!m||!p)return;const f={rootMargin:-Le(v)+"px "+-Le(l.clientWidth-(h+m))+"px "+-Le(l.clientHeight-(v+p))+"px "+-Le(h)+"px",threshold:Ce(0,Be(1,u))||1};let g=!0;function w(t){const o=t[0].intersectionRatio;if(o!==u){if(!g)return i();o?i(!1,o):n=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==o||Pt(d,e.getBoundingClientRect())||i(),g=!1}try{o=new IntersectionObserver(w,s(a({},f),{root:l.ownerDocument}))}catch(y){o=new IntersectionObserver(w,f)}o.observe(e)}(!0),r}(d,n):null;let m,p=-1,f=null;i&&(f=new ResizeObserver(e=>{let[o]=e;o&&o.target===d&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),d&&!u&&f.observe(d),f.observe(t));let g=u?$t(e):null;return u&&function t(){const o=$t(e);g&&!Pt(g,o)&&n(),g=o,m=requestAnimationFrame(t)}(),n(),()=>{var e;h.forEach(e=>{l&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)}),null==v||v(),null==(e=f)||e.disconnect(),f=null,u&&cancelAnimationFrame(m)}}const Ot=function(e){return void 0===e&&(e={}),{name:"shift",options:e,fn(t){return u(this,null,function*(){const{x:n,y:o,placement:l}=t,r=Ee(e,t),{mainAxis:i=!0,crossAxis:u=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=r,h=c(r,["mainAxis","crossAxis","limiter"]),v={x:n,y:o},m=yield Ze(t,h),p=De(He(l)),f=Re(p);let g=v[f],w=v[p];if(i){const e="y"===f?"bottom":"right";g=je(g+m["y"===f?"top":"left"],g,g-m[e])}if(u){const e="y"===p?"bottom":"right";w=je(w+m["y"===p?"top":"left"],w,w-m[e])}const y=d.fn(s(a({},t),{[f]:g,[p]:w}));return s(a({},y),{data:{x:y.x-n,y:y.y-o,enabled:{[f]:i,[p]:u}}})})}}},Ft=function(e){return void 0===e&&(e={}),{name:"flip",options:e,fn(t){return u(this,null,function*(){var n,o;const{placement:l,middlewareData:r,rects:i,initialPlacement:a,platform:s,elements:u}=t,d=Ee(e,t),{mainAxis:h=!0,crossAxis:v=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0}=d,w=c(d,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const y=He(l),x=De(a),k=He(a)===a,b=yield null==s.isRTL?void 0:s.isRTL(u.floating),M=m||(k||!g?[Xe(a)]:function(e){const t=Xe(e);return[Ve(e),t,Ve(t)]}(a)),_="none"!==f;!m&&_&&M.push(...function(e,t,n,o){const l=Ne(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Fe:Oe:t?Oe:Fe;case"left":case"right":return t?We:Ke;default:return[]}}(He(e),"start"===n,o);return l&&(r=r.map(e=>e+"-"+l),t&&(r=r.concat(r.map(Ve)))),r}(a,g,f,b));const B=[a,...M],C=yield Ze(t,w),T=[];let L=(null==(o=r.flip)?void 0:o.overflows)||[];if(h&&T.push(C[y]),v){const e=function(e,t,n){void 0===n&&(n=!1);const o=Ne(e),l=Pe(e),r=ze(l);let i="x"===l?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=Xe(i)),[i,Xe(i)]}(l,i,b);T.push(C[e[0]],C[e[1]])}if(L=[...L,{placement:l,overflows:T}],!T.every(e=>e<=0)){var $,S;const e=((null==($=r.flip)?void 0:$.index)||0)+1,t=B[e];if(t&&("alignment"!==v||x===De(t)||L.every(e=>De(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(S=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:S.placement;if(!n)switch(p){case"bestFit":{var I;const e=null==(I=L.filter(e=>{if(_){const t=De(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:I[0];e&&(n=e);break}case"initialPlacement":n=a}if(l!==n)return{reset:{placement:n}}}return{}})}}},Wt=["id"],Kt=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){const t=e,n=_(()=>{if(void 0!==t.isDark&&null!==t.isDark)return Boolean(t.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(e){}return!1}),o=B(null),l=B({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),r=B(!1);let i=null;function c(){return u(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const r=[(d=null!=(e=t.offset)?e:8,void 0===d&&(d=0),{name:"offset",options:d,fn(e){return u(this,null,function*(){var t,n;const{x:o,y:l,placement:r,middlewareData:i}=e,c=yield function(e,t){return u(this,null,function*(){const{placement:n,platform:o,elements:l}=e,r=yield null==o.isRTL?void 0:o.isRTL(l.floating),i=He(n),a=Ne(n),s="y"===De(n),c=Ue.has(i)?-1:1,u=r&&s?-1:1,d=Ee(t,e);let{mainAxis:h,crossAxis:v,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&"number"==typeof m&&(v="end"===a?-1*m:m),s?{x:v*u,y:h*c}:{x:h*c,y:v*u}})}(e,d);return r===(null==(t=i.offset)?void 0:t.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:o+c.x,y:l+c.y,data:s(a({},c),{placement:r})}})}}),Ft(),Ot({padding:8})],{x:i,y:c}=yield((e,t,n)=>{const o=/* @__PURE__ */new Map,l=a({platform:Dt},n),r=s(a({},l.platform),{_c:o});return((e,t,n)=>u(null,null,function*(){const{placement:o="bottom",strategy:l="absolute",middleware:r=[],platform:i}=n,c=r.filter(Boolean),u=yield null==i.isRTL?void 0:i.isRTL(t);let d=yield i.getElementRects({reference:e,floating:t,strategy:l}),{x:h,y:v}=qe(d,o,u),m=o,p={},f=0;for(let n=0;n<c.length;n++){const{name:r,fn:g}=c[n],{x:w,y,data:x,reset:k}=yield g({x:h,y:v,initialPlacement:o,placement:m,strategy:l,middlewareData:p,rects:d,platform:i,elements:{reference:e,floating:t}});h=null!=w?w:h,v=null!=y?y:v,p=s(a({},p),{[r]:a(a({},p[r]),x)}),k&&f<=50&&(f++,"object"==typeof k&&(k.placement&&(m=k.placement),k.rects&&(d=!0===k.rects?yield i.getElementRects({reference:e,floating:t,strategy:l}):k.rects),({x:h,y:v}=qe(d,m,u))),n=-1)}return{x:h,y:v,placement:m,strategy:l,middlewareData:p}}))(e,t,s(a({},l),{platform:r}))})(t.anchorEl,o.value,{placement:null!=(n=t.placement)?n:"top",middleware:r,strategy:"fixed"});var d;l.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(c)}px, 0)`,l.value.left="0px",l.value.top="0px"})}return C(()=>t.visible,e=>u(null,null,function*(){if(e)if(r.value=!1,yield T(),t.anchorEl&&o.value)try{const e=t.anchorEl.getBoundingClientRect();yield c();const n=l.value.transform;if(null!=t.originX&&null!=t.originY){const o=Math.abs(Number(t.originX)-e.left),i=Math.abs(Number(t.originY)-e.top);Math.hypot(o,i)>120?(l.value.transform=`translate3d(${Math.round(t.originX)}px, ${Math.round(t.originY)}px, 0)`,yield T(),r.value=!0,yield T(),l.value.transform=n):r.value=!0}else r.value=!0;i=Vt(t.anchorEl,o.value,c)}catch(n){yield c(),r.value=!0,i=Vt(t.anchorEl,o.value,c)}else r.value=!0;else r.value=!1,i&&(i(),i=null)})),C([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>u(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield T(),yield c())})),L(()=>{i&&i()}),(i,a)=>(f(),$(S,{to:"body"},[w(I,{name:"tooltip",appear:""},{default:j(()=>[E(x("div",{id:t.id,ref_key:"tooltip",ref:o,style:N({position:"fixed",left:l.value.left,top:l.value.top,transform:l.value.transform}),class:H(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",[n.value?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"]]),role:"tooltip"},M(e.content),15,Wt),[[R,e.visible&&r.value]])]),_:1})]))}}),[["__scopeId","data-v-993f63aa"]]),Xt=B(!1),Yt=B(""),qt=B("top"),Zt=B(null),Ut=B(null),Gt=B(null),Jt=B(null),Qt=B(null);let en=null,tn=null;function nn(){en&&(clearTimeout(en),en=null),tn&&(clearTimeout(tn),tn=null)}let on=!1;function ln(e,t,n="top",o=!1,l,r){if(!e)return;!function(){if(on)return;if("undefined"==typeof document)return;on=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),z({setup:()=>()=>{var e;return A(Kt,{visible:Xt.value,"anchor-el":Zt.value,content:Yt.value,placement:qt.value,id:Ut.value,originX:Gt.value,originY:Jt.value,isDark:null!=(e=Qt.value)?e:void 0})}}).mount(e)}(),nn();const i=()=>{var o,i;Ut.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Zt.value=e,Yt.value=t,qt.value=n,Gt.value=null!=(o=null==l?void 0:l.x)?o:null,Jt.value=null!=(i=null==l?void 0:l.y)?i:null,Qt.value="boolean"==typeof r?r:null,Xt.value=!0;try{e.setAttribute("aria-describedby",Ut.value)}catch(a){}};o?i():en=setTimeout(i,80)}function rn(e=!1){nn();const t=()=>{if(Zt.value&&Ut.value)try{Zt.value.removeAttribute("aria-describedby")}catch(e){}Xt.value=!1,Zt.value=null,Ut.value=null,Gt.value=null,Jt.value=null};e?t():tn=setTimeout(t,120)}const an={"common.copy":"Copy","common.copySuccess":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function sn(e){Object.assign(an,e)}function cn(){try{const t=globalThis.$vueI18nUse||null;if(t&&"function"==typeof t)try{const e=t();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return u(null,null,function*(){try{const t=yield import("vue-i18n"),n=t.useI18n||t.default&&t.default.useI18n;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)try{globalThis.$vueI18nUse=()=>t}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var t;return null!=(t=an[e])?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)}}}const un=Symbol("ViewportPriority");function dn(){const e=D(un,void 0);if(e)return e;const t=/* @__PURE__ */new WeakMap;let n=null;return e=>{const o=B(!1);let l,r=!1;const i=new Promise(e=>{l=()=>{r||(r=!0,e())}}),a=()=>{try{null==n||n.unobserve(e)}catch(o){}t.delete(e)},s=n||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(n=new IntersectionObserver(e=>{for(const l of e){const e=t.get(l.target);if(e&&(l.isIntersecting||l.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(o){}}null==n||n.unobserve(l.target),t.delete(l.target)}}},{root:null,rootMargin:"300px",threshold:0}),n));return s?(t.set(e,{resolve:l,visible:o}),s.observe(e),{isVisible:o,whenVisible:i,destroy:a}):(o.value=!0,l(),{isVisible:o,whenVisible:i,destroy:a})}}const hn={class:"relative inline-block"},vn=["src","alt","title","loading","tabindex","aria-label"],mn={class:"text-sm whitespace-nowrap"},pn={key:1,class:"text-sm text-gray-500"},fn={key:"error",class:"px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},gn={class:"text-sm whitespace-nowrap"},wn={key:0,class:"mt-2 text-sm text-gray-500 italic"},yn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},showCaption:{type:Boolean,default:!1},lazy:{type:Boolean,default:!0},svgMinHeight:{default:"12rem"},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){const n=e,o=t,l=B(!1),r=B(!1),i=B(!1),a=B(null),s=dn(),c=B(null),u=B("undefined"==typeof window);"undefined"!=typeof window&&C(()=>a.value,e=>{var t;if(null==(t=c.value)||t.destroy(),c.value=null,!e)return void(u.value=!1);const n=s(e,{rootMargin:"400px"});c.value=n,u.value=n.isVisible.value,n.whenVisible.then(()=>{u.value=!0})},{immediate:!0}),L(()=>{var e;null==(e=c.value)||e.destroy(),c.value=null});const d=_(()=>r.value&&n.fallbackSrc?n.fallbackSrc:n.node.src),h=_(()=>!n.lazy||u.value),v=_(()=>/\.svg(?:\?|$)/i.test(d.value));function m(){n.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",n.node.src))}function g(){l.value=!0,r.value=!1,o("load",d.value)}function k(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,d.value])}const{t:b}=cn();return C(d,()=>{l.value=!1,r.value=!1}),(t,o)=>(f(),p("figure",{ref_key:"figureRef",ref:a,class:"text-center my-8"},[x("div",hn,[w(I,{name:"img-switch",mode:"out-in"},{default:j(()=>{var i,a,s,c,u;return[e.node.loading||r.value||!h.value?r.value?e.node.loading||n.fallbackSrc?V("",!0):(f(),p("div",fn,[O(t.$slots,"error",{node:n.node,displaySrc:d.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy,isSvg:v.value},()=>[o[1]||(o[1]=x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[x("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),x("span",gn,M(y(b)("image.loadError")),1)],!0)])):(f(),p("div",{key:"placeholder",class:"placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",style:N(v.value?{minHeight:n.svgMinHeight,width:"100%"}:{minHeight:"6rem"})},[n.usePlaceholder?O(t.$slots,"placeholder",{key:0,node:n.node,displaySrc:d.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy,isSvg:v.value},()=>[o[0]||(o[0]=x("div",{class:"w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin","aria-hidden":"true"},null,-1)),x("span",mn,M(y(b)("image.loading")),1)],!0):(f(),p("span",pn,M(e.node.raw),1))],4)):(f(),p("img",{key:"image",src:d.value,alt:String(null!=(a=null!=(i=n.node.alt)?i:n.node.title)?a:""),title:String(null!=(c=null!=(s=n.node.title)?s:n.node.alt)?c:""),class:H(["max-w-96 h-auto rounded-lg transition-opacity duration-200 ease-in-out",{"opacity-0":!l.value,"opacity-100":l.value,"cursor-pointer":l.value}]),style:N(v.value?{minHeight:n.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0),loading:n.lazy?"lazy":"eager",decoding:"async",tabindex:l.value?0:-1,"aria-label":null!=(u=n.node.alt)?u:y(b)("image.preview"),onError:m,onLoad:g,onClick:k},null,46,vn))]}),_:3})]),n.showCaption&&n.node.alt?(f(),p("figcaption",wn,M(n.node.alt),1)):V("",!0)],512))}}),[["__scopeId","data-v-7ca79b66"]]);yn.install=e=>{e.component(yn.__name,yn)};let xn=null,kn=!1;function bn(){return u(this,null,function*(){if(xn)return xn;if(kn)return null;try{return xn=yield import("katex"),yield import("katex/contrib/mhchem"),xn}catch(e){return kn=!0,null}})}const Mn=F(!1);let _n=null;function Bn(){return _n||(_n=bn().then(e=>{Mn.value=!!e}).catch(()=>{Mn.value=!1})),W(Mn)}const Cn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=Bn();return(n,o)=>(f(),p("span",{class:H([[y(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},M(e.node.content),3))}}),[["__scopeId","data-v-56f30838"]]);Cn.install=e=>{e.component(Cn.__name,Cn)};const Tn=K(()=>u(null,null,function*(){var e,t;if("undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(t=null==(e=globalThis.process)?void 0:e.env)?void 0:t.NODE_ENV))return e=>{var t,n;return A(Cn,s(a({},e),{node:s(a({},e.node),{content:null!=(n=e.node.raw)?n:`$${null!=(t=e.node.content)?t:""}$`})}))};try{if(yield bn())return(yield import("./index2.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var t,n;return A(Cn,s(a({},e),{node:s(a({},e.node),{content:null!=(n=e.node.raw)?n:`$${null!=(t=e.node.content)?t:""}$`})}))}})),Ln=K(()=>u(null,null,function*(){try{if(yield bn())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n;return A(Cn,s(a({},e),{node:s(a({},e.node),{content:null!=(n=e.node.raw)?n:`$$${null!=(t=e.node.content)?t:""}$$`})}))}})),$n=/* @__PURE__ */m({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(f(),p("span",{class:"reference-node cursor-pointer bg-accent text-xs rounded-md px-1.5 mx-0.5 hover:bg-secondary",role:"button",tabindex:"0",onClick:n[0]||(n[0]=n=>t.$emit("click",n,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=n=>t.$emit("mouseEnter",n,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=n=>t.$emit("mouseLeave",n,e.node.id,e.messageId,e.threadId))},M(e.node.id),33))});$n.install=e=>{e.component($n.__name,$n)};const Sn={class:"superscript-node"},In={key:1},jn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,emphasis:Gn,footnote_reference:be,strikethrough:Dn,highlight:Zn,insert:Yn,subscript:Nn,emoji:ve,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("sup",Sn,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),p(k,{key:`${e.indexKey||"superscript"}-${l}`},[n[o.type]?(f(),$(X(n[o.type]),{key:0,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(f(),p("span",In,M(o.content||o.raw),1))],64))),128))]))}}),[["__scopeId","data-v-0ca396bb"]]);jn.install=e=>{e.component(jn.__name,jn)};const En={class:"subscript-node"},Hn={key:1},Nn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,emphasis:Gn,footnote_reference:be,strikethrough:Dn,highlight:Zn,insert:Yn,superscript:jn,emoji:ve,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("sub",En,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),p(k,{key:`${e.indexKey||"subscript"}-${l}`},[n[o.type]?(f(),$(X(n[o.type]),{key:0,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(f(),p("span",Hn,M(o.content||o.raw),1))],64))),128))]))}}),[["__scopeId","data-v-5e1f04df"]]);Nn.install=e=>{e.component(Nn.__name,Nn)};const Rn={class:"strong-node"},zn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,emphasis:Gn,strikethrough:Dn,highlight:Zn,insert:Yn,subscript:Nn,superscript:jn,emoji:ve,footnote_reference:be,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("strong",Rn,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),$(X(n[o.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:o,"custom-id":t.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-53b6c7df"]]);zn.install=e=>{e.component(zn.__name,zn)};const An={class:"strikethrough-node"},Dn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,emphasis:Gn,highlight:Zn,insert:Yn,subscript:Nn,superscript:jn,emoji:ve,footnote_reference:be,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("del",An,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),$(X(n[o.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-3716d25c"]]);Dn.install=e=>{e.component(Dn.__name,Dn)};const Pn=["href","title","aria-label","aria-hidden"],Vn=["aria-hidden"],On={class:"link-text-wrapper relative inline-flex"},Fn={class:"leading-[normal] link-text"},Wn={class:"leading-[normal] link-text"},Kn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=_(()=>{var e,n,o,l,r,i;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px";return{"--link-color":null!=(e=t.color)?e:"#0366d6","--underline-height":`${null!=(n=t.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(o=t.animationOpacity)?o:.9),"--underline-duration":`${null!=(l=t.animationDuration)?l:.8}s`,"--underline-timing":null!=(r=t.animationTiming)?r:"linear","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(i=t.animationIteration)?i:"infinite"}}),o={text:Cn,strong:zn,strikethrough:Dn,emphasis:Gn,image:yn},l=Y();function r(){t.showTooltip&&rn()}const i=_(()=>{var e,n;return String(null!=(n=null!=(e=t.node.title)?e:t.node.href)?n:"")});return(a,s)=>e.node.loading?(f(),p("span",q({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},y(l),{style:n.value}),[x("span",On,[x("span",Fn,[x("span",Wn,M(e.node.text),1)]),s[1]||(s[1]=x("span",{class:"underline-anim","aria-hidden":"true"},null,-1))])],16,Vn)):(f(),p("a",q({key:0,class:"link-node",href:e.node.href,title:i.value,"aria-label":`Link: ${i.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},y(l),{style:n.value,onMouseenter:s[0]||(s[0]=e=>function(e){var n,o,l,r,i,a;if(!t.showTooltip)return;const s=e,c=null!=(null==s?void 0:s.clientX)&&null!=(null==s?void 0:s.clientY)?{x:s.clientX,y:s.clientY}:void 0,u=null!=(a=null!=(i=null!=(l=null==(n=t.node)?void 0:n.href)?l:null==(o=t.node)?void 0:o.title)?i:null==(r=t.node)?void 0:r.text)?a:"";ln(e.currentTarget,u,"top",!1,c)}(e)),onMouseleave:r}),[(f(!0),p(k,null,b(e.node.children,(n,l)=>(f(),$(X(o[n.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${l}`},null,8,["node","custom-id","index-key"]))),128))],16,Pn))}}),[["__scopeId","data-v-0ea92a03"]]);Kn.install=e=>{e.component(Kn.__name,Kn)};const Xn={class:"insert-node"},Yn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,emphasis:Gn,strikethrough:Dn,highlight:Zn,subscript:Nn,superscript:jn,emoji:ve,footnote_reference:be,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("ins",Xn,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),$(X(n[o.type]),{key:`${e.indexKey||"insert"}-${l}`,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b8737de3"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const qn={class:"highlight-node"},Zn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,emphasis:Gn,strikethrough:Dn,insert:Yn,subscript:Nn,superscript:jn,emoji:ve,footnote_reference:be,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("mark",qn,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),$(X(n[o.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-fc52b444"]]);Zn.install=e=>{e.component(Zn.__name,Zn)};const Un={class:"emphasis-node"},Gn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,strong:zn,strikethrough:Dn,highlight:Zn,insert:Yn,subscript:Nn,superscript:jn,emoji:ve,footnote_reference:be,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>(f(),p("em",Un,[(f(!0),p(k,null,b(e.node.children,(o,l)=>(f(),$(X(n[o.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:o,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-c25e2822"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Jn=["href","title"],Qn=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(e){var n;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(n=t.node.id)?n:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(t,o)=>(f(),p("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,Jn))}}),[["__scopeId","data-v-4756ce0d"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const eo=["id"],to={class:"flex-1"},no=/* @__PURE__ */m({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean}},emits:["copy"],setup:e=>(t,n)=>(f(),p("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[x("div",to,[g([e.node.children],()=>w(y(dl),{"index-key":`footnote-${e.indexKey}`,nodes:e.node.children,typewriter:e.typewriter,onCopy:n[0]||(n[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","typewriter"]),n,1)])],8,eo))});no.install=e=>{e.component(no.__name,no)};const oo={class:"hard-break"},lo=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,t)=>(f(),p("br",oo))}),[["__scopeId","data-v-50c58f70"]]);lo.install=e=>{e.component(lo.__name,lo)};const ro=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=a({text:Cn,inline_code:_e,link:Kn,image:yn,strong:zn,emphasis:Gn,strikethrough:Dn,highlight:Zn,insert:Yn,subscript:Nn,superscript:jn,emoji:ve,checkbox:ae,checkbox_input:ae,footnote_reference:be,hardbreak:lo,math_inline:Tn,reference:$n},ge(t.customId));return(o,l)=>g([e.node.children],()=>(f(),$(X(`h${e.node.level}`),{class:H(["heading-node",[`heading-${e.node.level}`]]),dir:"auto"},{default:j(()=>[(f(!0),p(k,null,b(e.node.children,(o,l,r,i)=>{const a=[o];if(i&&i.key===`${e.indexKey||"heading"}-${l}`&&Z(i,a))return i;const s=(f(),$(X(n[o.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":t.customId,node:o,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]));return s.memo=a,s},l,0),128))]),_:1},8,["class"])),l,2)}}),[["__scopeId","data-v-d8e179e9"]]),io=ro;io.install=e=>{e.component(ro.__name,ro)};const ao=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"ListItemNode",props:{item:{},indexKey:{},value:{},typewriter:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=_(()=>null==t.value?{}:{value:t.value});return(e,o)=>(f(),p("li",q({class:"list-item pl-1.5 my-2",dir:"auto"},n.value),[g([t.item.children],()=>w(y(dl),{"index-key":`list-item-${t.indexKey}`,nodes:t.item.children,typewriter:t.typewriter,"batch-rendering":!1,onCopy:o[0]||(o[0]=t=>e.$emit("copy",t))},null,8,["index-key","nodes","typewriter"]),o,1)],16))}}),[["__scopeId","data-v-e7aa2cc3"]]);ao.install=e=>{e.component(ao.__name,ao)};const so=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean}},emits:["copy"],setup:e=>(t,n)=>(f(),$(X(e.node.ordered?"ol":"ul"),{class:H(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:j(()=>[(f(!0),p(k,null,b(e.node.items,(o,l,r,i)=>{var a;const s=[o];if(i&&i.key===`${e.indexKey||"list"}-${l}`&&Z(i,s))return i;const c=(f(),$(y(ao),{key:`${e.indexKey||"list"}-${l}`,item:o,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${l}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(a=e.node.start)?a:1)+l:void 0,onCopy:n[0]||(n[0]=e=>t.$emit("copy",e))},null,8,["item","custom-id","index-key","typewriter","value"]));return c.memo=s,c},n,1),128))]),_:1},8,["class"]))}),[["__scopeId","data-v-79057d57"]]);function co(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(t){}return globalThis.setTimeout(e,0)}so.install=e=>{e.component(so.__name,so)};let uo=null,ho=null;const vo=/* @__PURE__ */new Map;let mo=5,po=!1;function fo(e){po=!!e}function go(e){Number.isFinite(e)&&e>0&&(mo=Math.floor(e))}function wo(){return{inFlight:vo.size,max:mo}}const yo="WORKER_BUSY";function xo(e){uo=e,ho=null;const t=e;uo.onmessage=e=>{if(uo!==t)return;const{id:n,ok:o,result:l,error:r}=e.data,i=vo.get(n);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},uo.onerror=e=>{var n,o;if(uo===t)if(0!==vo.size){try{po?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(l){}for(const[t,n]of vo.entries())n.reject(new Error(`Worker error: ${e.message}`));vo.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},uo.onmessageerror=e=>{var n,o;if(uo===t)if(0!==vo.size){try{po?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,t]of vo.entries())t.reject(new Error("Worker messageerror"));vo.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function ko(){var e;if(uo)try{for(const[e,t]of vo.entries())t.reject(new Error("Worker cleared"));vo.clear(),null==(e=uo.terminate)||e.call(uo)}catch(t){}uo=null,ho=null}function bo(e,t,n=1400){if(ho)return Promise.reject(ho);const o=uo||(ho=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),ho.name="WorkerInitError",ho.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(ho);if(vo.size>=mo){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=yo,e.inFlight=vo.size,e.max=mo,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const c=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),vo.delete(i))},u={resolve:e=>{c(),l(e)},reject:e=>{c(),r(e)}};vo.set(i,u);try{o.postMessage({id:i,action:e,payload:t})}catch(d){return vo.delete(i),void r(d)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=vo.get(i);t&&t.reject(e)},n)})}function Mo(e,t,n=1400){return u(this,null,function*(){try{return yield bo("canParse",{code:e,theme:t},n)}catch(o){return Promise.reject(o)}})}function _o(e,t,n=1400){return u(this,null,function*(){try{return yield bo("findPrefix",{code:e,theme:t},n)}catch(o){return Promise.reject(o)}})}function Bo(){if(uo)try{for(const[e,t]of vo.entries())t.reject(new Error("Worker terminated"));vo.clear(),uo.terminate()}finally{uo=null}}let Co=null;const To={key:0},Lo={key:1,class:"flex items-center space-x-2 overflow-hidden"},$o=["src"],So={key:2},Io={class:"flex items-center space-x-1"},jo={class:"flex items-center space-x-1"},Eo={key:4},Ho={key:5,class:"flex items-center space-x-1"},No=["aria-pressed"],Ro={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},zo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ao=["disabled"],Do=["disabled"],Po={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Vo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Oo={key:1,class:"relative"},Fo={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Wo={class:"flex items-center gap-2 backdrop-blur rounded-lg"},Ko={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Xo=/* @__PURE__ */oe(/* @__PURE__ */m({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:t}){var n,o;const l=e,r=t,{t:i}=cn();let c=null;const d=B(!1);"undefined"!=typeof window&&u(null,null,function*(){var e;c=yield function(){return u(this,null,function*(){if(Co)return Co;try{const e=yield import("mermaid"),t=e&&e.default?e.default:e;if(!t||"function"!=typeof t.render&&"function"!=typeof t.parse&&"function"!=typeof t.initialize)if(t&&t.mermaidAPI&&("function"==typeof t.mermaidAPI.render||"function"==typeof t.mermaidAPI.parse)){const e=t.mermaidAPI;Co=s(a({},t),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>"function"==typeof t.initialize?t.initialize(n):e.initialize?e.initialize(n):void 0})}else Co=e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:t;else Co=t}catch(e){throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.')}try{const e=nu