markstream-vue 1.0.6 → 1.0.7-beta.2

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/index10.js CHANGED
@@ -1 +1 @@
1
- var e=(e,o,n)=>new Promise((t,l)=>{var i=e=>{try{a(n.next(e))}catch(o){l(o)}},r=e=>{try{a(n.throw(e))}catch(o){l(o)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,o)).next())});import{defineComponent as o,ref as n,useAttrs as t,inject as l,computed as i,watch as r,nextTick as a,onMounted as s,onBeforeUnmount as u,openBlock as c,createElementBlock as d,normalizeClass as v,renderSlot as m,createElementVNode as h,unref as p,toDisplayString as w,createCommentVNode as g,normalizeStyle as f,withDirectives as C,vShow as x,createBlock as k,Teleport as y,createVNode as b,Transition as M,withCtx as B,withModifiers as F}from"vue";import{ak as H,am as j,an as T,aj as $,ab as P,a7 as L,ag as E,a5 as z,Z,z as S}from"./exports.js";import{p as V,e as _,c as I}from"./diagramHeight.js";import{M as X}from"./index2.js";const Y=["data-markstream-mode"],N={key:0,class:"infographic-block-header flex justify-between items-center border-b"},O={key:0},D={key:1,class:"flex items-center gap-x-2 overflow-hidden"},R=["innerHTML"],U={key:2},A={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},G=["disabled"],q={class:"flex items-center gap-x-1"},J={class:"flex items-center gap-x-1"},K={key:4},Q={key:5,class:"infographic-header-actions flex items-center"},W=["aria-pressed"],ee={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:"action-icon"},oe={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:"action-icon"},ne=["disabled"],te=["disabled"],le={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:"action-icon"},ie={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:"action-icon"},re={key:0,class:"infographic-source"},ae={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},se={key:1,class:"relative"},ue={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},ce={class:"flex items-center gap-2 backdrop-blur rounded-lg"},de={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},ve={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},me={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},he="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",pe=/* @__PURE__ */S(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:S}){const pe=o,{t:we}=H(),ge=j(),fe=T(),Ce=$(),xe=n(!1),ke=n(!1),ye=n(),be=n(),Me=n(!0),Be=n(!1),Fe=n(!1),He=n(),je=n(null),Te=n(!1),$e=n(!1),Pe=n(null),Le=n("undefined"==typeof window||!Ce.value),Ee=t(),ze=l(X,null);let Ze="";const Se=i(()=>P(pe,Ee));"undefined"!=typeof window&&r([()=>ye.value,Ce],([e,o])=>{var n,t,l;if(null==(n=Pe.value)||n.destroy(),Pe.value=null,!o||Le.value)return void(Le.value=!0);if(!e)return void(Le.value=!1);const i=null!=(l=null!=(t=null==fe?void 0:fe.value.heavyBlockMargin)?t:null==fe?void 0:fe.value.rootMargin)?l:"160px",r=ge(e,{rootMargin:i,allowIdle:!1});Pe.value=r,Le.value=r.isVisible.value,r.whenVisible.then(()=>{Le.value=!0})},{immediate:!0});const Ve=i(()=>pe.node.code),_e=i(()=>{var e;return function(e){if("none"===pe.maxHeight)return I(e,void 0,null);const o=V(pe.maxHeight);return I(e,void 0,o)}(null!=(e=V(pe.estimatedPreviewHeightPx))?e:_(Ve.value))}),Ie=n(`${_e.value}px`),Xe=i(()=>null!=V(pe.estimatedPreviewHeightPx));function Ye(){var e;if(!be.value)return;if(Xe.value)return;const o=be.value.scrollHeight;if(o>0){const n=null!=(e=V(function(e){if("none"===pe.maxHeight)return`${e}px`;if(null!=pe.maxHeight){const o=Number.parseFloat(String(pe.maxHeight));if(Number.isFinite(o))return`${Math.min(e,o)}px`}const o=be.value;if(o){const n=getComputedStyle(o).getPropertyValue("--ms-size-code-max-height").trim(),t=Number.parseFloat(n);if(Number.isFinite(t))return`${Math.min(e,t)}px`}return`${Math.min(e,500)}px`}(o)))?e:o;Ie.value=`${Math.max(n,_e.value)}px`}}const Ne=n(1),Oe=n(0),De=n(0),Re=n(!1),Ue=n({x:0,y:0}),Ae=i(()=>Ve.value);function Ge(e){return!e||e.disabled}function qe(e,o,n="top"){if(Ge(e.currentTarget))return;const t=e,l=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;E(e.currentTarget,o,n,!1,l,pe.isDark)}function Je(){z()}function Ke(e){if(Ge(e.currentTarget))return;const o=xe.value?we("common.copied")||"Copied":we("common.copy")||"Copy",n=e,t=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;E(e.currentTarget,o,"top",!1,t,pe.isDark)}function Qe(){return e(this,null,function*(){try{const e=Ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),xe.value=!0,setTimeout(()=>{xe.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function We(e){("preview"!==e||L())&&(Be.value=!0,Me.value="source"===e)}function eo(){var o;const n=null==(o=be.value)?void 0:o.querySelector("svg");n?function(o){e(this,null,function*(){try{const n=(new XMLSerializer).serializeToString(o),t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(t);if("undefined"!=typeof document){const o=document.createElement("a");o.href=l,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(l)}}catch(n){console.error("Failed to export SVG:",n)}})}(n):console.error("SVG element not found")}function oo(e){"Escape"===e.key&&Fe.value&&no()}function no(){if(Fe.value=!1,He.value&&(He.value.innerHTML=""),je.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(e){}}function to(){!function(){if(Fe.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",oo)}catch(e){}a(()=>{if(be.value&&He.value){He.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=be.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),je.value=e,e.style.transform=`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}})}()}function lo(){Ne.value<3&&(Ne.value+=.1)}function io(){Ne.value>.5&&(Ne.value-=.1)}function ro(){Ne.value=1,Oe.value=0,De.value=0}function ao(e){Re.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-Oe.value,y:e.clientY-De.value}:Ue.value={x:e.touches[0].clientX-Oe.value,y:e.touches[0].clientY-De.value}}function so(e){if(!Re.value)return;let o,n;e instanceof MouseEvent?(o=e.clientX,n=e.clientY):(o=e.touches[0].clientX,n=e.touches[0].clientY),Oe.value=o-Ue.value.x,De.value=n-Ue.value.y}function uo(){Re.value=!1}let co=null,vo=!1,mo=!1,ho=!1,po="",wo=!1,go=0;function fo(e){return!wo&&e===go}function Co(o=!1){return e(this,null,function*(){var n,t;if(wo||!Le.value)return;if(!be.value)return;if(vo)return mo=!0,void(ho=ho||o);const l=Ae.value;if(!o&&l===po&&Te.value)return;const i=++go;vo=!0,function(){const e=Se.value;e&&Ze!==e&&(Ze&&(null==ze||ze.markSettled(Ze)),Ze=e,null==ze||ze.markPending(e))}();const r=be.value.innerHTML,s=Te.value,u=$e.value;$e.value=!1;try{const e=yield Z();if(!fo(i))return;if(!e)return void console.warn("Infographic library failed to load.");const o=be.value;if(!o)return;co&&(null==(n=co.destroy)||n.call(co),co=null),o.innerHTML="",co=new e({container:o,width:"100%",height:"100%"});let r="";if(null==(t=co.on)||t.call(co,"error",e=>{const o=Array.isArray(e)?e:[e];r=o.map(e=>{var o;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(o=e.message)?o:"":null!=e?e:"")}).filter(Boolean).join("; ")}),co.render(Ve.value),r)throw new Error(r);if(!o.childNodes.length)throw new Error("Infographic render returned empty output.");Te.value=!0,$e.value=!1,po=l,a(()=>{fo(i)&&Ye()})}catch(c){if(!fo(i))return;!1===pe.loading?(console.error("Failed to render infographic:",c),Te.value=!1,$e.value=!0,po="",be.value&&(be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${c instanceof Error?c.message:"Unknown error"}</div>`)):(Te.value=s,$e.value=u,s&&be.value&&(be.value.innerHTML=r))}finally{if(vo=!1,fo(i))if(mo){const e=ho;mo=!1,ho=!1,a(()=>{Co(e)})}else!function(){e(this,null,function*(){const e=Ze;e&&(Ze="",yield a(),function(e=Se.value){e&&ye.value&&(null==ze||ze.reportHeight(e,ye.value.offsetHeight))}(e),null==ze||ze.markSettled(e))})}()}})}function xo(e=!1){wo||!Le.value||Me.value||ke.value||a(()=>{wo||Co(e)})}r(()=>Ve.value,()=>{xo(!0)}),r(()=>pe.loading,(e,o)=>{o&&!e&&xo(!0)}),r(()=>Me.value,e=>{e||xo(!0)}),r(()=>ke.value,e=>{e||xo()}),r(()=>pe.maxHeight,()=>{a(()=>{Ye()})}),r([()=>pe.estimatedPreviewHeightPx,()=>Ve.value],()=>{Te.value||Me.value||(Ie.value=`${_e.value}px`)}),r(()=>Le.value,e=>{!e||Me.value||ke.value||xo()}),s(()=>{!Be.value&&L()&&(Me.value=!1),xo()}),u(()=>{var e,o;if(wo=!0,go+=1,mo=!1,ho=!1,null==(e=Pe.value)||e.destroy(),Pe.value=null,function(){const e=Ze;e&&(Ze="",null==ze||ze.markSettled(e))}(),co&&(null==(o=co.destroy)||o.call(co),co=null),po="","undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(n){}});const ko=i(()=>!L()),yo=i(()=>Me.value||ke.value),bo=i(()=>Me.value?"fallback":$e.value?"error":Te.value?"preview":"pending"),Mo=i(()=>({transform:`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}));return r(Mo,e=>{Fe.value&&je.value&&(je.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:ye,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":pe.loading,dark:pe.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":bo.value},[pe.showHeader?(c(),d("div",N,[e.$slots["header-left"]?(c(),d("div",O,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",D,[h("span",{class:"icon-slot action-icon shrink-0",innerHTML:p('<svg width="15.52" height="16" viewBox="0 0 291 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.59C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z" fill="#FF6376"></path><path d="M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z" fill="#FFCCCC"></path><path d="M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z" fill="#FF939F"></path><path d="M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z" fill="#FF356A"></path><path d="M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z" fill="#FF6376"></path></g></svg>\n')},null,8,R),o[21]||(o[21]=h("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),e.$slots["header-center"]?(c(),d("div",U,[m(e.$slots,"header-center",{},void 0,!0)])):pe.showModeToggle?(c(),d("div",A,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"":"is-active",ko.value?"opacity-50 cursor-not-allowed":""]]),disabled:ko.value,onClick:o[0]||(o[0]=()=>We("preview")),onMouseenter:o[1]||(o[1]=e=>qe(e,p(we)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>qe(e,p(we)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[h("div",q,[o[22]||(o[22]=h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),h("circle",{cx:"12",cy:"12",r:"3"})])],-1)),h("span",null,w(p(we)("common.preview")||"Preview"),1)])],42,G),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>We("source")),onMouseenter:o[4]||(o[4]=e=>qe(e,p(we)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>qe(e,p(we)("common.source")||"Source")),onMouseleave:Je,onBlur:Je},[h("div",J,[o[23]||(o[23]=h("svg",{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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),h("span",null,w(p(we)("common.source")||"Source"),1)])],34)])):g("",!0),e.$slots["header-right"]?(c(),d("div",K,[m(e.$slots,"header-right",{},void 0,!0)])):(c(),d("div",Q,[pe.showCollapseButton?(c(),d("button",{key:0,class:v(he),"aria-pressed":ke.value,onClick:o[6]||(o[6]=e=>ke.value=!ke.value),onMouseenter:o[7]||(o[7]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(c(),d("svg",{style:f({rotate:ke.value?"0deg":"90deg"}),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:"action-icon"},[...o[24]||(o[24]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,W)):g("",!0),pe.showCopyButton?(c(),d("button",{key:1,class:v(he),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[xe.value?(c(),d("svg",oe,[...o[26]||(o[26]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(c(),d("svg",ee,[...o[25]||(o[25]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):g("",!0),pe.showExportButton?(c(),d("button",{key:2,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.value,onClick:eo,onMouseenter:o[11]||(o[11]=e=>qe(e,p(we)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>qe(e,p(we)("common.export")||"Export")),onMouseleave:Je,onBlur:Je},[...o[27]||(o[27]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),h("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,ne)):g("",!0),pe.showFullscreenButton?(c(),d("button",{key:3,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.value,onClick:to,onMouseenter:o[13]||(o[13]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onMouseleave:Je,onBlur:Je},[Fe.value?(c(),d("svg",ie,[...o[29]||(o[29]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(c(),d("svg",le,[...o[28]||(o[28]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,te)):g("",!0)]))])):g("",!0),C(h("div",null,[Me.value?(c(),d("div",re,[h("pre",ae,w(Ve.value),1)])):(c(),d("div",se,[pe.showZoomControls?(c(),d("div",ue,[h("div",ce,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo,onMouseenter:o[15]||(o[15]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onMouseleave:Je,onBlur:Je},[...o[30]||(o[30]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[17]||(o[17]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onMouseleave:Je,onBlur:Je},[...o[31]||(o[31]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro,onMouseenter:o[19]||(o[19]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onMouseleave:Je,onBlur:Je},w(Math.round(100*Ne.value))+"% ",33)])])):g("",!0),h("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:f({height:Ie.value}),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},[Te.value||$e.value?g("",!0):(c(),d("pre",de,w(Ve.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Re.value}]),style:f(Mo.value)},[h("div",{ref_key:"infographicContainer",ref:be,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[x,!ke.value]]),(c(),k(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:pe.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[Fe.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(no,["self"])},[h("div",ve,[h("div",me,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo},[...o[32]||(o[32]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...o[33]||(o[33]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro},w(Math.round(100*Ne.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:no},[...o[34]||(o[34]=[h("svg",{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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),h("div",{ref_key:"modalContent",ref:He,class:v(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!Re.value,"cursor-grabbing":Re.value}]),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},null,34)])])):g("",!0)]),_:1})],2)]))],10,Y))}}),[["__scopeId","data-v-9bbae5a0"]]);pe.install=e=>{e.component(pe.__name,pe)};export{pe as default};
1
+ var e=(e,o,n)=>new Promise((t,l)=>{var i=e=>{try{a(n.next(e))}catch(o){l(o)}},r=e=>{try{a(n.throw(e))}catch(o){l(o)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,o)).next())});import{defineComponent as o,ref as n,useAttrs as t,inject as l,computed as i,watch as r,nextTick as a,onMounted as s,onBeforeUnmount as u,openBlock as c,createElementBlock as d,normalizeClass as v,renderSlot as m,createElementVNode as h,unref as p,toDisplayString as w,createCommentVNode as g,normalizeStyle as f,withDirectives as C,vShow as x,createBlock as k,Teleport as y,createVNode as b,Transition as M,withCtx as B,withModifiers as F}from"vue";import{ap as H,ar as j,as as $,ao as T,ag as P,a9 as L,al as E,a6 as z,$ as S,z as Z}from"./exports.js";import{p as V,e as _,c as I}from"./diagramHeight.js";import{M as X}from"./index2.js";const Y=["data-markstream-mode"],N={key:0,class:"infographic-block-header flex justify-between items-center border-b"},O={key:0},D={key:1,class:"flex items-center gap-x-2 overflow-hidden"},R=["innerHTML"],U={key:2},A={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},G=["disabled"],q={class:"flex items-center gap-x-1"},J={class:"flex items-center gap-x-1"},K={key:4},Q={key:5,class:"infographic-header-actions flex items-center"},W=["aria-pressed"],ee={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:"action-icon"},oe={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:"action-icon"},ne=["disabled"],te=["disabled"],le={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:"action-icon"},ie={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:"action-icon"},re={key:0,class:"infographic-source"},ae={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},se={key:1,class:"relative"},ue={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},ce={class:"flex items-center gap-2 backdrop-blur rounded-lg"},de={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},ve={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},me={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},he="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",pe=/* @__PURE__ */Z(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:Z}){const pe=o,{t:we}=H(),ge=j(),fe=$(),Ce=T(),xe=n(!1),ke=n(!1),ye=n(),be=n(),Me=n(!0),Be=n(!1),Fe=n(!1),He=n(),je=n(null),$e=n(!1),Te=n(!1),Pe=n(null),Le=n("undefined"==typeof window||!Ce.value),Ee=t(),ze=l(X,null);let Se="";const Ze=i(()=>P(pe,Ee));"undefined"!=typeof window&&r([()=>ye.value,Ce],([e,o])=>{var n,t,l;if(null==(n=Pe.value)||n.destroy(),Pe.value=null,!o||Le.value)return void(Le.value=!0);if(!e)return void(Le.value=!1);const i=null!=(l=null!=(t=null==fe?void 0:fe.value.heavyBlockMargin)?t:null==fe?void 0:fe.value.rootMargin)?l:"160px",r=ge(e,{rootMargin:i,allowIdle:!1});Pe.value=r,Le.value=r.isVisible.value,r.whenVisible.then(()=>{Le.value=!0})},{immediate:!0});const Ve=i(()=>pe.node.code),_e=i(()=>{var e;return function(e){if("none"===pe.maxHeight)return I(e,void 0,null);const o=V(pe.maxHeight);return I(e,void 0,o)}(null!=(e=V(pe.estimatedPreviewHeightPx))?e:_(Ve.value))}),Ie=n(`${_e.value}px`),Xe=i(()=>null!=V(pe.estimatedPreviewHeightPx));function Ye(){var e;if(!be.value)return;if(Xe.value)return;const o=be.value.scrollHeight;if(o>0){const n=null!=(e=V(function(e){if("none"===pe.maxHeight)return`${e}px`;if(null!=pe.maxHeight){const o=Number.parseFloat(String(pe.maxHeight));if(Number.isFinite(o))return`${Math.min(e,o)}px`}const o=be.value;if(o){const n=getComputedStyle(o).getPropertyValue("--ms-size-code-max-height").trim(),t=Number.parseFloat(n);if(Number.isFinite(t))return`${Math.min(e,t)}px`}return`${Math.min(e,500)}px`}(o)))?e:o;Ie.value=`${Math.max(n,_e.value)}px`}}const Ne=n(1),Oe=n(0),De=n(0),Re=n(!1),Ue=n({x:0,y:0}),Ae=i(()=>Ve.value);function Ge(e){return!e||e.disabled}function qe(e,o,n="top"){if(Ge(e.currentTarget))return;const t=e,l=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;E(e.currentTarget,o,n,!1,l,pe.isDark)}function Je(){z()}function Ke(e){if(Ge(e.currentTarget))return;const o=xe.value?we("common.copied")||"Copied":we("common.copy")||"Copy",n=e,t=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;E(e.currentTarget,o,"top",!1,t,pe.isDark)}function Qe(){return e(this,null,function*(){try{const e=Ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),xe.value=!0,setTimeout(()=>{xe.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function We(e){("preview"!==e||L())&&(Be.value=!0,Me.value="source"===e)}function eo(){var o;const n=null==(o=be.value)?void 0:o.querySelector("svg");n?function(o){e(this,null,function*(){try{const n=(new XMLSerializer).serializeToString(o),t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(t);if("undefined"!=typeof document){const o=document.createElement("a");o.href=l,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(l)}}catch(n){console.error("Failed to export SVG:",n)}})}(n):console.error("SVG element not found")}function oo(e){"Escape"===e.key&&Fe.value&&no()}function no(){if(Fe.value=!1,He.value&&(He.value.innerHTML=""),je.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(e){}}function to(){!function(){if(Fe.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",oo)}catch(e){}a(()=>{if(be.value&&He.value){He.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=be.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),je.value=e,e.style.transform=`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}})}()}function lo(){Ne.value<3&&(Ne.value+=.1)}function io(){Ne.value>.5&&(Ne.value-=.1)}function ro(){Ne.value=1,Oe.value=0,De.value=0}function ao(e){Re.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-Oe.value,y:e.clientY-De.value}:Ue.value={x:e.touches[0].clientX-Oe.value,y:e.touches[0].clientY-De.value}}function so(e){if(!Re.value)return;let o,n;e instanceof MouseEvent?(o=e.clientX,n=e.clientY):(o=e.touches[0].clientX,n=e.touches[0].clientY),Oe.value=o-Ue.value.x,De.value=n-Ue.value.y}function uo(){Re.value=!1}let co=null,vo=!1,mo=!1,ho=!1,po="",wo=!1,go=0;function fo(e){return!wo&&e===go}function Co(o=!1){return e(this,null,function*(){var n,t;if(wo||!Le.value)return;if(!be.value)return;if(vo)return mo=!0,void(ho=ho||o);const l=Ae.value;if(!o&&l===po&&$e.value)return;const i=!1===pe.loading,r=++go;vo=!0,function(){const e=Ze.value;e&&Se!==e&&(Se&&(null==ze||ze.markSettled(Se)),Se=e,null==ze||ze.markPending(e))}();const s=be.value.innerHTML,u=$e.value,c=Te.value;Te.value=!1;try{const e=yield S();if(!fo(r))return;if(!e)return void console.warn("Infographic library failed to load.");const o=be.value;if(!o)return;co&&(null==(n=co.destroy)||n.call(co),co=null),o.innerHTML="",co=new e({container:o,width:"100%",height:"100%"});let i="";if(null==(t=co.on)||t.call(co,"error",e=>{const o=Array.isArray(e)?e:[e];i=o.map(e=>{var o;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(o=e.message)?o:"":null!=e?e:"")}).filter(Boolean).join("; ")}),co.render(Ve.value),i)throw new Error(i);if(!o.childNodes.length)throw new Error("Infographic render returned empty output.");$e.value=!0,Te.value=!1,po=l,a(()=>{fo(r)&&Ye()})}catch(d){if(!fo(r))return;i&&!1===pe.loading&&l===Ae.value?(console.error("Failed to render infographic:",d),$e.value=!1,Te.value=!0,po="",be.value&&(be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${d instanceof Error?d.message:"Unknown error"}</div>`)):($e.value=u,Te.value=c,u&&be.value&&(be.value.innerHTML=s))}finally{if(vo=!1,fo(r))if(mo){const e=ho;mo=!1,ho=!1,a(()=>{Co(e)})}else!function(){e(this,null,function*(){const e=Se;e&&(Se="",yield a(),function(e=Ze.value){e&&ye.value&&(null==ze||ze.reportHeight(e,ye.value.offsetHeight))}(e),null==ze||ze.markSettled(e))})}()}})}function xo(e=!1){wo||!Le.value||Me.value||ke.value||a(()=>{wo||Co(e)})}r(()=>Ve.value,()=>{xo(!0)}),r(()=>pe.loading,(e,o)=>{o&&!e&&xo(!0)}),r(()=>Me.value,e=>{e||xo(!0)}),r(()=>ke.value,e=>{e||xo()}),r(()=>pe.maxHeight,()=>{a(()=>{Ye()})}),r([()=>pe.estimatedPreviewHeightPx,()=>Ve.value],()=>{$e.value||Me.value||(Ie.value=`${_e.value}px`)}),r(()=>Le.value,e=>{!e||Me.value||ke.value||xo()}),s(()=>{!Be.value&&L()&&(Me.value=!1),xo()}),u(()=>{var e,o;if(wo=!0,go+=1,mo=!1,ho=!1,null==(e=Pe.value)||e.destroy(),Pe.value=null,function(){const e=Se;e&&(Se="",null==ze||ze.markSettled(e))}(),co&&(null==(o=co.destroy)||o.call(co),co=null),po="","undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(n){}});const ko=i(()=>!L()),yo=i(()=>Me.value||ke.value),bo=i(()=>Me.value?"fallback":Te.value?"error":$e.value?"preview":"pending"),Mo=i(()=>({transform:`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}));return r(Mo,e=>{Fe.value&&je.value&&(je.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:ye,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":pe.loading,dark:pe.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":bo.value},[pe.showHeader?(c(),d("div",N,[e.$slots["header-left"]?(c(),d("div",O,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",D,[h("span",{class:"icon-slot action-icon shrink-0",innerHTML:p('<svg width="15.52" height="16" viewBox="0 0 291 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.59C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z" fill="#FF6376"></path><path d="M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z" fill="#FFCCCC"></path><path d="M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z" fill="#FF939F"></path><path d="M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z" fill="#FF356A"></path><path d="M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z" fill="#FF6376"></path></g></svg>\n')},null,8,R),o[21]||(o[21]=h("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),e.$slots["header-center"]?(c(),d("div",U,[m(e.$slots,"header-center",{},void 0,!0)])):pe.showModeToggle?(c(),d("div",A,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"":"is-active",ko.value?"opacity-50 cursor-not-allowed":""]]),disabled:ko.value,onClick:o[0]||(o[0]=()=>We("preview")),onMouseenter:o[1]||(o[1]=e=>qe(e,p(we)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>qe(e,p(we)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[h("div",q,[o[22]||(o[22]=h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),h("circle",{cx:"12",cy:"12",r:"3"})])],-1)),h("span",null,w(p(we)("common.preview")||"Preview"),1)])],42,G),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>We("source")),onMouseenter:o[4]||(o[4]=e=>qe(e,p(we)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>qe(e,p(we)("common.source")||"Source")),onMouseleave:Je,onBlur:Je},[h("div",J,[o[23]||(o[23]=h("svg",{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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),h("span",null,w(p(we)("common.source")||"Source"),1)])],34)])):g("",!0),e.$slots["header-right"]?(c(),d("div",K,[m(e.$slots,"header-right",{},void 0,!0)])):(c(),d("div",Q,[pe.showCollapseButton?(c(),d("button",{key:0,class:v(he),"aria-pressed":ke.value,onClick:o[6]||(o[6]=e=>ke.value=!ke.value),onMouseenter:o[7]||(o[7]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(c(),d("svg",{style:f({rotate:ke.value?"0deg":"90deg"}),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:"action-icon"},[...o[24]||(o[24]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,W)):g("",!0),pe.showCopyButton?(c(),d("button",{key:1,class:v(he),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[xe.value?(c(),d("svg",oe,[...o[26]||(o[26]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(c(),d("svg",ee,[...o[25]||(o[25]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):g("",!0),pe.showExportButton?(c(),d("button",{key:2,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.value,onClick:eo,onMouseenter:o[11]||(o[11]=e=>qe(e,p(we)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>qe(e,p(we)("common.export")||"Export")),onMouseleave:Je,onBlur:Je},[...o[27]||(o[27]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),h("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,ne)):g("",!0),pe.showFullscreenButton?(c(),d("button",{key:3,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.value,onClick:to,onMouseenter:o[13]||(o[13]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onMouseleave:Je,onBlur:Je},[Fe.value?(c(),d("svg",ie,[...o[29]||(o[29]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(c(),d("svg",le,[...o[28]||(o[28]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,te)):g("",!0)]))])):g("",!0),C(h("div",null,[Me.value?(c(),d("div",re,[h("pre",ae,w(Ve.value),1)])):(c(),d("div",se,[pe.showZoomControls?(c(),d("div",ue,[h("div",ce,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo,onMouseenter:o[15]||(o[15]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onMouseleave:Je,onBlur:Je},[...o[30]||(o[30]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[17]||(o[17]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onMouseleave:Je,onBlur:Je},[...o[31]||(o[31]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro,onMouseenter:o[19]||(o[19]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onMouseleave:Je,onBlur:Je},w(Math.round(100*Ne.value))+"% ",33)])])):g("",!0),h("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:f({height:Ie.value}),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},[$e.value||Te.value?g("",!0):(c(),d("pre",de,w(Ve.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Re.value}]),style:f(Mo.value)},[h("div",{ref_key:"infographicContainer",ref:be,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[x,!ke.value]]),(c(),k(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:pe.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[Fe.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(no,["self"])},[h("div",ve,[h("div",me,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo},[...o[32]||(o[32]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...o[33]||(o[33]=[h("svg",{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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro},w(Math.round(100*Ne.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:no},[...o[34]||(o[34]=[h("svg",{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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),h("div",{ref_key:"modalContent",ref:He,class:v(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!Re.value,"cursor-grabbing":Re.value}]),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},null,34)])])):g("",!0)]),_:1})],2)]))],10,Y))}}),[["__scopeId","data-v-de34ec4b"]]);pe.install=e=>{e.component(pe.__name,pe)};export{pe as default};
package/dist/index11.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=Math.pow,i=(t,n,l)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,u=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&i(e,n,t[n]);if(l)for(var n of l(t))r.call(t,n)&&i(e,n,t[n]);return e},s=(e,t,n)=>new Promise((l,o)=>{var r=e=>{try{i(n.next(e))}catch(t){o(t)}},a=e=>{try{i(n.throw(e))}catch(t){o(t)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,a);i((n=n.apply(e,t)).next())});import{defineComponent as c,ref as d,computed as v,useAttrs as m,inject as f,watch as h,onBeforeUnmount as g,nextTick as p,onMounted as w,onUnmounted as y,openBlock as k,createElementBlock as x,normalizeClass as b,renderSlot as M,createElementVNode as T,unref as C,toDisplayString as B,createCommentVNode as O,normalizeStyle as P,withDirectives as E,mergeProps as S,toHandlers as D,createBlock as F,Teleport as R,createVNode as j,Transition as $,withCtx as z,withModifiers as A,vShow as H}from"vue";import{aj as L,an as _,ak as N,am as X,ab as I,a5 as Y,ag as W,z as q}from"./exports.js";import{p as V,b as Z,g as U,a as K}from"./diagramHeight.js";import{e as G}from"./mermaidSequenceSemicolons.js";import{M as J}from"./index2.js";import{safeRaf as Q}from"./utils/safeRaf.js";import{c as ee,g as te,f as ne}from"./workers-mermaidWorkerClient.js";import{toSafeSvgElement as le}from"stream-markdown-parser";const oe=["data-markstream-mode","data-markstream-pending"],re={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},ae={key:0},ie={key:1,class:"flex items-center gap-x-2 overflow-hidden"},ue=["innerHTML"],se={key:2},ce={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},de={class:"flex items-center gap-x-1"},ve={class:"flex items-center gap-x-1"},me={key:4},fe={key:5,class:"mermaid-header-actions flex items-center"},he=["aria-pressed"],ge={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:"action-icon"},pe={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:"action-icon"},we=["aria-label","disabled"],ye=["aria-label","disabled"],ke={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:"action-icon"},xe={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:"action-icon"},be={key:0,class:"mermaid-source-panel"},Me={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Te={key:1,class:"relative"},Ce={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Be={class:"flex items-center gap-2 backdrop-blur rounded-lg"},Oe={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Pe={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Ee="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",Se=/* @__PURE__ */q(/* @__PURE__ */c({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},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},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:l}){var o,r;const i=e,c=l,q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Se=d(!1),De=d("undefined"==typeof window),Fe=L(),Re=_(),je=v(()=>i.isStrict?"strict":"loose"),$e=v(()=>({startOnLoad:!1,securityLevel:je.value,dompurifyConfig:"strict"===je.value?q:void 0,flowchart:"strict"===je.value?{htmlLabels:!1}:void 0}));function ze(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function Ae(e,t,n={}){if(!e)return null;const l=function(e,t){if(!e)return null;const n=le(t);if(!n)return null;const l=function(e,t){const n=Array.from(e.childNodes),l=document.createElement("div");return l.dataset.mermaidSvgLayer="1",l.style.zIndex="1",l.appendChild(t),e.insertBefore(l,e.firstChild),n.length>0&&function(e){const t=()=>{var t;for(const n of e)null==(t=n.parentNode)||t.removeChild(n)};"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>{requestAnimationFrame(t)}):setTimeout(t,32)}(n),l}(e,n);return{svg:n.outerHTML,bindTarget:l}}(e,t);return l||n.keepPreviousOnFailure||ze(e),l}let He=null;function Le(e){if(i.enableMermaidInteractions&&(null==e?void 0:e.querySelector("svg")))try{null==He||He(e)}catch(t){}}const{t:_e}=N();let Ne=!1,Xe=0;function Ie(){return s(this,null,function*(){try{const e=yield te();return Ne?null:(Se.value=!!e,e)}catch(e){throw Ne||(Se.value=!1),e}finally{Ne||(De.value=!0)}})}const Ye=d(!1),We=d(!1),qe=d(),Ve=d(),Ze=d(),Ue=d(),Ke=d(null),Ge=X(),Je=d(null),Qe=d("undefined"==typeof window||!Fe.value),et=m(),tt=f(J,null);let nt="",lt=0,ot=0;const rt=v(()=>I(i,et));function at(){const e=rt.value;e&&(nt&&nt!==e&&(null==tt||tt.markSettled(nt),lt=0),nt=e,lt+=1,ot+=1,1===lt&&(null==tt||tt.markPending(e)))}function it(){return s(this,null,function*(){const e=nt;if(!e)return;if(lt=Math.max(0,lt-1),lt>0)return;nt="";const t=++ot;yield p(),t===ot&&(function(e=rt.value){e&&qe.value&&(null==tt||tt.reportHeight(e,qe.value.offsetHeight))}(e),null==tt||tt.markSettled(e))})}function ut(){const e=nt;e&&(nt="",lt=0,ot+=1,null==tt||tt.markSettled(e))}const st=d(),ct=v(()=>i.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function dt(e,t=ct.value){const n=t,l={theme:"dark"===e?"dark":"default"};"strict"===je.value&&(l.flowchart={htmlLabels:!1});const o=`%%{init: ${JSON.stringify(l)}}%%\n`;return n.trim().startsWith("%%{")?n:o+n}function vt(){var e;return function(e){const t=function(){var e;const t=Ve.value?getComputedStyle(Ve.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=V(t))?e:360}(),n=zn();return K(e,t,n)}(null!=(e=V(i.estimatedPreviewHeightPx))?e:Z(ct.value))}function mt(){return`${vt()}px`}const ft=d(null);function ht(){var e;return!!(null==(e=Ze.value)?void 0:e.querySelector("svg"))}function gt(){return!1!==i.loading&&(ht()||!!ft.value)}const pt=d(1),wt=d(0),yt=d(0),kt=d(!1),xt=d({x:0,y:0}),bt=d(!0),Mt=d(!1),Tt=d(!1),Ct=d(null);let Bt="",Ot="";const Pt=d(0),Et=d(!1),St=v(()=>{var e;return Math.max(0,null!=(e=i.renderDebounceMs)?e:300)}),Dt=v(()=>{var e;return Math.max(0,null!=(e=i.contentStableDelayMs)?e:500)}),Ft=v(()=>{var e;return Math.max(120,null!=(e=i.previewPollDelayMs)?e:800)}),Rt=v(()=>{var e;return Math.max(Ft.value,null!=(e=i.previewPollMaxDelayMs)?e:4e3)}),jt=v(()=>{var e;return Math.max(1,Math.trunc(null!=(e=i.previewPollMaxAttempts)?e:12))}),$t=v(()=>!1!==i.loading);let zt=null,At=null,Ht=null,Lt=null,_t=0;const Nt=null!=(o=globalThis.requestIdleCallback)?o:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Xt=null!=(r=globalThis.cancelIdleCallback)?r:e=>clearTimeout(e);function It(e=Xe){return!Ne&&e===Xe}function Yt(){return It()&&Qe.value&&!We.value}function Wt(){null!=Ht&&(globalThis.clearTimeout(Ht),Ht=null),null!=Lt&&(Xt(Lt),Lt=null)}function qt(){Ne||(Wt(),Ht=globalThis.setTimeout(()=>{Ht=null,Yt()&&(Lt=Nt(()=>{Lt=null,Yt()&&al()},{timeout:500}))},St.value))}function Vt(){null!=At&&(globalThis.clearTimeout(At),At=null)}function Zt(e=600){if("undefined"==typeof globalThis||Ne)return;const t=Math.max(0,e);Vt(),At=globalThis.setTimeout(()=>{if(At=null,!Ne){if(i.loading||Tt.value||!Yt())return void Zt(Math.min(1200,Math.max(300,1.2*t)));qt()}},t)}const Ut=d(mt()),Kt=d(Ut.value);let Gt=null;const Jt=d(!1),Qt=d(!1),en=d({}),tn=d(0);let nn=null,ln=null;const on=d(!1),rn=v(()=>{var e,t;return!(We.value||bt.value||De.value&&!Tt.value&&!Ct.value&&(Jt.value||on.value&&Boolean(null==(t=null==(e=Ze.value)?void 0:e.textContent)?void 0:t.trim())))}),an=d({zoom:1,translateX:0,translateY:0,containerHeight:Ut.value}),un=v(()=>i.enableWheelZoom?{wheel:Un}:{}),sn=v(()=>{var e,t,n,l;return{worker:null!=(e=i.workerTimeoutMs)?e:1400,parse:null!=(t=i.parseTimeoutMs)?t:1800,render:null!=(n=i.renderTimeoutMs)?n:2500,fullRender:null!=(l=i.fullRenderTimeoutMs)?l:4e3}});let cn=null,dn=null,vn=!1,mn=Ft.value,fn=null,hn=0,gn=!0,pn=0;function wn(e,t){const n=null==t?void 0:t.timeoutMs,l=null==t?void 0:t.signal;if(null==l?void 0:l.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let o=null,r=!1,a=null;return new Promise((t,i)=>{const u=()=>{null!=o&&clearTimeout(o),a&&l&&l.removeEventListener("abort",a)};n&&n>0&&(o=globalThis.setTimeout(()=>{r||(r=!0,u(),i(new Error("Operation timed out")))},n)),l&&(a=()=>{r||(r=!0,u(),i(new DOMException("Aborted","AbortError")))},l.addEventListener("abort",a)),e().then(e=>{r||(r=!0,u(),t(e))}).catch(e=>{r||(r=!0,u(),i(e))})})}function yn(e){if("undefined"==typeof document)return;if(!Ze.value)return;if("function"==typeof i.onRenderError&&!0===i.onRenderError(e,ct.value,Ze.value))return on.value=!0,void il();const t=document.createElement("div");t.style.padding="var(--ms-inset-panel-body)",t.style.color="hsl(var(--ms-destructive))",t.textContent="Failed to render diagram: ";const n=document.createElement("span");n.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(n),ze(Ze.value),Ze.value.appendChild(t);const l=Ze.value?getComputedStyle(Ze.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";Ut.value=l||"360px",Kt.value=Ut.value,on.value=!0,il()}function kn(e){const t="string"==typeof e?e:"string"==typeof(null==e?void 0:e.message)?e.message:"";return"string"==typeof t&&/timed out/i.test(t)}function xn(e){return"AbortError"===(null==e?void 0:e.name)}function bn(e){return!kn(e)&&!xn(e)}"undefined"!=typeof window&&h([()=>qe.value,Fe],([e,t])=>{var n;if(null==(n=Je.value)||n.destroy(),Je.value=null,!t||Qe.value)return void(Qe.value=!0);if(!e)return void(Qe.value=!1);const l=Ge(e,{rootMargin:null==Re?void 0:Re.value.heavyBlockMargin,allowIdle:!1});Je.value=l,Qe.value=l.isVisible.value,l.whenVisible.then(()=>{Qe.value=!0})},{immediate:!0}),g(()=>{var e;Ne=!0,Xe+=1,tn.value+=1,null==(e=Je.value)||e.destroy(),Je.value=null,ut(),Wt()});const Mn=v(()=>!1!==i.showTooltips);function Tn(e){return!e||e.disabled}function Cn(e,t,n="top"){if(!Mn.value)return;if(Tn(e.currentTarget))return;const l=e,o=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;W(e.currentTarget,t,n,!1,o,i.isDark)}function Bn(){Mn.value&&Y()}function On(e){if(!Mn.value)return;if(Tn(e.currentTarget))return;const t=Ye.value?_e("common.copied")||"Copied":_e("common.copy")||"Copy",n=e,l=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;W(e.currentTarget,t,"top",!1,l,i.isDark)}function Pn(e,t){const n={theme:"dark"===t?"dark":"default"};"strict"===je.value&&(n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function En(){return gn&&!bt.value&&!Jt.value&&!on.value}function Sn(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function Dn(e){if("gantt"===U(e))return function(e){var t;const n=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&n.length>0&&n.pop();n.length>0;){const e=null==(t=n[n.length-1])?void 0:t.trim();if(e&&!e.startsWith("%%")){if(Sn(e))break;n.pop()}else n.pop()}return n.some(Sn)?n.join("\n"):""}(e);const t=e.split(/\r?\n/);for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}function Fn(e,t,n,l){return s(this,null,function*(){try{return yield wn(()=>e.render(t,n),{timeoutMs:l})}catch(o){if(!bn(o))throw o;const a=G(n);if(a===n)throw o;try{return yield wn(()=>e.render(`${t}-retry`,a),{timeoutMs:l})}catch(r){throw o}}})}function Rn(e,t,n){return s(this,null,function*(){var l;try{return yield ee(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:sn.value.worker,null==n?void 0:n.signal)}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o;if("WORKER_INIT_ERROR"===((null==o?void 0:o.code)||(null==o?void 0:o.name))||(null==o?void 0:o.fallbackToRenderer))return yield function(e,t,n){return s(this,null,function*(){var l,r,a,i;const u=yield Ie();if(!u)return;const s=u,c=Pn(e,t);if("function"==typeof s.parse){try{yield wn(()=>s.parse(c),{timeoutMs:null!=(l=null==n?void 0:n.timeoutMs)?l:sn.value.parse,signal:null==n?void 0:n.signal})}catch(o){if(!bn(o))throw o;const t=G(c);if(t===c)throw o;try{yield wn(()=>s.parse(t),{timeoutMs:null!=(r=null==n?void 0:n.timeoutMs)?r:sn.value.parse,signal:null==n?void 0:n.signal})}catch(v){throw o}}return!0}const d=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;try{yield wn(()=>u.render(d,c),{timeoutMs:null!=(a=null==n?void 0:n.timeoutMs)?a:sn.value.render,signal:null==n?void 0:n.signal})}catch(o){if(!bn(o))throw o;const t=G(c);if(t===c)throw o;try{yield wn(()=>u.render(`${d}-retry`,t),{timeoutMs:null!=(i=null==n?void 0:n.timeoutMs)?i:sn.value.render,signal:null==n?void 0:n.signal})}catch(v){throw o}}return!0})}(e,t,n);throw o}})}function jn(e,t,n){return s(this,null,function*(){var l;if("gantt"===U(e)){const l=Dn(e);if(!l.trim())return{fullOk:!1,prefixOk:!1};try{if(yield Rn(l,t,n))return l===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:l}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}}try{if(yield Rn(e,t,n))return{fullOk:!0,prefixOk:!1}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}let o=Dn(e);if(o&&o.trim()&&o!==e)try{try{const r=yield ne(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:sn.value.worker,null==n?void 0:n.signal);r&&r.trim()&&(o=r)}catch(r){}if(yield Rn(o,t,n))return{fullOk:!1,prefixOk:!0,prefix:o}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}})}const $n=v(()=>bt.value||Tt.value||We.value);function zn(){if("none"===i.maxHeight)return null;if(null!=i.maxHeight){const e=Number.parseFloat(String(i.maxHeight));if(Number.isFinite(e))return e}const e=Ve.value;if(e){const t=getComputedStyle(e).getPropertyValue("--ms-size-code-max-height").trim(),n=Number.parseFloat(t);if(Number.isFinite(n))return n}return 500}function An(e,t){if(!Ve.value||!Ze.value)return;const n=!(null==t?void 0:t.force)&&!1!==i.loading&&ht(),l=Ze.value.querySelector("svg");if(!l)return;let o=0,r=0;const a=l.getAttribute("viewBox"),u=l.getAttribute("width"),s=l.getAttribute("height");if(a){const e=a.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),r=Number.parseFloat(e[3]))}if(o&&r||u&&s&&(o=Number.parseFloat(u),r=Number.parseFloat(s)),Number.isNaN(o)||Number.isNaN(r)||o<=0||r<=0)try{const e=l.getBBox();e&&e.width>0&&e.height>0&&(o=e.width,r=e.height)}catch(c){return void console.error("Failed to get SVG BBox:",c)}if(o>0&&r>0){const t=r/o,a=null!=e?e:Ve.value.clientWidth,u=l.getBoundingClientRect().width,s=u>0?u:a,c=zn(),d=s*t,v=null==c?d:Math.min(d,c),m=Math.max(v,vt());Kt.value=`${Math.max(d,m)}px`,n||null!=V(i.estimatedPreviewHeightPx)||(Ut.value=`${m}px`)}}const Hn=d(!1),Ln=v(()=>({transform:`translate(${wt.value}px, ${yt.value}px) scale(${pt.value})`}));function _n(e){"Escape"===e.key&&Hn.value&&Xn()}function Nn(){var e;if(!Ve.value||!Ue.value)return!1;if("1"===(null==(e=Ue.value.firstElementChild)?void 0:e.getAttribute("data-mermaid-modal-clone")))return!0;const t=Ve.value.cloneNode(!0);t.dataset.mermaidModalClone="1",t.classList.add("fullscreen"),t.style.height="100%",t.style.maxHeight="100%";const n=t.querySelector("[data-mermaid-wrapper]");return n&&(Ke.value=n,n.style.transform=Ln.value.transform),ze(Ue.value),Ue.value.appendChild(t),Le(t),!0}function Xn(){if(Hn.value=!1,Ue.value&&ze(Ue.value),Ke.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",_n)}catch(e){}}function In(){pt.value<3&&(pt.value+=.1)}function Yn(){pt.value>.5&&(pt.value-=.1)}function Wn(){pt.value=1,wt.value=0,yt.value=0}function qn(e){kt.value=!0,e instanceof MouseEvent?xt.value={x:e.clientX-wt.value,y:e.clientY-yt.value}:xt.value={x:e.touches[0].clientX-wt.value,y:e.touches[0].clientY-yt.value}}function Vn(e){if(!kt.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),wt.value=t-xt.value.x,yt.value=n-xt.value.y}function Zn(){kt.value=!1}function Un(e){if(i.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!Ve.value)return;const t=Ve.value.getBoundingClientRect(),n=e.clientX-t.left,l=e.clientY-t.top,o=n-t.width/2,r=l-t.height/2,a=(o-wt.value)/pt.value,i=(r-yt.value)/pt.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(pt.value+s,.5),3);c!==pt.value&&(wt.value=o-a*c,yt.value=r-i*c,pt.value=c)}}function Kn(){return s(this,null,function*(){try{const e=ct.value,t={payload:{type:"copy",text:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(c("copy",t),t.defaultPrevented)return;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),Ye.value=!0,setTimeout(()=>{Ye.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Gn(){var e;const t=null==(e=Ze.value)?void 0:e.querySelector("svg");if(!t)return void console.error("SVG element not found");const n=(new XMLSerializer).serializeToString(t),l={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:t,svgString:n};c("export",l),l.defaultPrevented||function(e,t=null){s(this,null,function*(){try{const l=null!=t?t:(new XMLSerializer).serializeToString(e),o=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o);if("undefined"!=typeof document){const e=document.createElement("a");e.href=r,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch(n){}URL.revokeObjectURL(r)}}catch(l){console.error("Failed to export SVG:",l)}})}(t,n)}function Jn(){var e,t;const n=null!=(t=null==(e=Ze.value)?void 0:e.querySelector("svg"))?t:null,l=n?(new XMLSerializer).serializeToString(n):null,o={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:l};c("openModal",o),o.defaultPrevented||function(){if(Hn.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",_n)}catch(e){}p(()=>{Nn()||p(Nn)})}()}function Qn(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};c("toggleMode",e,t),t.defaultPrevented||el(e)}function el(e){return s(this,null,function*(){const t=st.value;if(!t)return Mt.value=!0,void(bt.value="source"===e);const n=t.getBoundingClientRect().height;t.style.height=`${n}px`,t.style.overflow="hidden",Mt.value=!0,bt.value="source"===e,yield p();const l=t.scrollHeight;t.style.transition="height var(--ms-duration-standard) var(--ms-ease-standard)",t.offsetHeight,t.style.height=`${l}px`;const o=()=>{t.style.transition="",t.style.height="",t.style.overflow="",t.removeEventListener("transitionend",r)};function r(){o()}t.addEventListener("transitionend",r),setTimeout(()=>o(),220)})}function tl(e=ct.value,t=(i.isDark?"dark":"light")){return{codeWithTheme:dt(t,e),signature:`${t}\0${e}`,theme:t}}function nl(e){return e.signature===tl().signature}function ll(){return s(this,arguments,function*(e=tl()){const l=Xe;if(!It(l)||!nl(e))return!1;if(Tt.value){const t=Ct.value,n=Bt;if(!t)return!1;const o=yield t;return!(!It(l)||!nl(e))&&(n===e.signature?o&&Ot===e.signature:ll(e))}if(!Ze.value){if(yield p(),!It(l))return!1;if(!Ze.value)return console.warn("Mermaid container not ready"),!1}return!(!It(l)||!nl(e))&&(Tt.value=!0,Bt=e.signature,at(),Ct.value=s(null,null,function*(){var o,r,a,s;try{const c=yield Ie();if(!It(l)||!c)return!1;const d=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;Jt.value||Qt.value||null==(o=c.initialize)||o.call(c,(a=u({},$e.value),s={dompurifyConfig:u({},q)},t(a,n(s))));const v=yield Fn(c,d,e.codeWithTheme,sn.value.fullRender);if(!It(l)||!nl(e))return Qt.value&&(Qt.value=!1),!1;if(!Ze.value)return!1;const m=Ae(Ze.value,null==v?void 0:v.svg,{keepPreviousOnFailure:!1!==i.loading});if(!m)return Qt.value&&(Qt.value=!1),!1;const f=null!=(r=null==v?void 0:v.bindFunctions)?r:null;return He=f,Le(m.bindTarget),Jt.value||Qt.value||(Q(()=>An()),Jt.value=!0,an.value={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Ut.value}),en.value[e.theme]={svg:m.svg,bindFunctions:f},Qt.value&&(Qt.value=!1),Ot=e.signature,ft.value=Ze.value.innerHTML,on.value=!1,_t=0,Vt(),!0}catch(c){if(!It(l)||!nl(e))return Qt.value&&(Qt.value=!1),!1;const t=kn(c),n=_t+1;return t&&n<=3?(_t=n,Zt(Math.min(1200,600*n))):(_t=0,Vt(),!1===i.loading&&console.error("Failed to render mermaid diagram:",c),!1===i.loading&&yn(c)),!1}finally{Bt="",Tt.value=!1,Ct.value=null,It(l)&&it()}}),Ct.value)})}function ol(){return s(this,null,function*(){var e;const t=ct.value;if(!t.trim()){if(gt())return;return Ze.value&&ze(Ze.value),ft.value=null,Ot="",void(on.value=!1)}if(!Se.value||!Yt())return;const n=tl(t);Jt.value&&n.signature===Ot&&(null==(e=Ze.value)?void 0:e.querySelector("svg"))||(yield ll(n))&&(on.value=!1)})}function rl(e,t,n,l){return s(this,null,function*(){const o=Xe;if(!It(o)||!En())return;if(!Ze.value&&(yield p(),!It(o)||!Ze.value))return;if(Tt.value)return;Tt.value=!0,at();const r=tl(t,n),a=s(null,null,function*(){var t;try{const a=yield Ie();if(!It(o)||!a)return!1;const u=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,s=Dn(e),c=s&&s.trim()?s:e,d=yield Fn(a,u,Pn(c,n),sn.value.render);if(!It(o)||tn.value!==l||!1===i.loading||!En()||!nl(r))return!1;const v=null==d?void 0:d.svg;if(!Ze.value||!v)return!1;const m=Ae(Ze.value,v,{keepPreviousOnFailure:!0});return!!m&&(He=null!=(t=null==d?void 0:d.bindFunctions)?t:null,Le(m.bindTarget),Q(()=>An()),!1)}catch(u){return!1}finally{Ct.value===a&&(Tt.value=!1,Ct.value=null),It(o)&&it()}});return Ct.value=a,a})}function al(){return s(this,null,function*(){var e;if(!Yt())return;const t=Xe,n=Date.now(),l=++tn.value;at();try{nn&&nn.abort(),nn=new AbortController;const r=nn.signal,a=i.isDark?"dark":"light",u=ct.value;if(!u.trim()){if(gt())return;return Ze.value&&ze(Ze.value),ft.value=null,Ot="",void(on.value=!1)}if(tl(u,a).signature===Ot)return;try{const e=yield jn(u,a,{signal:r,timeoutMs:sn.value.worker});if(!It(t))return;if(e.fullOk){if(r.aborted||tn.value!==l)return;if(!(yield ll(tl(u,a))))return;return void(It(t)&&tn.value===l&&(on.value=!1))}const o=hn&&n<=hn;if(e.prefixOk&&e.prefix&&!r.aborted&&tn.value===l&&En()&&!o)return void(yield rl(e.prefix,u,a,l))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}if(!It(t)||tn.value!==l)return;if(on.value)return;const s=en.value[a];if(s&&Ze.value){const t=Ae(Ze.value,s.svg);t&&(He=null!=(e=s.bindFunctions)?e:null,Le(t.bindTarget))}}finally{It(t)&&it()}})}function il(){vn&&(vn=!1,mn=Ft.value,gn=!1,fn&&(fn.abort(),fn=null),cn&&(globalThis.clearTimeout(cn),cn=null),dn&&(Xt(dn),dn=null),hn=Date.now())}function ul(){if(il(),Wt(),nn){try{nn.abort()}catch(e){}nn=null}if(fn){try{fn.abort()}catch(e){}fn=null}Vt(),_t=0}function sl(){null==ln||ln.abort(),ln=null}function cl(e=Ft.value){vn&&(pn>=jt.value?il():(cn&&globalThis.clearTimeout(cn),cn=globalThis.setTimeout(()=>{dn=Nt(()=>s(null,null,function*(){if(!vn)return;if(!Yt())return void il();if(bt.value||Jt.value)return void il();const e=i.isDark?"dark":"light",t=ct.value;if(!t.trim())return!1===i.loading?void il():void cl(mn);if(pn++,pn>jt.value)il();else{fn&&fn.abort(),fn=new AbortController;try{const n=yield jn(t,e,{signal:fn.signal,timeoutMs:sn.value.worker});if(n.fullOk){if((yield ll(tl(t,e)))&&Jt.value)return void il()}else n.prefixOk&&n.prefix&&En()&&(yield rl(n.prefix,t,e,tn.value))}catch(n){}mn=Math.min(Math.floor(1.5*mn),Rt.value),cl(mn)}}),{timeout:500})},e)))}function dl(){vn||$t.value&&Se.value&&Yt()&&(bt.value||Jt.value||(vn=!0,hn=0,gn=!0,pn=0,mn=Ft.value,cl(mn)))}function vl(){return s(this,null,function*(){const e=Xe;It(e)&&(yield Ie().catch(t=>{It(e)&&(Se.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t))}),It(e)&&(yield p(),It(e)&&(Mt.value||(bt.value=!Se.value),Yt()&&($t.value?(qt(),Pt.value=ct.value.length):bt.value||ol()))))})}return h(Ue,e=>{Hn.value&&e&&Nn()}),h(Ln,e=>{Hn.value&&Ke.value&&(Ke.value.style.transform=e.transform)},{immediate:!0}),h(Mn,e=>{e||Y()}),h(()=>ct.value,e=>{if((e.trim()||!1===i.loading)&&(Jt.value=!1,en.value={}),!$t.value)return il(),void(Yt()&&!bt.value&&ol());Yt()&&qt(),!bt.value&&Se.value&&Yt()?dl():il(),function(){if(!$t.value)return;if(!bt.value)return;if(!Se.value)return;const e=ct.value.length;e!==Pt.value&&(Et.value=!0,Pt.value=e,zt&&clearTimeout(zt),zt=setTimeout(()=>{Et.value&&bt.value&&ct.value.trim()&&(Et.value=!1,el("preview"))},Dt.value))}()}),h(()=>i.isDark,()=>s(null,null,function*(){var e;if(on.value)return;const t=i.isDark?"dark":"light",n=en.value[t];if(n){if(Ze.value){const t=Ae(Ze.value,n.svg);t&&(He=null!=(e=n.bindFunctions)?e:null,Le(t.bindTarget))}return}const l={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Ut.value},o=1!==pt.value||0!==wt.value||0!==yt.value;Qt.value=!0,o&&(pt.value=1,wt.value=0,yt.value=0,yield p()),yield ll(),o&&(yield p(),pt.value=l.zoom,wt.value=l.translateX,yt.value=l.translateY,Ut.value=l.containerHeight,an.value=l)})),h(()=>bt.value,e=>s(null,null,function*(){var t;if(e)il(),Jt.value&&(an.value={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Ut.value});else{if(on.value)return;const e=i.isDark?"dark":"light";if(Jt.value&&en.value[e]){if(yield p(),Ze.value){const n=en.value[e],l=Ae(Ze.value,n.svg);l&&(He=null!=(t=n.bindFunctions)?t:null,Le(l.bindTarget))}return pt.value=an.value.zoom,wt.value=an.value.translateX,yt.value=an.value.translateY,void(Ut.value=an.value.containerHeight)}if(yield p(),!Se.value||!Yt())return;if(!$t.value)return il(),void(yield ol());dl(),yield al()}})),h(()=>i.loading,(e,t)=>s(null,null,function*(){var n;if(e)sl();else if(!0===t){sl();const e=ct.value,t=e.trim();if(!t)return Ze.value&&ze(Ze.value),ft.value=null,Ot="",on.value=!1,ul();if(!Yt())return void ul();const r=i.isDark?"dark":"light",u=tl(e,r);if(Jt.value&&u.signature===Ot){if(yield p(),Ze.value&&!Ze.value.querySelector("svg")&&en.value[r]){const e=en.value[r],t=Ae(Ze.value,e.svg);t&&(He=null!=(n=e.bindFunctions)?n:null,Le(t.bindTarget))}return An(void 0,{force:!0}),void ul()}const s=new AbortController;ln=s;try{let e=0;for(;;)try{yield Rn(t,r,{signal:s.signal,timeoutMs:sn.value.worker});break}catch(l){const t="WORKER_BUSY"===(null==l?void 0:l.code)||"WORKER_TIMEOUT"===(null==l?void 0:l.code),n="WORKER_TIMEOUT"===(null==l?void 0:l.code)?2:8;if(!t||e>=n)throw l;const o=Math.min(50*a(2,e),400);e++,yield wn(()=>new Promise(e=>setTimeout(e,o)),{signal:s.signal})}if(!(yield ll(u)))return;on.value=!1,ul()}catch(o){if(xn(o))return;ul(),yn(o)}finally{ln===s&&(ln=null)}}})),h(Ve,e=>{Gt&&Gt.disconnect(),e&&(Gt=new ResizeObserver(e=>{e&&e.length>0&&!bt.value&&!We.value&&Q(()=>{An(e[0].contentRect.width)})}),Gt.observe(e))},{immediate:!0}),w(()=>{Fe.value&&!Yt()||vl()}),h(()=>Se.value,e=>{Mt.value||(bt.value=!e)}),h(()=>i.maxHeight,()=>{p(()=>{An()})}),h([()=>i.estimatedPreviewHeightPx,()=>ct.value],()=>{Jt.value||ht()||bt.value||(Ut.value=mt(),Kt.value=Ut.value)}),h(()=>Qe.value,e=>s(null,null,function*(){e&&(De.value?(Jt.value||($t.value?(qt(),Pt.value=ct.value.length):ol()),i.loading||Jt.value||ol(),!bt.value&&Se.value&&$t.value&&dl()):yield vl())}),{immediate:!1}),y(()=>{zt&&clearTimeout(zt),Wt(),Gt&&Gt.disconnect(),nn&&(nn.abort(),nn=null),sl(),il(),Vt(),ut()}),h(()=>We.value,e=>s(null,null,function*(){e?(il(),nn&&nn.abort()):Yt()&&!Jt.value&&(yield p(),$t.value?(qt(),dl()):bt.value||ol())}),{immediate:!1}),(e,t)=>(k(),x("div",{ref_key:"blockContainer",ref:qe,class:b(["mermaid-block-container rounded-lg border overflow-hidden",[{"is-rendering":i.loading,dark:i.isDark}]]),"data-markstream-mermaid":"1","data-markstream-mode":bt.value?"fallback":Jt.value?"preview":"pending","data-markstream-pending":rn.value?"true":void 0},[i.showHeader?(k(),x("div",re,[e.$slots["header-left"]?(k(),x("div",ae,[M(e.$slots,"header-left",{},void 0,!0)])):(k(),x("div",ie,[T("span",{class:"icon-slot action-icon shrink-0",innerHTML:C('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n')},null,8,ue),t[21]||(t[21]=T("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate"},"Mermaid",-1))])),e.$slots["header-center"]?(k(),x("div",se,[M(e.$slots,"header-center",{},void 0,!0)])):i.showModeToggle&&Se.value?(k(),x("div",ce,[T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[bt.value?"":"is-active"]]),onClick:t[0]||(t[0]=()=>Qn("preview")),onMouseenter:t[1]||(t[1]=e=>Cn(e,C(_e)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>Cn(e,C(_e)("common.preview")||"Preview")),onMouseleave:Bn,onBlur:Bn},[T("div",de,[t[22]||(t[22]=T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),T("circle",{cx:"12",cy:"12",r:"3"})])],-1)),T("span",null,B(C(_e)("common.preview")||"Preview"),1)])],34),T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[bt.value?"is-active":""]]),onClick:t[3]||(t[3]=()=>Qn("source")),onMouseenter:t[4]||(t[4]=e=>Cn(e,C(_e)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>Cn(e,C(_e)("common.source")||"Source")),onMouseleave:Bn,onBlur:Bn},[T("div",ve,[t[23]||(t[23]=T("svg",{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:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),T("span",null,B(C(_e)("common.source")||"Source"),1)])],34)])):O("",!0),e.$slots["header-right"]?(k(),x("div",me,[M(e.$slots,"header-right",{},void 0,!0)])):(k(),x("div",fe,[i.showCollapseButton?(k(),x("button",{key:0,class:b(Ee),"aria-pressed":We.value,onClick:t[6]||(t[6]=e=>We.value=!We.value),onMouseenter:t[7]||(t[7]=e=>Cn(e,We.value?C(_e)("common.expand")||"Expand":C(_e)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>Cn(e,We.value?C(_e)("common.expand")||"Expand":C(_e)("common.collapse")||"Collapse")),onMouseleave:Bn,onBlur:Bn},[(k(),x("svg",{style:P({rotate:We.value?"0deg":"90deg"}),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:"action-icon"},[...t[24]||(t[24]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,he)):O("",!0),i.showCopyButton?(k(),x("button",{key:1,class:b(Ee),onClick:Kn,onMouseenter:t[9]||(t[9]=e=>On(e)),onFocus:t[10]||(t[10]=e=>On(e)),onMouseleave:Bn,onBlur:Bn},[Ye.value?(k(),x("svg",pe,[...t[26]||(t[26]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(k(),x("svg",ge,[...t[25]||(t[25]=[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),T("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):O("",!0),i.showExportButton&&Se.value?(k(),x("button",{key:2,class:b(`${Ee} ${$n.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":C(_e)("common.export")||"Export",disabled:$n.value,onClick:Gn,onMouseenter:t[11]||(t[11]=e=>Cn(e,C(_e)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>Cn(e,C(_e)("common.export")||"Export")),onMouseleave:Bn,onBlur:Bn},[...t[27]||(t[27]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),T("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,we)):O("",!0),i.showFullscreenButton&&Se.value?(k(),x("button",{key:3,class:b(`${Ee} ${$n.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":Hn.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open",disabled:$n.value,onClick:Jn,onMouseenter:t[13]||(t[13]=e=>Cn(e,Hn.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>Cn(e,Hn.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open")),onMouseleave:Bn,onBlur:Bn},[Hn.value?(k(),x("svg",xe,[...t[29]||(t[29]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(k(),x("svg",ke,[...t[28]||(t[28]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,ye)):O("",!0)]))])):O("",!0),E(T("div",{ref_key:"modeContainerRef",ref:st},[bt.value?(k(),x("div",be,[T("pre",Me,B(ct.value),1)])):(k(),x("div",Te,[i.showZoomControls?(k(),x("div",Ce,[T("div",Be,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:In,onMouseenter:t[15]||(t[15]=e=>Cn(e,C(_e)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>Cn(e,C(_e)("common.zoomIn")||"Zoom in")),onMouseleave:Bn,onBlur:Bn},[...t[30]||(t[30]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Yn,onMouseenter:t[17]||(t[17]=e=>Cn(e,C(_e)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>Cn(e,C(_e)("common.zoomOut")||"Zoom out")),onMouseleave:Bn,onBlur:Bn},[...t[31]||(t[31]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] text-[length:var(--ms-text-label)] rounded transition-colors",onClick:Wn,onMouseenter:t[19]||(t[19]=e=>Cn(e,C(_e)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>Cn(e,C(_e)("common.resetZoom")||"Reset zoom")),onMouseleave:Bn,onBlur:Bn},B(Math.round(100*pt.value))+"% ",33)])])):O("",!0),T("div",S({ref_key:"mermaidContainer",ref:Ve,class:"mermaid-preview-area relative overflow-hidden block transition-[height] ease-out",style:{height:Ut.value}},D(un.value,!0),{onMousedown:qn,onMousemove:Vn,onMouseup:Zn,onMouseleave:Zn,onTouchstartPassive:qn,onTouchmovePassive:Vn,onTouchendPassive:Zn}),[T("div",{"data-mermaid-wrapper":"",class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":kt.value}]),style:P(Ln.value)},[T("div",{ref_key:"mermaidContent",ref:Ze,class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:P({height:Kt.value})},null,4)],6)],16),(k(),F(R,{to:"body"},[T("div",{class:b(["markstream-vue",{dark:i.isDark}])},[j($,{name:"mermaid-dialog",appear:""},{default:z(()=>[Hn.value?(k(),x("div",{key:0,class:"mermaid-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:A(Xn,["self"])},[T("div",Oe,[T("div",Pe,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:In},[...t[32]||(t[32]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Yn},[...t[33]||(t[33]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] text-[length:var(--ms-text-label)] rounded transition-colors",onClick:Wn},B(Math.round(100*pt.value))+"% ",1),T("button",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Xn},[...t[34]||(t[34]=[T("svg",{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:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),T("div",S({ref_key:"modalContent",ref:Ue,class:"w-full h-full flex items-center justify-center p-4 overflow-hidden"},D(un.value,!0),{onMousedown:qn,onMousemove:Vn,onMouseup:Zn,onMouseleave:Zn,onTouchstartPassive:qn,onTouchmovePassive:Vn,onTouchendPassive:Zn}),null,16)])])):O("",!0)]),_:1})],2)]))]))],512),[[H,!We.value]])],10,oe))}}),[["__scopeId","data-v-bf4cfe79"]]);Se.install=e=>{e.component(Se.__name,Se)};export{Se as default};
1
+ var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=Math.pow,i=(t,n,l)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,u=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&i(e,n,t[n]);if(l)for(var n of l(t))r.call(t,n)&&i(e,n,t[n]);return e},s=(e,t,n)=>new Promise((l,o)=>{var r=e=>{try{i(n.next(e))}catch(t){o(t)}},a=e=>{try{i(n.throw(e))}catch(t){o(t)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,a);i((n=n.apply(e,t)).next())});import{defineComponent as c,ref as d,computed as v,useAttrs as m,inject as f,watch as h,onBeforeUnmount as g,nextTick as p,onMounted as w,onUnmounted as y,openBlock as k,createElementBlock as x,normalizeClass as b,renderSlot as M,createElementVNode as T,unref as C,toDisplayString as B,createCommentVNode as O,normalizeStyle as P,withDirectives as E,mergeProps as S,toHandlers as D,createBlock as F,Teleport as R,createVNode as $,Transition as j,withCtx as z,withModifiers as A,vShow as H}from"vue";import{ao as L,as as _,ap as N,ar as X,ag as I,a6 as Y,al as W,z as q}from"./exports.js";import{p as V,b as Z,g as U,a as K}from"./diagramHeight.js";import{e as G}from"./mermaidSequenceSemicolons.js";import{M as J}from"./index2.js";import{safeRaf as Q}from"./utils/safeRaf.js";import{c as ee,g as te,f as ne}from"./workers-mermaidWorkerClient.js";import{toSafeSvgElement as le}from"stream-markdown-parser";const oe=["data-markstream-mode","data-markstream-pending"],re={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},ae={key:0},ie={key:1,class:"flex items-center gap-x-2 overflow-hidden"},ue=["innerHTML"],se={key:2},ce={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},de={class:"flex items-center gap-x-1"},ve={class:"flex items-center gap-x-1"},me={key:4},fe={key:5,class:"mermaid-header-actions flex items-center"},he=["aria-pressed"],ge={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:"action-icon"},pe={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:"action-icon"},we=["aria-label","disabled"],ye=["aria-label","disabled"],ke={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:"action-icon"},xe={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:"action-icon"},be={key:0,class:"mermaid-source-panel"},Me={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Te={key:1,class:"relative"},Ce={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Be={class:"flex items-center gap-2 backdrop-blur rounded-lg"},Oe={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Pe={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Ee="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",Se=/* @__PURE__ */q(/* @__PURE__ */c({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},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},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:l}){var o,r;const i=e,c=l,q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Se=d(!1),De=d("undefined"==typeof window),Fe=L(),Re=_(),$e=v(()=>i.isStrict?"strict":"loose"),je=v(()=>({startOnLoad:!1,securityLevel:$e.value,dompurifyConfig:"strict"===$e.value?q:void 0,flowchart:"strict"===$e.value?{htmlLabels:!1}:void 0}));function ze(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function Ae(e,t,n={}){if(!e)return null;const l=function(e,t){if(!e)return null;const n=le(t);if(!n)return null;const l=function(e,t){const n=Array.from(e.childNodes),l=document.createElement("div");return l.dataset.mermaidSvgLayer="1",l.style.zIndex="1",l.appendChild(t),e.insertBefore(l,e.firstChild),n.length>0&&function(e){const t=()=>{var t;for(const n of e)null==(t=n.parentNode)||t.removeChild(n)};"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>{requestAnimationFrame(t)}):setTimeout(t,32)}(n),l}(e,n);return{svg:n.outerHTML,bindTarget:l}}(e,t);return l||n.keepPreviousOnFailure||ze(e),l}let He=null;function Le(e){if(i.enableMermaidInteractions&&(null==e?void 0:e.querySelector("svg")))try{null==He||He(e)}catch(t){}}const{t:_e}=N();let Ne=!1,Xe=0;function Ie(){return s(this,null,function*(){try{const e=yield te();return Ne?null:(Se.value=!!e,e)}catch(e){throw Ne||(Se.value=!1),e}finally{Ne||(De.value=!0)}})}const Ye=d(!1),We=d(!1),qe=d(),Ve=d(),Ze=d(),Ue=d(),Ke=d(null),Ge=X(),Je=d(null),Qe=d("undefined"==typeof window||!Fe.value),et=m(),tt=f(J,null);let nt="",lt=0,ot=0;const rt=v(()=>I(i,et));function at(){const e=rt.value;e&&(nt&&nt!==e&&(null==tt||tt.markSettled(nt),lt=0),nt=e,lt+=1,ot+=1,1===lt&&(null==tt||tt.markPending(e)))}function it(){return s(this,null,function*(){const e=nt;if(!e)return;if(lt=Math.max(0,lt-1),lt>0)return;nt="";const t=++ot;yield p(),t===ot&&(function(e=rt.value){e&&qe.value&&(null==tt||tt.reportHeight(e,qe.value.offsetHeight))}(e),null==tt||tt.markSettled(e))})}function ut(){const e=nt;e&&(nt="",lt=0,ot+=1,null==tt||tt.markSettled(e))}const st=d(),ct=v(()=>i.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function dt(e,t=ct.value){const n=t,l={theme:"dark"===e?"dark":"default"};"strict"===$e.value&&(l.flowchart={htmlLabels:!1});const o=`%%{init: ${JSON.stringify(l)}}%%\n`;return n.trim().startsWith("%%{")?n:o+n}function vt(){var e;return function(e){const t=function(){var e;const t=Ve.value?getComputedStyle(Ve.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=V(t))?e:360}(),n=An();return K(e,t,n)}(null!=(e=V(i.estimatedPreviewHeightPx))?e:Z(ct.value))}function mt(){return`${vt()}px`}const ft=d(null);function ht(){var e;return!!(null==(e=Ze.value)?void 0:e.querySelector("svg"))}function gt(){return!1!==i.loading&&(ht()||!!ft.value)}const pt=d(1),wt=d(0),yt=d(0),kt=d(!1),xt=d({x:0,y:0}),bt=d(!0),Mt=d(!1),Tt=d(!1),Ct=d(null);let Bt="",Ot=!1,Pt="";const Et=d(0),St=d(!1),Dt=v(()=>{var e;return Math.max(0,null!=(e=i.renderDebounceMs)?e:300)}),Ft=v(()=>{var e;return Math.max(0,null!=(e=i.contentStableDelayMs)?e:500)}),Rt=v(()=>{var e;return Math.max(120,null!=(e=i.previewPollDelayMs)?e:800)}),$t=v(()=>{var e;return Math.max(Rt.value,null!=(e=i.previewPollMaxDelayMs)?e:4e3)}),jt=v(()=>{var e;return Math.max(1,Math.trunc(null!=(e=i.previewPollMaxAttempts)?e:12))}),zt=v(()=>!1!==i.loading);let At=null,Ht=null,Lt=null,_t=null,Nt=0;const Xt=null!=(o=globalThis.requestIdleCallback)?o:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),It=null!=(r=globalThis.cancelIdleCallback)?r:e=>clearTimeout(e);function Yt(e=Xe){return!Ne&&e===Xe}function Wt(){return Yt()&&Qe.value&&!We.value}function qt(){null!=Lt&&(globalThis.clearTimeout(Lt),Lt=null),null!=_t&&(It(_t),_t=null)}function Vt(){Ne||(qt(),Lt=globalThis.setTimeout(()=>{Lt=null,Wt()&&(_t=Xt(()=>{_t=null,Wt()&&il()},{timeout:500}))},Dt.value))}function Zt(){null!=Ht&&(globalThis.clearTimeout(Ht),Ht=null)}function Ut(e=600){if("undefined"==typeof globalThis||Ne)return;const t=Math.max(0,e);Zt(),Ht=globalThis.setTimeout(()=>{if(Ht=null,!Ne){if(i.loading||Tt.value||!Wt())return void Ut(Math.min(1200,Math.max(300,1.2*t)));Vt()}},t)}const Kt=d(mt()),Gt=d(Kt.value);let Jt=null;const Qt=d(!1),en=d(!1),tn=d({}),nn=d(0);let ln=null,on=null;const rn=d(!1),an=v(()=>{var e,t;return!(We.value||bt.value||De.value&&!Tt.value&&!Ct.value&&(Qt.value||rn.value&&Boolean(null==(t=null==(e=Ze.value)?void 0:e.textContent)?void 0:t.trim())))}),un=d({zoom:1,translateX:0,translateY:0,containerHeight:Kt.value}),sn=v(()=>i.enableWheelZoom?{wheel:Kn}:{}),cn=v(()=>{var e,t,n,l;return{worker:null!=(e=i.workerTimeoutMs)?e:1400,parse:null!=(t=i.parseTimeoutMs)?t:1800,render:null!=(n=i.renderTimeoutMs)?n:2500,fullRender:null!=(l=i.fullRenderTimeoutMs)?l:4e3}});let dn=null,vn=null,mn=!1,fn=Rt.value,hn=null,gn=0,pn=!0,wn=0;function yn(e,t){const n=null==t?void 0:t.timeoutMs,l=null==t?void 0:t.signal;if(null==l?void 0:l.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let o=null,r=!1,a=null;return new Promise((t,i)=>{const u=()=>{null!=o&&clearTimeout(o),a&&l&&l.removeEventListener("abort",a)};n&&n>0&&(o=globalThis.setTimeout(()=>{r||(r=!0,u(),i(new Error("Operation timed out")))},n)),l&&(a=()=>{r||(r=!0,u(),i(new DOMException("Aborted","AbortError")))},l.addEventListener("abort",a)),e().then(e=>{r||(r=!0,u(),t(e))}).catch(e=>{r||(r=!0,u(),i(e))})})}function kn(e){if("undefined"==typeof document)return;if(!Ze.value)return;if("function"==typeof i.onRenderError&&!0===i.onRenderError(e,ct.value,Ze.value))return rn.value=!0,void ul();const t=document.createElement("div");t.style.padding="var(--ms-inset-panel-body)",t.style.color="hsl(var(--ms-destructive))",t.textContent="Failed to render diagram: ";const n=document.createElement("span");n.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(n),ze(Ze.value),Ze.value.appendChild(t);const l=Ze.value?getComputedStyle(Ze.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";Kt.value=l||"360px",Gt.value=Kt.value,rn.value=!0,ul()}function xn(e){const t="string"==typeof e?e:"string"==typeof(null==e?void 0:e.message)?e.message:"";return"string"==typeof t&&/timed out/i.test(t)}function bn(e){return"AbortError"===(null==e?void 0:e.name)}function Mn(e){return!xn(e)&&!bn(e)}"undefined"!=typeof window&&h([()=>qe.value,Fe],([e,t])=>{var n;if(null==(n=Je.value)||n.destroy(),Je.value=null,!t||Qe.value)return void(Qe.value=!0);if(!e)return void(Qe.value=!1);const l=Ge(e,{rootMargin:null==Re?void 0:Re.value.heavyBlockMargin,allowIdle:!1});Je.value=l,Qe.value=l.isVisible.value,l.whenVisible.then(()=>{Qe.value=!0})},{immediate:!0}),g(()=>{var e;Ne=!0,Xe+=1,nn.value+=1,null==(e=Je.value)||e.destroy(),Je.value=null,ut(),qt()});const Tn=v(()=>!1!==i.showTooltips);function Cn(e){return!e||e.disabled}function Bn(e,t,n="top"){if(!Tn.value)return;if(Cn(e.currentTarget))return;const l=e,o=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;W(e.currentTarget,t,n,!1,o,i.isDark)}function On(){Tn.value&&Y()}function Pn(e){if(!Tn.value)return;if(Cn(e.currentTarget))return;const t=Ye.value?_e("common.copied")||"Copied":_e("common.copy")||"Copy",n=e,l=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;W(e.currentTarget,t,"top",!1,l,i.isDark)}function En(e,t){const n={theme:"dark"===t?"dark":"default"};"strict"===$e.value&&(n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function Sn(){return pn&&!bt.value&&!Qt.value&&!rn.value}function Dn(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function Fn(e){if("gantt"===U(e))return function(e){var t;const n=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&n.length>0&&n.pop();n.length>0;){const e=null==(t=n[n.length-1])?void 0:t.trim();if(e&&!e.startsWith("%%")){if(Dn(e))break;n.pop()}else n.pop()}return n.some(Dn)?n.join("\n"):""}(e);const t=e.split(/\r?\n/);for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}function Rn(e,t,n,l){return s(this,null,function*(){try{return yield yn(()=>e.render(t,n),{timeoutMs:l})}catch(o){if(!Mn(o))throw o;const a=G(n);if(a===n)throw o;try{return yield yn(()=>e.render(`${t}-retry`,a),{timeoutMs:l})}catch(r){throw o}}})}function $n(e,t,n){return s(this,null,function*(){var l;try{return yield ee(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:cn.value.worker,null==n?void 0:n.signal)}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o;if("WORKER_INIT_ERROR"===((null==o?void 0:o.code)||(null==o?void 0:o.name))||(null==o?void 0:o.fallbackToRenderer))return yield function(e,t,n){return s(this,null,function*(){var l,r,a,i;const u=yield Ie();if(!u)return;const s=u,c=En(e,t);if("function"==typeof s.parse){try{yield yn(()=>s.parse(c),{timeoutMs:null!=(l=null==n?void 0:n.timeoutMs)?l:cn.value.parse,signal:null==n?void 0:n.signal})}catch(o){if(!Mn(o))throw o;const t=G(c);if(t===c)throw o;try{yield yn(()=>s.parse(t),{timeoutMs:null!=(r=null==n?void 0:n.timeoutMs)?r:cn.value.parse,signal:null==n?void 0:n.signal})}catch(v){throw o}}return!0}const d=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;try{yield yn(()=>u.render(d,c),{timeoutMs:null!=(a=null==n?void 0:n.timeoutMs)?a:cn.value.render,signal:null==n?void 0:n.signal})}catch(o){if(!Mn(o))throw o;const t=G(c);if(t===c)throw o;try{yield yn(()=>u.render(`${d}-retry`,t),{timeoutMs:null!=(i=null==n?void 0:n.timeoutMs)?i:cn.value.render,signal:null==n?void 0:n.signal})}catch(v){throw o}}return!0})}(e,t,n);throw o}})}function jn(e,t,n){return s(this,null,function*(){var l;if("gantt"===U(e)){const l=Fn(e);if(!l.trim())return{fullOk:!1,prefixOk:!1};try{if(yield $n(l,t,n))return l===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:l}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}}try{if(yield $n(e,t,n))return{fullOk:!0,prefixOk:!1}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}let o=Fn(e);if(o&&o.trim()&&o!==e)try{try{const r=yield ne(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:cn.value.worker,null==n?void 0:n.signal);r&&r.trim()&&(o=r)}catch(r){}if(yield $n(o,t,n))return{fullOk:!1,prefixOk:!0,prefix:o}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}})}const zn=v(()=>bt.value||Tt.value||We.value);function An(){if("none"===i.maxHeight)return null;if(null!=i.maxHeight){const e=Number.parseFloat(String(i.maxHeight));if(Number.isFinite(e))return e}const e=Ve.value;if(e){const t=getComputedStyle(e).getPropertyValue("--ms-size-code-max-height").trim(),n=Number.parseFloat(t);if(Number.isFinite(n))return n}return 500}function Hn(e,t){if(!Ve.value||!Ze.value)return;const n=!(null==t?void 0:t.force)&&!1!==i.loading&&ht(),l=Ze.value.querySelector("svg");if(!l)return;let o=0,r=0;const a=l.getAttribute("viewBox"),u=l.getAttribute("width"),s=l.getAttribute("height");if(a){const e=a.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),r=Number.parseFloat(e[3]))}if(o&&r||u&&s&&(o=Number.parseFloat(u),r=Number.parseFloat(s)),Number.isNaN(o)||Number.isNaN(r)||o<=0||r<=0)try{const e=l.getBBox();e&&e.width>0&&e.height>0&&(o=e.width,r=e.height)}catch(c){return void console.error("Failed to get SVG BBox:",c)}if(o>0&&r>0){const t=r/o,a=null!=e?e:Ve.value.clientWidth,u=l.getBoundingClientRect().width,s=u>0?u:a,c=An(),d=s*t,v=null==c?d:Math.min(d,c),m=Math.max(v,vt());Gt.value=`${Math.max(d,m)}px`,n||null!=V(i.estimatedPreviewHeightPx)||(Kt.value=`${m}px`)}}const Ln=d(!1),_n=v(()=>({transform:`translate(${wt.value}px, ${yt.value}px) scale(${pt.value})`}));function Nn(e){"Escape"===e.key&&Ln.value&&In()}function Xn(){var e;if(!Ve.value||!Ue.value)return!1;if("1"===(null==(e=Ue.value.firstElementChild)?void 0:e.getAttribute("data-mermaid-modal-clone")))return!0;const t=Ve.value.cloneNode(!0);t.dataset.mermaidModalClone="1",t.classList.add("fullscreen"),t.style.height="100%",t.style.maxHeight="100%";const n=t.querySelector("[data-mermaid-wrapper]");return n&&(Ke.value=n,n.style.transform=_n.value.transform),ze(Ue.value),Ue.value.appendChild(t),Le(t),!0}function In(){if(Ln.value=!1,Ue.value&&ze(Ue.value),Ke.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",Nn)}catch(e){}}function Yn(){pt.value<3&&(pt.value+=.1)}function Wn(){pt.value>.5&&(pt.value-=.1)}function qn(){pt.value=1,wt.value=0,yt.value=0}function Vn(e){kt.value=!0,e instanceof MouseEvent?xt.value={x:e.clientX-wt.value,y:e.clientY-yt.value}:xt.value={x:e.touches[0].clientX-wt.value,y:e.touches[0].clientY-yt.value}}function Zn(e){if(!kt.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),wt.value=t-xt.value.x,yt.value=n-xt.value.y}function Un(){kt.value=!1}function Kn(e){if(i.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!Ve.value)return;const t=Ve.value.getBoundingClientRect(),n=e.clientX-t.left,l=e.clientY-t.top,o=n-t.width/2,r=l-t.height/2,a=(o-wt.value)/pt.value,i=(r-yt.value)/pt.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(pt.value+s,.5),3);c!==pt.value&&(wt.value=o-a*c,yt.value=r-i*c,pt.value=c)}}function Gn(){return s(this,null,function*(){try{const e=ct.value,t={payload:{type:"copy",text:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(c("copy",t),t.defaultPrevented)return;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),Ye.value=!0,setTimeout(()=>{Ye.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Jn(){var e;const t=null==(e=Ze.value)?void 0:e.querySelector("svg");if(!t)return void console.error("SVG element not found");const n=(new XMLSerializer).serializeToString(t),l={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:t,svgString:n};c("export",l),l.defaultPrevented||function(e,t=null){s(this,null,function*(){try{const l=null!=t?t:(new XMLSerializer).serializeToString(e),o=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o);if("undefined"!=typeof document){const e=document.createElement("a");e.href=r,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch(n){}URL.revokeObjectURL(r)}}catch(l){console.error("Failed to export SVG:",l)}})}(t,n)}function Qn(){var e,t;const n=null!=(t=null==(e=Ze.value)?void 0:e.querySelector("svg"))?t:null,l=n?(new XMLSerializer).serializeToString(n):null,o={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:l};c("openModal",o),o.defaultPrevented||function(){if(Ln.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",Nn)}catch(e){}p(()=>{Xn()||p(Xn)})}()}function el(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};c("toggleMode",e,t),t.defaultPrevented||tl(e)}function tl(e){return s(this,null,function*(){const t=st.value;if(!t)return Mt.value=!0,void(bt.value="source"===e);const n=t.getBoundingClientRect().height;t.style.height=`${n}px`,t.style.overflow="hidden",Mt.value=!0,bt.value="source"===e,yield p();const l=t.scrollHeight;t.style.transition="height var(--ms-duration-standard) var(--ms-ease-standard)",t.offsetHeight,t.style.height=`${l}px`;const o=()=>{t.style.transition="",t.style.height="",t.style.overflow="",t.removeEventListener("transitionend",r)};function r(){o()}t.addEventListener("transitionend",r),setTimeout(()=>o(),220)})}function nl(e=ct.value,t=(i.isDark?"dark":"light"),n=!1===i.loading){return{codeWithTheme:dt(t,e),final:n,signature:`${t}\0${e}`,theme:t}}function ll(e){return e.signature===nl().signature}function ol(){return s(this,arguments,function*(e=nl()){const l=Xe;if(!Yt(l)||!ll(e))return!1;if(Tt.value){const t=Ct.value,n=Ot,o=Bt;if(!t)return!1;const r=yield t;return!(!Yt(l)||!ll(e))&&(o===e.signature?!(!r||Pt!==e.signature)||!(!e.final||!1!==i.loading||n)&&ol(e):ol(e))}if(!Ze.value){if(yield p(),!Yt(l))return!1;if(!Ze.value)return console.warn("Mermaid container not ready"),!1}return!(!Yt(l)||!ll(e))&&(Tt.value=!0,Ot=e.final,Bt=e.signature,at(),Ct.value=s(null,null,function*(){var o,r,a,s;try{const c=yield Ie();if(!Yt(l)||!c)return!1;const d=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;Qt.value||en.value||null==(o=c.initialize)||o.call(c,(a=u({},je.value),s={dompurifyConfig:u({},q)},t(a,n(s))));const v=yield Rn(c,d,e.codeWithTheme,cn.value.fullRender);if(!Yt(l)||!ll(e))return en.value&&(en.value=!1),!1;if(!Ze.value)return!1;const m=Ae(Ze.value,null==v?void 0:v.svg,{keepPreviousOnFailure:!e.final||!1!==i.loading});if(!m)return en.value&&(en.value=!1),!1;const f=null!=(r=null==v?void 0:v.bindFunctions)?r:null;return He=f,Le(m.bindTarget),Qt.value||en.value||(Q(()=>Hn()),Qt.value=!0,un.value={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Kt.value}),tn.value[e.theme]={svg:m.svg,bindFunctions:f},en.value&&(en.value=!1),Pt=e.signature,ft.value=Ze.value.innerHTML,rn.value=!1,Nt=0,Zt(),!0}catch(c){if(!Yt(l)||!ll(e))return en.value&&(en.value=!1),!1;const t=xn(c),n=Nt+1;return t&&n<=3?(Nt=n,Ut(Math.min(1200,600*n))):(Nt=0,Zt(),e.final&&!1===i.loading&&console.error("Failed to render mermaid diagram:",c),e.final&&!1===i.loading&&kn(c)),!1}finally{Ot=!1,Bt="",Tt.value=!1,Ct.value=null,Yt(l)&&it()}}),Ct.value)})}function rl(){return s(this,null,function*(){var e;const t=ct.value;if(!t.trim()){if(gt())return;return Ze.value&&ze(Ze.value),ft.value=null,Pt="",void(rn.value=!1)}if(!Se.value||!Wt())return;const n=nl(t);Qt.value&&n.signature===Pt&&(null==(e=Ze.value)?void 0:e.querySelector("svg"))||(yield ol(n))&&(rn.value=!1)})}function al(e,t,n,l){return s(this,null,function*(){const o=Xe;if(!Yt(o)||!Sn())return;if(!Ze.value&&(yield p(),!Yt(o)||!Ze.value))return;if(Tt.value)return;Tt.value=!0,at();const r=nl(t,n),a=s(null,null,function*(){var t;try{const a=yield Ie();if(!Yt(o)||!a)return!1;const u=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,s=Fn(e),c=s&&s.trim()?s:e,d=yield Rn(a,u,En(c,n),cn.value.render);if(!Yt(o)||nn.value!==l||!1===i.loading||!Sn()||!ll(r))return!1;const v=null==d?void 0:d.svg;if(!Ze.value||!v)return!1;const m=Ae(Ze.value,v,{keepPreviousOnFailure:!0});return!!m&&(He=null!=(t=null==d?void 0:d.bindFunctions)?t:null,Le(m.bindTarget),Q(()=>Hn()),!1)}catch(u){return!1}finally{Ct.value===a&&(Tt.value=!1,Ct.value=null),Yt(o)&&it()}});return Ct.value=a,a})}function il(){return s(this,null,function*(){var e;if(!Wt())return;const t=Xe,n=Date.now(),l=++nn.value;at();try{ln&&ln.abort(),ln=new AbortController;const r=ln.signal,a=i.isDark?"dark":"light",u=ct.value;if(!u.trim()){if(gt())return;return Ze.value&&ze(Ze.value),ft.value=null,Pt="",void(rn.value=!1)}if(nl(u,a).signature===Pt)return;try{const e=yield jn(u,a,{signal:r,timeoutMs:cn.value.worker});if(!Yt(t))return;if(e.fullOk){if(r.aborted||nn.value!==l)return;if(!(yield ol(nl(u,a))))return;return void(Yt(t)&&nn.value===l&&(rn.value=!1))}const o=gn&&n<=gn;if(e.prefixOk&&e.prefix&&!r.aborted&&nn.value===l&&Sn()&&!o)return void(yield al(e.prefix,u,a,l))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}if(!Yt(t)||nn.value!==l)return;if(rn.value)return;const s=tn.value[a];if(s&&Ze.value){const t=Ae(Ze.value,s.svg);t&&(He=null!=(e=s.bindFunctions)?e:null,Le(t.bindTarget))}}finally{Yt(t)&&it()}})}function ul(){mn&&(mn=!1,fn=Rt.value,pn=!1,hn&&(hn.abort(),hn=null),dn&&(globalThis.clearTimeout(dn),dn=null),vn&&(It(vn),vn=null),gn=Date.now())}function sl(){if(ul(),qt(),ln){try{ln.abort()}catch(e){}ln=null}if(hn){try{hn.abort()}catch(e){}hn=null}Zt(),Nt=0}function cl(){null==on||on.abort(),on=null}function dl(e=Rt.value){mn&&(wn>=jt.value?ul():(dn&&globalThis.clearTimeout(dn),dn=globalThis.setTimeout(()=>{vn=Xt(()=>s(null,null,function*(){if(!mn)return;if(!Wt())return void ul();if(bt.value||Qt.value)return void ul();const e=i.isDark?"dark":"light",t=ct.value;if(!t.trim())return!1===i.loading?void ul():void dl(fn);if(wn++,wn>jt.value)ul();else{hn&&hn.abort(),hn=new AbortController;try{const n=yield jn(t,e,{signal:hn.signal,timeoutMs:cn.value.worker});if(n.fullOk){if((yield ol(nl(t,e)))&&Qt.value)return void ul()}else n.prefixOk&&n.prefix&&Sn()&&(yield al(n.prefix,t,e,nn.value))}catch(n){}fn=Math.min(Math.floor(1.5*fn),$t.value),dl(fn)}}),{timeout:500})},e)))}function vl(){mn||zt.value&&Se.value&&Wt()&&(bt.value||Qt.value||(mn=!0,gn=0,pn=!0,wn=0,fn=Rt.value,dl(fn)))}function ml(){return s(this,null,function*(){const e=Xe;Yt(e)&&(yield Ie().catch(t=>{Yt(e)&&(Se.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t))}),Yt(e)&&(yield p(),Yt(e)&&(Mt.value||(bt.value=!Se.value),Wt()&&(zt.value?(Vt(),Et.value=ct.value.length):bt.value||rl()))))})}return h(Ue,e=>{Ln.value&&e&&Xn()}),h(_n,e=>{Ln.value&&Ke.value&&(Ke.value.style.transform=e.transform)},{immediate:!0}),h(Tn,e=>{e||Y()}),h(()=>ct.value,e=>{if((e.trim()||!1===i.loading)&&(Qt.value=!1,tn.value={}),!zt.value)return ul(),void(Wt()&&!bt.value&&rl());Wt()&&Vt(),!bt.value&&Se.value&&Wt()?vl():ul(),function(){if(!zt.value)return;if(!bt.value)return;if(!Se.value)return;const e=ct.value.length;e!==Et.value&&(St.value=!0,Et.value=e,At&&clearTimeout(At),At=setTimeout(()=>{St.value&&bt.value&&ct.value.trim()&&(St.value=!1,tl("preview"))},Ft.value))}()}),h(()=>i.isDark,()=>s(null,null,function*(){var e;if(rn.value)return;const t=i.isDark?"dark":"light",n=tn.value[t];if(n){if(Ze.value){const t=Ae(Ze.value,n.svg);t&&(He=null!=(e=n.bindFunctions)?e:null,Le(t.bindTarget))}return}const l={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Kt.value},o=1!==pt.value||0!==wt.value||0!==yt.value;en.value=!0,o&&(pt.value=1,wt.value=0,yt.value=0,yield p()),yield ol(),o&&(yield p(),pt.value=l.zoom,wt.value=l.translateX,yt.value=l.translateY,Kt.value=l.containerHeight,un.value=l)})),h(()=>bt.value,e=>s(null,null,function*(){var t;if(e)ul(),Qt.value&&(un.value={zoom:pt.value,translateX:wt.value,translateY:yt.value,containerHeight:Kt.value});else{if(rn.value)return;const e=i.isDark?"dark":"light";if(Qt.value&&tn.value[e]){if(yield p(),Ze.value){const n=tn.value[e],l=Ae(Ze.value,n.svg);l&&(He=null!=(t=n.bindFunctions)?t:null,Le(l.bindTarget))}return pt.value=un.value.zoom,wt.value=un.value.translateX,yt.value=un.value.translateY,void(Kt.value=un.value.containerHeight)}if(yield p(),!Se.value||!Wt())return;if(!zt.value)return ul(),void(yield rl());vl(),yield il()}})),h(()=>i.loading,(e,t)=>s(null,null,function*(){var n;if(e)cl();else if(!0===t){cl();const e=ct.value,t=e.trim();if(!t)return Ze.value&&ze(Ze.value),ft.value=null,Pt="",rn.value=!1,sl();if(!Wt())return void sl();const r=i.isDark?"dark":"light",u=nl(e,r);if(Qt.value&&u.signature===Pt){if(yield p(),Ze.value&&!Ze.value.querySelector("svg")&&tn.value[r]){const e=tn.value[r],t=Ae(Ze.value,e.svg);t&&(He=null!=(n=e.bindFunctions)?n:null,Le(t.bindTarget))}return Hn(void 0,{force:!0}),void sl()}const s=new AbortController;on=s;try{let e=0;for(;;)try{yield $n(t,r,{signal:s.signal,timeoutMs:cn.value.worker});break}catch(l){const t="WORKER_BUSY"===(null==l?void 0:l.code)||"WORKER_TIMEOUT"===(null==l?void 0:l.code),n="WORKER_TIMEOUT"===(null==l?void 0:l.code)?2:8;if(!t||e>=n)throw l;const o=Math.min(50*a(2,e),400);e++,yield yn(()=>new Promise(e=>setTimeout(e,o)),{signal:s.signal})}if(!(yield ol(u)))return;rn.value=!1,sl()}catch(o){if(bn(o))return;sl(),kn(o)}finally{on===s&&(on=null)}}})),h(Ve,e=>{Jt&&Jt.disconnect(),e&&(Jt=new ResizeObserver(e=>{e&&e.length>0&&!bt.value&&!We.value&&Q(()=>{Hn(e[0].contentRect.width)})}),Jt.observe(e))},{immediate:!0}),w(()=>{Fe.value&&!Wt()||ml()}),h(()=>Se.value,e=>{Mt.value||(bt.value=!e)}),h(()=>i.maxHeight,()=>{p(()=>{Hn()})}),h([()=>i.estimatedPreviewHeightPx,()=>ct.value],()=>{Qt.value||ht()||bt.value||(Kt.value=mt(),Gt.value=Kt.value)}),h(()=>Qe.value,e=>s(null,null,function*(){e&&(De.value?(Qt.value||(zt.value?(Vt(),Et.value=ct.value.length):rl()),i.loading||Qt.value||rl(),!bt.value&&Se.value&&zt.value&&vl()):yield ml())}),{immediate:!1}),y(()=>{At&&clearTimeout(At),qt(),Jt&&Jt.disconnect(),ln&&(ln.abort(),ln=null),cl(),ul(),Zt(),ut()}),h(()=>We.value,e=>s(null,null,function*(){e?(ul(),ln&&ln.abort()):Wt()&&!Qt.value&&(yield p(),zt.value?(Vt(),vl()):bt.value||rl())}),{immediate:!1}),(e,t)=>(k(),x("div",{ref_key:"blockContainer",ref:qe,class:b(["mermaid-block-container rounded-lg border overflow-hidden",[{"is-rendering":i.loading,dark:i.isDark}]]),"data-markstream-mermaid":"1","data-markstream-mode":bt.value?"fallback":Qt.value?"preview":"pending","data-markstream-pending":an.value?"true":void 0},[i.showHeader?(k(),x("div",re,[e.$slots["header-left"]?(k(),x("div",ae,[M(e.$slots,"header-left",{},void 0,!0)])):(k(),x("div",ie,[T("span",{class:"icon-slot action-icon shrink-0",innerHTML:C('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n')},null,8,ue),t[21]||(t[21]=T("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate"},"Mermaid",-1))])),e.$slots["header-center"]?(k(),x("div",se,[M(e.$slots,"header-center",{},void 0,!0)])):i.showModeToggle&&Se.value?(k(),x("div",ce,[T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[bt.value?"":"is-active"]]),onClick:t[0]||(t[0]=()=>el("preview")),onMouseenter:t[1]||(t[1]=e=>Bn(e,C(_e)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>Bn(e,C(_e)("common.preview")||"Preview")),onMouseleave:On,onBlur:On},[T("div",de,[t[22]||(t[22]=T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),T("circle",{cx:"12",cy:"12",r:"3"})])],-1)),T("span",null,B(C(_e)("common.preview")||"Preview"),1)])],34),T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[bt.value?"is-active":""]]),onClick:t[3]||(t[3]=()=>el("source")),onMouseenter:t[4]||(t[4]=e=>Bn(e,C(_e)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>Bn(e,C(_e)("common.source")||"Source")),onMouseleave:On,onBlur:On},[T("div",ve,[t[23]||(t[23]=T("svg",{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:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),T("span",null,B(C(_e)("common.source")||"Source"),1)])],34)])):O("",!0),e.$slots["header-right"]?(k(),x("div",me,[M(e.$slots,"header-right",{},void 0,!0)])):(k(),x("div",fe,[i.showCollapseButton?(k(),x("button",{key:0,class:b(Ee),"aria-pressed":We.value,onClick:t[6]||(t[6]=e=>We.value=!We.value),onMouseenter:t[7]||(t[7]=e=>Bn(e,We.value?C(_e)("common.expand")||"Expand":C(_e)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>Bn(e,We.value?C(_e)("common.expand")||"Expand":C(_e)("common.collapse")||"Collapse")),onMouseleave:On,onBlur:On},[(k(),x("svg",{style:P({rotate:We.value?"0deg":"90deg"}),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:"action-icon"},[...t[24]||(t[24]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,he)):O("",!0),i.showCopyButton?(k(),x("button",{key:1,class:b(Ee),onClick:Gn,onMouseenter:t[9]||(t[9]=e=>Pn(e)),onFocus:t[10]||(t[10]=e=>Pn(e)),onMouseleave:On,onBlur:On},[Ye.value?(k(),x("svg",pe,[...t[26]||(t[26]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(k(),x("svg",ge,[...t[25]||(t[25]=[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),T("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):O("",!0),i.showExportButton&&Se.value?(k(),x("button",{key:2,class:b(`${Ee} ${zn.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":C(_e)("common.export")||"Export",disabled:zn.value,onClick:Jn,onMouseenter:t[11]||(t[11]=e=>Bn(e,C(_e)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>Bn(e,C(_e)("common.export")||"Export")),onMouseleave:On,onBlur:On},[...t[27]||(t[27]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),T("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,we)):O("",!0),i.showFullscreenButton&&Se.value?(k(),x("button",{key:3,class:b(`${Ee} ${zn.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":Ln.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open",disabled:zn.value,onClick:Qn,onMouseenter:t[13]||(t[13]=e=>Bn(e,Ln.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>Bn(e,Ln.value?C(_e)("common.minimize")||"Minimize":C(_e)("common.open")||"Open")),onMouseleave:On,onBlur:On},[Ln.value?(k(),x("svg",xe,[...t[29]||(t[29]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(k(),x("svg",ke,[...t[28]||(t[28]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,ye)):O("",!0)]))])):O("",!0),E(T("div",{ref_key:"modeContainerRef",ref:st},[bt.value?(k(),x("div",be,[T("pre",Me,B(ct.value),1)])):(k(),x("div",Te,[i.showZoomControls?(k(),x("div",Ce,[T("div",Be,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Yn,onMouseenter:t[15]||(t[15]=e=>Bn(e,C(_e)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>Bn(e,C(_e)("common.zoomIn")||"Zoom in")),onMouseleave:On,onBlur:On},[...t[30]||(t[30]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Wn,onMouseenter:t[17]||(t[17]=e=>Bn(e,C(_e)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>Bn(e,C(_e)("common.zoomOut")||"Zoom out")),onMouseleave:On,onBlur:On},[...t[31]||(t[31]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] text-[length:var(--ms-text-label)] rounded transition-colors",onClick:qn,onMouseenter:t[19]||(t[19]=e=>Bn(e,C(_e)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>Bn(e,C(_e)("common.resetZoom")||"Reset zoom")),onMouseleave:On,onBlur:On},B(Math.round(100*pt.value))+"% ",33)])])):O("",!0),T("div",S({ref_key:"mermaidContainer",ref:Ve,class:"mermaid-preview-area relative overflow-hidden block transition-[height] ease-out",style:{height:Kt.value}},D(sn.value,!0),{onMousedown:Vn,onMousemove:Zn,onMouseup:Un,onMouseleave:Un,onTouchstartPassive:Vn,onTouchmovePassive:Zn,onTouchendPassive:Un}),[T("div",{"data-mermaid-wrapper":"",class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":kt.value}]),style:P(_n.value)},[T("div",{ref_key:"mermaidContent",ref:Ze,class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:P({height:Gt.value})},null,4)],6)],16),(k(),F(R,{to:"body"},[T("div",{class:b(["markstream-vue",{dark:i.isDark}])},[$(j,{name:"mermaid-dialog",appear:""},{default:z(()=>[Ln.value?(k(),x("div",{key:0,class:"mermaid-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:A(In,["self"])},[T("div",Oe,[T("div",Pe,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Yn},[...t[32]||(t[32]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Wn},[...t[33]||(t[33]=[T("svg",{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:"action-icon"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] text-[length:var(--ms-text-label)] rounded transition-colors",onClick:qn},B(Math.round(100*pt.value))+"% ",1),T("button",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:In},[...t[34]||(t[34]=[T("svg",{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:"action-icon"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),T("div",S({ref_key:"modalContent",ref:Ue,class:"w-full h-full flex items-center justify-center p-4 overflow-hidden"},D(sn.value,!0),{onMousedown:Vn,onMousemove:Zn,onMouseup:Un,onMouseleave:Un,onTouchstartPassive:Vn,onTouchmovePassive:Zn,onTouchendPassive:Un}),null,16)])])):O("",!0)]),_:1})],2)]))]))],512),[[H,!We.value]])],10,oe))}}),[["__scopeId","data-v-4bb0e77b"]]);Se.install=e=>{e.component(Se.__name,Se)};export{Se as default};
package/dist/index2.js CHANGED
@@ -1 +1 @@
1
- var t=(t,s,v)=>new Promise((l,a)=>{var h=t=>{try{n(v.next(t))}catch(s){a(s)}},e=t=>{try{n(v.throw(t))}catch(s){a(s)}},n=t=>t.done?l(t.value):Promise.resolve(t.value).then(h,e);n((v=v.apply(t,s)).next())});import{inject as s,shallowRef as v}from"vue";import"stream-markdown-parser";const l=/* @__PURE__ */Symbol.for("markstream-vue:node-lifecycle");function a(){return s(l,null)}const h='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',e='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',n={id:"material",core:{"":e,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:e,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:h,csharp:h,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(t=>t.materialExtendedMap)},c=/* @__PURE__ */new Map;let i="material";const o=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let w=null;function p(t){c.set(t.id,t)}function g(t){if(!c.has(t))throw new Error(`[markstream-vue] Unknown icon theme: "${t}". Registered: ${[...c.keys()].join(", ")}`);i=t,null==w||w();const s=c.get(t);s.loadExtended&&!o.has(t)&&u(s)}function m(){return[...c.keys()]}function d(t){const s=c.get(i);if(!s)return;const v=s.core[t];if(v)return v;const l=o.get(s.id);if(l){const s=l[t];if(s)return s}s.loadExtended&&!o.has(s.id)&&u(s)}function f(){var t,s;return null!=(s=null==(t=c.get(i))?void 0:t.fallback)?s:""}function u(s){return t(this,null,function*(){var t,v,l;if(o.has(s.id))return null!=(t=o.get(s.id))?t:null;let a=r.get(s.id);return a||(a=(null!=(l=null==(v=s.loadExtended)?void 0:v.call(s))?l:Promise.resolve(null)).then(t=>(o.set(s.id,t),null==w||w(),t)).catch(()=>(o.set(s.id,null),null)),r.set(s.id,a)),a})}let x=null;const M=v(0);w=()=>{M.value++},p(n);const H={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function z(t){x=null!=t?t:null}function A(t){var s;const v=function(t){if(!t)return"";const s=t.trim();if(!s)return"";const[v]=s.split(/\s+/),[l]=v.split(":");return l.toLowerCase()}(t);return null!=(s=H[v])?s:v}function j(t){const s=A(t);if(!s)return"plaintext";switch(s){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return s}}function y(){return t(this,null,function*(){yield function(){return t(this,null,function*(){const t=c.get(i);(null==t?void 0:t.loadExtended)&&(yield u(t))})}()})}function B(t){if(x){const s=x(t);if(null!=s&&""!==s)return s}return d(A(t))||f()}const V={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};let b=!1;function q(){return b}function C(){b=!0}function k(){return t(this,null,function*(){const{preloadCodeBlockRuntime:t}=yield import("./monaco.js");return t()})}function L(){return t(this,null,function*(){const{getUseMonaco:t}=yield import("./monaco.js");return t()})}export{l as M,m as a,f as b,L as c,V as d,y as e,d as f,B as g,j as h,q as i,z as j,M as l,C as m,A as n,k as p,p as r,g as s,a as u};
1
+ var t=(t,s,v)=>new Promise((l,a)=>{var h=t=>{try{n(v.next(t))}catch(s){a(s)}},e=t=>{try{n(v.throw(t))}catch(s){a(s)}},n=t=>t.done?l(t.value):Promise.resolve(t.value).then(h,e);n((v=v.apply(t,s)).next())});import{inject as s,shallowRef as v}from"vue";import"stream-markdown-parser";const l=/* @__PURE__ */Symbol.for("markstream-vue:node-lifecycle");function a(){return s(l,null)}let h=!1;function e(){return h}function n(){h=!0}const c=/* @__PURE__ */new Map;let i="material";const o=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let w=null;function p(t){c.set(t.id,t)}function g(t){if(!c.has(t))throw new Error(`[markstream-vue] Unknown icon theme: "${t}". Registered: ${[...c.keys()].join(", ")}`);i=t,null==w||w();const s=c.get(t);s.loadExtended&&!o.has(t)&&u(s)}function m(){return[...c.keys()]}function d(t){const s=c.get(i);if(!s)return;const v=s.core[t];if(v)return v;const l=o.get(s.id);if(l){const s=l[t];if(s)return s}s.loadExtended&&!o.has(s.id)&&u(s)}function f(){var t,s;return null!=(s=null==(t=c.get(i))?void 0:t.fallback)?s:""}function u(s){return t(this,null,function*(){var t,v,l;if(o.has(s.id))return null!=(t=o.get(s.id))?t:null;let a=r.get(s.id);return a||(a=(null!=(l=null==(v=s.loadExtended)?void 0:v.call(s))?l:Promise.resolve(null)).then(t=>(o.set(s.id,t),null==w||w(),t)).catch(()=>(o.set(s.id,null),null)),r.set(s.id,a)),a})}const x='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',M='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',H={id:"material",core:{"":M,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:M,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:x,csharp:x,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(t=>t.materialExtendedMap)};let z=null;const A=v(0);w=()=>{A.value++},p(H);const j={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function y(t){z=null!=t?t:null}function B(t){var s;const v=function(t){if(!t)return"";const s=t.trim();if(!s)return"";const[v]=s.split(/\s+/),[l]=v.split(":");return l.toLowerCase()}(t);return null!=(s=j[v])?s:v}function V(t){const s=B(t);if(!s)return"plaintext";switch(s){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return s}}function b(){return t(this,null,function*(){yield function(){return t(this,null,function*(){const t=c.get(i);(null==t?void 0:t.loadExtended)&&(yield u(t))})}()})}function q(t){if(z){const s=z(t);if(null!=s&&""!==s)return s}return d(B(t))||f()}const C={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};function k(){return t(this,null,function*(){const{preloadCodeBlockRuntime:t}=yield import("./monaco.js");return t()})}function L(){return t(this,null,function*(){const{getUseMonaco:t}=yield import("./monaco.js");return t()})}export{l as M,m as a,f as b,L as c,C as d,b as e,d as f,q as g,V as h,e as i,y as j,A as l,n as m,B as n,k as p,p as r,g as s,a as u};
package/dist/index6.js CHANGED
@@ -1 +1 @@
1
- var e=(e,n,l)=>new Promise((a,t)=>{var o=e=>{try{u(l.next(e))}catch(n){t(n)}},r=e=>{try{u(l.throw(e))}catch(n){t(n)}},u=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,r);u((l=l.apply(e,n)).next())});import{defineComponent as n,ref as l,inject as a,computed as t,getCurrentInstance as o,watch as r,onMounted as u,onBeforeUnmount as i,openBlock as d,createElementBlock as v,normalizeStyle as s,unref as c,createVNode as m,Transition as f,withCtx as h,createElementVNode as g,createCommentVNode as p,normalizeClass as k,toDisplayString as y,nextTick as x}from"vue";import{aj as w,an as b,ab as _,ai as S,am as R,ao as T,z as M}from"./exports.js";import{M as E}from"./index2.js";import{n as O,f as H,k as K,j as I,b as j,W}from"./workers-katexWorkerClient.js";const $=["data-markstream-mode","data-markstream-pending","data-markstream-viewport-pending"],z={key:0,class:"math-loading-overlay"},A=["innerHTML"],B={key:1,class:"math-block__fallback text-left"},L=/* @__PURE__ */M(/* @__PURE__ */n({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(n){var M,L;const N=n,P=l(null),C=a(E,null),D=t(()=>O(N.node.content)),F=1===(null==(L=null==(M=o())?void 0:M.vnode.el)?void 0:L.nodeType),U=w(),V=b(),X=l("undefined"==typeof window||F||!U.value),q=t(()=>_(N,{})),G=function(){if(!N.node.content)return{html:"",text:N.node.raw,loading:!1};if(N.node.loading)return{html:"",text:"",loading:!0};const e="undefined"==typeof window||F||!U.value?H():null;if(!e)return{html:"",text:N.node.loading?"":N.node.raw,loading:N.node.loading};try{const n=e.renderToString(D.value,{throwOnError:!1,displayMode:!0});return K(D.value,!0,n),{html:n,text:"",loading:!1}}catch(n){return{html:"",text:N.node.loading?"":N.node.raw,loading:N.node.loading}}}(),J=l(G.html),Q=l(G.text);let Y=!1,Z=0,ee=!1,ne=null;const le=S(),ae=R();let te=null,oe=null,re="";const ue=l(G.loading),ie=l(!1),de=l(ce());function ve(e){null!=e&&e!==Z||(ie.value=!1)}function se(){var e;if(null==N.indexKey)return"";const n=null!=(e=N.cacheScope)?e:null==le?void 0:le.scope;return`${null!=n&&String(n).length>0?`${String(n)}:`:""}math-block:${String(N.indexKey)}`}function ce(){var e;const n=se();return n&&null!=(e=null==le?void 0:le.cache.get(n))?e:0}function me(){if(0===de.value)return;de.value=0;const e=se();e&&(null==le||le.cache.set(e,0))}function fe(e){if(J.value)return void me();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(de.value,e);if(n===de.value)return;de.value=n;const l=se();l&&(null==le||le.cache.set(l,n))}function he(){x(()=>{var e,n;fe(null!=(n=null==(e=P.value)?void 0:e.offsetHeight)?n:0)})}function ge(){const e=re;C&&e&&(re="",C.markSettled(e))}function pe(){return e(this,null,function*(){if(ee)return ge(),void ve();ne&&(ne.abort(),ne=null);const n=++Z;if(!N.node.content)return ge(),ve(),ue.value=!1,J.value="",Q.value=N.node.raw,Y=!1,void he();const l=new AbortController;if(ne=l,ie.value=!0,!Y&&U.value)try{!te&&P.value&&(te=ae(P.value,{rootMargin:null==V?void 0:V.value.heavyBlockMargin,allowIdle:!1}),X.value=te.isVisible.value),yield T(te,l.signal),X.value=!0}catch(a){}else U.value||(X.value=!0);ee||n!==Z||l.signal.aborted?ee||ve(n):(function(){const e=q.value;C&&e&&re!==e&&(re&&C.markSettled(re),re=e,C.markPending(e))}(),I(D.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:l.signal}).then(e=>{ee||n!==Z||(J.value=e,Q.value="",Y=!0,ue.value=!1,me(),he())}).catch(l=>e(null,null,function*(){if(ee||n!==Z)return;const e=(null==l?void 0:l.code)||(null==l?void 0:l.name),t="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==l?void 0:l.fallbackToRenderer)||(e===W||"WORKER_TIMEOUT"===e)&&!N.node.loading){const e=yield j();if(ee||n!==Z)return;if(e){try{const n=e.renderToString(D.value,{throwOnError:N.node.loading,displayMode:!0});J.value=n,Q.value="",Y=!0,ue.value=!1,me(),he(),K(D.value,!0,n)}catch(a){}return}}if(t||!N.node.loading)return ue.value=!1,J.value="",Q.value=N.node.raw,void he();Y||(ue.value=!0)})).finally(()=>{ee||n!==Z||(ve(n),function(){const e=re;C&&e&&(re="",x(()=>{var n,l;if(!ee){const a=null!=(l=null==(n=P.value)?void 0:n.offsetHeight)?l:0;a>0&&C.reportHeight(e,a)}C.markSettled(e)}))}())}))})}return G.html&&(Y=!0),G.html&&me(),r(()=>[N.node.content,N.node.loading,N.node.raw],()=>{pe()},{flush:"post"}),r([()=>N.indexKey,()=>N.cacheScope],()=>{de.value=ce(),he()}),u(()=>{"undefined"!=typeof ResizeObserver&&P.value&&(oe=new ResizeObserver(()=>{var e,n;fe(null!=(n=null==(e=P.value)?void 0:e.offsetHeight)?n:0)}),oe.observe(P.value)),he(),J.value||pe()}),i(()=>{var e;ee=!0,ge(),ne&&(ne.abort(),ne=null),null==oe||oe.disconnect(),oe=null,null==(e=null==te?void 0:te.destroy)||e.call(te),te=null}),(e,n)=>(d(),v("div",{ref_key:"containerEl",ref:P,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":J.value?"katex":Q.value?"fallback":"loading","data-markstream-pending":ie.value?"true":void 0,"data-markstream-viewport-pending":c(U)&&!X.value?"true":void 0,style:s(de.value?{minHeight:`${de.value}px`}:void 0)},[m(f,{name:"math-fade"},{default:h(()=>[!ue.value||J.value||Q.value?p("",!0):(d(),v("div",z,[...n[0]||(n[0]=[g("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),J.value?(d(),v("div",{key:0,class:k(["math-block__content",{"math-rendering":ue.value}]),innerHTML:J.value},null,10,A)):Q.value?(d(),v("pre",B,y(Q.value),1)):(d(),v("div",{key:2,class:k(["math-block__content",{"math-rendering":ue.value}])},null,2))],12,$))}}),[["__scopeId","data-v-6a85ddf7"]]);L.install=e=>{e.component(L.__name,L)};export{L as default};
1
+ var e=(e,n,l)=>new Promise((a,t)=>{var o=e=>{try{u(l.next(e))}catch(n){t(n)}},r=e=>{try{u(l.throw(e))}catch(n){t(n)}},u=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,r);u((l=l.apply(e,n)).next())});import{defineComponent as n,ref as l,inject as a,computed as t,getCurrentInstance as o,watch as r,onMounted as u,onBeforeUnmount as i,openBlock as d,createElementBlock as v,normalizeStyle as s,unref as c,createVNode as f,Transition as m,withCtx as h,createElementVNode as g,createCommentVNode as p,normalizeClass as k,toDisplayString as y,nextTick as x}from"vue";import{ao as w,as as b,ag as _,an as S,ar as R,at as T,z as M}from"./exports.js";import{M as E}from"./index2.js";import{n as O,f as H,k as K,j as I,b as j,W}from"./workers-katexWorkerClient.js";const $=["data-markstream-mode","data-markstream-pending","data-markstream-viewport-pending"],z={key:0,class:"math-loading-overlay"},A=["innerHTML"],B={key:1,class:"math-block__fallback text-left"},L=/* @__PURE__ */M(/* @__PURE__ */n({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(n){var M,L;const N=n,P=l(null),C=a(E,null),D=t(()=>O(N.node.content)),F=1===(null==(L=null==(M=o())?void 0:M.vnode.el)?void 0:L.nodeType),U=w(),V=b(),X=l("undefined"==typeof window||F||!U.value),q=t(()=>_(N,{})),G=function(){if(!N.node.content)return{html:"",text:N.node.raw,loading:!1};if(N.node.loading)return{html:"",text:"",loading:!0};const e="undefined"==typeof window||F||!U.value?H():null;if(!e)return{html:"",text:N.node.loading?"":N.node.raw,loading:N.node.loading};try{const n=e.renderToString(D.value,{throwOnError:!1,displayMode:!0});return K(D.value,!0,n),{html:n,text:"",loading:!1}}catch(n){return{html:"",text:N.node.loading?"":N.node.raw,loading:N.node.loading}}}(),J=l(G.html),Q=l(G.text);let Y=!1,Z=0,ee=!1,ne=null;const le=S(),ae=R();let te=null,oe=null,re="";const ue=l(G.loading),ie=l(!1),de=l(ce());function ve(e){null!=e&&e!==Z||(ie.value=!1)}function se(){var e;if(null==N.indexKey)return"";const n=null!=(e=N.cacheScope)?e:null==le?void 0:le.scope;return`${null!=n&&String(n).length>0?`${String(n)}:`:""}math-block:${String(N.indexKey)}`}function ce(){var e;const n=se();return n&&null!=(e=null==le?void 0:le.cache.get(n))?e:0}function fe(){if(0===de.value)return;de.value=0;const e=se();e&&(null==le||le.cache.set(e,0))}function me(e){if(J.value)return void fe();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(de.value,e);if(n===de.value)return;de.value=n;const l=se();l&&(null==le||le.cache.set(l,n))}function he(){x(()=>{var e,n;me(null!=(n=null==(e=P.value)?void 0:e.offsetHeight)?n:0)})}function ge(){const e=re;C&&e&&(re="",C.markSettled(e))}function pe(){return e(this,null,function*(){if(ee)return ge(),void ve();ne&&(ne.abort(),ne=null);const n=++Z;if(!N.node.content)return ge(),ve(),ue.value=!1,J.value="",Q.value=N.node.raw,Y=!1,void he();const l=new AbortController;if(ne=l,ie.value=!0,!Y&&U.value)try{!te&&P.value&&(te=ae(P.value,{rootMargin:null==V?void 0:V.value.heavyBlockMargin,allowIdle:!1}),X.value=te.isVisible.value),yield T(te,l.signal),X.value=!0}catch(a){}else U.value||(X.value=!0);ee||n!==Z||l.signal.aborted?ee||ve(n):(function(){const e=q.value;C&&e&&re!==e&&(re&&C.markSettled(re),re=e,C.markPending(e))}(),I(D.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:l.signal}).then(e=>{ee||n!==Z||(J.value=e,Q.value="",Y=!0,ue.value=!1,fe(),he())}).catch(l=>e(null,null,function*(){if(ee||n!==Z)return;const e=(null==l?void 0:l.code)||(null==l?void 0:l.name),t="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==l?void 0:l.fallbackToRenderer)||(e===W||"WORKER_TIMEOUT"===e)&&!N.node.loading){const e=yield j();if(ee||n!==Z)return;if(e){try{const n=e.renderToString(D.value,{throwOnError:N.node.loading,displayMode:!0});J.value=n,Q.value="",Y=!0,ue.value=!1,fe(),he(),K(D.value,!0,n)}catch(a){}return}}if(t||!N.node.loading)return ue.value=!1,J.value="",Q.value=N.node.raw,void he();Y||(ue.value=!0)})).finally(()=>{ee||n!==Z||(ve(n),function(){const e=re;C&&e&&(re="",x(()=>{var n,l;if(!ee){const a=null!=(l=null==(n=P.value)?void 0:n.offsetHeight)?l:0;a>0&&C.reportHeight(e,a)}C.markSettled(e)}))}())}))})}return G.html&&(Y=!0),G.html&&fe(),r(()=>[N.node.content,N.node.loading,N.node.raw],()=>{pe()},{flush:"post"}),r([()=>N.indexKey,()=>N.cacheScope],()=>{de.value=ce(),he()}),u(()=>{"undefined"!=typeof ResizeObserver&&P.value&&(oe=new ResizeObserver(()=>{var e,n;me(null!=(n=null==(e=P.value)?void 0:e.offsetHeight)?n:0)}),oe.observe(P.value)),he(),J.value||pe()}),i(()=>{var e;ee=!0,ge(),ne&&(ne.abort(),ne=null),null==oe||oe.disconnect(),oe=null,null==(e=null==te?void 0:te.destroy)||e.call(te),te=null}),(e,n)=>(d(),v("div",{ref_key:"containerEl",ref:P,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":J.value?"katex":Q.value?"fallback":"loading","data-markstream-pending":ie.value?"true":void 0,"data-markstream-viewport-pending":c(U)&&!X.value?"true":void 0,style:s(de.value?{minHeight:`${de.value}px`}:void 0)},[f(m,{name:"math-fade"},{default:h(()=>[!ue.value||J.value||Q.value?p("",!0):(d(),v("div",z,[...n[0]||(n[0]=[g("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),J.value?(d(),v("div",{key:0,class:k(["math-block__content",{"math-rendering":ue.value}]),innerHTML:J.value},null,10,A)):Q.value?(d(),v("pre",B,y(Q.value),1)):(d(),v("div",{key:2,class:k(["math-block__content",{"math-rendering":ue.value}])},null,2))],12,$))}}),[["__scopeId","data-v-6a85ddf7"]]);L.install=e=>{e.component(L.__name,L)};export{L as default};
package/dist/index7.js CHANGED
@@ -1 +1 @@
1
- var e=(e,a,n)=>new Promise((l,o)=>{var t=e=>{try{i(n.next(e))}catch(a){o(a)}},r=e=>{try{i(n.throw(e))}catch(a){o(a)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(t,r);i((n=n.apply(e,a)).next())});import{defineComponent as a,ref as n,computed as l,getCurrentInstance as o,watch as t,onMounted as r,onBeforeUnmount as i,openBlock as d,createElementBlock as u,unref as s,toDisplayString as v,createBlock as m,Transition as c,withCtx as g,createElementVNode as p,renderSlot as f,createCommentVNode as h}from"vue";import{aj as k,an as w,am as y,ao as _,z as x}from"./exports.js";import{n as T,f as b,k as E,j as R,b as M,W as I}from"./workers-katexWorkerClient.js";const O=["data-markstream-mode","data-markstream-pending","data-markstream-viewport-pending"],L=["innerHTML"],j={key:1,class:"math-inline math-inline--fallback"},W={class:"math-inline__loading",role:"status","aria-live":"polite"},A=/* @__PURE__ */x(/* @__PURE__ */a({__name:"MathInlineNode",props:{node:{}},setup(a){var x,A;const K=a,S=n(null),$=l(()=>"$$"===K.node.markup),C=l(()=>T(K.node.content)),D=1===(null==(A=null==(x=o())?void 0:x.vnode.el)?void 0:A.nodeType),H=k(),N=w(),P=n("undefined"==typeof window||D||!H.value),z=function(){if(!K.node.content)return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading};if(K.node.loading)return{html:"",text:"",loading:!0};const e="undefined"==typeof window||D||!H.value?b():null;if(!e)return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading};try{const a=e.renderToString(C.value,{throwOnError:!1,displayMode:$.value});return E(C.value,$.value,a),{html:a,text:"",loading:!1}}catch(a){return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading}}}(),B=n(z.html),U=n(z.text);let V=!1,X=0,q=!1,F=null;const G=n(z.loading),J=n(!1),Q=y();let Y=null;function Z(e){null!=e&&e!==X||(J.value=!1)}function ee(){return e(this,null,function*(){if(q)return;F&&(F.abort(),F=null);const a=++X;if(!K.node.content)return Z(),B.value="",U.value=K.node.loading?"":K.node.raw,G.value=K.node.loading,void(V=!1);const n=new AbortController;if(F=n,J.value=!0,!V&&H.value)try{!Y&&S.value&&(Y=Q(S.value,{rootMargin:null==N?void 0:N.value.rootMargin,allowIdle:!1}),P.value=Y.isVisible.value),yield _(Y,n.signal),P.value=!0}catch(l){}else H.value||(P.value=!0);q||a!==X||n.signal.aborted?Z(a):R(C.value,$.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(e=>{q||a!==X||(B.value=e,U.value="",G.value=!1,V=!0)}).catch(n=>e(null,null,function*(){if(q||a!==X)return;const e=(null==n?void 0:n.code)||(null==n?void 0:n.name),o="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==n?void 0:n.fallbackToRenderer)||(e===I||"WORKER_TIMEOUT"===e)&&!K.node.loading){const e=yield M();if(q||a!==X)return;if(e){try{const a=e.renderToString(C.value,{throwOnError:K.node.loading,displayMode:$.value});B.value=a,U.value="",G.value=!1,V=!0,E(C.value,$.value,a)}catch(l){}return}}if(o||!K.node.loading)return G.value=!1,B.value="",void(U.value=K.node.raw);V||(G.value=!0)})).finally(()=>{q||Z(a)})})}return z.html&&(V=!0),t(()=>[K.node.content,K.node.loading,K.node.raw,K.node.markup],()=>{ee()}),r(()=>{B.value||ee()}),i(()=>{var e;q=!0,F&&(F.abort(),F=null),null==(e=null==Y?void 0:Y.destroy)||e.call(Y),Y=null}),(e,a)=>(d(),u("span",{ref_key:"containerEl",ref:S,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":B.value?"katex":U.value?"fallback":"loading","data-markstream-pending":J.value?"true":void 0,"data-markstream-viewport-pending":s(H)&&!P.value?"true":void 0},[B.value?(d(),u("span",{key:0,class:"math-inline",innerHTML:B.value},null,8,L)):U.value?(d(),u("span",j,v(U.value),1)):G.value?(d(),m(c,{key:2,name:"table-node-fade"},{default:g(()=>[p("span",W,[f(e.$slots,"loading",{isLoading:G.value},()=>[a[0]||(a[0]=p("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),a[1]||(a[1]=p("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):h("",!0)],8,O))}}),[["__scopeId","data-v-79d81e75"]]);A.install=e=>{e.component(A.__name,A)};export{A as default};
1
+ var e=(e,a,n)=>new Promise((l,t)=>{var o=e=>{try{i(n.next(e))}catch(a){t(a)}},r=e=>{try{i(n.throw(e))}catch(a){t(a)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(o,r);i((n=n.apply(e,a)).next())});import{defineComponent as a,ref as n,computed as l,getCurrentInstance as t,watch as o,onMounted as r,onBeforeUnmount as i,openBlock as d,createElementBlock as u,unref as s,toDisplayString as v,createBlock as m,Transition as c,withCtx as g,createElementVNode as p,renderSlot as f,createCommentVNode as h}from"vue";import{ao as k,as as w,ar as y,at as _,z as x}from"./exports.js";import{n as T,f as b,k as E,j as R,b as M,W as I}from"./workers-katexWorkerClient.js";const O=["data-markstream-mode","data-markstream-pending","data-markstream-viewport-pending"],L=["innerHTML"],W={key:1,class:"math-inline math-inline--fallback"},j={class:"math-inline__loading",role:"status","aria-live":"polite"},A=/* @__PURE__ */x(/* @__PURE__ */a({__name:"MathInlineNode",props:{node:{}},setup(a){var x,A;const K=a,S=n(null),$=l(()=>"$$"===K.node.markup),C=l(()=>T(K.node.content)),D=1===(null==(A=null==(x=t())?void 0:x.vnode.el)?void 0:A.nodeType),H=k(),N=w(),P=n("undefined"==typeof window||D||!H.value),z=function(){if(!K.node.content)return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading};if(K.node.loading)return{html:"",text:"",loading:!0};const e="undefined"==typeof window||D||!H.value?b():null;if(!e)return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading};try{const a=e.renderToString(C.value,{throwOnError:!1,displayMode:$.value});return E(C.value,$.value,a),{html:a,text:"",loading:!1}}catch(a){return{html:"",text:K.node.loading?"":K.node.raw,loading:K.node.loading}}}(),B=n(z.html),U=n(z.text);let V=!1,X=0,q=!1,F=null;const G=n(z.loading),J=n(!1),Q=y();let Y=null;function Z(e){null!=e&&e!==X||(J.value=!1)}function ee(){return e(this,null,function*(){if(q)return;F&&(F.abort(),F=null);const a=++X;if(!K.node.content)return Z(),B.value="",U.value=K.node.loading?"":K.node.raw,G.value=K.node.loading,void(V=!1);const n=new AbortController;if(F=n,J.value=!0,!V&&H.value)try{!Y&&S.value&&(Y=Q(S.value,{rootMargin:null==N?void 0:N.value.rootMargin,allowIdle:!1}),P.value=Y.isVisible.value),yield _(Y,n.signal),P.value=!0}catch(l){}else H.value||(P.value=!0);q||a!==X||n.signal.aborted?Z(a):R(C.value,$.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(e=>{q||a!==X||(B.value=e,U.value="",G.value=!1,V=!0)}).catch(n=>e(null,null,function*(){if(q||a!==X)return;const e=(null==n?void 0:n.code)||(null==n?void 0:n.name),t="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==n?void 0:n.fallbackToRenderer)||(e===I||"WORKER_TIMEOUT"===e)&&!K.node.loading){const e=yield M();if(q||a!==X)return;if(e){try{const a=e.renderToString(C.value,{throwOnError:K.node.loading,displayMode:$.value});B.value=a,U.value="",G.value=!1,V=!0,E(C.value,$.value,a)}catch(l){}return}}if(t||!K.node.loading)return G.value=!1,B.value="",void(U.value=K.node.raw);V||(G.value=!0)})).finally(()=>{q||Z(a)})})}return z.html&&(V=!0),o(()=>[K.node.content,K.node.loading,K.node.raw,K.node.markup],()=>{ee()}),r(()=>{B.value||ee()}),i(()=>{var e;q=!0,F&&(F.abort(),F=null),null==(e=null==Y?void 0:Y.destroy)||e.call(Y),Y=null}),(e,a)=>(d(),u("span",{ref_key:"containerEl",ref:S,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":B.value?"katex":U.value?"fallback":"loading","data-markstream-pending":J.value?"true":void 0,"data-markstream-viewport-pending":s(H)&&!P.value?"true":void 0},[B.value?(d(),u("span",{key:0,class:"math-inline",innerHTML:B.value},null,8,L)):U.value?(d(),u("span",W,v(U.value),1)):G.value?(d(),m(c,{key:2,name:"table-node-fade"},{default:g(()=>[p("span",j,[f(e.$slots,"loading",{isLoading:G.value},()=>[a[0]||(a[0]=p("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),a[1]||(a[1]=p("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):h("",!0)],8,O))}}),[["__scopeId","data-v-79d81e75"]]);A.install=e=>{e.component(A.__name,A)};export{A as default};